]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6540 #comment please test this patch for the added notify functionality
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 18 Jul 2014 03:35:04 +0000 (22:35 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 18 Jul 2014 03:35:04 +0000 (22:35 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia.c

index a1cff0d0061095e56e63698a1bcb36594d29acac..0dca2d700f598c3271462a629a006d4efedc325e 100644 (file)
@@ -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) {
index 390c8886a93435407410df0aa3e3ca2c8ba583c4..acb10c4f9d6e540dc98641fad98e247e6f25426f 100644 (file)
@@ -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")) {