make app to turn on new zombie exec instead of always doing it
This commit is contained in:
parent
908c41031d
commit
3a2f818387
|
@ -1167,6 +1167,7 @@ typedef enum {
|
||||||
CF_LAZY_ATTENDED_TRANSFER,
|
CF_LAZY_ATTENDED_TRANSFER,
|
||||||
CF_SIGNAL_DATA,
|
CF_SIGNAL_DATA,
|
||||||
CF_SIMPLIFY,
|
CF_SIMPLIFY,
|
||||||
|
CF_ZOMBIE_EXEC,
|
||||||
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
|
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
|
||||||
/* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */
|
/* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */
|
||||||
CF_FLAG_MAX
|
CF_FLAG_MAX
|
||||||
|
|
|
@ -4271,6 +4271,21 @@ SWITCH_STANDARD_API(uuid_flush_dtmf_function)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_STANDARD_API(uuid_zombie_exec_function)
|
||||||
|
{
|
||||||
|
switch_core_session_t *fsession;
|
||||||
|
|
||||||
|
if (!zstr(cmd) && (fsession = switch_core_session_locate(cmd))) {
|
||||||
|
switch_channel_set_flag(switch_core_session_get_channel(fsession), CF_ZOMBIE_EXEC);
|
||||||
|
switch_core_session_rwunlock(fsession);
|
||||||
|
stream->write_function(stream, "+OK MMM Brains...\n");
|
||||||
|
} else {
|
||||||
|
stream->write_function(stream, "-ERR no such session\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
#define SETVAR_SYNTAX "<uuid> <var> [value]"
|
#define SETVAR_SYNTAX "<uuid> <var> [value]"
|
||||||
SWITCH_STANDARD_API(uuid_setvar_function)
|
SWITCH_STANDARD_API(uuid_setvar_function)
|
||||||
{
|
{
|
||||||
|
@ -5331,6 +5346,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_simplify", "Try to cut out of a call path / attended xfer", uuid_simplify_function, SIMPLIFY_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_simplify", "Try to cut out of a call path / attended xfer", uuid_simplify_function, SIMPLIFY_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_jitterbuffer", "Try to cut out of a call path / attended xfer",
|
SWITCH_ADD_API(commands_api_interface, "uuid_jitterbuffer", "Try to cut out of a call path / attended xfer",
|
||||||
uuid_jitterbuffer_function, JITTERBUFFER_SYNTAX);
|
uuid_jitterbuffer_function, JITTERBUFFER_SYNTAX);
|
||||||
|
SWITCH_ADD_API(commands_api_interface, "uuid_zombie_exec", "Set zombie_exec flag on the specified uuid", uuid_zombie_exec_function, "<uuid>");
|
||||||
SWITCH_ADD_API(commands_api_interface, "xml_flush_cache", "clear xml cache", xml_flush_function, "<id> <key> <val>");
|
SWITCH_ADD_API(commands_api_interface, "xml_flush_cache", "clear xml cache", xml_flush_function, "<id> <key> <val>");
|
||||||
SWITCH_ADD_API(commands_api_interface, "xml_locate", "find some xml", xml_locate_function, "[root | <section> <tag> <tag_attr_name> <tag_attr_val>]");
|
SWITCH_ADD_API(commands_api_interface, "xml_locate", "find some xml", xml_locate_function, "[root | <section> <tag> <tag_attr_name> <tag_attr_val>]");
|
||||||
SWITCH_ADD_API(commands_api_interface, "xml_wrap", "Wrap another api command in xml", xml_wrap_api_function, "<command> <args>");
|
SWITCH_ADD_API(commands_api_interface, "xml_wrap", "Wrap another api command in xml", xml_wrap_api_function, "<command> <args>");
|
||||||
|
|
|
@ -1005,6 +1005,18 @@ SWITCH_STANDARD_APP(eval_function)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_STANDARD_APP(zombie_function)
|
||||||
|
{
|
||||||
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
|
|
||||||
|
if (switch_channel_up(channel)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s MMM Brains....\n", switch_channel_get_name(channel));
|
||||||
|
switch_channel_set_flag(channel, CF_ZOMBIE_EXEC);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_STANDARD_APP(hangup_function)
|
SWITCH_STANDARD_APP(hangup_function)
|
||||||
{
|
{
|
||||||
|
@ -3921,6 +3933,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
|
||||||
SWITCH_ADD_APP(app_interface, "strftime", "strftime", "strftime", strftime_function, "[<epoch>|]<format string>", SAF_SUPPORT_NOMEDIA);
|
SWITCH_ADD_APP(app_interface, "strftime", "strftime", "strftime", strftime_function, "[<epoch>|]<format string>", SAF_SUPPORT_NOMEDIA);
|
||||||
SWITCH_ADD_APP(app_interface, "phrase", "Say a Phrase", "Say a Phrase", phrase_function, "<macro_name>,<data>", SAF_NONE);
|
SWITCH_ADD_APP(app_interface, "phrase", "Say a Phrase", "Say a Phrase", phrase_function, "<macro_name>,<data>", SAF_NONE);
|
||||||
SWITCH_ADD_APP(app_interface, "eval", "Do Nothing", "Do Nothing", eval_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
|
SWITCH_ADD_APP(app_interface, "eval", "Do Nothing", "Do Nothing", eval_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
|
||||||
|
SWITCH_ADD_APP(app_interface, "stop", "Do Nothing", "Do Nothing", eval_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
||||||
|
SWITCH_ADD_APP(app_interface, "set_zombie_exec", "Enable Zombie Execution", "Enable Zombie Execution",
|
||||||
|
zombie_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
||||||
SWITCH_ADD_APP(app_interface, "pre_answer", "Pre-Answer the call", "Pre-Answer the call for a channel.", pre_answer_function, "", SAF_SUPPORT_NOMEDIA);
|
SWITCH_ADD_APP(app_interface, "pre_answer", "Pre-Answer the call", "Pre-Answer the call for a channel.", pre_answer_function, "", SAF_SUPPORT_NOMEDIA);
|
||||||
SWITCH_ADD_APP(app_interface, "answer", "Answer the call", "Answer the call for a channel.", answer_function, "", SAF_SUPPORT_NOMEDIA);
|
SWITCH_ADD_APP(app_interface, "answer", "Answer the call", "Answer the call for a channel.", answer_function, "", SAF_SUPPORT_NOMEDIA);
|
||||||
SWITCH_ADD_APP(app_interface, "hangup", "Hangup the call", "Hangup the call for a channel.", hangup_function, "[<cause>]", SAF_SUPPORT_NOMEDIA);
|
SWITCH_ADD_APP(app_interface, "hangup", "Hangup the call", "Hangup the call for a channel.", hangup_function, "[<cause>]", SAF_SUPPORT_NOMEDIA);
|
||||||
|
|
|
@ -2049,7 +2049,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flag
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
|
||||||
"%s Channel is hungup and application '%s' does not have the zombie_exec flag.\n",
|
"%s Channel is hungup and application '%s' does not have the zombie_exec flag.\n",
|
||||||
switch_channel_get_name(session->channel), app);
|
switch_channel_get_name(session->channel), app);
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_IGNORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arg && strstr(app, "::")) {
|
if (!arg && strstr(app, "::")) {
|
||||||
|
|
|
@ -46,6 +46,10 @@ static void switch_core_standard_on_hangup(switch_core_session_t *session)
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard HANGUP, cause: %s\n",
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard HANGUP, cause: %s\n",
|
||||||
switch_channel_get_name(session->channel), switch_channel_cause2str(switch_channel_get_cause(session->channel)));
|
switch_channel_get_name(session->channel), switch_channel_cause2str(switch_channel_get_cause(session->channel)));
|
||||||
|
|
||||||
|
if (!switch_channel_test_flag(session->channel, CF_ZOMBIE_EXEC)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((extension = switch_channel_get_caller_extension(session->channel)) == 0) {
|
if ((extension = switch_channel_get_caller_extension(session->channel)) == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -53,14 +57,17 @@ static void switch_core_standard_on_hangup(switch_core_session_t *session)
|
||||||
|
|
||||||
while(extension->current_application) {
|
while(extension->current_application) {
|
||||||
switch_caller_application_t *current_application = extension->current_application;
|
switch_caller_application_t *current_application = extension->current_application;
|
||||||
|
switch_status_t status;
|
||||||
|
|
||||||
extension->current_application = extension->current_application->next;
|
extension->current_application = extension->current_application->next;
|
||||||
|
|
||||||
if (switch_core_session_execute_application(session,
|
status = switch_core_session_execute_application(session,
|
||||||
current_application->application_name,
|
current_application->application_name, current_application->application_data);
|
||||||
current_application->application_data) != SWITCH_STATUS_SUCCESS) {
|
|
||||||
|
|
||||||
|
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_IGNORE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue