FS-8913 #resolve [Problem with transfer when using bypass_media + SRTP + Inbound late negotiation]

This commit is contained in:
Anthony Minessale committed 2016-03-31 16:45:34 -05:00
1 parent fdd81dcc82
commit 647cc257fd
5 files changed
+108 -29

No files matched your search

+67
View File
@@ -1557,6 +1557,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_unhold_uuid(const char *uuid)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_ivr_3p_media(const char *uuid, switch_media_flag_t flags)
{
const char *other_uuid = NULL;
@@ -1813,7 +1817,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_3p_nomedia(const char *uuid, switch_m
if (!switch_core_session_in_thread(session)) {
switch_channel_set_state(channel, CS_PARK);
}
switch_channel_set_state(other_channel, CS_PARK);
if (switch_core_session_in_thread(session)) {
switch_yield(100000);
} else {
@@ -1884,6 +1890,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
msg.from = __FILE__;
if ((session = switch_core_session_locate(uuid))) {
status = SWITCH_STATUS_SUCCESS;
channel = switch_core_session_get_channel(session);
@@ -1969,6 +1976,64 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
return status;
}
typedef struct {
switch_memory_pool_t *pool;
const char *uuid;
switch_media_flag_t flags;
switch_bool_t on;
switch_bool_t is3p;
uint32_t delay;
} media_job_t;
static void *SWITCH_THREAD_FUNC media_thread_run(switch_thread_t *thread, void *obj)
{
media_job_t *job = (media_job_t *) obj;
if (job->delay) {
switch_yield(job->delay * 1000);
}
if (job->on) {
if (job->is3p) {
switch_ivr_3p_media(job->uuid, job->flags);
} else {
switch_ivr_media(job->uuid, job->flags);
}
} else {
if (job->is3p) {
switch_ivr_3p_nomedia(job->uuid, job->flags);
} else {
switch_ivr_nomedia(job->uuid, job->flags);
}
}
return NULL;
}
SWITCH_DECLARE(void) switch_ivr_bg_media(const char *uuid, switch_media_flag_t flags, switch_bool_t on, switch_bool_t is3p, uint32_t delay)
{
switch_thread_data_t *td;
switch_memory_pool_t *pool;
media_job_t *job;
switch_core_new_memory_pool(&pool);
td = switch_core_alloc(pool, sizeof(*td));
job = switch_core_alloc(pool, sizeof(*job));
td->func = media_thread_run;
job->pool = pool;
job->uuid = switch_core_strdup(pool, uuid);
job->flags = flags;
job->on = on;
job->is3p = is3p;
job->delay = delay;
td->obj = job;
td->pool = pool;
switch_thread_pool_launch_thread(&td);
}
SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, const char *extension, const char *dialplan,
const char *context)
{
@@ -2008,6 +2073,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
/* reset temp hold music */
switch_channel_set_variable(channel, SWITCH_TEMP_HOLD_MUSIC_VARIABLE, NULL);
switch_channel_execute_on(channel, "execute_on_blind_transfer");
if ((profile = switch_channel_get_caller_profile(channel))) {
const char *var;