FS-9924: Removed extra space in source files

This commit is contained in:
Sergey Safarov
2017-01-06 02:10:15 -05:00
parent 60d4e87487
commit df1ab07ca4
455 changed files with 9699 additions and 9698 deletions

View File

@@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
*
@@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Ken Rice <krice@freeswitch.org>
* Michael Murdock <mike at mmurdock dot org>
@@ -129,7 +129,7 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t
switch_channel_set_variable(channel, "last_non_matching_digits", match->match_digits);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_DEBUG, "%s Digit NOT match binding [%s]\n",
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_DEBUG, "%s Digit NOT match binding [%s]\n",
switch_channel_get_name(channel), match->match_digits);
if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
@@ -137,14 +137,14 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t
if ((status = switch_core_session_queue_event(use_session, &event)) != SWITCH_STATUS_SUCCESS) {
switch_event_destroy(&event);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_WARNING, "%s event queue failure.\n",
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_WARNING, "%s event queue failure.\n",
switch_core_session_get_name(use_session));
}
}
/* send it back around and skip the dmachine */
switch_channel_queue_dtmf_string(channel, match->match_digits);
if (use_session != session) {
switch_core_session_rwunlock(use_session);
}
@@ -166,7 +166,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
int x = 0;
char *flags = "";
if (act->target == DIGIT_TARGET_PEER || act->target == DIGIT_TARGET_BOTH) {
if (act->target == DIGIT_TARGET_PEER || act->target == DIGIT_TARGET_BOTH) {
if (switch_core_session_get_partner(act->session, &use_session) != SWITCH_STATUS_SUCCESS) {
use_session = act->session;
}
@@ -183,14 +183,14 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
switch_channel_set_variable(channel, "last_matching_digits", match->match_digits);
if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s]\n",
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s]\n",
switch_channel_get_name(channel), act->string, act->value);
if (!strncasecmp(string, "exec", 4)) {
char *e;
string += 4;
if (*string == ':') {
string++;
@@ -220,7 +220,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
if ((status = switch_core_session_queue_event(use_session, &event)) != SWITCH_STATUS_SUCCESS) {
switch_event_destroy(&event);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_WARNING, "%s event queue failure.\n",
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_WARNING, "%s event queue failure.\n",
switch_core_session_get_name(use_session));
}
}
@@ -244,7 +244,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
switch_api_execute(string, act->value, NULL, &stream);
if (stream.data) {
switch_channel_set_variable(channel, "bind_digit_action_api_result", (char *)stream.data);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s] api executed, %s\n",
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s] api executed, %s\n",
switch_core_session_get_name(use_session), act->string, act->value, (char *)stream.data);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s] api executed\n",
@@ -252,7 +252,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
}
switch_safe_free(stream.data);
}
if (use_session != act->session) {
switch_core_session_rwunlock(use_session);
@@ -275,7 +275,7 @@ static switch_digit_action_target_t str2target(const char *target_str)
if (!strcasecmp(target_str, "both")) {
return DIGIT_TARGET_BOTH;
}
return DIGIT_TARGET_SELF;
}
@@ -341,7 +341,7 @@ SWITCH_STANDARD_APP(digit_action_set_realm_function)
return;
}
if ((dmachine = switch_core_session_get_dmachine(session, target))) {
switch_ivr_dmachine_set_realm(dmachine, realm);
}
@@ -349,7 +349,7 @@ SWITCH_STANDARD_APP(digit_action_set_realm_function)
}
static void bind_to_session(switch_core_session_t *session,
static void bind_to_session(switch_core_session_t *session,
const char *arg0, const char *arg1, const char *arg2, const char *arg3,
switch_digit_action_target_t target, switch_digit_action_target_t bind_target)
{
@@ -367,16 +367,16 @@ static void bind_to_session(switch_core_session_t *session,
if ((var = switch_channel_get_variable(channel, "bind_digit_digit_timeout"))) {
digit_timeout = switch_atoul(var);
}
if ((var = switch_channel_get_variable(channel, "bind_digit_input_timeout"))) {
input_timeout = switch_atoul(var);
}
switch_ivr_dmachine_create(&dmachine, "DPTOOLS", NULL, digit_timeout, input_timeout, NULL, digit_nomatch_action_callback, session);
switch_core_session_set_dmachine(session, dmachine, target);
}
act = switch_core_session_alloc(session, sizeof(*act));
act->realm = switch_core_session_strdup(session, arg0);
act->input = switch_core_session_strdup(session, arg1);
@@ -404,7 +404,7 @@ static void bind_to_session(switch_core_session_t *session,
}
switch_ivr_dmachine_bind(dmachine, act->realm, act->input, is_priority, 0, digit_action_callback, act);
if ((terminators = switch_channel_get_variable(channel, "bda_terminators"))) {
switch_ivr_dmachine_set_terminators(dmachine, terminators);
}
@@ -617,7 +617,7 @@ SWITCH_STANDARD_APP(keepalive_function)
msg.message_id = SWITCH_MESSAGE_INDICATE_KEEPALIVE;
msg.numeric_arg = seconds;
switch_core_session_receive_message(session, &msg);
switch_core_session_enable_heartbeat(session, seconds);
return;
}
@@ -660,7 +660,7 @@ SWITCH_STANDARD_APP(rename_function)
switch_file_rename(argv[0], argv[1], switch_core_session_get_pool(session));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RENAME: %s %s\n",
switch_channel_get_name(switch_core_session_get_channel(session)), argv[0], argv[1]);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", RENAME_SYNTAX);
}
@@ -672,7 +672,7 @@ SWITCH_STANDARD_APP(transfer_vars_function)
char *argv[1] = { 0 };
int argc;
char *lbuf = NULL;
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
switch_core_session_t *nsession = NULL;
@@ -922,7 +922,7 @@ SWITCH_STANDARD_APP(eavesdrop_function)
switch_safe_free(e_data.uuid_list[x]);
}
e_data.total = 0;
if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Database Error!\n");
break;
@@ -1056,7 +1056,7 @@ SWITCH_STANDARD_APP(ring_ready_function)
return;
}
}
switch_channel_ring_ready(switch_core_session_get_channel(session));
}
@@ -1182,7 +1182,7 @@ SWITCH_STANDARD_APP(sched_transfer_function)
id = switch_ivr_schedule_transfer(when, switch_core_session_get_uuid(session), argv[1], argv[2], argv[3]);
snprintf(ids, sizeof(ids), "%u", id);
switch_channel_set_variable(switch_core_session_get_channel(session), "last_sched_id", ids);
switch_channel_set_variable(switch_core_session_get_channel(session), "last_sched_id", ids);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Args\n");
}
@@ -1377,7 +1377,7 @@ SWITCH_STANDARD_APP(pre_answer_function)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *arg = (char *) data;
if (!zstr(arg)) {
if (switch_stristr("is_conference", arg)) {
switch_channel_set_flag(channel, CF_CONFERENCE);
@@ -1559,9 +1559,9 @@ static void base_set (switch_core_session_t *session, const char *data, switch_s
expanded = switch_channel_expand_variables(channel, val);
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s [%s]=[%s]\n",
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s [%s]=[%s]\n",
what, switch_channel_get_name(channel), var, expanded ? expanded : "UNDEF");
switch_channel_add_variable_var_check(channel, var, expanded, SWITCH_FALSE, stack);
if (expanded && expanded != val) {
@@ -1586,11 +1586,11 @@ SWITCH_STANDARD_APP(multiset_function)
arg = switch_core_session_strdup(session, arg);
argc = switch_split(arg, delim, array);
for(i = 0; i < argc; i++) {
base_set(session, array[i], SWITCH_STACK_BOTTOM);
}
} else {
base_set(session, data, SWITCH_STACK_BOTTOM);
@@ -1933,7 +1933,7 @@ SWITCH_STANDARD_API(strftime_api_function)
if (!zstr(q) && (p = strchr(q, '|'))) {
*p++ = '\0';
thetime = switch_time_make(atol(q), 0);
q = p + 1;
} else {
@@ -2226,7 +2226,7 @@ SWITCH_STANDARD_APP(park_state_function)
/********************************************************************************/
/*
dtmf handler function you can hook up to be executed when a digit is dialed during playback
dtmf handler function you can hook up to be executed when a digit is dialed during playback
if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
*/
static switch_status_t bridge_on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
@@ -2451,7 +2451,7 @@ static switch_status_t tmp_hanguphook(switch_core_session_t *session)
if (!zstr(bond)) {
switch_core_session_t *b_session;
if ((b_session = switch_core_session_locate(bond))) {
switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
if (switch_channel_up(b_channel)) {
@@ -2710,7 +2710,7 @@ SWITCH_STANDARD_APP(read_function)
valid_terminators = "#";
}
switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, sizeof(digit_buffer), timeout, valid_terminators,
switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, sizeof(digit_buffer), timeout, valid_terminators,
digit_timeout);
}
@@ -2799,7 +2799,7 @@ SWITCH_STANDARD_APP(play_and_get_digits_function)
}
switch_play_and_get_digits(session, min_digits, max_digits, max_tries, timeout, valid_terminators,
prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer),
prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer),
digits_regex, digit_timeout, transfer_on_failure);
}
@@ -3066,7 +3066,7 @@ SWITCH_STANDARD_APP(capture_function)
int ovector[30] = {0};
char *lbuf;
int proceed;
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) == 3) {
if ((proceed = switch_regex_perform(argv[1], argv[2], &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
@@ -3075,7 +3075,7 @@ SWITCH_STANDARD_APP(capture_function)
switch_regex_safe_free(re);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No data specified.\n");
}
}
}
SWITCH_STANDARD_APP(record_function)
@@ -3164,7 +3164,7 @@ SWITCH_STANDARD_APP(record_session_function)
path = switch_core_session_strdup(session, data);
/* Search for a space then a plus followed by only numbers at the end of the path,
/* Search for a space then a plus followed by only numbers at the end of the path,
if found trim any spaces to the left/right of the plus use the left side as the
path and right side as a time limit on the recording
*/
@@ -3385,7 +3385,7 @@ SWITCH_STANDARD_APP(audio_bridge_function)
moh = switch_channel_get_hold_music(caller_channel);
}
if (!zstr(moh) && !strcasecmp(moh, "silence")) {
if (!zstr(moh) && !strcasecmp(moh, "silence")) {
moh = NULL;
}
@@ -3427,7 +3427,7 @@ SWITCH_STANDARD_APP(audio_bridge_function)
if (fail) {
int64_t wait = (int64_t)campon_sleep * 1000000;
while (stake.running && wait > 0 && switch_channel_ready(caller_channel)) {
switch_yield(100000);
wait -= 100000;
@@ -3436,8 +3436,8 @@ SWITCH_STANDARD_APP(audio_bridge_function)
}
}
status = switch_ivr_originate(NULL, &peer_session,
&cause, camp_data, campon_timeout, NULL, NULL, NULL, NULL, NULL, SOF_NONE,
status = switch_ivr_originate(NULL, &peer_session,
&cause, camp_data, campon_timeout, NULL, NULL, NULL, NULL, NULL, SOF_NONE,
switch_channel_get_cause_ptr(caller_channel));
@@ -3564,19 +3564,19 @@ static void pickup_send_presence(const char *key_name)
switch_event_t *event;
int count;
dup_key_name = strdup(key_name);
key_name = dup_key_name;
if ((domain_name = strchr(dup_key_name, '@'))) {
*domain_name++ = '\0';
}
if (zstr(domain_name)) {
dup_domain_name = switch_core_get_domain(SWITCH_TRUE);
domain_name = dup_domain_name;
}
if (zstr(domain_name)) {
domain_name = "cluecon.com";
}
@@ -3591,7 +3591,7 @@ static void pickup_send_presence(const char *key_name)
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", dup_id);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", dup_id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "force-status", "Active (%d call%s)", count, count == 1 ? "" : "s");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "active");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
@@ -3609,7 +3609,7 @@ static void pickup_send_presence(const char *key_name)
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", dup_id);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", dup_id);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "force-status", "Idle");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
@@ -3620,13 +3620,13 @@ static void pickup_send_presence(const char *key_name)
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "terminated");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", "inbound");
switch_event_fire(&event);
}
}
}
switch_safe_free(dup_domain_name);
switch_safe_free(dup_key_name);
switch_safe_free(dup_id);
}
static void pickup_pres_event_handler(switch_event_t *event)
@@ -3667,7 +3667,7 @@ static void pickup_pres_event_handler(switch_event_t *event)
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", PICKUP_PROTO);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", key_name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", key_name, domain_name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "force-status", "Active (%d call%s)", count, count == 1 ? "" : "s");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "active");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
@@ -3681,7 +3681,7 @@ static void pickup_pres_event_handler(switch_event_t *event)
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", PICKUP_PROTO);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", key_name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", key_name, domain_name);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "force-status", "Idle");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
@@ -3751,7 +3751,7 @@ static char *pickup_pop_uuid(const char *key, const char *uuid)
if ((head = switch_core_hash_find(globals.pickup_hash, key))) {
switch_core_hash_delete(globals.pickup_hash, key);
if (uuid) {
pickup_node_t *np, *lp = NULL;
@@ -3762,14 +3762,14 @@ static char *pickup_pop_uuid(const char *key, const char *uuid)
} else {
head = np->next;
}
node = np;
break;
}
lp = np;
}
} else {
node = head;
head = head->next;
@@ -3786,13 +3786,13 @@ static char *pickup_pop_uuid(const char *key, const char *uuid)
free(node->key);
free(node);
}
switch_mutex_unlock(globals.pickup_mutex);
if (r) pickup_send_presence(key);
switch_safe_free(dup_key);
return r;
}
@@ -3829,7 +3829,7 @@ static switch_status_t pickup_event_handler(switch_core_session_t *session)
return SWITCH_STATUS_FALSE;
case CS_HANGUP:
{
if (switch_channel_test_flag(channel, CF_CHANNEL_SWAP)) {
const char *key = switch_channel_get_variable(channel, "channel_swap_uuid");
switch_core_session_t *swap_session;
@@ -3903,7 +3903,7 @@ static switch_call_cause_t pickup_outgoing_channel(switch_core_session_t *sessio
switch_core_session_set_private(nsession, tech_pvt);
nchannel = switch_core_session_get_channel(nsession);
switch_channel_set_cap(nchannel, CC_PROXY_MEDIA);
switch_channel_set_cap(nchannel, CC_BYPASS_MEDIA);
@@ -3912,7 +3912,7 @@ static switch_call_cause_t pickup_outgoing_channel(switch_core_session_t *sessio
switch_channel_set_caller_profile(nchannel, caller_profile);
switch_channel_set_state(nchannel, CS_ROUTING);
*new_session = nsession;
@@ -3963,7 +3963,7 @@ SWITCH_STANDARD_APP(pickup_function)
if ((uuid = pickup_pop_uuid((char *)data, NULL))) {
if ((pickup_session = switch_core_session_locate(uuid))) {
switch_channel_t *pickup_channel = switch_core_session_get_channel(pickup_session);
switch_caller_profile_t *pickup_caller_profile = switch_channel_get_caller_profile(pickup_channel),
switch_caller_profile_t *pickup_caller_profile = switch_channel_get_caller_profile(pickup_channel),
*caller_profile = switch_channel_get_caller_profile(channel);
const char *name, *num;
switch_event_t *event;
@@ -3974,10 +3974,10 @@ SWITCH_STANDARD_APP(pickup_function)
switch_channel_set_variable(channel, hp->name, hp->value);
}
switch_channel_set_flag(pickup_channel, CF_CHANNEL_SWAP);
switch_channel_set_variable(pickup_channel, "channel_swap_uuid", switch_core_session_get_uuid(session));
name = caller_profile->caller_id_name;
num = caller_profile->caller_id_number;
@@ -3986,11 +3986,11 @@ SWITCH_STANDARD_APP(pickup_function)
caller_profile->callee_id_name = name;
caller_profile->callee_id_number = num;
if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) {
const char *partner_uuid = switch_channel_get_partner_uuid(channel);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "RECV");
if (partner_uuid) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", partner_uuid);
}
@@ -4221,7 +4221,7 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
}
var_event = NULL;
}
if (switch_xml_locate_user_merged("id", user, domain, NULL, &x_user, params) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n", user, domain);
cause = SWITCH_CAUSE_SUBSCRIBER_ABSENT;
@@ -4345,7 +4345,7 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
switch_safe_free(d_dest);
}
}
if (new_channel && x_user) {
if ((x_params = switch_xml_child(x_user, "variables"))) {
for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
@@ -4493,7 +4493,7 @@ SWITCH_STANDARD_APP(detect_silence_function)
}
static switch_status_t event_chat_send(switch_event_t *message_event)
{
switch_event_t *event;
const char *to;
@@ -4512,7 +4512,7 @@ static switch_status_t event_chat_send(switch_event_t *message_event)
if (switch_event_fire(&event) == SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_SUCCESS;
}
switch_event_destroy(&event);
return SWITCH_STATUS_MEMERR;
@@ -4521,7 +4521,7 @@ static switch_status_t event_chat_send(switch_event_t *message_event)
static switch_status_t api_chat_send(switch_event_t *message_event)
{
const char *proto;
const char *from;
const char *from;
const char *to;
//const char *subject;
//const char *body;
@@ -4534,7 +4534,7 @@ static switch_status_t api_chat_send(switch_event_t *message_event)
//subject = switch_event_get_header(message_event, "subject");
//body = switch_event_get_body(message_event);
type = switch_event_get_header(message_event, "type");
hint = switch_event_get_header(message_event, "hint");
hint = switch_event_get_header(message_event, "hint");
if (to) {
@@ -4610,7 +4610,7 @@ SWITCH_STANDARD_APP(limit_function)
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
backend = argv[0];
/* must have at least one item */
@@ -4618,10 +4618,10 @@ SWITCH_STANDARD_APP(limit_function)
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "USAGE: limit %s\n", LIMIT_USAGE);
return;
}
/* if this is an invalid backend, fallback to db backend */
/* TODO: remove this when we can! */
if (switch_true(switch_channel_get_variable(channel, "switch_limit_backwards_compat_flag")) &&
if (switch_true(switch_channel_get_variable(channel, "switch_limit_backwards_compat_flag")) &&
!switch_loadable_module_get_limit_interface(backend)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown backend '%s'. To maintain backwards compatability, falling back on db backend and shifting argumens. Either update your diaplan to include the backend, fix the typo, or load the appropriate limit implementation module.\n", backend);
mydata = switch_core_session_sprintf(session, "db %s", data);
@@ -4709,9 +4709,9 @@ SWITCH_STANDARD_APP(limit_execute_function)
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
/* backwards compat version, if we have 5, just prepend with db and reparse */
if (switch_true(switch_channel_get_variable(channel, "switch_limit_backwards_compat_flag")) &&
if (switch_true(switch_channel_get_variable(channel, "switch_limit_backwards_compat_flag")) &&
argc == 5) {
mydata = switch_core_session_sprintf(session, "db %s", data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -4758,7 +4758,7 @@ SWITCH_STANDARD_APP(limit_execute_function)
/* Only release the resource if we are still in CS_EXECUTE */
if (switch_channel_get_state(switch_core_session_get_channel(session)) == CS_EXECUTE) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "immediately releasing\n");
switch_limit_release(backend, session, realm, id);
switch_limit_release(backend, session, realm, id);
}
}
}
@@ -4902,12 +4902,12 @@ static switch_status_t next_file(switch_file_handle_t *handle)
}
if (context->file && switch_test_flag(handle, SWITCH_FILE_DATA_SHORT)) { /* TODO handle other data type flags */
switch_size_t len;
switch_size_t len;
uint16_t buf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 };
switch_status_t stat;
switch_file_handle_t fh = { 0 };
if ((stat = switch_core_file_open(&fh, context->file, handle->channels, handle->samplerate,
if ((stat = switch_core_file_open(&fh, context->file, handle->channels, handle->samplerate,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL)) == SWITCH_STATUS_SUCCESS) {
do {
len = SWITCH_RECOMMENDED_BUFFER_SIZE / handle->channels;
@@ -4916,7 +4916,7 @@ static switch_status_t next_file(switch_file_handle_t *handle)
}
} while (stat == SWITCH_STATUS_SUCCESS);
switch_core_file_close(&fh);
switch_core_file_close(&fh);
switch_file_remove(context->file, handle->memory_pool);
} else {
@@ -4962,7 +4962,7 @@ static switch_status_t file_string_file_seek(switch_file_handle_t *handle, unsig
context->index = -1;
return next_file(handle);
}
if (!handle->seekable) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n");
return SWITCH_STATUS_NOTIMPL;
@@ -5004,7 +5004,7 @@ static switch_status_t file_string_file_set_string(switch_file_handle_t *handle,
file_string_context_t *context = handle->private_info;
file_string_audio_col_t *col_ptr = context->audio_cols;
while (col_ptr && col != col_ptr->col) {
while (col_ptr && col != col_ptr->col) {
col_ptr = col_ptr->next;
}
@@ -5017,7 +5017,7 @@ static switch_status_t file_string_file_set_string(switch_file_handle_t *handle,
col_ptr->next = context->audio_cols;
context->audio_cols = col_ptr;
}
return switch_core_file_set_string(&context->fh, col, string);
}
@@ -5232,7 +5232,7 @@ static switch_status_t read_frame_callback(switch_core_session_t *session, switc
}
return switch_channel_test_app_flag_key(rf->key, channel, MUTEX_FLAG_WAIT) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
}
static void free_node(mutex_node_t **npp)
@@ -5256,7 +5256,7 @@ static void cancel(switch_core_session_t *session, master_mutex_t *master)
for (np = master->list; np; np = np->next) {
if (np && !strcmp(np->uuid, uuid)) {
switch_core_event_hook_remove_state_change(session, mutex_hanguphook);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s canceled\n",
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s canceled\n",
switch_core_session_get_uuid(session),
switch_core_session_get_name(session), master->key);
@@ -5269,7 +5269,7 @@ static void cancel(switch_core_session_t *session, master_mutex_t *master)
}
free_node(&np);
break;
}
@@ -5288,7 +5288,7 @@ static void advance(master_mutex_t *master, switch_bool_t pop_current)
if (!master || !master->list) {
goto end;
}
while (master->list) {
mutex_node_t *np;
@@ -5302,14 +5302,14 @@ static void advance(master_mutex_t *master, switch_bool_t pop_current)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ADVANCE POP %p\n", (void *)np);
free_node(&np);
}
if (master->list) {
switch_core_session_t *session;
if ((session = switch_core_session_locate(master->list->uuid))) {
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
"%s mutex %s advanced\n", switch_channel_get_name(channel), master->key);
switch_channel_set_app_flag_key(master->key, channel, MUTEX_FLAG_SET);
switch_channel_clear_app_flag_key(master->key, channel, MUTEX_FLAG_WAIT);
@@ -5327,7 +5327,7 @@ static void advance(master_mutex_t *master, switch_bool_t pop_current)
switch_mutex_unlock(globals.mutex_mutex);
}
static void confirm(switch_core_session_t *session, master_mutex_t *master)
@@ -5346,7 +5346,7 @@ static void confirm(switch_core_session_t *session, master_mutex_t *master)
if (!strcmp(master->list->uuid, switch_core_session_get_uuid(session))) {
switch_channel_clear_app_flag_key(master->key, channel, MUTEX_FLAG_SET);
switch_core_event_hook_remove_state_change(session, mutex_hanguphook);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s cleared\n",
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s cleared\n",
switch_core_session_get_uuid(session),
switch_channel_get_name(channel), master->key);
advance(master, SWITCH_TRUE);
@@ -5396,7 +5396,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s
switch_mutex_unlock(globals.mutex_mutex);
return SWITCH_FALSE;
}
if (!(master = switch_core_hash_find(globals.mutex_hash, key))) {
master = switch_core_alloc(globals.pool, sizeof(*master));
master->key = switch_core_strdup(globals.pool, key);
@@ -5406,7 +5406,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "EXIST MASTER %s %p\n", key, (void *) master);
}
if (on) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "HIT ON\n");
@@ -5430,7 +5430,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s
switch_channel_clear_app_flag_key(key, channel, MUTEX_FLAG_WAIT);
switch_channel_set_private(channel, "_mutex_master", master);
switch_core_event_hook_add_state_change(session, mutex_hanguphook);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s acquired\n",
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s acquired\n",
switch_core_session_get_uuid(session),
switch_channel_get_name(channel), key);
switch_mutex_unlock(globals.mutex_mutex);
@@ -5444,7 +5444,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s
}
switch_mutex_unlock(globals.mutex_mutex);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s mutex %s is busy, waiting...\n", switch_channel_get_name(channel), key);
if ((feedback = switch_channel_get_variable(channel, "mutex_feedback"))) {
@@ -5456,19 +5456,19 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s
if ((rf.exten = switch_channel_get_variable(channel, "mutex_orbit_exten"))) {
to_val = 60;
}
if ((var = switch_channel_get_variable(channel, "mutex_timeout"))) {
long tmp = atol(var);
if (tmp > 0) {
to_val = tmp;
}
}
if (to_val) {
switch_codec_implementation_t read_impl;
switch_core_session_get_read_impl(session, &read_impl);
rf.to = (1000 / (read_impl.microseconds_per_packet / 1000)) * to_val;
rf.dp = switch_channel_get_variable(channel, "mutex_orbit_dialplan");
rf.context = switch_channel_get_variable(channel, "mutex_orbit_context");
@@ -5500,7 +5500,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s
if (switch_channel_test_app_flag_key(key, channel, MUTEX_FLAG_WAIT) || !switch_channel_up(channel)) {
cancel(session, master);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s acquired\n",
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s acquired\n",
switch_core_session_get_uuid(session),
switch_channel_get_name(channel), key);
switch_core_event_hook_add_state_change(session, mutex_hanguphook);
@@ -5534,7 +5534,7 @@ SWITCH_STANDARD_APP(mutex_function)
}
do_mutex(session, key, on);
}
@@ -5587,7 +5587,7 @@ void *SWITCH_THREAD_FUNC page_thread(switch_thread_t *thread, void *obj)
if (switch_ivr_originate(NULL, &session, &cause, pd->dial_str, 60, NULL, NULL, NULL, NULL, pd->var_event, SOF_NONE, NULL) == SWITCH_STATUS_SUCCESS) {
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_set_variable(channel, "page_file", pd->path);
mypd = switch_core_session_alloc(session, sizeof(*mypd));
@@ -5613,14 +5613,14 @@ void *SWITCH_THREAD_FUNC page_thread(switch_thread_t *thread, void *obj)
return NULL;
}
static void launch_call(const char *dial_str,
const char *path, const char *exten, const char *context, const char *dp,
static void launch_call(const char *dial_str,
const char *path, const char *exten, const char *context, const char *dp,
switch_mutex_t *mutex, uint32_t *counter, switch_event_t **var_event)
{
switch_thread_data_t *td;
switch_memory_pool_t *pool;
page_data_t *pd;
switch_core_new_memory_pool(&pool);
pd = switch_core_alloc(pool, sizeof(*pd));
@@ -5648,7 +5648,7 @@ static void launch_call(const char *dial_str,
td->obj = pd;
switch_thread_pool_launch_thread(&td);
}
typedef struct call_monitor_s {
@@ -5689,7 +5689,7 @@ void *SWITCH_THREAD_FUNC call_monitor_thread(switch_thread_t *thread, void *obj)
while (data && *data && *data == ' ') {
data++;
}
while (*data == '<') {
char *parsed = NULL;
@@ -5716,15 +5716,15 @@ void *SWITCH_THREAD_FUNC call_monitor_thread(switch_thread_t *thread, void *obj)
}
while (sent < size) {
do {
switch_mutex_lock(mutex);
do {
switch_mutex_lock(mutex);
busy = (counter >= cm->chunk_size);
switch_mutex_unlock(mutex);
if (busy) {
if (busy) {
switch_yield(100000);
}
}
} while (busy);
launch_call(argv[sent++], cm->path, cm->exten, cm->context, cm->dp, mutex, &counter, &var_event);
@@ -5755,7 +5755,7 @@ static void launch_call_monitor(const char *path, int del, const char *data, uin
switch_thread_data_t *td;
switch_memory_pool_t *pool;
call_monitor_t *cm;
switch_core_new_memory_pool(&pool);
cm = switch_core_alloc(pool, sizeof(*cm));
@@ -5777,7 +5777,7 @@ static void launch_call_monitor(const char *path, int del, const char *data, uin
td->obj = cm;
switch_thread_pool_launch_thread(&td);
}
@@ -5814,10 +5814,10 @@ SWITCH_STANDARD_APP(page_function)
if ((l = switch_channel_get_variable(channel, "page_dp"))) {
dp = l;
}
l = switch_channel_get_variable(channel, "page_record_limit");
if (l) {
if (*l == '+') {
l++;
@@ -5866,7 +5866,7 @@ SWITCH_STANDARD_APP(page_function)
}
switch_ivr_play_file(session, NULL, beep, NULL);
switch_ivr_record_file(session, &fh, path, &args, limit);
}
@@ -5874,7 +5874,7 @@ SWITCH_STANDARD_APP(page_function)
if (zstr(exten)) {
exten = switch_core_session_sprintf(session, "playback:%s", path);
}
if (switch_file_exists(path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
launch_call_monitor(path, del, pdata, chunk_size, exten, context, dp);
} else {
@@ -5909,7 +5909,7 @@ SWITCH_STANDARD_API(page_api_function)
while (data && *data && *data == ' ') {
data++;
}
while (*data == '(') {
char *parsed = NULL;
@@ -5928,7 +5928,7 @@ SWITCH_STANDARD_API(page_api_function)
if (!var_event) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
goto end;
}
}
pdata = data;
@@ -5948,7 +5948,7 @@ SWITCH_STANDARD_API(page_api_function)
if ((l = switch_event_get_header(var_event, "page_dp"))) {
dp = l;
}
if ((l = switch_event_get_header(var_event, "page_chunk_size"))) {
uint32_t tmp = switch_atoui(l);
@@ -5967,7 +5967,7 @@ SWITCH_STANDARD_API(page_api_function)
oexten = switch_mprintf("playback:%s", path);
exten = oexten;
}
if (switch_file_exists(path, NULL) == SWITCH_STATUS_SUCCESS) {
launch_call_monitor(path, 0, pdata, chunk_size, exten, context, dp);
} else {
@@ -5976,7 +5976,7 @@ SWITCH_STANDARD_API(page_api_function)
end:
switch_safe_free(odata);
switch_safe_free(oexten);
@@ -6217,16 +6217,16 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
SWITCH_ADD_APP(app_interface, "blind_transfer_ack", "", "", blind_transfer_ack_function, "[true|false]", SAF_NONE);
SWITCH_ADD_APP(app_interface, "bind_digit_action", "bind a key sequence or regex to an action",
SWITCH_ADD_APP(app_interface, "bind_digit_action", "bind a key sequence or regex to an action",
"bind a key sequence or regex to an action", bind_digit_action_function, BIND_DIGIT_ACTION_USAGE, SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "capture", "capture data into a var", "capture data into a var",
SWITCH_ADD_APP(app_interface, "capture", "capture data into a var", "capture data into a var",
capture_function, "<varname>|<data>|<regex>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "clear_digit_action", "clear all digit bindings", "",
SWITCH_ADD_APP(app_interface, "clear_digit_action", "clear all digit bindings", "",
clear_digit_action_function, CLEAR_DIGIT_ACTION_USAGE, SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "digit_action_set_realm", "change binding realm", "",
SWITCH_ADD_APP(app_interface, "digit_action_set_realm", "change binding realm", "",
digit_action_set_realm_function, DIGIT_ACTION_SET_REALM_USAGE, SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number",
@@ -6258,7 +6258,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
SWITCH_ADD_APP(app_interface, "eval", "Do Nothing", "Do Nothing", eval_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
SWITCH_ADD_APP(app_interface, "set_media_stats", "Set Media Stats", "Set Media Stats", set_media_stats_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
SWITCH_ADD_APP(app_interface, "stop", "Do Nothing", "Do Nothing", eval_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
SWITCH_ADD_APP(app_interface, "set_zombie_exec", "Enable Zombie Execution", "Enable Zombie Execution",
SWITCH_ADD_APP(app_interface, "set_zombie_exec", "Enable Zombie Execution", "Enable Zombie Execution",
zombie_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
SWITCH_ADD_APP(app_interface, "pre_answer", "Pre-Answer the call", "Pre-Answer the call for a channel.", pre_answer_function, "", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "answer", "Answer the call", "Answer the call for a channel.", answer_function, "", SAF_SUPPORT_NOMEDIA);
@@ -6311,7 +6311,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
SWITCH_ADD_APP(app_interface, "video_decode", "Set video decode.", "Set video decode.", video_set_decode_function, "[[on|wait]|off]",
SAF_NONE);
SWITCH_ADD_APP(app_interface, "send_info", "Send info", "Send info", send_info_function, "<info>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "jitterbuffer", "Send session jitterbuffer", "Send a jitterbuffer message to a session.",
SWITCH_ADD_APP(app_interface, "jitterbuffer", "Send session jitterbuffer", "Send a jitterbuffer message to a session.",
jitterbuffer_function, "<jitterbuffer_data>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "send_display", "Send session a new display", "Send session a new display.", display_function, "<text>",
SAF_SUPPORT_NOMEDIA);
@@ -6377,10 +6377,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
SWITCH_ADD_APP(app_interface, "loop_playback", "Playback File looply", "Playback a file to the channel looply for limted times",
loop_playback_function, "[+loops] <path>", SAF_NONE);
SWITCH_ADD_APP(app_interface, "att_xfer", "Attended Transfer", "Attended Transfer", att_xfer_function, "<channel_url>", SAF_NONE);
SWITCH_ADD_APP(app_interface, "read", "Read Digits", "Read Digits", read_function,
SWITCH_ADD_APP(app_interface, "read", "Read Digits", "Read Digits", read_function,
"<min> <max> <file> <var_name> <timeout> <terminators> <digit_timeout>", SAF_NONE);
SWITCH_ADD_APP(app_interface, "play_and_get_digits", "Play and get Digits", "Play and get Digits",
play_and_get_digits_function,
play_and_get_digits_function,
"\n\t<min> <max> <tries> <timeout> <terminators> <file> <invalid_file> <var_name> <regexp> [<digit_timeout>] ['<failure_ext> [failure_dp [failure_context]]']", SAF_NONE);
SWITCH_ADD_APP(app_interface, "stop_video_write_overlay", "Stop video write overlay", "Stop video write overlay", stop_video_write_overlay_session_function, "<path>", SAF_NONE);