comparison sip-out/invite.c @ 157:7643b779dbea

sip-out: handle INVITE errors, except for cause mapping
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 Oct 2022 07:56:14 -0800
parents 0bacca1f2f7b
children 51cf5ea7f320
comparison
equal deleted inserted replaced
156:0bacca1f2f7b 157:7643b779dbea
20 #include "call.h" 20 #include "call.h"
21 21
22 extern char *get_single_header(); 22 extern char *get_single_header();
23 extern char *extract_to_tag(); 23 extern char *extract_to_tag();
24 24
25 extern unsigned sip_linger_invite_err;
25 extern unsigned sip_linger_response_err; 26 extern unsigned sip_linger_response_err;
26 27
27 static 28 static
28 check_sdp_present(msg) 29 check_sdp_present(msg)
29 struct sip_pkt_rx *msg; 30 struct sip_pkt_rx *msg;
234 struct call *call; 235 struct call *call;
235 struct sip_pkt_rx *msg; 236 struct sip_pkt_rx *msg;
236 char *tag; 237 char *tag;
237 struct sockaddr_in *sin; 238 struct sockaddr_in *sin;
238 { 239 {
239 240 int rc;
241
242 rc = send_ack(call, tag, sin);
243 if (rc < 0)
244 syslog(LOG_CRIT, "ACK to %03u response exceeds msg size!",
245 msg->status_code);
246 switch (call->sip_state) {
247 case SIP_STATE_INV_SENT:
248 case SIP_STATE_100_RCVD:
249 call->overall_state = OVERALL_STATE_TEARDOWN;
250 disconnect_mncc(call, GSM48_CAUSE_LOC_NET_BEYOND,
251 sip_error_to_gsm_cause(msg->status_code));
252 disconnect_tmgw(call);
253 call->sip_state = SIP_STATE_ENDED;
254 sip_mark_end_time(call, sip_linger_invite_err);
255 return;
256 case SIP_STATE_CANCEL_SENT:
257 case SIP_STATE_ACCEPT_100:
258 case SIP_STATE_ACCEPT_200:
259 call->sip_state = SIP_STATE_ENDED;
260 sip_mark_end_time(call, sip_linger_invite_err);
261 return;
262 case SIP_STATE_CONNECTED:
263 case SIP_STATE_BYE_SENT:
264 case SIP_STATE_ENDED:
265 return;
266 default:
267 syslog(LOG_CRIT,
268 "FATAL: invalid SIP state 0x%x on INVITE %03u response",
269 call->sip_state, msg->status_code);
270 exit(1);
271 }
240 } 272 }
241 273
242 void 274 void
243 handle_invite_response(call, msg, sin) 275 handle_invite_response(call, msg, sin)
244 struct call *call; 276 struct call *call;