FreeCalypso > hg > themwi-system-sw
annotate sip-out/invite.c @ 156:0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 12 Oct 2022 07:13:55 -0800 |
parents | |
children | 7643b779dbea |
rev | line source |
---|---|
156
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * In this module we handle responses to INVITE. |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <sys/socket.h> |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <sys/time.h> |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <netinet/in.h> |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdio.h> |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <stdint.h> |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <stdlib.h> |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <string.h> |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include <strings.h> |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include <syslog.h> |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include "../include/gsm48_const.h" |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #include "../include/out_routes.h" |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #include "../libsip/parse.h" |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 #include "../libsip/sdp.h" |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 #include "../libsip/out_msg.h" |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 #include "call.h" |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 extern char *get_single_header(); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 extern char *extract_to_tag(); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 extern unsigned sip_linger_response_err; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 static |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 check_sdp_present(msg) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 struct sip_pkt_rx *msg; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 char *hval; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 if (!msg->msg_body_len) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 return 0; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 hval = get_single_header(msg, "Content-Type", "c", (int *) 0); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 if (!hval) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 return 0; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 if (!strcasecmp(hval, "application/sdp")) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 return 1; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 else |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 return 0; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 static |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 extract_sdp(call, msg) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 struct call *call; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 struct sip_pkt_rx *msg; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 struct sdp_parse sdp_parse; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 int rc, use_pcma; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 rc = parse_incoming_sdp(msg->msg_body, msg->msg_body_len, &sdp_parse); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 if (rc < 0) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 return rc; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 switch (sdp_parse.codec_mask) { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 case SDP_CODEC_MASK_PCMU: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 case SDP_CODEC_MASK_BOTH: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 use_pcma = 0; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 break; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 case SDP_CODEC_MASK_PCMA: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 case SDP_CODEC_MASK_BOTH | SDP_CODEC_MASK_PCMA_PREF: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 use_pcma = 1; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 break; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 default: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 return -2; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 call->pstn_rtp_remote.sin_family = AF_INET; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 call->pstn_rtp_remote.sin_addr = sdp_parse.ip_addr; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 call->pstn_rtp_remote.sin_port = htons(sdp_parse.audio_port); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 call->use_pcma = use_pcma; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 return 0; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 static void |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 handle_1xx(call, msg, tag, sin) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 struct call *call; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 struct sip_pkt_rx *msg; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 char *tag; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 struct sockaddr_in *sin; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 int rc; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 switch (call->sip_state) { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 case SIP_STATE_INV_SENT: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 call->sip_state = SIP_STATE_100_RCVD; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 /* FALL THRU */ |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 case SIP_STATE_100_RCVD: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 if (msg->status_code == 180) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 call->overall_state = OVERALL_STATE_RINGING; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 if (check_sdp_present(msg) && |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 call->mgw_state == MGW_STATE_ALLOCATED) { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 rc = extract_sdp(call, msg); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 if (rc < 0) { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 syslog(LOG_ERR, "bad SDP in %03u response", |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 msg->status_code); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 call->overall_state = OVERALL_STATE_TEARDOWN; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU, |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 GSM48_CC_CAUSE_BEARER_CA_UNAVAIL); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 disconnect_tmgw(call); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 initiate_sip_cancel(call); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 return; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 tmgw_send_mdcx_connect(call, 1); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 } else if (msg->status_code == 180) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 mncc_signal_alerting(call); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 return; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 case SIP_STATE_ACCEPT_100: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 initiate_sip_cancel(call); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 return; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 static |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 send_ack(call, tag, sin) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 struct call *call; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 char *tag; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 struct sockaddr_in *sin; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 struct sip_msg_out msg; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 int rc; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 rc = start_request_out_msg(&msg, "ACK", call->to_uri); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 if (rc < 0) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 return rc; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 rc = add_req_boilerplate(&msg, call, "1 ACK", tag); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 if (rc < 0) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 return rc; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 out_msg_finish(&msg); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 sip_tx_packet(&msg, sin); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 return 0; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 static void |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 handle_200(call, msg, tag, sin) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 struct call *call; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 struct sip_pkt_rx *msg; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 char *tag; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 struct sockaddr_in *sin; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 int rc; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 switch (call->sip_state) { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 case SIP_STATE_INV_SENT: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 case SIP_STATE_100_RCVD: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 rc = send_ack(call, tag, sin); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 if (rc < 0) { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 syslog(LOG_CRIT, |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 "ACK to %03u response exceeds msg size!", |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 msg->status_code); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 call->overall_state = OVERALL_STATE_TEARDOWN; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU, |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 GSM48_CC_CAUSE_DEST_OOO); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 disconnect_tmgw(call); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 call->sip_state = SIP_STATE_ENDED; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 sip_mark_end_time(call, sip_linger_response_err); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 return; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 if (tag) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 strcpy(call->to_tag, tag); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 call->sip_state = SIP_STATE_CONNECTED; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 if (!check_sdp_present(msg)) { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 syslog(LOG_ERR, "error: %03u response has no SDP", |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 msg->status_code); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 call->overall_state = OVERALL_STATE_TEARDOWN; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU, |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 GSM48_CC_CAUSE_DEST_OOO); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 disconnect_tmgw(call); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 initiate_bye(call); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 return; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 rc = extract_sdp(call, msg); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 if (rc < 0) { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 syslog(LOG_ERR, "bad SDP in %03u response", |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 msg->status_code); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 call->overall_state = OVERALL_STATE_TEARDOWN; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU, |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 GSM48_CC_CAUSE_BEARER_CA_UNAVAIL); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 disconnect_tmgw(call); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 initiate_bye(call); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 return; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 call->overall_state = OVERALL_STATE_CONNECTED; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 switch (call->mgw_state) { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 case MGW_STATE_ALLOCATED: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 case MGW_STATE_IBT_CONN: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 tmgw_send_mdcx_connect(call, 0); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 return; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 case MGW_STATE_MDCX_IBT: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 return; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 default: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 syslog(LOG_CRIT, |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 "FATAL: invalid MGW state 0x%x on INVITE %03u response", |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 call->mgw_state, msg->status_code); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 exit(1); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 case SIP_STATE_CONNECTED: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 case SIP_STATE_BYE_SENT: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 if (tag && call->to_tag[0] && strcmp(call->to_tag, tag)) { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 syslog(LOG_ERR, |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 "received %u response with different To tag, ignoring", |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 msg->status_code); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 return; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 send_ack(call, call->to_tag, sin); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 return; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 case SIP_STATE_CANCEL_SENT: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 case SIP_STATE_ACCEPT_100: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 case SIP_STATE_ACCEPT_200: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 rc = send_ack(call, tag, sin); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 if (rc < 0) { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 syslog(LOG_CRIT, |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 "ACK to %03u response exceeds msg size!", |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 msg->status_code); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 call->sip_state = SIP_STATE_ENDED; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 sip_mark_end_time(call, sip_linger_response_err); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 return; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
217 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
218 if (tag) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 strcpy(call->to_tag, tag); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
220 initiate_bye(call); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 return; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 case SIP_STATE_ENDED: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 return; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 default: |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 syslog(LOG_CRIT, |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 "FATAL: invalid SIP state 0x%x on INVITE %03u response", |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 call->sip_state, msg->status_code); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 exit(1); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
229 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 static void |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 handle_error(call, msg, tag, sin) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
234 struct call *call; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235 struct sip_pkt_rx *msg; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
236 char *tag; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
237 struct sockaddr_in *sin; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
238 { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
239 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
240 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
241 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
242 void |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
243 handle_invite_response(call, msg, sin) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
244 struct call *call; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
245 struct sip_pkt_rx *msg; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
246 struct sockaddr_in *sin; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
247 { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
248 char *tag; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
249 |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
250 tag = extract_to_tag(msg, call->to_uri); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
251 if (tag) { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
252 if (!*tag) { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
253 syslog(LOG_ERR, |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
254 "To tag in INVITE %03u response is null", |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
255 msg->status_code); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
256 tag = 0; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
257 } else if (strlen(tag) > MAX_SIP_TO_TAG) { |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
258 syslog(LOG_ERR, |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
259 "To tag in INVITE %03u response exceeds length limit", |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
260 msg->status_code); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
261 tag = 0; |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
262 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
263 } |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
264 if (msg->status_code >= 100 && msg->status_code <= 199) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
265 handle_1xx(call, msg, tag, sin); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
266 else if (msg->status_code >= 200 && msg->status_code <= 299) |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
267 handle_200(call, msg, tag, sin); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
268 else |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
269 handle_error(call, msg, tag, sin); |
0bacca1f2f7b
sip-out: handle all INVITE responses, except errors
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
270 } |