提交 b8f0d11a authored 作者: William King's avatar William King

Fire an event on successful sms delivery, as well as clearify if the delivery…

Fire an event on successful sms delivery, as well as clearify if the delivery method was blocking or not.
上级 8b74de2d
......@@ -50,6 +50,9 @@ static void event_handler(switch_event_t *event)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Delivery Failure\n");
DUMP_EVENT(event);
return;
} else if ( check_failure && switch_false(check_failure) ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SMS Delivery Success\n");
return;
}
......
......@@ -512,6 +512,7 @@ static switch_status_t do_chat_send(switch_event_t *message_event)
switch_chat_interface_t *ci;
switch_status_t status = SWITCH_STATUS_FALSE;
switch_hash_index_t *hi;
switch_event_t *dup = NULL;
const void *var;
void *val;
const char *proto;
......@@ -588,14 +589,20 @@ static switch_status_t do_chat_send(switch_event_t *message_event)
}
}
if (status != SWITCH_STATUS_SUCCESS) {
switch_event_t *dup;
switch_event_dup(&dup, message_event);
switch_event_add_header_string(dup, SWITCH_STACK_BOTTOM, "Delivery-Failure", "true");
switch_event_fire(&dup);
}
switch_event_dup(&dup, message_event);
if ( switch_true(switch_event_get_header(message_event, "blocking")) ) {
if (status == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(dup, SWITCH_STACK_BOTTOM, "Delivery-Failure", "false");
} else {
switch_event_add_header_string(dup, SWITCH_STACK_BOTTOM, "Delivery-Failure", "true");
}
} else {
switch_event_add_header_string(dup, SWITCH_STACK_BOTTOM, "Nonblocking-Delivery", "true");
}
switch_event_fire(&dup);
return status;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论