comparison sip-out/uac_resp.c @ 162:83022d408071

sip-out: handle responses to UAC CANCEL
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 Oct 2022 13:44:16 -0800
parents c0a391f28e91
children
comparison
equal deleted inserted replaced
161:c0a391f28e91 162:83022d408071
18 #include "../libsip/resp_ident.h" 18 #include "../libsip/resp_ident.h"
19 #include "call.h" 19 #include "call.h"
20 20
21 extern struct call *find_call_by_sip_id(); 21 extern struct call *find_call_by_sip_id();
22 22
23 extern unsigned sip_linger_timeout;
23 extern unsigned sip_linger_bye_out_ok; 24 extern unsigned sip_linger_bye_out_ok;
24 extern unsigned sip_linger_bye_out_err; 25 extern unsigned sip_linger_bye_out_err;
25 26
26 void 27 void
27 handle_bye_response(call, msg, sin) 28 handle_bye_response(call, msg, sin)
36 return; 37 return;
37 if (call->sip_state == SIP_STATE_BYE_SENT) { 38 if (call->sip_state == SIP_STATE_BYE_SENT) {
38 call->sip_state = SIP_STATE_ENDED; 39 call->sip_state = SIP_STATE_ENDED;
39 if (msg->status_code <= 299) 40 if (msg->status_code <= 299)
40 sip_mark_end_time(call, sip_linger_bye_out_ok); 41 sip_mark_end_time(call, sip_linger_bye_out_ok);
42 else
43 sip_mark_end_time(call, sip_linger_bye_out_err);
44 }
45 }
46
47 void
48 handle_cancel_response(call, msg, sin)
49 struct call *call;
50 struct sip_pkt_rx *msg;
51 struct sockaddr_in *sin;
52 {
53 if (msg->status_code != 200)
54 syslog(LOG_ERR, "non-200 response to CANCEL: %.64s",
55 msg->status_str);
56 if (msg->status_code < 200)
57 return;
58 if (call->sip_state == SIP_STATE_CANCEL_SENT) {
59 call->sip_state = SIP_STATE_ACCEPT_200;
60 if (msg->status_code <= 299)
61 sip_mark_end_time(call, sip_linger_timeout);
41 else 62 else
42 sip_mark_end_time(call, sip_linger_bye_out_err); 63 sip_mark_end_time(call, sip_linger_bye_out_err);
43 } 64 }
44 } 65 }
45 66