comparison sip-in/bye_out.c @ 109:9b87894704eb

sip-in: first step toward final call clearing
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 28 Sep 2022 16:32:13 -0800
parents 2c22b40408fb
children c1c94b7fc2e2
comparison
equal deleted inserted replaced
108:0d6435808bcd 109:9b87894704eb
2 * In this module we implement our UAC functionality of sending BYE. 2 * In this module we implement our UAC functionality of sending BYE.
3 */ 3 */
4 4
5 #include <sys/types.h> 5 #include <sys/types.h>
6 #include <sys/socket.h> 6 #include <sys/socket.h>
7 #include <sys/time.h>
7 #include <netinet/in.h> 8 #include <netinet/in.h>
8 #include <arpa/inet.h> 9 #include <arpa/inet.h>
9 #include <stdio.h> 10 #include <stdio.h>
10 #include <stdint.h> 11 #include <stdint.h>
11 #include <stdlib.h> 12 #include <stdlib.h>
20 extern struct call *find_call_by_sip_id(); 21 extern struct call *find_call_by_sip_id();
21 22
22 extern struct in_addr sip_bind_ip; 23 extern struct in_addr sip_bind_ip;
23 extern unsigned sip_bind_port; 24 extern unsigned sip_bind_port;
24 extern unsigned max_forwards; 25 extern unsigned max_forwards;
26 extern unsigned sip_linger_acked;
27 extern unsigned sip_linger_error;
25 28
26 fill_bye_out_msg(msg, call) 29 fill_bye_out_msg(msg, call)
27 struct sip_msg_out *msg; 30 struct sip_msg_out *msg;
28 struct call *call; 31 struct call *call;
29 { 32 {
105 msg->status_code, rid.cseq_num, rid.cseq_method); 108 msg->status_code, rid.cseq_num, rid.cseq_method);
106 return; 109 return;
107 } 110 }
108 if (msg->status_code < 200) 111 if (msg->status_code < 200)
109 return; 112 return;
110 if (call->sip_state == SIP_STATE_BYE_SENT) 113 if (call->sip_state == SIP_STATE_BYE_SENT) {
111 call->sip_state = SIP_STATE_ENDED; 114 call->sip_state = SIP_STATE_ENDED;
115 if (msg->status_code <= 299)
116 sip_mark_end_time(call, sip_linger_acked);
117 else
118 sip_mark_end_time(call, sip_linger_error);
119 }
112 } 120 }