FreeCalypso > hg > themwi-system-sw
diff sip-manual-out/uac.c @ 123:a36b731bfef9
sip-manual-out: implement sending BYE and CANCEL
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 29 Sep 2022 17:21:11 -0800 |
parents | c62d0f28da6f |
children | 6ac96217c442 |
line wrap: on
line diff
--- a/sip-manual-out/uac.c Thu Sep 29 15:03:12 2022 -0800 +++ b/sip-manual-out/uac.c Thu Sep 29 17:21:11 2022 -0800 @@ -26,7 +26,7 @@ char to_tag[MAX_TO_TAG+1]; -add_req_boilerplate(msg, cseq) +add_req_boilerplate(msg, cseq, add_to_tag) struct sip_msg_out *msg; char *cseq; { @@ -41,7 +41,7 @@ rc = out_msg_add_header(msg, "From", from_uri); if (rc < 0) return rc; - if (to_tag[0]) { + if (add_to_tag && to_tag[0]) { sprintf(strbuf, "<%s>;tag=%s", to_uri, to_tag); rc = out_msg_add_header(msg, "To", strbuf); } else @@ -80,7 +80,7 @@ msg_size_err: fprintf(stderr, "composing ACK message: size error\n"); return; } - rc = add_req_boilerplate(&msg, "1 ACK"); + rc = add_req_boilerplate(&msg, "1 ACK", 1); if (rc < 0) goto msg_size_err; out_msg_finish(&msg); @@ -129,6 +129,10 @@ } if (rid.cseq_num == 1 && !strcmp(rid.cseq_method, "INVITE")) handle_invite_response(msg, sin); + else if (rid.cseq_num == 1 && !strcmp(rid.cseq_method, "CANCEL")) + printf("Response to CANCEL: %s\n", msg->status_str); + else if (rid.cseq_num == 2 && !strcmp(rid.cseq_method, "BYE")) + printf("Response to BYE: %s\n", msg->status_str); else printf("Got SIP resp for our Call-ID with unknown CSeq %u %s\n", rid.cseq_num, rid.cseq_method);