add param:confirm-blind-transfer var:confirm_blind_transfer that makes blind transfers keep the transferrer on the line until its confirmed that the call was completed or brings it back to the bridge. blind_transfer_ack app can be executed in the dp by the transferee to indicate sucess or fail or a sucessful bridge will automatically trigger a success

This commit is contained in:
Anthony Minessale
2012-05-08 08:50:33 -05:00
parent 2325dfbc4a
commit 07204a1fb5
7 changed files with 143 additions and 20 deletions
+23 -1
View File
@@ -1653,6 +1653,28 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
}
}
goto end;
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");
char *xdest;
if (event && uuid) {
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->numeric_arg ? "SIP/2.0 200 OK\r\n" : "SIP/2.0 403 Forbidden\r\n"),
SIPTAG_EVENT_STR(event), TAG_END());
if (!msg->numeric_arg) {
xdest = switch_core_session_sprintf(session, "intercept:%s", uuid);
switch_ivr_session_transfer(session, xdest, "inline", NULL);
}
}
}
goto end;
case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
if (switch_rtp_ready(tech_pvt->rtp_session)) {
@@ -5343,7 +5365,6 @@ static switch_status_t list_profile_gateway(const char *line, const char *cursor
return status;
}
SWITCH_STANDARD_APP(sofia_sla_function)
{
private_object_t *tech_pvt;
@@ -5502,6 +5523,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
SWITCH_ADD_APP(app_interface, "sofia_sla", "private sofia sla function",
"private sofia sla function", sofia_sla_function, "<uuid>", SAF_NONE);
SWITCH_ADD_API(api_interface, "sofia", "Sofia Controls", sofia_function, "<cmd> <args>");
SWITCH_ADD_API(api_interface, "sofia_gateway_data", "Get data from a sofia gateway", sofia_gateway_data_function,
"<gateway_name> [ivar|ovar|var] <name>");
+1
View File
@@ -264,6 +264,7 @@ typedef enum {
PFLAG_PRESENCE_MAP,
PFLAG_OPTIONS_RESPOND_503_ON_BUSY,
PFLAG_PRESENCE_DISABLE_EARLY,
PFLAG_CONFIRM_BLIND_TRANSFER,
/* No new flags below this line */
PFLAG_MAX
} PFLAGS;
+48 -19
View File
@@ -3105,6 +3105,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
} else {
sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL);
}
} else if (!strcasecmp(var, "confirm-blind-transfer")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER);
} else {
sofia_clear_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER);
}
} else if (!strcasecmp(var, "presence-proto-lookup")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_PRESENCE_MAP);
@@ -3892,6 +3898,12 @@ switch_status_t config_sofia(int reload, char *profile_name)
} else {
sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL);
}
} else if (!strcasecmp(var, "confirm-blind-transfer")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER);
} else {
sofia_clear_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER);
}
} else if (!strcasecmp(var, "presence-proto-lookup")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_PRESENCE_MAP);
@@ -7093,37 +7105,54 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
if (exten) {
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *br;
switch_core_session_t *b_session;
if ((br = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_core_session_t *b_session;
if ((br = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (b_session = switch_core_session_locate(br))) {
if ((b_session = switch_core_session_locate(br))) {
switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
switch_channel_set_variable(channel, "transfer_fallback_extension", from->a_user);
if (!zstr(full_ref_by)) {
switch_channel_set_variable(b_channel, SOFIA_SIP_HEADER_PREFIX "Referred-By", full_ref_by);
}
if (!zstr(full_ref_to)) {
switch_channel_set_variable(b_channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);
}
const char *var;
switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
if (switch_true(switch_channel_get_variable(channel, "recording_follow_transfer"))) {
switch_core_media_bug_transfer_recordings(session, b_session);
}
switch_channel_set_variable(channel, "transfer_fallback_extension", from->a_user);
if (!zstr(full_ref_by)) {
switch_channel_set_variable(b_channel, SOFIA_SIP_HEADER_PREFIX "Referred-By", full_ref_by);
}
switch_ivr_session_transfer(b_session, exten, NULL, NULL);
switch_core_session_rwunlock(b_session);
if (!zstr(full_ref_to)) {
switch_channel_set_variable(b_channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);
}
if (switch_true(switch_channel_get_variable(channel, "recording_follow_transfer"))) {
switch_core_media_bug_transfer_recordings(session, b_session);
}
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "BLIND_TRANSFER");
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("SIP/2.0 200 OK\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END());
if (((var = switch_channel_get_variable(channel, "confirm_blind_transfer")) && switch_true(var)) ||
sofia_test_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER)) {
switch_channel_set_state_flag(b_channel, CF_CONFIRM_BLIND_TRANSFER);
switch_channel_set_variable(channel, "sip_blind_transfer_event", etmp);
switch_channel_set_variable(b_channel, "blind_transfer_uuid", switch_core_session_get_uuid(session));
switch_channel_set_variable(channel, "blind_transfer_uuid", switch_core_session_get_uuid(b_session));
switch_channel_set_variable(channel, "park_timeout", "600:blind_transfer");
switch_channel_set_state(channel, CS_PARK);
} else {
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("SIP/2.0 200 OK\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END());
}
switch_ivr_session_transfer(b_session, exten, NULL, NULL);
switch_core_session_rwunlock(b_session);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot Blind Transfer 1 Legged calls\n");
switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR");
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("SIP/2.0 403 Forbidden\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END());
NUTAG_SUBSTATE(nua_substate_terminated),
SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"),
SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END());
}
}