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
|
||||
*/
|
||||
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
|
||||
|
@ -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 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);
|
||||
|
||||
|
@ -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 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
|
||||
|
@ -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(switch_status_t) switch_channel_state_thread_trylock(switch_channel_t *channel);
|
||||
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
#endif
|
||||
/* For Emacs:
|
||||
|
|
|
@ -811,6 +811,7 @@ SWITCH_DECLARE(const char *) switch_core_get_switchname(void);
|
|||
\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(switch_status_t) switch_core_get_variables(switch_event_t **event);
|
||||
|
||||
/*!
|
||||
\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_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)
|
||||
|
||||
SWITCH_DECLARE(switch_console_callback_match_t *) switch_core_session_findall(void);
|
||||
/*!
|
||||
\brief Hangup all sessions that belong to an endpoint
|
||||
\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);
|
||||
|
||||
/*!
|
||||
\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.
|
||||
\param uuid the uuid of the session to hold
|
||||
|
|
|
@ -1510,7 +1510,8 @@ typedef enum {
|
|||
SMBF_STEREO_SWAP = (1 << 11),
|
||||
SMBF_LOCK = (1 << 12),
|
||||
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;
|
||||
typedef uint32_t switch_media_bug_flag_t;
|
||||
|
||||
|
|
|
@ -3184,7 +3184,7 @@ SWITCH_STANDARD_API(sched_broadcast_function)
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#define HOLD_SYNTAX "[off] <uuid> [<display>]"
|
||||
#define HOLD_SYNTAX "[off|toggle] <uuid> [<display>]"
|
||||
SWITCH_STANDARD_API(uuid_hold_function)
|
||||
{
|
||||
char *mycmd = NULL, *argv[4] = { 0 };
|
||||
|
@ -3200,6 +3200,8 @@ SWITCH_STANDARD_API(uuid_hold_function)
|
|||
} else {
|
||||
if (!strcasecmp(argv[0], "off")) {
|
||||
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 {
|
||||
status = switch_ivr_hold_uuid(argv[0], argv[1], 1);
|
||||
}
|
||||
|
|
|
@ -759,7 +759,7 @@ static switch_status_t fifo_execute_sql_queued(char **sqlp, switch_bool_t sql_al
|
|||
if (switch_stristr("insert", sql)) {
|
||||
index = 0;
|
||||
}
|
||||
|
||||
|
||||
if (block) {
|
||||
switch_sql_queue_manager_push_confirm(globals.qm, sql, index, !sql_already_dynamic);
|
||||
} else {
|
||||
|
@ -1409,7 +1409,7 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void
|
|||
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);
|
||||
|
||||
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];
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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, "
|
||||
"next_avail=%ld + lag + 1 where uuid='%q' and ring_count > 0",
|
||||
(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++) {
|
||||
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);
|
||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
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, "
|
||||
"outbound_fail_count=outbound_fail_count+1, next_avail=%ld + lag + 1 where uuid='%q'",
|
||||
(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) {
|
||||
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);
|
||||
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);
|
||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
||||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
|
||||
}
|
||||
|
||||
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'",
|
||||
(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) {
|
||||
|
@ -2906,7 +2906,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
|||
|
||||
if (node && 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 *record_template = switch_channel_get_variable(channel, "fifo_record_template");
|
||||
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_uuid", switch_core_session_get_uuid(session));
|
||||
|
||||
switch_channel_set_flag(other_channel, CF_BREAK);
|
||||
|
||||
while (switch_channel_ready(channel) && switch_channel_ready(other_channel) &&
|
||||
|
@ -2981,15 +2980,29 @@ SWITCH_STANDARD_APP(fifo_function)
|
|||
}
|
||||
|
||||
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_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->next == NULL);
|
||||
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();
|
||||
switch_time_exp_lt(&tm, ts);
|
||||
epoch_start = (long)switch_epoch_time_now(NULL);
|
||||
|
@ -3038,7 +3051,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
|||
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));
|
||||
|
@ -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",
|
||||
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);
|
||||
|
||||
|
@ -3108,8 +3121,9 @@ SWITCH_STANDARD_APP(fifo_function)
|
|||
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
|
||||
|
||||
|
||||
switch_core_media_bug_pause(session);
|
||||
switch_core_media_bug_pause(other_session);
|
||||
if (switch_channel_ready(channel)) {
|
||||
switch_core_media_bug_pause(session);
|
||||
}
|
||||
|
||||
if (record_template) {
|
||||
switch_ivr_stop_record_session(session, expanded);
|
||||
|
@ -4072,7 +4086,7 @@ static switch_status_t load_config(int reload, int del_all)
|
|||
|
||||
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";
|
||||
fifo_execute_sql_queued(&sql, SWITCH_FALSE, SWITCH_FALSE);
|
||||
fifo_execute_sql_queued(&sql, SWITCH_FALSE, SWITCH_TRUE);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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))) {
|
||||
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,
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
23
src/switch.c
23
src/switch.c
|
@ -929,16 +929,6 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
#endif
|
||||
|
||||
if (nc) {
|
||||
#ifdef WIN32
|
||||
FreeConsole();
|
||||
#else
|
||||
if (!nf) {
|
||||
daemonize(do_wait);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
switch (priority) {
|
||||
case 2:
|
||||
set_realtime_priority();
|
||||
|
@ -956,7 +946,6 @@ int main(int argc, char *argv[])
|
|||
|
||||
switch_core_setrlimits();
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
if (runas_user || runas_group) {
|
||||
if (change_user_group(runas_user, runas_group) < 0) {
|
||||
|
@ -966,7 +955,19 @@ int main(int argc, char *argv[])
|
|||
return 255;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (nc) {
|
||||
#ifdef WIN32
|
||||
FreeConsole();
|
||||
#else
|
||||
if (!nf) {
|
||||
daemonize(do_wait);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
if (win32_service) {
|
||||
/* Attempt to start service */
|
||||
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_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)
|
||||
{
|
||||
char *uuid = NULL;
|
||||
|
@ -2561,7 +2571,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(swit
|
|||
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->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->caller_profile != NULL);
|
||||
|
@ -3337,7 +3347,7 @@ static void do_execute_on(switch_channel_t *channel, const char *variable)
|
|||
char *app;
|
||||
|
||||
app = switch_core_session_strdup(channel->session, variable);
|
||||
|
||||
|
||||
for(p = app; p && *p; p++) {
|
||||
if (*p == ' ' || (*p == ':' && (*(p+1) != ':'))) {
|
||||
*p++ = '\0';
|
||||
|
@ -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_event_header_t *hp;
|
||||
switch_event_t *event;
|
||||
switch_event_t *event, *cevent;
|
||||
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) {
|
||||
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(&cevent);
|
||||
|
||||
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)
|
||||
{
|
||||
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_size_t bytes;
|
||||
switch_event_t *event;
|
||||
int tap_only = 1;
|
||||
int tap_only = 1, punt = 0;
|
||||
|
||||
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_pre_answer(session->channel) != SWITCH_STATUS_SUCCESS) {
|
||||
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_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,
|
||||
"L16",
|
||||
NULL,
|
||||
imp.samples_per_second,
|
||||
imp.actual_samples_per_second,
|
||||
imp.microseconds_per_packet / 1000,
|
||||
imp.number_of_channels,
|
||||
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;
|
||||
}
|
||||
|
||||
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_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 {
|
||||
st = switch_core_file_read(&dh->fh, rframe->data, &len);
|
||||
rframe->samples = (uint32_t) len;
|
||||
rframe->datalen = rframe->samples * 2;
|
||||
if (len < rframe->samples) {
|
||||
memset((char *)rframe->data + len * 2, 0, rframe->datalen - len * 2);
|
||||
}
|
||||
}
|
||||
|
||||
if (st != SWITCH_STATUS_SUCCESS || len == 0) {
|
||||
|
@ -1089,6 +1090,8 @@ struct record_helper {
|
|||
switch_file_handle_t in_fh;
|
||||
switch_file_handle_t out_fh;
|
||||
int native;
|
||||
int rready;
|
||||
int wready;
|
||||
uint32_t packet_len;
|
||||
int min_sec;
|
||||
switch_bool_t hangup_on_error;
|
||||
|
@ -1114,16 +1117,24 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
|
|||
break;
|
||||
case SWITCH_ABC_TYPE_TAP_NATIVE_READ:
|
||||
{
|
||||
nframe = switch_core_media_bug_get_native_read_frame(bug);
|
||||
len = nframe->datalen;
|
||||
switch_core_file_write(&rh->in_fh, nframe->data, &len);
|
||||
rh->rready = 1;
|
||||
|
||||
if (rh->rready && rh->wready) {
|
||||
nframe = switch_core_media_bug_get_native_read_frame(bug);
|
||||
len = nframe->datalen;
|
||||
switch_core_file_write(&rh->in_fh, nframe->data, &len);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SWITCH_ABC_TYPE_TAP_NATIVE_WRITE:
|
||||
{
|
||||
nframe = switch_core_media_bug_get_native_write_frame(bug);
|
||||
len = nframe->datalen;
|
||||
switch_core_file_write(&rh->out_fh, nframe->data, &len);
|
||||
rh->wready = 1;
|
||||
|
||||
if (rh->rready && rh->wready) {
|
||||
nframe = switch_core_media_bug_get_native_write_frame(bug);
|
||||
len = nframe->datalen;
|
||||
switch_core_file_write(&rh->out_fh, nframe->data, &len);
|
||||
}
|
||||
}
|
||||
break;
|
||||
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,
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
|
|||
switch_core_session_t *session_a, *session_b;
|
||||
uint32_t read_frame_count = 0;
|
||||
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_frame_t silence_frame = { 0 };
|
||||
int16_t silence_data[SWITCH_RECOMMENDED_BUFFER_SIZE / 2] = { 0 };
|
||||
|
@ -201,8 +201,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
|
|||
chan_a = switch_core_session_get_channel(session_a);
|
||||
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"))) {
|
||||
exec_data = switch_channel_get_variable(chan_a, "bridge_pre_execute_data");
|
||||
}
|
||||
|
@ -358,12 +357,15 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (read_frame_count > DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a)) {
|
||||
|
||||
switch_channel_execute_on(chan_a, SWITCH_CHANNEL_EXECUTE_ON_PRE_BRIDGE_VARIABLE);
|
||||
if (read_frame_count >= DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a)) {
|
||||
|
||||
if (!inner_bridge) {
|
||||
switch_channel_api_on(chan_a, SWITCH_API_BRIDGE_START_VARIABLE);
|
||||
if (!exec_check) {
|
||||
switch_channel_execute_on(chan_a, SWITCH_CHANNEL_EXECUTE_ON_PRE_BRIDGE_VARIABLE);
|
||||
|
||||
if (!inner_bridge) {
|
||||
switch_channel_api_on(chan_a, SWITCH_API_BRIDGE_START_VARIABLE);
|
||||
}
|
||||
exec_check = 1;
|
||||
}
|
||||
|
||||
if (exec_app) {
|
||||
|
@ -373,8 +375,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
|
|||
switch_core_session_execute_application_async(session_a, exec_app, exec_data);
|
||||
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)
|
||||
&& switch_channel_test_flag(chan_b, CF_ANSWERED)) {
|
||||
switch_ivr_nomedia(switch_core_session_get_uuid(session_a), SMF_REBRIDGE);
|
||||
|
@ -972,6 +973,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_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_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -982,6 +986,9 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session
|
|||
switch_channel_event_set_data(channel, event);
|
||||
if ((other_session = switch_core_session_locate(msg.string_arg))) {
|
||||
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_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_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(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_bridge_time(caller_channel);
|
||||
switch_channel_set_bridge_time(peer_channel);
|
||||
|
||||
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-B-Unique-ID", switch_core_session_get_uuid(peer_session));
|
||||
|
@ -1641,9 +1648,21 @@ 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_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_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(originatee_channel);
|
||||
|
|
|
@ -3756,6 +3756,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
*bleg = NULL;
|
||||
}
|
||||
|
||||
if (bleg && !*bleg && status == SWITCH_STATUS_SUCCESS) {
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (bleg && *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);
|
||||
|
||||
if (divisor == (uint32_t)-1) {
|
||||
memset(data, 0, sizeof(*data));
|
||||
memset(data, 0, samples * 2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue