From 3ce4ae962b8fe8d9b127410e42db402e3adc86d4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 17 Jul 2014 22:35:04 -0500 Subject: [PATCH] FS-6540 #comment please test this patch for the added notify functionality --- src/mod/endpoints/mod_sofia/mod_sofia.c | 16 ++++++++++++++-- src/mod/endpoints/mod_sofia/sofia.c | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index a1cff0d006..0dca2d700f 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1180,10 +1180,22 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi break; case SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE: { - const char *event = switch_channel_get_variable(channel, "sip_blind_transfer_event"); - const char *uuid = switch_channel_get_variable(channel, "blind_transfer_uuid"); + const char *event; + const char *uuid; char *xdest; + if (msg->string_arg) { + nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"), + NUTAG_SUBSTATE(nua_substate_terminated), + SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"), + SIPTAG_PAYLOAD_STR(msg->string_arg), + SIPTAG_EVENT_STR("refer"), TAG_END()); + goto end; + } + + event = switch_channel_get_variable(channel, "sip_blind_transfer_event"); + uuid = switch_channel_get_variable(channel, "blind_transfer_uuid"); + if (event && uuid) { char payload_str[255] = "SIP/2.0 403 Forbidden\r\n"; if (msg->numeric_arg) { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 390c8886a9..acb10c4f9d 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -550,6 +550,27 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, switch_assert(tech_pvt != NULL); } + + if (sofia_test_pflag(profile, PFLAG_PROXY_REFER) && sip->sip_payload && sip->sip_payload->pl_data && + sip->sip_content_type && sip->sip_content_type->c_type && + switch_stristr("sipfrag", sip->sip_content_type->c_type)) { + switch_core_session_t *other_session; + if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { + switch_core_session_message_t *msg; + + msg = switch_core_session_alloc(other_session, sizeof(*msg)); + MESSAGE_STAMP_FFL(msg); + msg->message_id = SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE; + msg->string_arg = switch_core_session_strdup(other_session, sip->sip_payload->pl_data); + msg->from = __FILE__; + switch_core_session_queue_message(other_session, msg); + switch_core_session_rwunlock(other_session); + + nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END()); + goto end; + } + } + /* For additional NOTIFY event packages see http://www.iana.org/assignments/sip-events. */ if (sip->sip_content_type && sip->sip_content_type->c_type && sip->sip_payload && sip->sip_payload->pl_data && !strcasecmp(sip->sip_event->o_type, "refer")) {