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

Function globallyUniqueId

SIP/SIPUtility.cpp:270–277  ·  view source on GitHub ↗

Make a globally unique identifier starting with string start. We could just use another big random number, but this is nicer. Use the GSM MCC+MNC+LAC+cellid of the cell, plus the time, plus 32 bits of random, which is both unique and has the added advantage that humans can read useful information out of it. The SIP spec shows examples making ids unique by appending the IP address, but that is just

Source from the content-addressed store, hash-verified

268// The SIP spec shows examples making ids unique by appending the IP address, but that is just silly because
269// we will probabably have a local IP address behind some firewall.
270string globallyUniqueId(const char *start)
271{
272 // This is a a globally unique callid.
273 GSM::L3LocationAreaIdentity lai = gBTS.LAI(); // 3 digit MCC, 3 digit MNC, 16-bit LAC.
274 char buf[80];
275 snprintf(buf,80,"%s%03u%02u%x%x-%x%x",start,lai.MCC(),lai.MNC(),lai.LAC(),cellid(), timeUniquifier(),(unsigned)(0xffffffff&random()));
276 return string(buf);
277}
278
279
280static string make_tag1(const char *start)

Callers 2

dsSetLocalMOMethod · 0.85
newSipDialogRegister1Method · 0.85

Calls 6

cellidFunction · 0.85
timeUniquifierFunction · 0.85
MCCMethod · 0.80
MNCMethod · 0.80
LACMethod · 0.80
LAIMethod · 0.45

Tested by

no test coverage detected