FreeCalypso > hg > themwi-system-sw
comparison sip-manual-out/sdp_in.c @ 214:10a4b0b0a239
sip-manual-out: parse SDP for all responses, not just 200
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 08 Jul 2023 13:32:32 -0800 |
parents | fbfa72b114e8 |
children |
comparison
equal
deleted
inserted
replaced
213:55ad0f4bb33c | 214:10a4b0b0a239 |
---|---|
15 | 15 |
16 extern char *get_single_header(); | 16 extern char *get_single_header(); |
17 extern char *extract_to_tag(); | 17 extern char *extract_to_tag(); |
18 | 18 |
19 struct sockaddr_in rtp_remote_addr; | 19 struct sockaddr_in rtp_remote_addr; |
20 int pcma_selected, rtp_out_enable; | 20 int got_sdp_answer, pcma_selected, rtp_out_enable; |
21 | 21 |
22 static | 22 static |
23 check_sdp_present(msg) | 23 check_sdp_present(msg) |
24 struct sip_pkt_rx *msg; | 24 struct sip_pkt_rx *msg; |
25 { | 25 { |
41 struct sip_pkt_rx *msg; | 41 struct sip_pkt_rx *msg; |
42 { | 42 { |
43 struct sdp_parse sdp_parse; | 43 struct sdp_parse sdp_parse; |
44 int rc; | 44 int rc; |
45 | 45 |
46 if (!check_sdp_present(msg)) { | 46 if (!check_sdp_present(msg)) |
47 printf("INVITE response has no SDP!\n"); | |
48 return; | 47 return; |
49 } | |
50 rc = parse_incoming_sdp(msg->msg_body, msg->msg_body_len, &sdp_parse); | 48 rc = parse_incoming_sdp(msg->msg_body, msg->msg_body_len, &sdp_parse); |
51 if (rc < 0) { | 49 if (rc < 0) { |
52 printf("SDP parse error: %d\n", rc); | 50 printf("SDP parse error: %d\n", rc); |
53 return; | 51 return; |
54 } | 52 } |
69 inet_ntoa(sdp_parse.ip_addr), sdp_parse.audio_port, | 67 inet_ntoa(sdp_parse.ip_addr), sdp_parse.audio_port, |
70 pcma_selected ? "PCMA" : "PCMU"); | 68 pcma_selected ? "PCMA" : "PCMU"); |
71 rtp_remote_addr.sin_family = AF_INET; | 69 rtp_remote_addr.sin_family = AF_INET; |
72 rtp_remote_addr.sin_addr = sdp_parse.ip_addr; | 70 rtp_remote_addr.sin_addr = sdp_parse.ip_addr; |
73 rtp_remote_addr.sin_port = htons(sdp_parse.audio_port); | 71 rtp_remote_addr.sin_port = htons(sdp_parse.audio_port); |
72 got_sdp_answer = 1; | |
73 } | |
74 | |
75 void | |
76 invite_200_rtpout() | |
77 { | |
78 if (!got_sdp_answer) { | |
79 printf("INVITE response has no SDP!\n"); | |
80 return; | |
81 } | |
74 rtp_out_enable = 1; | 82 rtp_out_enable = 1; |
75 assign_rtpout_ssrc(); | 83 assign_rtpout_ssrc(); |
76 init_pcm_fill_octet(); | 84 init_pcm_fill_octet(); |
77 prepare_tfo_fill(); | 85 prepare_tfo_fill(); |
78 } | 86 } |