comparison sip-in/retrans.c @ 78:72b7d85d6354

sip-in: retransmission error handling
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 20 Sep 2022 18:00:56 -0800
parents 709b78a4ebf0
children 915f0f397fb6
comparison
equal deleted inserted replaced
77:fe39404092d9 78:72b7d85d6354
10 #include <stdint.h> 10 #include <stdint.h>
11 #include <stdlib.h> 11 #include <stdlib.h>
12 #include <string.h> 12 #include <string.h>
13 #include <strings.h> 13 #include <strings.h>
14 #include <syslog.h> 14 #include <syslog.h>
15 #include "../include/gsm48_const.h"
15 #include "../libsip/out_msg.h" 16 #include "../libsip/out_msg.h"
16 #include "call.h" 17 #include "call.h"
17 18
18 extern unsigned cfg_retrans_count; 19 extern unsigned cfg_retrans_count;
19 extern struct call *call_list; 20 extern struct call *call_list;
29 case SIP_STATE_INVITE_200: 30 case SIP_STATE_INVITE_200:
30 if (call->sip_tx_count < cfg_retrans_count) { 31 if (call->sip_tx_count < cfg_retrans_count) {
31 fill_invite_200_resp(&msg, call); 32 fill_invite_200_resp(&msg, call);
32 sip_tx_packet(&msg, &call->udp_sin); 33 sip_tx_packet(&msg, &call->udp_sin);
33 call->sip_tx_count++; 34 call->sip_tx_count++;
34 } else 35 } else {
35 /* error handling to be implemented */; 36 /* TODO: send BYE */
37 call->sip_state = SIP_STATE_ENDED;
38 call->overall_state = OVERALL_STATE_TEARDOWN;
39 disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU,
40 GSM48_CC_CAUSE_INTERWORKING);
41 disconnect_tmgw(call);
42 }
36 break; 43 break;
37 case SIP_STATE_INVITE_ERR: 44 case SIP_STATE_INVITE_ERR:
38 if (call->sip_tx_count < cfg_retrans_count) { 45 if (call->sip_tx_count < cfg_retrans_count) {
39 start_response_out_msg(&msg, call->invite_fail); 46 start_response_out_msg(&msg, call->invite_fail);
40 fill_invite_resp_from_call(&msg, call); 47 fill_invite_resp_from_call(&msg, call);
41 out_msg_finish(&msg); 48 out_msg_finish(&msg);
42 sip_tx_packet(&msg, &call->udp_sin); 49 sip_tx_packet(&msg, &call->udp_sin);
43 call->sip_tx_count++; 50 call->sip_tx_count++;
44 } else 51 } else
45 /* error handling to be implemented */; 52 call->sip_state = SIP_STATE_ENDED;
46 break; 53 break;
47 } 54 }
48 } 55 }
49 } 56 }