FreeCalypso > hg > themwi-system-sw
comparison sip-in/invite.c @ 114:a30c25fb4c2f
sip-in: generate CDR syslog entries
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 28 Sep 2022 22:41:16 -0800 |
parents | bfc97065bf51 |
children | c93c339271a7 |
comparison
equal
deleted
inserted
replaced
113:bfc97065bf51 | 114:a30c25fb4c2f |
---|---|
99 char *hval, *unsup_ext; | 99 char *hval, *unsup_ext; |
100 int ext_100rel_req, ext_100rel_sup, use_100rel, use_pcma; | 100 int ext_100rel_req, ext_100rel_sup, use_100rel, use_pcma; |
101 struct sdp_parse sdp_parse; | 101 struct sdp_parse sdp_parse; |
102 struct sdp_gen sdp_gen; | 102 struct sdp_gen sdp_gen; |
103 struct call *call; | 103 struct call *call; |
104 char *dp; | 104 char *dp, cdr_str[80]; |
105 unsigned cdr_num_len, cdr_cnam_len; | |
105 unsigned req_uri_len, to_hdr_len, copylen; | 106 unsigned req_uri_len, to_hdr_len, copylen; |
106 int rc; | 107 int rc; |
107 | 108 |
108 /* extract called number from Request-URI */ | 109 /* extract called number from Request-URI */ |
109 rc = user_from_sip_uri(req->req_uri, uri_user, 12); | 110 rc = user_from_sip_uri(req->req_uri, uri_user, 12); |
240 if (rc < 0) | 241 if (rc < 0) |
241 goto error_resp_toolong; | 242 goto error_resp_toolong; |
242 sip_tx_packet(&resp, sin); | 243 sip_tx_packet(&resp, sin); |
243 return; | 244 return; |
244 } | 245 } |
245 /* SIP INVITE validation done - check if GSM service is up */ | 246 /* SIP INVITE validation done - gather CDR info */ |
247 cdr_num_len = gfrom.user_len; | |
248 if (cdr_num_len > 33) | |
249 cdr_num_len = 33; | |
250 cdr_cnam_len = gfrom.cnam_len; | |
251 if (cdr_cnam_len > 33) | |
252 cdr_cnam_len = 33; | |
253 if (cdr_cnam_len) | |
254 sprintf(cdr_str, "%.*s (%s%.*s%s)", cdr_num_len, gfrom.user, | |
255 gfrom.cnam_quoted ? "\"" : "", cdr_cnam_len, gfrom.cnam, | |
256 gfrom.cnam_quoted ? "\"" : ""); | |
257 else | |
258 sprintf(cdr_str, "%.*s", cdr_num_len, gfrom.user); | |
259 hval = get_single_header(req, "P-Asserted-Identity", (char *) 0, | |
260 (int *) 0); | |
261 /* check if GSM service is up */ | |
246 rc = connect_gsm_mtcall(); | 262 rc = connect_gsm_mtcall(); |
247 if (rc < 0) { | 263 if (rc < 0) { |
248 gsm_offline: start_response_out_msg(&resp, "480 GSM service is offline"); | 264 gsm_offline: syslog(LOG_INFO, "Down-call from %s to %s", cdr_str, uri_user); |
265 if (hval) | |
266 syslog(LOG_INFO, "Down-call PAI: %s", hval); | |
267 start_response_out_msg(&resp, "480 GSM service is offline"); | |
249 goto error_resp; | 268 goto error_resp; |
250 } | 269 } |
251 rc = connect_tmgw_socket(); | 270 rc = connect_tmgw_socket(); |
252 if (rc < 0) | 271 if (rc < 0) |
253 goto gsm_offline; | 272 goto gsm_offline; |
311 out_msg_finish(&resp); | 330 out_msg_finish(&resp); |
312 sip_tx_packet(&resp, sin); | 331 sip_tx_packet(&resp, sin); |
313 /* add to call list */ | 332 /* add to call list */ |
314 call->next = call_list; | 333 call->next = call_list; |
315 call_list = call; | 334 call_list = call; |
316 syslog(LOG_INFO, "call in%06u started", call->in_tag_num); | 335 syslog(LOG_INFO, "Call in%06u from %s to %s", call->in_tag_num, |
336 cdr_str, uri_user); | |
337 if (hval) | |
338 syslog(LOG_INFO, "Call in%06u PAI: %s", call->in_tag_num, hval); | |
317 /* send CRCX to TMGW */ | 339 /* send CRCX to TMGW */ |
318 tmgw_send_crcx(call); | 340 tmgw_send_crcx(call); |
319 call->overall_state = OVERALL_STATE_CRCX; | 341 call->overall_state = OVERALL_STATE_CRCX; |
320 call->sip_state = SIP_STATE_INVITE_PROC; | 342 call->sip_state = SIP_STATE_INVITE_PROC; |
321 } | 343 } |