# HG changeset patch # User Mychaela Falconia # Date 1664485407 28800 # Node ID a4450ae8fd09c6caf333077ab5bcb1dd22a0d323 # Parent c93c339271a721cf79194fc4d87ff6476fdbe104 sip-manual-out UAC: use the new CSeq parsing function diff -r c93c339271a7 -r a4450ae8fd09 sip-manual-out/uac.c --- a/sip-manual-out/uac.c Wed Sep 28 23:07:46 2022 -0800 +++ b/sip-manual-out/uac.c Thu Sep 29 13:03:27 2022 -0800 @@ -11,6 +11,7 @@ #include #include #include "../libsip/parse.h" +#include "../libsip/resp_ident.h" #include "../libsip/out_msg.h" #define MAX_TO_TAG 63 @@ -111,25 +112,22 @@ struct sip_pkt_rx *msg; struct sockaddr_in *sin; { - char *call_id_hdr, *cseq_hdr; + struct sip_resp_ident rid; + int rc; - call_id_hdr = get_single_header(msg, "Call-ID", "i", (int *) 0); - if (!call_id_hdr) { - printf("Got SIP response w/o Call-ID header\n"); + rc = sip_resp_extract_ident(msg, &rid); + if (rc < 0) { + printf("SIP %03u response: bad or missing %s header\n", + msg->status_code, rid.error_field); return; } - if (strcmp(call_id_hdr, call_id)) { + if (strcmp(rid.call_id, call_id)) { printf("Got SIP response with wrong Call-ID\n"); return; } - cseq_hdr = get_single_header(msg, "CSeq", (char *) 0, (int *) 0); - if (!cseq_hdr) { - printf("Got SIP response w/o CSeq header\n"); - return; - } - if (!strcmp(cseq_hdr, "1 INVITE")) + if (rid.cseq_num == 1 && !strcmp(rid.cseq_method, "INVITE")) handle_invite_response(msg, sin); else - printf("Got SIP resp for our Call-ID with unknown CSeq %s\n", - cseq_hdr); + printf("Got SIP resp for our Call-ID with unknown CSeq %u %s\n", + rid.cseq_num, rid.cseq_method); }