# HG changeset patch # User Mychaela Falconia # Date 1688851952 28800 # Node ID 10a4b0b0a239f3cee3d039b3800ca5bc027a510a # Parent 55ad0f4bb33cfb3caaea2adebc35bb77af81a9e9 sip-manual-out: parse SDP for all responses, not just 200 diff -r 55ad0f4bb33c -r 10a4b0b0a239 sip-manual-out/sdp_in.c --- a/sip-manual-out/sdp_in.c Sun Jun 25 14:16:53 2023 -0800 +++ b/sip-manual-out/sdp_in.c Sat Jul 08 13:32:32 2023 -0800 @@ -17,7 +17,7 @@ extern char *extract_to_tag(); struct sockaddr_in rtp_remote_addr; -int pcma_selected, rtp_out_enable; +int got_sdp_answer, pcma_selected, rtp_out_enable; static check_sdp_present(msg) @@ -43,10 +43,8 @@ struct sdp_parse sdp_parse; int rc; - if (!check_sdp_present(msg)) { - printf("INVITE response has no SDP!\n"); + if (!check_sdp_present(msg)) return; - } rc = parse_incoming_sdp(msg->msg_body, msg->msg_body_len, &sdp_parse); if (rc < 0) { printf("SDP parse error: %d\n", rc); @@ -71,6 +69,16 @@ rtp_remote_addr.sin_family = AF_INET; rtp_remote_addr.sin_addr = sdp_parse.ip_addr; rtp_remote_addr.sin_port = htons(sdp_parse.audio_port); + got_sdp_answer = 1; +} + +void +invite_200_rtpout() +{ + if (!got_sdp_answer) { + printf("INVITE response has no SDP!\n"); + return; + } rtp_out_enable = 1; assign_rtpout_ssrc(); init_pcm_fill_octet(); diff -r 55ad0f4bb33c -r 10a4b0b0a239 sip-manual-out/uac.c --- a/sip-manual-out/uac.c Sun Jun 25 14:16:53 2023 -0800 +++ b/sip-manual-out/uac.c Sat Jul 08 13:32:32 2023 -0800 @@ -103,11 +103,12 @@ else printf("To tag exceeds length limit!\n"); } + extract_resp_sdp(msg); if (msg->status_code >= 200) { printf("Sending ACK\n"); send_ack(sin); if (msg->status_code <= 299) - extract_resp_sdp(msg); + invite_200_rtpout(); } }