FreeCalypso > hg > themwi-system-sw
changeset 118:a4450ae8fd09
sip-manual-out UAC: use the new CSeq parsing function
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 29 Sep 2022 13:03:27 -0800 |
parents | c93c339271a7 |
children | 056616f7e8ab |
files | sip-manual-out/uac.c |
diffstat | 1 files changed, 11 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- 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 <string.h> #include <strings.h> #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); }