| 639 | } |
| 640 | |
| 641 | void 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 | |
| 676 | void cancel_invite(struct sip_msg *cancel_msg, |
| 677 | struct cell *t_cancel, struct cell *t_invite, int locked) |
no test coverage detected