comparison sip-in/retrans.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 0d6435808bcd
children c1c94b7fc2e2
comparison
equal deleted inserted replaced
108:0d6435808bcd 109:9b87894704eb
3 * and BYE requests. 3 * and BYE requests.
4 */ 4 */
5 5
6 #include <sys/types.h> 6 #include <sys/types.h>
7 #include <sys/socket.h> 7 #include <sys/socket.h>
8 #include <sys/time.h>
8 #include <netinet/in.h> 9 #include <netinet/in.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>
12 #include <string.h> 13 #include <string.h>
15 #include "../include/gsm48_const.h" 16 #include "../include/gsm48_const.h"
16 #include "../libsip/out_msg.h" 17 #include "../libsip/out_msg.h"
17 #include "call.h" 18 #include "call.h"
18 19
19 extern unsigned cfg_retrans_count; 20 extern unsigned cfg_retrans_count;
21 extern unsigned sip_linger_error;
20 extern struct call *call_list; 22 extern struct call *call_list;
21 23
22 void 24 void
23 run_periodic_retrans() 25 run_periodic_retrans()
24 { 26 {
64 start_response_out_msg(&msg, call->invite_fail); 66 start_response_out_msg(&msg, call->invite_fail);
65 fill_invite_resp_from_call(&msg, call); 67 fill_invite_resp_from_call(&msg, call);
66 out_msg_finish(&msg); 68 out_msg_finish(&msg);
67 sip_tx_packet(&msg, &call->udp_sin); 69 sip_tx_packet(&msg, &call->udp_sin);
68 call->sip_tx_count++; 70 call->sip_tx_count++;
69 } else 71 } else {
70 call->sip_state = SIP_STATE_ENDED; 72 call->sip_state = SIP_STATE_ENDED;
73 sip_mark_end_time(call, sip_linger_error);
74 }
71 break; 75 break;
72 case SIP_STATE_BYE_SENT: 76 case SIP_STATE_BYE_SENT:
73 if (call->sip_tx_count < cfg_retrans_count) { 77 if (call->sip_tx_count < cfg_retrans_count) {
74 fill_bye_out_msg(&msg, call); 78 fill_bye_out_msg(&msg, call);
75 sip_tx_packet(&msg, &call->udp_sin); 79 sip_tx_packet(&msg, &call->udp_sin);
76 call->sip_tx_count++; 80 call->sip_tx_count++;
77 } else 81 } else {
78 call->sip_state = SIP_STATE_ENDED; 82 call->sip_state = SIP_STATE_ENDED;
83 sip_mark_end_time(call, sip_linger_error);
84 }
79 break; 85 break;
80 } 86 }
81 } 87 }
82 } 88 }