MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / child_init_callid

Function child_init_callid

modules/tm/callid.c:102–126  ·  view source on GitHub ↗

* Child initialization -- generates suffix */

Source from the content-addressed store, hash-verified

100 * Child initialization -- generates suffix
101 */
102int child_init_callid(int rank)
103{
104 const struct socket_info *si;
105
106 /* on tcp/tls bind_address is 0 so try to get the first address we listen
107 * on no matter the protocol */
108 si=bind_address?bind_address:get_first_socket();
109 if (si==0){
110 LM_CRIT("null socket list\n");
111 return -1;
112 }
113 callid_suffix.s = callid_buf + callid_prefix.len;
114
115 callid_suffix.len = snprintf(callid_suffix.s, CALLID_SUFFIX_LEN,
116 "%c%d@%.*s", CID_SEP, my_pid(),
117 si->address_str.len,
118 si->address_str.s);
119 if ((callid_suffix.len == -1) || (callid_suffix.len > CALLID_SUFFIX_LEN)) {
120 LM_ERR("buffer too small\n");
121 return -1;
122 }
123
124 LM_DBG("callid: '%.*s'\n", callid_prefix.len + callid_suffix.len, callid_prefix.s);
125 return 0;
126}
127
128
129/*

Callers 1

child_initFunction · 0.85

Calls 2

get_first_socketFunction · 0.85
my_pidFunction · 0.85

Tested by

no test coverage detected