use final_delivery variable in chat plan to indicate that you do not want to deliver the message to its intended recipient because you have already pre-empted the message

This commit is contained in:
Anthony Minessale 2014-07-23 20:28:15 +05:00
parent 3d5d8163b3
commit 7c01f06e74
1 changed files with 9 additions and 10 deletions

View File

@ -592,8 +592,6 @@ static switch_status_t do_chat_send(switch_event_t *message_event)
const char *hint; const char *hint;
*/ */
dest_proto = switch_event_get_header(message_event, "dest_proto"); dest_proto = switch_event_get_header(message_event, "dest_proto");
if (!dest_proto) { if (!dest_proto) {
@ -626,20 +624,21 @@ static switch_status_t do_chat_send(switch_event_t *message_event)
if ((ci = (switch_chat_interface_t *) val)) { if ((ci = (switch_chat_interface_t *) val)) {
if (ci->chat_send && !strncasecmp(ci->interface_name, "GLOBAL_", 7)) { if (ci->chat_send && !strncasecmp(ci->interface_name, "GLOBAL_", 7)) {
status = ci->chat_send(message_event); status = ci->chat_send(message_event);
if (status == SWITCH_STATUS_SUCCESS) { if (status == SWITCH_STATUS_SUCCESS) {
/* The event was handled by an extension in the chatplan, if (switch_true(switch_event_get_header(message_event, "final_delivery"))) {
* so the event will be duplicated, modified and queued again, /* The event was handled by an extension in the chatplan,
* but it won't be processed by the chatplan again. * so the event will be duplicated, modified and queued again,
* So this copy of the event can be destroyed by the caller. * but it won't be processed by the chatplan again.
*/ * So this copy of the event can be destroyed by the caller.
switch_mutex_unlock(loadable_modules.mutex); */
return SWITCH_STATUS_SUCCESS; do_skip = 1;
}
} else if (status == SWITCH_STATUS_BREAK) { } else if (status == SWITCH_STATUS_BREAK) {
/* The event went through the chatplan, but no extension matched /* The event went through the chatplan, but no extension matched
* to handle the sms messsage. It'll be attempted to be delivered * to handle the sms messsage. It'll be attempted to be delivered
* directly, and unless that works the sms delivery will have failed. * directly, and unless that works the sms delivery will have failed.
*/ */
do_skip = 1;
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Chat Interface Error [%s]!\n", dest_proto); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Chat Interface Error [%s]!\n", dest_proto);
break; break;