MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / get_cancel_reason

Function get_cancel_reason

modules/tm/t_fwd.c:641–674  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

639}
640
641void get_cancel_reason(struct sip_msg *msg, int flags, str *reason)
642{
643#define CANCEL_REASON_SIP_487 \
644 "Reason: SIP;cause=487;text=\"ORIGINATOR_CANCEL\"" CRLF
645 int_str avp_reason;
646 struct hdr_field *hdr;
647
648 reason->s = NULL;
649 reason->len = 0;
650
651 if (search_first_avp( AVP_VAL_STR, _reason_avp_id, &avp_reason, NULL)) {
652 *reason = avp_reason.s;
653 } else {
654 /* propagate the REASON flag ? */
655 if ( flags&T_CANCEL_REASON_FLAG ) {
656 /* look for the Reason header */
657 if (parse_headers(msg, HDR_EOH_F, 0)<0) {
658 LM_ERR("failed to parse all hdrs - ignoring Reason hdr\n");
659 } else {
660 hdr = get_header_by_static_name(msg, "Reason");
661 if (hdr!=NULL) {
662 reason->s = hdr->name.s;
663 reason->len = hdr->len;
664 }
665 }
666 }
667 }
668
669 /* if no reason, use NORMAL CLEARING */
670 if (reason->s == NULL) {
671 reason->s = CANCEL_REASON_SIP_487;
672 reason->len = sizeof(CANCEL_REASON_SIP_487) - 1;
673 }
674}
675
676void cancel_invite(struct sip_msg *cancel_msg,
677 struct cell *t_cancel, struct cell *t_invite, int locked)

Callers 2

tm_replicate_cancelFunction · 0.85
cancel_inviteFunction · 0.85

Calls 1

search_first_avpFunction · 0.85

Tested by

no test coverage detected