mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-14 23:34:13 +00:00
FS-4453 --resolve this will now cause up to a 20 second timeout waiting for the response and the call will be blocking
This commit is contained in:
1 parent
7f525d5ca9
commit
d832b5dfef
6 files changed
+60
-12
No files matched your search
@@ -745,6 +745,24 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
|
||||
|
||||
void sofia_handle_sip_r_message(int status, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip)
|
||||
{
|
||||
const char *call_id;
|
||||
int *mstatus;
|
||||
|
||||
if (!sip && sip->sip_call_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
call_id = sip->sip_call_id->i_id;
|
||||
|
||||
|
||||
switch_mutex_lock(profile->flag_mutex);
|
||||
mstatus = switch_core_hash_find(profile->chat_hash, call_id);
|
||||
switch_mutex_unlock(profile->flag_mutex);
|
||||
|
||||
if (mstatus) {
|
||||
*mstatus = status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void sofia_wait_for_reply(struct private_object *tech_pvt, nua_event_t event, uint32_t timeout)
|
||||
|
||||
@@ -128,6 +128,9 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
|
||||
char *route_uri = NULL;
|
||||
const char *network_ip = NULL, *network_port = NULL, *from_proto;
|
||||
char *extra_headers = NULL;
|
||||
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
||||
int mstatus = 0, sanity = 0;
|
||||
|
||||
|
||||
proto = switch_event_get_header(message_event, "proto");
|
||||
from_proto = switch_event_get_header(message_event, "from_proto");
|
||||
@@ -324,6 +327,12 @@ 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_uuid_str(uuid_str, sizeof(uuid_str));
|
||||
|
||||
switch_mutex_lock(profile->flag_mutex);
|
||||
switch_core_hash_insert(profile->chat_hash, uuid_str, &mstatus);
|
||||
switch_mutex_unlock(profile->flag_mutex);
|
||||
|
||||
nua_message(msg_nh,
|
||||
TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)),
|
||||
TAG_IF(route_uri, NUTAG_PROXY(route_uri)),
|
||||
@@ -331,7 +340,7 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
|
||||
SIPTAG_FROM_STR(from),
|
||||
TAG_IF(contact, NUTAG_URL(contact)),
|
||||
SIPTAG_TO_STR(dup_dest),
|
||||
|
||||
SIPTAG_CALL_ID_STR(uuid_str),
|
||||
TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
|
||||
SIPTAG_CONTENT_TYPE_STR(ct),
|
||||
SIPTAG_PAYLOAD_STR(body),
|
||||
@@ -339,6 +348,20 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
|
||||
TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
|
||||
TAG_END());
|
||||
|
||||
|
||||
sanity = 200;
|
||||
while(!mstatus && --sanity) {
|
||||
switch_yield(100000);
|
||||
}
|
||||
|
||||
if (!(mstatus > 199 && mstatus < 300)) {
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
switch_mutex_lock(profile->flag_mutex);
|
||||
switch_core_hash_delete(profile->chat_hash, uuid_str);
|
||||
switch_mutex_unlock(profile->flag_mutex);
|
||||
|
||||
sofia_glue_free_destination(dst);
|
||||
switch_safe_free(dup_dest);
|
||||
switch_safe_free(remote_host);
|
||||
|
||||
Reference in new issue
Block a user