MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / extractIMSI

Function extractIMSI

SIP/SIPMessage.cpp:321–334  ·  view source on GitHub ↗

Validate the IMSI string "IMSI"+digits; return pointer to digits or NULL if invalid.

Source from the content-addressed store, hash-verified

319
320// Validate the IMSI string "IMSI"+digits; return pointer to digits or NULL if invalid.
321const char* extractIMSI(const char *IMSI)
322{
323 // Form of the name is IMSI<digits>, and it should always be 18 or 19 char.
324 // IMSIs are 14 or 15 char + "IMSI" prefix
325 unsigned namelen = strlen(IMSI);
326 if (strncmp(IMSI,"IMSI",4) || (namelen>19) || (namelen<18) || !isNumeric(IMSI+4)) {
327 // Note that if you use this on a non-INVITE it will fail, because it may have fields like "222-0123" which are not IMSIs.
328 // Dont warn here. We print a better warning just once in newCheckInvite.
329 // LOG(WARNING) << "INVITE with malformed username \"" << IMSI << "\"";
330 return "";
331 }
332 // Skip first 4 char "IMSI".
333 return IMSI+4;
334}
335
336string SipMessage::smGetPrecis() const
337{

Callers 1

smGetInviteImsiMethod · 0.85

Calls 1

isNumericFunction · 0.85

Tested by

no test coverage detected