提交 93f96add authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-4453 confirm this fixes your problem please

上级 1dd4bd49
...@@ -755,6 +755,7 @@ void sofia_handle_sip_r_message(int status, sofia_profile_t *profile, nua_handle ...@@ -755,6 +755,7 @@ void sofia_handle_sip_r_message(int status, sofia_profile_t *profile, nua_handle
call_id = sip->sip_call_id->i_id; call_id = sip->sip_call_id->i_id;
switch_mutex_lock(profile->flag_mutex); switch_mutex_lock(profile->flag_mutex);
mstatus = switch_core_hash_find(profile->chat_hash, call_id); mstatus = switch_core_hash_find(profile->chat_hash, call_id);
switch_mutex_unlock(profile->flag_mutex); switch_mutex_unlock(profile->flag_mutex);
......
...@@ -130,8 +130,9 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) ...@@ -130,8 +130,9 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
char *extra_headers = NULL; char *extra_headers = NULL;
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
int mstatus = 0, sanity = 0; int mstatus = 0, sanity = 0;
const char *blocking;
int is_blocking = 0;
proto = switch_event_get_header(message_event, "proto"); proto = switch_event_get_header(message_event, "proto");
from_proto = switch_event_get_header(message_event, "from_proto"); from_proto = switch_event_get_header(message_event, "from_proto");
from = switch_event_get_header(message_event, "from"); from = switch_event_get_header(message_event, "from");
...@@ -140,7 +141,9 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) ...@@ -140,7 +141,9 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
body = switch_event_get_body(message_event); body = switch_event_get_body(message_event);
type = switch_event_get_header(message_event, "type"); type = switch_event_get_header(message_event, "type");
from_full = switch_event_get_header(message_event, "from_full"); from_full = switch_event_get_header(message_event, "from_full");
blocking = switch_event_get_header(message_event, "blocking");
is_blocking = switch_true(blocking);
network_ip = switch_event_get_header(message_event, "to_sip_ip"); network_ip = switch_event_get_header(message_event, "to_sip_ip");
network_port = switch_event_get_header(message_event, "to_sip_port"); network_port = switch_event_get_header(message_event, "to_sip_port");
...@@ -328,11 +331,13 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) ...@@ -328,11 +331,13 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
switch_snprintf(header, sizeof(header), "X-FS-Sending-Message: %s", switch_core_get_uuid()); switch_snprintf(header, sizeof(header), "X-FS-Sending-Message: %s", switch_core_get_uuid());
switch_uuid_str(uuid_str, sizeof(uuid_str)); switch_uuid_str(uuid_str, sizeof(uuid_str));
switch_mutex_lock(profile->flag_mutex); if (is_blocking) {
switch_core_hash_insert(profile->chat_hash, uuid_str, &mstatus); switch_mutex_lock(profile->flag_mutex);
switch_mutex_unlock(profile->flag_mutex); switch_core_hash_insert(profile->chat_hash, uuid_str, &mstatus);
switch_mutex_unlock(profile->flag_mutex);
}
nua_message(msg_nh, nua_message(msg_nh,
TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)),
TAG_IF(route_uri, NUTAG_PROXY(route_uri)), TAG_IF(route_uri, NUTAG_PROXY(route_uri)),
...@@ -347,20 +352,23 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) ...@@ -347,20 +352,23 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
SIPTAG_HEADER_STR(header), SIPTAG_HEADER_STR(header),
TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
TAG_END()); TAG_END());
if (is_blocking) {
sanity = 200;
sanity = 200; while(!mstatus && --sanity) {
while(!mstatus && --sanity) { switch_yield(100000);
switch_yield(100000); }
}
if (!(mstatus > 199 && mstatus < 300)) {
if (!(mstatus > 199 && mstatus < 300)) { status = SWITCH_STATUS_FALSE;
status = SWITCH_STATUS_FALSE; }
}
switch_mutex_lock(profile->flag_mutex); switch_mutex_lock(profile->flag_mutex);
switch_core_hash_delete(profile->chat_hash, uuid_str); switch_core_hash_delete(profile->chat_hash, uuid_str);
switch_mutex_unlock(profile->flag_mutex); switch_mutex_unlock(profile->flag_mutex);
}
sofia_glue_free_destination(dst); sofia_glue_free_destination(dst);
switch_safe_free(dup_dest); switch_safe_free(dup_dest);
......
...@@ -758,6 +758,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_chat_send_args(const char *dest_prot ...@@ -758,6 +758,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_chat_send_args(const char *dest_prot
switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "type", type); switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "type", type);
switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "hint", hint); switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "hint", hint);
switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "skip_global_process", "true"); switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "skip_global_process", "true");
if (blocking) {
switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "blocking", "true");
}
if (body) { if (body) {
switch_event_add_body(message_event, "%s", body); switch_event_add_body(message_event, "%s", body);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论