diff --git a/conf/dialplan/default.xml b/conf/dialplan/default.xml index a5ba393a52..ca4769a86b 100644 --- a/conf/dialplan/default.xml +++ b/conf/dialplan/default.xml @@ -2,6 +2,14 @@ + + + + + + + + @@ -35,8 +43,10 @@ - + + + diff --git a/conf/vars.xml b/conf/vars.xml index c8b229f671..54dd2bbcf0 100644 --- a/conf/vars.xml +++ b/conf/vars.xml @@ -41,15 +41,14 @@ Used by: sofia.conf.xml dingaling.conf.xml --> - + - + diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 9278c95759..c80271b84e 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -431,6 +431,7 @@ typedef enum { SWITCH_MESSAGE_INDICATE_RESPOND - indicate reject SWITCH_MESSAGE_INDICATE_BROADCAST - indicate media broadcast SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT - indicate media broadcast + SWITCH_MESSAGE_INDICATE_DEFLECT - indicate deflect */ typedef enum { @@ -449,7 +450,8 @@ typedef enum { SWITCH_MESSAGE_INDICATE_REDIRECT, SWITCH_MESSAGE_INDICATE_RESPOND, SWITCH_MESSAGE_INDICATE_BROADCAST, - SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT + SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT, + SWITCH_MESSAGE_INDICATE_DEFLECT } switch_core_session_message_types_t; diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 030f0d289c..8408a625ae 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -428,6 +428,18 @@ SWITCH_STANDARD_APP(respond_function) } +SWITCH_STANDARD_APP(deflect_function) +{ + switch_core_session_message_t msg = { 0 }; + + /* Tell the channel to respond the call */ + msg.from = __FILE__; + msg.string_arg = data; + msg.message_id = SWITCH_MESSAGE_INDICATE_DEFLECT; + switch_core_session_receive_message(session, &msg); + +} + SWITCH_STANDARD_APP(set_function) { @@ -1398,8 +1410,9 @@ SWITCH_STANDARD_APP(audio_bridge_function) } } - - switch_channel_hangup(caller_channel, cause); + if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && switch_channel_get_state(caller_channel) != CS_RING) { + switch_channel_hangup(caller_channel, cause); + } return; } else { if (no_media_bridge) { @@ -1632,6 +1645,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "ivr", "Run an ivr menu", "Run an ivr menu.", ivr_application_function, "", SAF_NONE); SWITCH_ADD_APP(app_interface, "redirect", "Send session redirect", "Send a redirect message to a session.", redirect_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "respond", "Send session respond", "Send a respond message to a session.", respond_function, "", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "reject", "Send session reject (depricated)", "Send a respond message to a session.", respond_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "sched_hangup", SCHED_HANGUP_DESCR, SCHED_HANGUP_DESCR, sched_hangup_function, "[+]