| 779 | } |
| 780 | |
| 781 | static int call_handle_notify(struct dlg_cell *dlg, struct sip_msg *msg) |
| 782 | { |
| 783 | str retry = str_init("Retry-After: 1 (not found)\n"); |
| 784 | str state = str_init("notify"); |
| 785 | int status_code; |
| 786 | int_str new_callid; |
| 787 | str status; |
| 788 | int val_type; |
| 789 | |
| 790 | if (msg->REQ_METHOD != METHOD_NOTIFY) |
| 791 | return -2; |
| 792 | |
| 793 | /* only interested in refer events */ |
| 794 | if (parse_headers(msg, HDR_EVENT_F, 0) < 0 || |
| 795 | (!msg->event || msg->event->body.len <= 0)) |
| 796 | return -1; |
| 797 | |
| 798 | if (!msg->event->parsed && (parse_event(msg->event) < 0)) |
| 799 | return -1; |
| 800 | if (((event_t *)msg->event->parsed)->parsed != EVENT_REFER) |
| 801 | return -2; |
| 802 | |
| 803 | status_code = 400; |
| 804 | if (get_body(msg, &status) < 0 || status.len < 0) |
| 805 | goto reply; |
| 806 | /* try to validate, without looking at the content type */ |
| 807 | if (status.len <= SIP_VERSION_LEN || memcmp(status.s, SIP_VERSION, SIP_VERSION_LEN)) |
| 808 | goto reply; |
| 809 | |
| 810 | status_code = 480; |
| 811 | if (call_dlg_api.fetch_dlg_value(dlg, &call_transfer_callid_param, &val_type, |
| 812 | &new_callid, 0) < 0) { |
| 813 | add_lump_rpl(msg, retry.s, retry.len, LUMP_RPL_HDR); |
| 814 | goto reply; |
| 815 | } |
| 816 | status.len -= SIP_VERSION_LEN; |
| 817 | status.s += SIP_VERSION_LEN; |
| 818 | trim(&status); |
| 819 | call_transfer_raise(dlg, &new_callid.s, &empty_str, &state, &status); |
| 820 | |
| 821 | status_code = 200; |
| 822 | |
| 823 | reply: |
| 824 | status.s = error_text(status_code); |
| 825 | status.len = strlen(status.s); |
| 826 | if (run_tm_api(&call_tm_api, t_reply, msg, status_code, &status) < 0) |
| 827 | return -1; |
| 828 | return 0; |
| 829 | } |
| 830 | |
| 831 | static void call_transfer_dlg_callback(struct dlg_cell* dlg, int type, |
| 832 | struct dlg_cb_params *params) |
no test coverage detected