comparison sip-in/retrans.c @ 68:709b78a4ebf0

sip-in: implement retransmission of INVITE responses
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 18 Sep 2022 21:56:20 -0800
parents
children 72b7d85d6354
comparison
equal deleted inserted replaced
67:15c9e1f8f756 68:709b78a4ebf0
1 /*
2 * In this module we handle retransmission of INVITE responses
3 * and BYE requests.
4 */
5
6 #include <sys/types.h>
7 #include <sys/socket.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 "../libsip/out_msg.h"
16 #include "call.h"
17
18 extern unsigned cfg_retrans_count;
19 extern struct call *call_list;
20
21 void
22 run_periodic_retrans()
23 {
24 struct call *call;
25 struct sip_msg_out msg;
26
27 for (call = call_list; call; call = call->next) {
28 switch (call->sip_state) {
29 case SIP_STATE_INVITE_200:
30 if (call->sip_tx_count < cfg_retrans_count) {
31 fill_invite_200_resp(&msg, call);
32 sip_tx_packet(&msg, &call->udp_sin);
33 call->sip_tx_count++;
34 } else
35 /* error handling to be implemented */;
36 break;
37 case SIP_STATE_INVITE_ERR:
38 if (call->sip_tx_count < cfg_retrans_count) {
39 start_response_out_msg(&msg, call->invite_fail);
40 fill_invite_resp_from_call(&msg, call);
41 out_msg_finish(&msg);
42 sip_tx_packet(&msg, &call->udp_sin);
43 call->sip_tx_count++;
44 } else
45 /* error handling to be implemented */;
46 break;
47 }
48 }
49 }