add execute_on_answer magic variable

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8003 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2008-04-02 15:11:07 +00:00
parent 1c52292c9b
commit d3be2ae749
5 changed files with 75 additions and 96 deletions

View File

@@ -1533,7 +1533,17 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *
status = switch_core_session_receive_message(channel->session, &msg);
if (status == SWITCH_STATUS_SUCCESS) {
const char *var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE);
char *app;
switch_channel_perform_mark_answered(channel, file, func, line);
if (var) {
char *arg = NULL;
app = switch_core_session_strdup(channel->session, var);
if ((arg = strchr(app, ' '))) {
*arg++ = '\0';
}
switch_core_session_execute_application(channel->session, app, arg);
}
} else {
switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
}