Merge branch 'master' into v1.2.stable
This commit is contained in:
commit
7114899b6b
|
@ -187,6 +187,7 @@ SWITCH_DECLARE(void) switch_channel_uninit(switch_channel_t *channel);
|
||||||
\param caller_profile the profile to assign
|
\param caller_profile the profile to assign
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile);
|
SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile);
|
||||||
|
SWITCH_DECLARE(void) switch_channel_step_caller_profile(switch_channel_t *channel);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Retrieve the given channel's caller profile
|
\brief Retrieve the given channel's caller profile
|
||||||
|
@ -200,7 +201,8 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(swit
|
||||||
\param channel channel to assign the profile to
|
\param channel channel to assign the profile to
|
||||||
\param caller_profile the profile to assign
|
\param caller_profile the profile to assign
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(void) switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile);
|
SWITCH_DECLARE(void) _switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile);
|
||||||
|
#define switch_channel_set_originator_caller_profile(_c, _cp) switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(_c), SWITCH_LOG_CRIT, "%s SET ORIGINATOR\n", switch_channel_get_name(_c)); _switch_channel_set_originator_caller_profile(_c, _cp)
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_channel_set_hunt_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile);
|
SWITCH_DECLARE(void) switch_channel_set_hunt_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile);
|
||||||
|
|
||||||
|
@ -216,7 +218,8 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originator_caller_p
|
||||||
\param channel channel to assign the profile to
|
\param channel channel to assign the profile to
|
||||||
\param caller_profile the profile to assign
|
\param caller_profile the profile to assign
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile);
|
SWITCH_DECLARE(void) _switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile);
|
||||||
|
#define switch_channel_set_originatee_caller_profile(_c, _cp) switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(_c), SWITCH_LOG_CRIT, "%s SET ORIGINATEE\n", switch_channel_get_name(_c)); _switch_channel_set_originatee_caller_profile(_c, _cp)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Retrieve the given channel's originatee caller profile
|
\brief Retrieve the given channel's originatee caller profile
|
||||||
|
@ -651,6 +654,7 @@ SWITCH_DECLARE(void) switch_channel_state_thread_lock(switch_channel_t *channel)
|
||||||
SWITCH_DECLARE(void) switch_channel_state_thread_unlock(switch_channel_t *channel);
|
SWITCH_DECLARE(void) switch_channel_state_thread_unlock(switch_channel_t *channel);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_channel_state_thread_trylock(switch_channel_t *channel);
|
SWITCH_DECLARE(switch_status_t) switch_channel_state_thread_trylock(switch_channel_t *channel);
|
||||||
|
|
||||||
|
|
||||||
SWITCH_END_EXTERN_C
|
SWITCH_END_EXTERN_C
|
||||||
#endif
|
#endif
|
||||||
/* For Emacs:
|
/* For Emacs:
|
||||||
|
|
|
@ -811,6 +811,7 @@ SWITCH_DECLARE(const char *) switch_core_get_switchname(void);
|
||||||
\param value the value of the variable
|
\param value the value of the variable
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(void) switch_core_set_variable(_In_z_ const char *varname, _In_opt_z_ const char *value);
|
SWITCH_DECLARE(void) switch_core_set_variable(_In_z_ const char *varname, _In_opt_z_ const char *value);
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_core_get_variables(switch_event_t **event);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Conditionally add a global variable to the core
|
\brief Conditionally add a global variable to the core
|
||||||
|
@ -847,7 +848,7 @@ SWITCH_DECLARE(uint32_t) switch_core_session_hupall_matching_var_ans(_In_ const
|
||||||
switch_call_cause_t cause, switch_hup_type_t type);
|
switch_call_cause_t cause, switch_hup_type_t type);
|
||||||
SWITCH_DECLARE(switch_console_callback_match_t *) switch_core_session_findall_matching_var(const char *var_name, const char *var_val);
|
SWITCH_DECLARE(switch_console_callback_match_t *) switch_core_session_findall_matching_var(const char *var_name, const char *var_val);
|
||||||
#define switch_core_session_hupall_matching_var(_vn, _vv, _c) switch_core_session_hupall_matching_var_ans(_vn, _vv, _c, SHT_UNANSWERED | SHT_ANSWERED)
|
#define switch_core_session_hupall_matching_var(_vn, _vv, _c) switch_core_session_hupall_matching_var_ans(_vn, _vv, _c, SHT_UNANSWERED | SHT_ANSWERED)
|
||||||
|
SWITCH_DECLARE(switch_console_callback_match_t *) switch_core_session_findall(void);
|
||||||
/*!
|
/*!
|
||||||
\brief Hangup all sessions that belong to an endpoint
|
\brief Hangup all sessions that belong to an endpoint
|
||||||
\param endpoint_interface The endpoint interface
|
\param endpoint_interface The endpoint interface
|
||||||
|
|
|
@ -591,6 +591,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_hold_uuid(const char *uuid, const char *message, switch_bool_t moh);
|
SWITCH_DECLARE(switch_status_t) switch_ivr_hold_uuid(const char *uuid, const char *message, switch_bool_t moh);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Toggles channel hold state of session
|
||||||
|
\param uuid the uuid of the session to hold
|
||||||
|
\param message optional message
|
||||||
|
\param moh play music-on-hold
|
||||||
|
\return SWITCH_STATUS_SUCCESS if all is well
|
||||||
|
*/
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_ivr_hold_toggle_uuid(const char *uuid, const char *message, switch_bool_t moh);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Signal the session with a protocol specific unhold message.
|
\brief Signal the session with a protocol specific unhold message.
|
||||||
\param uuid the uuid of the session to hold
|
\param uuid the uuid of the session to hold
|
||||||
|
|
|
@ -1510,7 +1510,8 @@ typedef enum {
|
||||||
SMBF_STEREO_SWAP = (1 << 11),
|
SMBF_STEREO_SWAP = (1 << 11),
|
||||||
SMBF_LOCK = (1 << 12),
|
SMBF_LOCK = (1 << 12),
|
||||||
SMBF_TAP_NATIVE_READ = (1 << 13),
|
SMBF_TAP_NATIVE_READ = (1 << 13),
|
||||||
SMBF_TAP_NATIVE_WRITE = (1 << 14)
|
SMBF_TAP_NATIVE_WRITE = (1 << 14),
|
||||||
|
SMBF_ONE_ONLY = (1 << 15)
|
||||||
} switch_media_bug_flag_enum_t;
|
} switch_media_bug_flag_enum_t;
|
||||||
typedef uint32_t switch_media_bug_flag_t;
|
typedef uint32_t switch_media_bug_flag_t;
|
||||||
|
|
||||||
|
|
|
@ -3184,7 +3184,7 @@ SWITCH_STANDARD_API(sched_broadcast_function)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define HOLD_SYNTAX "[off] <uuid> [<display>]"
|
#define HOLD_SYNTAX "[off|toggle] <uuid> [<display>]"
|
||||||
SWITCH_STANDARD_API(uuid_hold_function)
|
SWITCH_STANDARD_API(uuid_hold_function)
|
||||||
{
|
{
|
||||||
char *mycmd = NULL, *argv[4] = { 0 };
|
char *mycmd = NULL, *argv[4] = { 0 };
|
||||||
|
@ -3200,6 +3200,8 @@ SWITCH_STANDARD_API(uuid_hold_function)
|
||||||
} else {
|
} else {
|
||||||
if (!strcasecmp(argv[0], "off")) {
|
if (!strcasecmp(argv[0], "off")) {
|
||||||
status = switch_ivr_unhold_uuid(argv[1]);
|
status = switch_ivr_unhold_uuid(argv[1]);
|
||||||
|
} else if (!strcasecmp(argv[0], "toggle")) {
|
||||||
|
status = switch_ivr_hold_toggle_uuid(argv[1], argv[2], 1);
|
||||||
} else {
|
} else {
|
||||||
status = switch_ivr_hold_uuid(argv[0], argv[1], 1);
|
status = switch_ivr_hold_uuid(argv[0], argv[1], 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1409,7 +1409,7 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void
|
||||||
struct call_helper *h = cbh->rows[i];
|
struct call_helper *h = cbh->rows[i];
|
||||||
char *sql = switch_mprintf("update fifo_outbound set ring_count=ring_count+1 where uuid='%s'", h->uuid);
|
char *sql = switch_mprintf("update fifo_outbound set ring_count=ring_count+1 where uuid='%s'", h->uuid);
|
||||||
|
|
||||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1451,7 +1451,7 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void
|
||||||
struct call_helper *h = cbh->rows[i];
|
struct call_helper *h = cbh->rows[i];
|
||||||
char *sql = switch_mprintf("update fifo_outbound set ring_count=ring_count-1 "
|
char *sql = switch_mprintf("update fifo_outbound set ring_count=ring_count-1 "
|
||||||
"where uuid='%q' and ring_count > 0", h->uuid);
|
"where uuid='%q' and ring_count > 0", h->uuid);
|
||||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1465,7 +1465,7 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void
|
||||||
"outbound_fail_total_count = outbound_fail_total_count+1, "
|
"outbound_fail_total_count = outbound_fail_total_count+1, "
|
||||||
"next_avail=%ld + lag + 1 where uuid='%q' and ring_count > 0",
|
"next_avail=%ld + lag + 1 where uuid='%q' and ring_count > 0",
|
||||||
(long) switch_epoch_time_now(NULL), h->uuid);
|
(long) switch_epoch_time_now(NULL), h->uuid);
|
||||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1522,7 +1522,7 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void
|
||||||
for (i = 0; i < cbh->rowcount; i++) {
|
for (i = 0; i < cbh->rowcount; i++) {
|
||||||
struct call_helper *h = cbh->rows[i];
|
struct call_helper *h = cbh->rows[i];
|
||||||
char *sql = switch_mprintf("update fifo_outbound set ring_count=ring_count-1 where uuid='%q' and ring_count > 0", h->uuid);
|
char *sql = switch_mprintf("update fifo_outbound set ring_count=ring_count-1 where uuid='%q' and ring_count > 0", h->uuid);
|
||||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
@ -1632,7 +1632,7 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj)
|
||||||
|
|
||||||
|
|
||||||
sql = switch_mprintf("update fifo_outbound set ring_count=ring_count+1 where uuid='%s'", h->uuid);
|
sql = switch_mprintf("update fifo_outbound set ring_count=ring_count+1 where uuid='%s'", h->uuid);
|
||||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
|
||||||
|
|
||||||
status = switch_ivr_originate(NULL, &session, &cause, originate_string, h->timeout, NULL, NULL, NULL, NULL, ovars, SOF_NONE, NULL);
|
status = switch_ivr_originate(NULL, &session, &cause, originate_string, h->timeout, NULL, NULL, NULL, NULL, ovars, SOF_NONE, NULL);
|
||||||
free(originate_string);
|
free(originate_string);
|
||||||
|
@ -1642,7 +1642,7 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj)
|
||||||
sql = switch_mprintf("update fifo_outbound set ring_count=ring_count-1, "
|
sql = switch_mprintf("update fifo_outbound set ring_count=ring_count-1, "
|
||||||
"outbound_fail_count=outbound_fail_count+1, next_avail=%ld + lag + 1 where uuid='%q'",
|
"outbound_fail_count=outbound_fail_count+1, next_avail=%ld + lag + 1 where uuid='%q'",
|
||||||
(long) switch_epoch_time_now(NULL), h->uuid);
|
(long) switch_epoch_time_now(NULL), h->uuid);
|
||||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
|
||||||
|
|
||||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", node->name);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", node->name);
|
||||||
|
@ -2150,7 +2150,7 @@ static void dec_use_count(switch_core_session_t *session, switch_bool_t send_eve
|
||||||
del_bridge_call(outbound_id);
|
del_bridge_call(outbound_id);
|
||||||
sql = switch_mprintf("update fifo_outbound set use_count=use_count-1, stop_time=%ld, next_avail=%ld + lag + 1 where use_count > 0 and uuid='%q'",
|
sql = switch_mprintf("update fifo_outbound set use_count=use_count-1, stop_time=%ld, next_avail=%ld + lag + 1 where use_count > 0 and uuid='%q'",
|
||||||
now, now, outbound_id);
|
now, now, outbound_id);
|
||||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (send_event) {
|
if (send_event) {
|
||||||
|
@ -2217,7 +2217,7 @@ SWITCH_STANDARD_APP(fifo_track_call_function)
|
||||||
|
|
||||||
sql = switch_mprintf("update fifo_outbound set stop_time=0,start_time=%ld,outbound_fail_count=0,use_count=use_count+1,%s=%s+1,%s=%s+1 where uuid='%q'",
|
sql = switch_mprintf("update fifo_outbound set stop_time=0,start_time=%ld,outbound_fail_count=0,use_count=use_count+1,%s=%s+1,%s=%s+1 where uuid='%q'",
|
||||||
(long) switch_epoch_time_now(NULL), col1, col1, col2, col2, data);
|
(long) switch_epoch_time_now(NULL), col1, col1, col2, col2, data);
|
||||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
|
||||||
|
|
||||||
|
|
||||||
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) {
|
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) {
|
||||||
|
@ -2906,7 +2906,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
|
|
||||||
if (node && other_session) {
|
if (node && other_session) {
|
||||||
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
|
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
|
||||||
switch_caller_profile_t *cloned_profile;
|
switch_caller_profile_t *cloned_profile, *a_cp, *b_cp;
|
||||||
const char *o_announce = NULL;
|
const char *o_announce = NULL;
|
||||||
const char *record_template = switch_channel_get_variable(channel, "fifo_record_template");
|
const char *record_template = switch_channel_get_variable(channel, "fifo_record_template");
|
||||||
char *expanded = NULL;
|
char *expanded = NULL;
|
||||||
|
@ -2931,7 +2931,6 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
|
|
||||||
switch_channel_set_variable(other_channel, "fifo_serviced_by", my_id);
|
switch_channel_set_variable(other_channel, "fifo_serviced_by", my_id);
|
||||||
switch_channel_set_variable(other_channel, "fifo_serviced_uuid", switch_core_session_get_uuid(session));
|
switch_channel_set_variable(other_channel, "fifo_serviced_uuid", switch_core_session_get_uuid(session));
|
||||||
|
|
||||||
switch_channel_set_flag(other_channel, CF_BREAK);
|
switch_channel_set_flag(other_channel, CF_BREAK);
|
||||||
|
|
||||||
while (switch_channel_ready(channel) && switch_channel_ready(other_channel) &&
|
while (switch_channel_ready(channel) && switch_channel_ready(other_channel) &&
|
||||||
|
@ -2981,15 +2980,29 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_channel_answer(channel);
|
switch_channel_answer(channel);
|
||||||
cloned_profile = switch_caller_profile_clone(other_session, switch_channel_get_caller_profile(channel));
|
|
||||||
|
a_cp = switch_channel_get_caller_profile(channel);
|
||||||
|
b_cp = switch_channel_get_caller_profile(other_channel);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cloned_profile = switch_caller_profile_clone(other_session, a_cp);
|
||||||
switch_assert(cloned_profile);
|
switch_assert(cloned_profile);
|
||||||
switch_channel_set_originator_caller_profile(other_channel, cloned_profile);
|
switch_channel_set_originator_caller_profile(other_channel, cloned_profile);
|
||||||
|
|
||||||
cloned_profile = switch_caller_profile_clone(session, switch_channel_get_caller_profile(other_channel));
|
a_cp->callee_id_name = switch_core_strdup(a_cp->pool, b_cp->caller_id_name);
|
||||||
|
a_cp->callee_id_number = switch_core_strdup(a_cp->pool, b_cp->caller_id_number);
|
||||||
|
|
||||||
|
|
||||||
|
cloned_profile = switch_caller_profile_clone(session, b_cp);
|
||||||
switch_assert(cloned_profile);
|
switch_assert(cloned_profile);
|
||||||
switch_assert(cloned_profile->next == NULL);
|
switch_assert(cloned_profile->next == NULL);
|
||||||
switch_channel_set_originatee_caller_profile(channel, cloned_profile);
|
switch_channel_set_originatee_caller_profile(channel, cloned_profile);
|
||||||
|
|
||||||
|
b_cp->callee_id_name = switch_core_strdup(b_cp->pool, a_cp->caller_id_name);
|
||||||
|
b_cp->callee_id_number = switch_core_strdup(b_cp->pool, a_cp->caller_id_number);
|
||||||
|
|
||||||
|
|
||||||
ts = switch_micro_time_now();
|
ts = switch_micro_time_now();
|
||||||
switch_time_exp_lt(&tm, ts);
|
switch_time_exp_lt(&tm, ts);
|
||||||
epoch_start = (long)switch_epoch_time_now(NULL);
|
epoch_start = (long)switch_epoch_time_now(NULL);
|
||||||
|
@ -3038,7 +3051,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
switch_epoch_time_now(NULL), outbound_id);
|
switch_epoch_time_now(NULL), outbound_id);
|
||||||
|
|
||||||
|
|
||||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_bridge_call(switch_core_session_get_uuid(other_session));
|
add_bridge_call(switch_core_session_get_uuid(other_session));
|
||||||
|
@ -3073,7 +3086,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
"outbound_call_count=outbound_call_count+1, next_avail=%ld + lag + 1 where uuid='%s' and use_count > 0",
|
"outbound_call_count=outbound_call_count+1, next_avail=%ld + lag + 1 where uuid='%s' and use_count > 0",
|
||||||
now, now, outbound_id);
|
now, now, outbound_id);
|
||||||
|
|
||||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
|
||||||
|
|
||||||
del_bridge_call(outbound_id);
|
del_bridge_call(outbound_id);
|
||||||
|
|
||||||
|
@ -3108,8 +3121,9 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
||||||
|
|
||||||
|
|
||||||
|
if (switch_channel_ready(channel)) {
|
||||||
switch_core_media_bug_pause(session);
|
switch_core_media_bug_pause(session);
|
||||||
switch_core_media_bug_pause(other_session);
|
}
|
||||||
|
|
||||||
if (record_template) {
|
if (record_template) {
|
||||||
switch_ivr_stop_record_session(session, expanded);
|
switch_ivr_stop_record_session(session, expanded);
|
||||||
|
@ -4072,7 +4086,7 @@ static switch_status_t load_config(int reload, int del_all)
|
||||||
|
|
||||||
if (!reload) {
|
if (!reload) {
|
||||||
char *sql= "update fifo_outbound set start_time=0,stop_time=0,ring_count=0,use_count=0,outbound_call_count=0,outbound_fail_count=0 where static=0";
|
char *sql= "update fifo_outbound set start_time=0,stop_time=0,ring_count=0,use_count=0,outbound_call_count=0,outbound_fail_count=0 where static=0";
|
||||||
fifo_execute_sql_queued(&sql, SWITCH_FALSE, SWITCH_FALSE);
|
fifo_execute_sql_queued(&sql, SWITCH_FALSE, SWITCH_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reload) {
|
if (reload) {
|
||||||
|
@ -4095,7 +4109,7 @@ static switch_status_t load_config(int reload, int del_all)
|
||||||
sql = switch_mprintf("delete from fifo_outbound where static=1 and hostname='%q'", globals.hostname);
|
sql = switch_mprintf("delete from fifo_outbound where static=1 and hostname='%q'", globals.hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
|
||||||
|
|
||||||
if (!(node = switch_core_hash_find(globals.fifo_hash, MANUAL_QUEUE_NAME))) {
|
if (!(node = switch_core_hash_find(globals.fifo_hash, MANUAL_QUEUE_NAME))) {
|
||||||
node = create_node(MANUAL_QUEUE_NAME, 0, globals.sql_mutex);
|
node = create_node(MANUAL_QUEUE_NAME, 0, globals.sql_mutex);
|
||||||
|
|
|
@ -505,7 +505,7 @@ switch_status_t spandsp_inband_dtmf_session(switch_core_session_t *session)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status = switch_core_media_bug_add(session, "spandsp_dtmf_detect", NULL,
|
if ((status = switch_core_media_bug_add(session, "spandsp_dtmf_detect", NULL,
|
||||||
inband_dtmf_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) {
|
inband_dtmf_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE | SMBF_ONE_ONLY, &bug)) != SWITCH_STATUS_SUCCESS) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
23
src/switch.c
23
src/switch.c
|
@ -929,16 +929,6 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (nc) {
|
|
||||||
#ifdef WIN32
|
|
||||||
FreeConsole();
|
|
||||||
#else
|
|
||||||
if (!nf) {
|
|
||||||
daemonize(do_wait);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (priority) {
|
switch (priority) {
|
||||||
case 2:
|
case 2:
|
||||||
set_realtime_priority();
|
set_realtime_priority();
|
||||||
|
@ -956,7 +946,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
switch_core_setrlimits();
|
switch_core_setrlimits();
|
||||||
|
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
if (runas_user || runas_group) {
|
if (runas_user || runas_group) {
|
||||||
if (change_user_group(runas_user, runas_group) < 0) {
|
if (change_user_group(runas_user, runas_group) < 0) {
|
||||||
|
@ -966,7 +955,19 @@ int main(int argc, char *argv[])
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (nc) {
|
||||||
|
#ifdef WIN32
|
||||||
|
FreeConsole();
|
||||||
#else
|
#else
|
||||||
|
if (!nf) {
|
||||||
|
daemonize(do_wait);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
if (win32_service) {
|
if (win32_service) {
|
||||||
/* Attempt to start service */
|
/* Attempt to start service */
|
||||||
SERVICE_TABLE_ENTRY dispatchTable[] = {
|
SERVICE_TABLE_ENTRY dispatchTable[] = {
|
||||||
|
|
|
@ -2497,8 +2497,18 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw
|
||||||
switch_mutex_unlock(channel->profile_mutex);
|
switch_mutex_unlock(channel->profile_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(void) switch_channel_step_caller_profile(switch_channel_t *channel)
|
||||||
|
{
|
||||||
|
switch_caller_profile_t *cp;
|
||||||
|
|
||||||
|
|
||||||
|
switch_mutex_lock(channel->profile_mutex);
|
||||||
|
cp = switch_caller_profile_clone(channel->session, channel->caller_profile);
|
||||||
|
switch_mutex_unlock(channel->profile_mutex);
|
||||||
|
|
||||||
|
switch_channel_set_caller_profile(channel, cp);
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
|
SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
|
||||||
{
|
{
|
||||||
char *uuid = NULL;
|
char *uuid = NULL;
|
||||||
|
@ -2561,7 +2571,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(swit
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
|
SWITCH_DECLARE(void) _switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
|
||||||
{
|
{
|
||||||
switch_assert(channel != NULL);
|
switch_assert(channel != NULL);
|
||||||
switch_assert(channel->caller_profile != NULL);
|
switch_assert(channel->caller_profile != NULL);
|
||||||
|
@ -2625,7 +2635,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_origination_caller_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
|
SWITCH_DECLARE(void) _switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
|
||||||
{
|
{
|
||||||
switch_assert(channel != NULL);
|
switch_assert(channel != NULL);
|
||||||
switch_assert(channel->caller_profile != NULL);
|
switch_assert(channel->caller_profile != NULL);
|
||||||
|
@ -3360,10 +3370,12 @@ static void do_execute_on(switch_channel_t *channel, const char *variable)
|
||||||
SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix)
|
SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix)
|
||||||
{
|
{
|
||||||
switch_event_header_t *hp;
|
switch_event_header_t *hp;
|
||||||
switch_event_t *event;
|
switch_event_t *event, *cevent;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
|
||||||
switch_channel_get_variables(channel, &event);
|
switch_core_get_variables(&event);
|
||||||
|
switch_channel_get_variables(channel, &cevent);
|
||||||
|
switch_event_merge(event, cevent);
|
||||||
|
|
||||||
for (hp = event->headers; hp; hp = hp->next) {
|
for (hp = event->headers; hp; hp = hp->next) {
|
||||||
char *var = hp->name;
|
char *var = hp->name;
|
||||||
|
@ -3384,6 +3396,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *chan
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_event_destroy(&event);
|
switch_event_destroy(&event);
|
||||||
|
switch_event_destroy(&cevent);
|
||||||
|
|
||||||
return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
|
return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,6 +307,15 @@ SWITCH_DECLARE(const char *) switch_core_get_switchname(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_core_get_variables(switch_event_t **event)
|
||||||
|
{
|
||||||
|
switch_status_t status;
|
||||||
|
switch_thread_rwlock_rdlock(runtime.global_var_rwlock);
|
||||||
|
status = switch_event_dup(event, runtime.global_vars);
|
||||||
|
switch_thread_rwlock_unlock(runtime.global_var_rwlock);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname)
|
SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname)
|
||||||
{
|
{
|
||||||
char *val;
|
char *val;
|
||||||
|
|
|
@ -411,10 +411,28 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
|
||||||
switch_media_bug_t *bug, *bp;
|
switch_media_bug_t *bug, *bp;
|
||||||
switch_size_t bytes;
|
switch_size_t bytes;
|
||||||
switch_event_t *event;
|
switch_event_t *event;
|
||||||
int tap_only = 1;
|
int tap_only = 1, punt = 0;
|
||||||
|
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
|
if (!zstr(function)) {
|
||||||
|
if ((flags & SMBF_ONE_ONLY)) {
|
||||||
|
switch_thread_rwlock_wrlock(session->bug_rwlock);
|
||||||
|
for (bp = session->bugs; bp; bp = bp->next) {
|
||||||
|
if (!zstr(bp->function) && !strcasecmp(function, bp->function)) {
|
||||||
|
punt = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch_thread_rwlock_unlock(session->bug_rwlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (punt) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Only one bug of this type allowed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!switch_channel_media_ready(session->channel)) {
|
if (!switch_channel_media_ready(session->channel)) {
|
||||||
if (switch_channel_pre_answer(session->channel) != SWITCH_STATUS_SUCCESS) {
|
if (switch_channel_pre_answer(session->channel) != SWITCH_STATUS_SUCCESS) {
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
|
|
|
@ -381,6 +381,29 @@ SWITCH_DECLARE(void) switch_core_session_hupall(switch_call_cause_t cause)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_console_callback_match_t *) switch_core_session_findall(void)
|
||||||
|
{
|
||||||
|
switch_hash_index_t *hi;
|
||||||
|
void *val;
|
||||||
|
switch_core_session_t *session;
|
||||||
|
switch_console_callback_match_t *my_matches = NULL;
|
||||||
|
|
||||||
|
switch_mutex_lock(runtime.session_hash_mutex);
|
||||||
|
for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
|
||||||
|
switch_hash_this(hi, NULL, NULL, &val);
|
||||||
|
if (val) {
|
||||||
|
session = (switch_core_session_t *) val;
|
||||||
|
if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_console_push_match(&my_matches, session->uuid_str);
|
||||||
|
switch_core_session_rwunlock(session);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch_mutex_unlock(runtime.session_hash_mutex);
|
||||||
|
|
||||||
|
return my_matches;
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(const char *uuid_str, switch_core_session_message_t *message)
|
SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(const char *uuid_str, switch_core_session_message_t *message)
|
||||||
{
|
{
|
||||||
switch_core_session_t *session = NULL;
|
switch_core_session_t *session = NULL;
|
||||||
|
|
|
@ -931,7 +931,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
|
||||||
if (switch_core_codec_init(&codec,
|
if (switch_core_codec_init(&codec,
|
||||||
"L16",
|
"L16",
|
||||||
NULL,
|
NULL,
|
||||||
imp.samples_per_second,
|
imp.actual_samples_per_second,
|
||||||
imp.microseconds_per_packet / 1000,
|
imp.microseconds_per_packet / 1000,
|
||||||
imp.number_of_channels,
|
imp.number_of_channels,
|
||||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
||||||
|
@ -1445,6 +1445,28 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_hold_uuid(const char *uuid, const cha
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_ivr_hold_toggle_uuid(const char *uuid, const char *message, switch_bool_t moh)
|
||||||
|
{
|
||||||
|
switch_core_session_t *session;
|
||||||
|
switch_channel_t *channel;
|
||||||
|
switch_channel_callstate_t callstate;
|
||||||
|
|
||||||
|
if ((session = switch_core_session_locate(uuid))) {
|
||||||
|
if ((channel = switch_core_session_get_channel(session))) {
|
||||||
|
callstate = switch_channel_get_callstate(channel);
|
||||||
|
|
||||||
|
if (callstate == CCS_ACTIVE) {
|
||||||
|
switch_ivr_hold(session, message, moh);
|
||||||
|
} else if (callstate == CCS_HELD) {
|
||||||
|
switch_ivr_unhold(session);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch_core_session_rwunlock(session);
|
||||||
|
}
|
||||||
|
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_unhold(switch_core_session_t *session)
|
SWITCH_DECLARE(switch_status_t) switch_ivr_unhold(switch_core_session_t *session)
|
||||||
{
|
{
|
||||||
switch_core_session_message_t msg = { 0 };
|
switch_core_session_message_t msg = { 0 };
|
||||||
|
|
|
@ -844,8 +844,9 @@ static switch_bool_t write_displace_callback(switch_media_bug_t *bug, void *user
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
st = switch_core_file_read(&dh->fh, rframe->data, &len);
|
st = switch_core_file_read(&dh->fh, rframe->data, &len);
|
||||||
rframe->samples = (uint32_t) len;
|
if (len < rframe->samples) {
|
||||||
rframe->datalen = rframe->samples * 2;
|
memset((char *)rframe->data + len * 2, 0, rframe->datalen - len * 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st != SWITCH_STATUS_SUCCESS || len == 0) {
|
if (st != SWITCH_STATUS_SUCCESS || len == 0) {
|
||||||
|
@ -1089,6 +1090,8 @@ struct record_helper {
|
||||||
switch_file_handle_t in_fh;
|
switch_file_handle_t in_fh;
|
||||||
switch_file_handle_t out_fh;
|
switch_file_handle_t out_fh;
|
||||||
int native;
|
int native;
|
||||||
|
int rready;
|
||||||
|
int wready;
|
||||||
uint32_t packet_len;
|
uint32_t packet_len;
|
||||||
int min_sec;
|
int min_sec;
|
||||||
switch_bool_t hangup_on_error;
|
switch_bool_t hangup_on_error;
|
||||||
|
@ -1114,17 +1117,25 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
|
||||||
break;
|
break;
|
||||||
case SWITCH_ABC_TYPE_TAP_NATIVE_READ:
|
case SWITCH_ABC_TYPE_TAP_NATIVE_READ:
|
||||||
{
|
{
|
||||||
|
rh->rready = 1;
|
||||||
|
|
||||||
|
if (rh->rready && rh->wready) {
|
||||||
nframe = switch_core_media_bug_get_native_read_frame(bug);
|
nframe = switch_core_media_bug_get_native_read_frame(bug);
|
||||||
len = nframe->datalen;
|
len = nframe->datalen;
|
||||||
switch_core_file_write(&rh->in_fh, nframe->data, &len);
|
switch_core_file_write(&rh->in_fh, nframe->data, &len);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SWITCH_ABC_TYPE_TAP_NATIVE_WRITE:
|
case SWITCH_ABC_TYPE_TAP_NATIVE_WRITE:
|
||||||
{
|
{
|
||||||
|
rh->wready = 1;
|
||||||
|
|
||||||
|
if (rh->rready && rh->wready) {
|
||||||
nframe = switch_core_media_bug_get_native_write_frame(bug);
|
nframe = switch_core_media_bug_get_native_write_frame(bug);
|
||||||
len = nframe->datalen;
|
len = nframe->datalen;
|
||||||
switch_core_file_write(&rh->out_fh, nframe->data, &len);
|
switch_core_file_write(&rh->out_fh, nframe->data, &len);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SWITCH_ABC_TYPE_CLOSE:
|
case SWITCH_ABC_TYPE_CLOSE:
|
||||||
{
|
{
|
||||||
|
@ -2587,7 +2598,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_inband_dtmf_session(switch_core_sessi
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status = switch_core_media_bug_add(session, "inband_dtmf", NULL,
|
if ((status = switch_core_media_bug_add(session, "inband_dtmf", NULL,
|
||||||
inband_dtmf_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) {
|
inband_dtmf_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE | SMBF_ONE_ONLY, &bug)) != SWITCH_STATUS_SUCCESS) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
|
||||||
switch_core_session_t *session_a, *session_b;
|
switch_core_session_t *session_a, *session_b;
|
||||||
uint32_t read_frame_count = 0;
|
uint32_t read_frame_count = 0;
|
||||||
const char *app_name = NULL, *app_arg = NULL;
|
const char *app_name = NULL, *app_arg = NULL;
|
||||||
int inner_bridge = 0;
|
int inner_bridge = 0, exec_check = 0;
|
||||||
switch_codec_t silence_codec = { 0 };
|
switch_codec_t silence_codec = { 0 };
|
||||||
switch_frame_t silence_frame = { 0 };
|
switch_frame_t silence_frame = { 0 };
|
||||||
int16_t silence_data[SWITCH_RECOMMENDED_BUFFER_SIZE / 2] = { 0 };
|
int16_t silence_data[SWITCH_RECOMMENDED_BUFFER_SIZE / 2] = { 0 };
|
||||||
|
@ -201,7 +201,6 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
|
||||||
chan_a = switch_core_session_get_channel(session_a);
|
chan_a = switch_core_session_get_channel(session_a);
|
||||||
chan_b = switch_core_session_get_channel(session_b);
|
chan_b = switch_core_session_get_channel(session_b);
|
||||||
|
|
||||||
switch_channel_set_bridge_time(chan_a);
|
|
||||||
|
|
||||||
if ((exec_app = switch_channel_get_variable(chan_a, "bridge_pre_execute_app"))) {
|
if ((exec_app = switch_channel_get_variable(chan_a, "bridge_pre_execute_app"))) {
|
||||||
exec_data = switch_channel_get_variable(chan_a, "bridge_pre_execute_data");
|
exec_data = switch_channel_get_variable(chan_a, "bridge_pre_execute_data");
|
||||||
|
@ -358,13 +357,16 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (read_frame_count > DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a)) {
|
if (read_frame_count >= DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a)) {
|
||||||
|
|
||||||
|
if (!exec_check) {
|
||||||
switch_channel_execute_on(chan_a, SWITCH_CHANNEL_EXECUTE_ON_PRE_BRIDGE_VARIABLE);
|
switch_channel_execute_on(chan_a, SWITCH_CHANNEL_EXECUTE_ON_PRE_BRIDGE_VARIABLE);
|
||||||
|
|
||||||
if (!inner_bridge) {
|
if (!inner_bridge) {
|
||||||
switch_channel_api_on(chan_a, SWITCH_API_BRIDGE_START_VARIABLE);
|
switch_channel_api_on(chan_a, SWITCH_API_BRIDGE_START_VARIABLE);
|
||||||
}
|
}
|
||||||
|
exec_check = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (exec_app) {
|
if (exec_app) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "%s Bridge execute app %s(%s)\n",
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "%s Bridge execute app %s(%s)\n",
|
||||||
|
@ -374,7 +376,6 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
|
||||||
exec_app = exec_data = NULL;
|
exec_app = exec_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((bypass_media_after_bridge || switch_channel_test_flag(chan_b, CF_BYPASS_MEDIA_AFTER_BRIDGE)) && switch_channel_test_flag(chan_a, CF_ANSWERED)
|
if ((bypass_media_after_bridge || switch_channel_test_flag(chan_b, CF_BYPASS_MEDIA_AFTER_BRIDGE)) && switch_channel_test_flag(chan_a, CF_ANSWERED)
|
||||||
&& switch_channel_test_flag(chan_b, CF_ANSWERED)) {
|
&& switch_channel_test_flag(chan_b, CF_ANSWERED)) {
|
||||||
switch_ivr_nomedia(switch_core_session_get_uuid(session_a), SMF_REBRIDGE);
|
switch_ivr_nomedia(switch_core_session_get_uuid(session_a), SMF_REBRIDGE);
|
||||||
|
@ -973,6 +974,9 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session
|
||||||
switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE));
|
switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE));
|
||||||
switch_channel_set_variable(channel, SWITCH_LAST_BRIDGE_VARIABLE, switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE));
|
switch_channel_set_variable(channel, SWITCH_LAST_BRIDGE_VARIABLE, switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE));
|
||||||
|
|
||||||
|
switch_channel_set_bridge_time(channel);
|
||||||
|
|
||||||
|
|
||||||
if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
|
if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_core_session_t *other_session;
|
switch_core_session_t *other_session;
|
||||||
|
@ -982,6 +986,9 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session
|
||||||
switch_channel_event_set_data(channel, event);
|
switch_channel_event_set_data(channel, event);
|
||||||
if ((other_session = switch_core_session_locate(msg.string_arg))) {
|
if ((other_session = switch_core_session_locate(msg.string_arg))) {
|
||||||
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
|
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
|
||||||
|
|
||||||
|
switch_channel_set_bridge_time(other_channel);
|
||||||
|
|
||||||
switch_event_add_presence_data_cols(other_channel, event, "Bridge-B-PD-");
|
switch_event_add_presence_data_cols(other_channel, event, "Bridge-B-PD-");
|
||||||
switch_core_session_rwunlock(other_session);
|
switch_core_session_rwunlock(other_session);
|
||||||
}
|
}
|
||||||
|
@ -1162,9 +1169,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *
|
||||||
switch_event_fire(&event);
|
switch_event_fire(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_channel_set_bridge_time(caller_channel);
|
|
||||||
switch_channel_set_bridge_time(peer_channel);
|
|
||||||
|
|
||||||
switch_channel_set_state_flag(caller_channel, CF_RESET);
|
switch_channel_set_state_flag(caller_channel, CF_RESET);
|
||||||
switch_channel_set_state_flag(peer_channel, CF_RESET);
|
switch_channel_set_state_flag(peer_channel, CF_RESET);
|
||||||
|
|
||||||
|
@ -1263,6 +1267,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
|
||||||
|
|
||||||
switch_channel_set_variable(peer_channel, "call_uuid", switch_core_session_get_uuid(session));
|
switch_channel_set_variable(peer_channel, "call_uuid", switch_core_session_get_uuid(session));
|
||||||
|
|
||||||
|
switch_channel_set_bridge_time(caller_channel);
|
||||||
|
switch_channel_set_bridge_time(peer_channel);
|
||||||
|
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session));
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session));
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", switch_core_session_get_uuid(peer_session));
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", switch_core_session_get_uuid(peer_session));
|
||||||
|
@ -1641,10 +1648,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
|
||||||
switch_channel_set_variable(originator_channel, "original_caller_id_name", originator_cp->caller_id_name);
|
switch_channel_set_variable(originator_channel, "original_caller_id_name", originator_cp->caller_id_name);
|
||||||
switch_channel_set_variable(originator_channel, "original_caller_id_number", originator_cp->caller_id_number);
|
switch_channel_set_variable(originator_channel, "original_caller_id_number", originator_cp->caller_id_number);
|
||||||
|
|
||||||
|
switch_channel_step_caller_profile(originatee_channel);
|
||||||
|
switch_channel_step_caller_profile(originator_channel);
|
||||||
|
|
||||||
|
originator_cp = switch_channel_get_caller_profile(originator_channel);
|
||||||
|
originatee_cp = switch_channel_get_caller_profile(originatee_channel);
|
||||||
|
|
||||||
switch_channel_set_originator_caller_profile(originatee_channel, switch_caller_profile_clone(originatee_session, originator_cp));
|
switch_channel_set_originator_caller_profile(originatee_channel, switch_caller_profile_clone(originatee_session, originator_cp));
|
||||||
switch_channel_set_originatee_caller_profile(originator_channel, switch_caller_profile_clone(originator_session, originatee_cp));
|
switch_channel_set_originatee_caller_profile(originator_channel, switch_caller_profile_clone(originator_session, originatee_cp));
|
||||||
|
|
||||||
|
originator_cp->callee_id_name = switch_core_strdup(originator_cp->pool, originatee_cp->caller_id_name);
|
||||||
|
originator_cp->callee_id_number = switch_core_strdup(originator_cp->pool, originatee_cp->caller_id_number);
|
||||||
|
|
||||||
|
originatee_cp->callee_id_name = switch_core_strdup(originatee_cp->pool, originator_cp->caller_id_name);
|
||||||
|
originatee_cp->callee_id_number = switch_core_strdup(originatee_cp->pool, originator_cp->caller_id_number);
|
||||||
|
|
||||||
|
|
||||||
switch_channel_stop_broadcast(originator_channel);
|
switch_channel_stop_broadcast(originator_channel);
|
||||||
switch_channel_stop_broadcast(originatee_channel);
|
switch_channel_stop_broadcast(originatee_channel);
|
||||||
|
|
||||||
|
|
|
@ -3756,6 +3756,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
||||||
*bleg = NULL;
|
*bleg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bleg && !*bleg && status == SWITCH_STATUS_SUCCESS) {
|
||||||
|
status = SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (bleg && *bleg) {
|
if (bleg && *bleg) {
|
||||||
switch_channel_t *bchan = switch_core_session_get_channel(*bleg);
|
switch_channel_t *bchan = switch_core_session_get_channel(*bleg);
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ SWITCH_DECLARE(void) switch_generate_sln_silence(int16_t *data, uint32_t samples
|
||||||
assert(divisor);
|
assert(divisor);
|
||||||
|
|
||||||
if (divisor == (uint32_t)-1) {
|
if (divisor == (uint32_t)-1) {
|
||||||
memset(data, 0, sizeof(*data));
|
memset(data, 0, samples * 2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue