FreeCalypso > hg > themwi-system-sw
comparison sip-out/retrans.c @ 154:e54b0a9e322f
beginning of themwi-sip-out
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 11 Oct 2022 23:04:01 -0800 |
parents | sip-in/retrans.c@bf3b19bf57e9 |
children |
comparison
equal
deleted
inserted
replaced
153:99fd4ae573ae | 154:e54b0a9e322f |
---|---|
1 /* | |
2 * In this module we handle retransmission of our outgoing SIP UAC packets. | |
3 */ | |
4 | |
5 #include <sys/types.h> | |
6 #include <sys/socket.h> | |
7 #include <sys/time.h> | |
8 #include <netinet/in.h> | |
9 #include <stdio.h> | |
10 #include <stdint.h> | |
11 #include <stdlib.h> | |
12 #include <string.h> | |
13 #include <strings.h> | |
14 #include <syslog.h> | |
15 #include "../include/gsm48_const.h" | |
16 #include "../include/out_routes.h" | |
17 #include "../libsip/out_msg.h" | |
18 #include "call.h" | |
19 | |
20 extern unsigned cfg_retrans_count; | |
21 extern unsigned sip_linger_timeout; | |
22 extern unsigned sip_linger_bye_out_err; | |
23 extern struct call *call_list; | |
24 | |
25 void | |
26 run_periodic_retrans() | |
27 { | |
28 struct call *call; | |
29 struct sip_msg_out msg; | |
30 | |
31 for (call = call_list; call; call = call->next) { | |
32 switch (call->sip_state) { | |
33 case SIP_STATE_INV_SENT: | |
34 if (call->sip_tx_count < cfg_retrans_count) { | |
35 fill_invite_req_msg(&msg, call); | |
36 sip_tx_packet(&msg, &call->udp_sin); | |
37 call->sip_tx_count++; | |
38 } else { | |
39 syslog(LOG_ERR, | |
40 "outbound INVITE retrans timeout"); | |
41 call->overall_state = OVERALL_STATE_TEARDOWN; | |
42 disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU, | |
43 GSM48_CC_CAUSE_DEST_OOO); | |
44 disconnect_tmgw(call); | |
45 call->sip_state = SIP_STATE_ACCEPT_100; | |
46 sip_mark_end_time(call, sip_linger_timeout); | |
47 } | |
48 break; | |
49 case SIP_STATE_CANCEL_SENT: | |
50 if (call->sip_tx_count < cfg_retrans_count) { | |
51 fill_cancel_req_msg(&msg, call); | |
52 sip_tx_packet(&msg, &call->udp_sin); | |
53 call->sip_tx_count++; | |
54 } else { | |
55 syslog(LOG_ERR, | |
56 "outbound CANCEL retrans timeout"); | |
57 call->sip_state = SIP_STATE_ACCEPT_200; | |
58 sip_mark_end_time(call, sip_linger_timeout); | |
59 } | |
60 break; | |
61 case SIP_STATE_BYE_SENT: | |
62 if (call->sip_tx_count < cfg_retrans_count) { | |
63 fill_bye_req_msg(&msg, call); | |
64 sip_tx_packet(&msg, &call->udp_sin); | |
65 call->sip_tx_count++; | |
66 } else { | |
67 syslog(LOG_ERR, "outbound BYE retrans timeout"); | |
68 call->sip_state = SIP_STATE_ENDED; | |
69 sip_mark_end_time(call, sip_linger_bye_out_err); | |
70 } | |
71 break; | |
72 } | |
73 } | |
74 } |