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
| 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. |
| 270 | string 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 | |
| 280 | static string make_tag1(const char *start) |