mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-30 15:14:17 +00:00
code analysis, clean up asserts related to switch_core_session_get_channel.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7402 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
c8dd27cdd1
commit
482badffca
44 files changed
+506
-1661
No files matched your search
@@ -1465,7 +1465,6 @@ SWITCH_STANDARD_API(originate_function)
|
||||
}
|
||||
|
||||
caller_channel = switch_core_session_get_channel(caller_session);
|
||||
switch_assert(caller_channel != NULL);
|
||||
switch_channel_clear_state_handler(caller_channel, NULL);
|
||||
|
||||
if (*exten == '&' && *(exten + 1)) {
|
||||
@@ -2016,8 +2015,6 @@ SWITCH_STANDARD_API(uuid_setvar_function)
|
||||
switch_channel_t *channel;
|
||||
channel = switch_core_session_get_channel(psession);
|
||||
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (switch_strlen_zero(var_name)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n");
|
||||
stream->write_function(stream, "-ERR No variable specified\n");
|
||||
@@ -2063,8 +2060,6 @@ SWITCH_STANDARD_API(uuid_getvar_function)
|
||||
if ((psession = switch_core_session_locate(uuid))) {
|
||||
switch_channel_t *channel;
|
||||
channel = switch_core_session_get_channel(psession);
|
||||
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (switch_strlen_zero(var_name)) {
|
||||
stream->write_function(stream, "-ERR No variable name specified!\n");
|
||||
@@ -2119,7 +2114,6 @@ SWITCH_STANDARD_API(uuid_dump_function)
|
||||
char *buf;
|
||||
|
||||
channel = switch_core_session_get_channel(psession);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_xml_t xml;
|
||||
|
||||
@@ -1366,7 +1366,6 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t * thread,
|
||||
switch_assert(member != NULL);
|
||||
|
||||
channel = switch_core_session_get_channel(member->session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
read_codec = switch_core_session_get_read_codec(member->session);
|
||||
switch_assert(read_codec != NULL);
|
||||
@@ -1550,7 +1549,6 @@ static void conference_loop_output(conference_member_t * member)
|
||||
uint32_t low_count = 0, bytes = samples * 2;
|
||||
call_list_t *call_list = NULL, *cp = NULL;
|
||||
|
||||
switch_assert(channel != NULL);
|
||||
switch_assert(member->conference != NULL);
|
||||
|
||||
if (switch_core_timer_init(&timer, member->conference->timer_name, interval, tsamples, NULL) == SWITCH_STATUS_SUCCESS) {
|
||||
@@ -2450,13 +2448,10 @@ static void conference_list_pretty(conference_obj_t * conference, switch_stream_
|
||||
channel = switch_core_session_get_channel(member->session);
|
||||
profile = switch_channel_get_caller_profile(channel);
|
||||
|
||||
|
||||
stream->write_function(stream, "%u) %s (%s)\n", member->id, profile->caller_id_name, profile->caller_id_number);
|
||||
|
||||
}
|
||||
|
||||
switch_mutex_unlock(conference->member_mutex);
|
||||
|
||||
}
|
||||
|
||||
static void conference_list(conference_obj_t * conference, switch_stream_handle_t *stream, char *delim)
|
||||
@@ -2486,7 +2481,6 @@ static void conference_list(conference_obj_t * conference, switch_stream_handle_
|
||||
profile = switch_channel_get_caller_profile(channel);
|
||||
name = switch_channel_get_name(channel);
|
||||
|
||||
|
||||
stream->write_function(stream, "%u%s%s%s%s%s%s%s%s%s",
|
||||
member->id, delim, name, delim, uuid, delim, profile->caller_id_name, delim, profile->caller_id_number, delim);
|
||||
|
||||
@@ -3637,7 +3631,6 @@ static switch_status_t audio_bridge_on_ring(switch_core_session_t *session)
|
||||
switch_channel_t *channel = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CUSTOM RING\n");
|
||||
|
||||
@@ -3684,12 +3677,10 @@ static switch_status_t conference_outcall(conference_obj_t * conference,
|
||||
}
|
||||
|
||||
peer_channel = switch_core_session_get_channel(peer_session);
|
||||
switch_assert(peer_channel != NULL);
|
||||
rdlock = 1;
|
||||
goto callup;
|
||||
}
|
||||
|
||||
|
||||
conference_name = conference->name;
|
||||
|
||||
if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
|
||||
@@ -3699,7 +3690,6 @@ static switch_status_t conference_outcall(conference_obj_t * conference,
|
||||
|
||||
if (session != NULL) {
|
||||
caller_channel = switch_core_session_get_channel(session);
|
||||
|
||||
}
|
||||
|
||||
if (switch_strlen_zero(cid_name)) {
|
||||
@@ -3723,7 +3713,6 @@ static switch_status_t conference_outcall(conference_obj_t * conference,
|
||||
|
||||
rdlock = 1;
|
||||
peer_channel = switch_core_session_get_channel(peer_session);
|
||||
switch_assert(peer_channel != NULL);
|
||||
|
||||
/* make sure the conference still exists */
|
||||
if (!switch_test_flag(conference, CFLAG_RUNNING)) {
|
||||
@@ -3942,8 +3931,6 @@ SWITCH_STANDARD_APP(conference_auto_function)
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
call_list_t *call_list, *np;
|
||||
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
call_list = switch_channel_get_private(channel, "_conference_autocall_list_");
|
||||
|
||||
if (switch_strlen_zero(data)) {
|
||||
@@ -3987,8 +3974,6 @@ SWITCH_STANDARD_APP(conference_function)
|
||||
conf_xml_cfg_t xml_cfg = { 0 };
|
||||
switch_event_t *params = NULL;
|
||||
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (switch_strlen_zero(data)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid arguments\n");
|
||||
return;
|
||||
|
||||
@@ -111,10 +111,7 @@ SWITCH_STANDARD_APP(set_user_function)
|
||||
{
|
||||
switch_xml_t x_domain, xml = NULL, x_user, x_param, x_params;
|
||||
char *user, *mailbox, *domain;
|
||||
switch_channel_t *channel;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
|
||||
if (switch_strlen_zero(data)) {
|
||||
goto error;
|
||||
@@ -164,29 +161,19 @@ SWITCH_STANDARD_APP(set_user_function)
|
||||
|
||||
SWITCH_STANDARD_APP(ring_ready_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
switch_channel_ring_ready(channel);
|
||||
switch_channel_ring_ready(switch_core_session_get_channel(session));
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(break_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
switch_channel_set_flag(channel, CF_BREAK);
|
||||
switch_channel_set_flag(switch_core_session_get_channel(session), CF_BREAK);
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(queue_dtmf_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_channel_queue_dtmf_string(channel, (const char *) data);
|
||||
|
||||
switch_channel_queue_dtmf_string(switch_core_session_get_channel(session), (const char *) data);
|
||||
}
|
||||
|
||||
|
||||
SWITCH_STANDARD_APP(send_dtmf_function)
|
||||
{
|
||||
switch_core_session_send_dtmf_string(session, (const char *) data);
|
||||
@@ -329,12 +316,8 @@ SWITCH_STANDARD_APP(eval_function)
|
||||
|
||||
SWITCH_STANDARD_APP(phrase_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
char *mydata = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
|
||||
const char *lang;
|
||||
char *macro = mydata;
|
||||
@@ -344,7 +327,7 @@ SWITCH_STANDARD_APP(phrase_function)
|
||||
*mdata++ = '\0';
|
||||
}
|
||||
|
||||
lang = switch_channel_get_variable(channel, "language");
|
||||
lang = switch_channel_get_variable(switch_core_session_get_channel(session), "language");
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Execute %s(%s) lang %s\n", macro, switch_str_nil(mdata), switch_str_nil(lang));
|
||||
switch_ivr_phrase_macro(session, macro, mdata, lang, NULL);
|
||||
@@ -353,35 +336,23 @@ SWITCH_STANDARD_APP(phrase_function)
|
||||
|
||||
SWITCH_STANDARD_APP(hangup_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (!switch_strlen_zero(data)) {
|
||||
cause = switch_channel_str2cause(data);
|
||||
}
|
||||
|
||||
switch_channel_hangup(channel, cause);
|
||||
switch_channel_hangup(switch_core_session_get_channel(session), cause);
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(answer_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
switch_channel_answer(channel);
|
||||
switch_channel_answer(switch_core_session_get_channel(session));
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(pre_answer_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
switch_channel_pre_answer(channel);
|
||||
switch_channel_pre_answer(switch_core_session_get_channel(session));
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(redirect_function)
|
||||
@@ -420,12 +391,8 @@ SWITCH_STANDARD_APP(deflect_function)
|
||||
|
||||
SWITCH_STANDARD_APP(set_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
char *var, *val = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (switch_strlen_zero(data)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n");
|
||||
} else {
|
||||
@@ -440,7 +407,7 @@ SWITCH_STANDARD_APP(set_function)
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", var, val ? val : "UNDEF");
|
||||
switch_channel_set_variable(channel, var, val);
|
||||
switch_channel_set_variable(switch_core_session_get_channel(session), var, val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,14 +437,10 @@ SWITCH_STANDARD_APP(set_global_function)
|
||||
|
||||
SWITCH_STANDARD_APP(set_profile_var_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
char *name, *val = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
caller_profile = switch_channel_get_caller_profile(channel);
|
||||
caller_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(session));
|
||||
|
||||
if (switch_strlen_zero(data)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n");
|
||||
@@ -550,14 +513,11 @@ SWITCH_STANDARD_APP(set_profile_var_function)
|
||||
|
||||
SWITCH_STANDARD_APP(export_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
const char *exports;
|
||||
char *new_exports = NULL, *new_exports_d = NULL, *var, *val = NULL, *var_name = NULL;
|
||||
int local = 1;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (switch_strlen_zero(data)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n");
|
||||
} else {
|
||||
@@ -599,27 +559,18 @@ SWITCH_STANDARD_APP(export_function)
|
||||
|
||||
SWITCH_STANDARD_APP(unset_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (switch_strlen_zero(data)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n");
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "UNSET [%s]\n", (char *) data);
|
||||
switch_channel_set_variable(channel, data, NULL);
|
||||
switch_channel_set_variable(switch_core_session_get_channel(session), data, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(log_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
char *level, *log_str;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (data && (level = strdup(data))) {
|
||||
switch_log_level_t ltype = SWITCH_LOG_DEBUG;
|
||||
|
||||
@@ -640,15 +591,11 @@ SWITCH_STANDARD_APP(log_function)
|
||||
|
||||
SWITCH_STANDARD_APP(info_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
switch_event_t *event;
|
||||
char *buf;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(channel, event);
|
||||
switch_channel_event_set_data(switch_core_session_get_channel(session), event);
|
||||
switch_event_serialize(event, &buf, SWITCH_FALSE);
|
||||
switch_assert(buf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "CHANNEL_DATA:\n%s\n", buf);
|
||||
@@ -659,17 +606,13 @@ SWITCH_STANDARD_APP(info_function)
|
||||
|
||||
SWITCH_STANDARD_APP(event_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
switch_event_t *event;
|
||||
char *argv[25] = { 0 };
|
||||
int argc = 0;
|
||||
char *lbuf;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_APPLICATION) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(channel, event);
|
||||
switch_channel_event_set_data(switch_core_session_get_channel(session), event);
|
||||
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
|
||||
&& (argc = switch_separate_string(lbuf, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
|
||||
int x = 0;
|
||||
@@ -700,13 +643,7 @@ SWITCH_STANDARD_APP(event_function)
|
||||
|
||||
SWITCH_STANDARD_APP(privacy_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
caller_profile = switch_channel_get_caller_profile(channel);
|
||||
switch_caller_profile_t *caller_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(session));
|
||||
|
||||
if (switch_strlen_zero(data)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No privacy mode specified.\n");
|
||||
@@ -742,15 +679,11 @@ SWITCH_STANDARD_APP(strftime_function)
|
||||
switch_size_t retsize;
|
||||
switch_time_exp_t tm;
|
||||
char date[80] = "";
|
||||
switch_channel_t *channel;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
switch_time_exp_lt(&tm, switch_timestamp_now());
|
||||
switch_strftime(date, &retsize, sizeof(date), argv[1], &tm);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", argv[0], date);
|
||||
switch_channel_set_variable(channel, argv[0], date);
|
||||
switch_channel_set_variable(switch_core_session_get_channel(session), argv[0], date);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1025,8 +958,6 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit
|
||||
const char *terminators;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
const char *p;
|
||||
|
||||
switch_assert(channel);
|
||||
|
||||
if (!(terminators = switch_channel_get_variable(channel, SWITCH_PLAYBACK_TERMINATORS_VARIABLE))) {
|
||||
terminators = "*";
|
||||
@@ -1067,8 +998,6 @@ SWITCH_STANDARD_APP(speak_function)
|
||||
char *mydata = NULL;
|
||||
switch_input_args_t args = { 0 };
|
||||
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (switch_strlen_zero(data) || !(mydata = switch_core_session_strdup(session, data))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Params!\n");
|
||||
return;
|
||||
@@ -1122,12 +1051,9 @@ SWITCH_STANDARD_APP(speak_function)
|
||||
|
||||
SWITCH_STANDARD_APP(playback_function)
|
||||
{
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_input_args_t args = { 0 };
|
||||
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
switch_channel_pre_answer(channel);
|
||||
switch_channel_pre_answer(switch_core_session_get_channel(session));
|
||||
|
||||
args.input_callback = on_dtmf;
|
||||
switch_ivr_play_file(session, NULL, data, &args);
|
||||
@@ -1135,7 +1061,6 @@ SWITCH_STANDARD_APP(playback_function)
|
||||
|
||||
SWITCH_STANDARD_APP(gentones_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
char *tone_script = NULL;
|
||||
switch_input_args_t args = { 0 };
|
||||
char *l;
|
||||
@@ -1146,12 +1071,7 @@ SWITCH_STANDARD_APP(gentones_function)
|
||||
return;
|
||||
}
|
||||
|
||||
tone_script = switch_core_session_strdup(session, data);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
switch_channel_pre_answer(channel);
|
||||
switch_channel_pre_answer(switch_core_session_get_channel(session));
|
||||
|
||||
if ((l = strchr(tone_script, '|'))) {
|
||||
*l++ = '\0';
|
||||
@@ -1208,8 +1128,6 @@ SWITCH_STANDARD_APP(record_function)
|
||||
const char *tmp;
|
||||
int rate;
|
||||
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
|
||||
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
} else {
|
||||
@@ -1301,8 +1219,6 @@ SWITCH_STANDARD_APP(audio_bridge_function)
|
||||
uint8_t no_media_bridge = 0;
|
||||
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
|
||||
|
||||
assert(caller_channel != NULL);
|
||||
|
||||
if (switch_strlen_zero(data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -547,8 +547,6 @@ SWITCH_STANDARD_DIALPLAN(enum_dialplan_hunt)
|
||||
enum_route_t *rtp;
|
||||
char *dp = (char *) arg;
|
||||
|
||||
assert(channel != NULL);
|
||||
|
||||
if (!caller_profile) {
|
||||
caller_profile = switch_channel_get_caller_profile(channel);
|
||||
}
|
||||
@@ -597,8 +595,6 @@ SWITCH_STANDARD_APP(enum_app_function)
|
||||
uint32_t cnt = 1;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
|
||||
assert(channel != NULL);
|
||||
|
||||
if (!(mydata = switch_core_session_strdup(session, data))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ typedef enum {
|
||||
|
||||
SWITCH_STANDARD_APP(bcast_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_socket_t *socket;
|
||||
switch_sockaddr_t *audio_addr = NULL, *control_packet_addr;
|
||||
switch_frame_t *read_frame;
|
||||
@@ -77,11 +77,6 @@ SWITCH_STANDARD_APP(bcast_function)
|
||||
switch_port_t mcast_control_port = 6061;
|
||||
char *mcast_port_str = "34567";
|
||||
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
|
||||
if (!switch_strlen_zero((char *) data)) {
|
||||
mydata = switch_core_session_strdup(session, data);
|
||||
assert(mydata != NULL);
|
||||
|
||||
@@ -40,10 +40,7 @@ SWITCH_MODULE_DEFINITION(mod_fifo, mod_fifo_load, mod_fifo_shutdown, NULL);
|
||||
|
||||
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
|
||||
{
|
||||
switch_core_session_t *bleg;
|
||||
switch_channel_t *channel;
|
||||
|
||||
bleg = (switch_core_session_t *) buf;
|
||||
switch_core_session_t *bleg = (switch_core_session_t *) buf;
|
||||
|
||||
switch (itype) {
|
||||
case SWITCH_INPUT_TYPE_DTMF:
|
||||
@@ -51,10 +48,8 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit
|
||||
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
|
||||
|
||||
if (dtmf->digit == '*') {
|
||||
channel = switch_core_session_get_channel(session);
|
||||
if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
|
||||
channel = switch_core_session_get_channel(bleg);
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
||||
if (switch_channel_test_flag(switch_core_session_get_channel(session), CF_ORIGINATOR)) {
|
||||
switch_channel_hangup(switch_core_session_get_channel(bleg), SWITCH_CAUSE_NORMAL_CLEARING);
|
||||
return SWITCH_STATUS_BREAK;
|
||||
}
|
||||
}
|
||||
@@ -67,10 +62,8 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
#define check_string(s) if (!switch_strlen_zero(s) && !strcasecmp(s, "undef")) { s = NULL; }
|
||||
|
||||
|
||||
static switch_status_t read_frame_callback(switch_core_session_t *session, switch_frame_t *frame, void *user_data)
|
||||
{
|
||||
switch_queue_t *fifo = (switch_queue_t *) user_data;
|
||||
@@ -194,7 +187,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||
int argc;
|
||||
char *mydata = NULL, *argv[5] = { 0 };
|
||||
fifo_node_t *node;
|
||||
switch_channel_t *channel;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
int nowait = 0;
|
||||
const char *moh = NULL;
|
||||
const char *announce = NULL;
|
||||
@@ -208,8 +201,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (switch_strlen_zero(data)) {
|
||||
if (switch_strlen_zero(data)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Args\n");
|
||||
return;
|
||||
}
|
||||
@@ -221,17 +213,13 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||
return;
|
||||
}
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
|
||||
switch_mutex_lock(globals.mutex);
|
||||
switch_mutex_lock(globals.mutex);
|
||||
if (!(node = switch_core_hash_find(globals.fifo_hash, argv[0]))) {
|
||||
node = create_node(argv[0]);
|
||||
}
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
|
||||
|
||||
|
||||
moh = switch_channel_get_variable(channel, "fifo_music");
|
||||
moh = switch_channel_get_variable(channel, "fifo_music");
|
||||
announce = switch_channel_get_variable(channel, "fifo_announce");
|
||||
|
||||
if (argc > 2) {
|
||||
@@ -254,8 +242,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||
check_string(announce);
|
||||
check_string(moh);
|
||||
|
||||
|
||||
if (moh) {
|
||||
if (moh) {
|
||||
switch_ivr_broadcast(uuid, moh, SMF_LOOP | SMF_ECHO_ALEG);
|
||||
}
|
||||
|
||||
@@ -284,9 +271,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||
|
||||
switch_ivr_park(session, NULL);
|
||||
|
||||
|
||||
|
||||
if (switch_channel_ready(channel)) {
|
||||
if (switch_channel_ready(channel)) {
|
||||
if (announce) {
|
||||
switch_ivr_play_file(session, NULL, announce, NULL);
|
||||
}
|
||||
@@ -345,9 +330,8 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||
switch_mutex_unlock(node->mutex);
|
||||
switch_channel_answer(channel);
|
||||
}
|
||||
|
||||
|
||||
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_channel_event_set_data(channel, event);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "consumer_start");
|
||||
@@ -360,9 +344,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||
switch_channel_set_variable(channel, "fifo_status", "WAITING");
|
||||
switch_channel_set_variable(channel, "fifo_timestamp", date);
|
||||
|
||||
|
||||
|
||||
while(switch_channel_ready(channel)) {
|
||||
while(switch_channel_ready(channel)) {
|
||||
if (moh) {
|
||||
args.read_frame_callback = read_frame_callback;
|
||||
args.user_data = node->fifo;
|
||||
@@ -389,8 +371,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
|
||||
switch_caller_profile_t *cloned_profile;
|
||||
|
||||
|
||||
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_channel_event_set_data(other_channel, event);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "caller_pop");
|
||||
@@ -404,9 +385,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (announce) {
|
||||
if (announce) {
|
||||
switch_ivr_play_file(session, NULL, announce, NULL);
|
||||
} else {
|
||||
switch_ivr_sleep(session, 500);
|
||||
@@ -477,8 +456,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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_channel_event_set_data(channel, event);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "consumer_stop");
|
||||
@@ -495,7 +473,6 @@ SWITCH_STANDARD_APP(fifo_function)
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int xml_hash(switch_xml_t xml, switch_hash_t *hash, char *container, char *tag, int cc_off, int verbose)
|
||||
|
||||
@@ -284,18 +284,13 @@ static switch_status_t do_config()
|
||||
|
||||
static switch_status_t hanguphook(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
switch_channel_state_t state;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_channel_state_t state = switch_channel_get_state(channel);
|
||||
const char *realm = NULL;
|
||||
const char *id = NULL;
|
||||
char *sql = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
state = switch_channel_get_state(channel);
|
||||
|
||||
if (state == CS_HANGUP || state == CS_RING) {
|
||||
if (state == CS_HANGUP || state == CS_RING) {
|
||||
id = switch_channel_get_variable(channel, "limit_id");
|
||||
realm = switch_channel_get_variable(channel, "limit_realm");
|
||||
sql = switch_mprintf("delete from limit_data where uuid='%q' and hostname='%q' and realm='%q'and id='%q';",
|
||||
@@ -406,16 +401,12 @@ SWITCH_STANDARD_API(db_api_function)
|
||||
|
||||
SWITCH_STANDARD_APP(db_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
int argc = 0;
|
||||
char *argv[4] = { 0 };
|
||||
char *mydata = NULL;
|
||||
char *sql = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
if (!switch_strlen_zero(data)) {
|
||||
if (!switch_strlen_zero(data)) {
|
||||
mydata = switch_core_session_strdup(session, data);
|
||||
argc = switch_separate_string(mydata, '/', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
}
|
||||
@@ -423,9 +414,8 @@ SWITCH_STANDARD_APP(db_function)
|
||||
if (argc < 4 || !argv[0]) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
if (!strcasecmp(argv[0], "insert")) {
|
||||
|
||||
if (!strcasecmp(argv[0], "insert")) {
|
||||
sql = switch_mprintf("delete from db_data where realm='%q' and data_key='%q'", argv[1], argv[2]);
|
||||
switch_assert(sql);
|
||||
limit_execute_sql(sql, globals.mutex);
|
||||
@@ -441,12 +431,8 @@ SWITCH_STANDARD_APP(db_function)
|
||||
switch_safe_free(sql);
|
||||
return;
|
||||
|
||||
|
||||
error:
|
||||
error:
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "USAGE: db %s\n", DB_USAGE);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -536,16 +522,12 @@ SWITCH_STANDARD_API(group_api_function)
|
||||
|
||||
SWITCH_STANDARD_APP(group_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
int argc = 0;
|
||||
char *argv[3] = { 0 };
|
||||
char *mydata = NULL;
|
||||
char *sql;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
if (!switch_strlen_zero(data)) {
|
||||
if (!switch_strlen_zero(data)) {
|
||||
mydata = switch_core_session_strdup(session, data);
|
||||
argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
}
|
||||
@@ -585,10 +567,7 @@ SWITCH_STANDARD_APP(limit_function)
|
||||
int max = 0, got = 0;
|
||||
char buf[80] = "";
|
||||
callback_t cbt = { 0 };
|
||||
switch_channel_t *channel;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
|
||||
if (!switch_strlen_zero(data)) {
|
||||
mydata = switch_core_session_strdup(session, data);
|
||||
@@ -600,12 +579,9 @@ SWITCH_STANDARD_APP(limit_function)
|
||||
return;
|
||||
}
|
||||
|
||||
switch_mutex_lock(globals.mutex);
|
||||
|
||||
switch_mutex_lock(globals.mutex);
|
||||
|
||||
|
||||
|
||||
realm = argv[0];
|
||||
realm = argv[0];
|
||||
id = argv[1];
|
||||
max = atoi(argv[2]);
|
||||
|
||||
@@ -639,11 +615,8 @@ SWITCH_STANDARD_APP(limit_function)
|
||||
limit_execute_sql(sql, NULL);
|
||||
switch_safe_free(sql);
|
||||
|
||||
|
||||
done:
|
||||
|
||||
done:
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit
|
||||
|
||||
SWITCH_STANDARD_APP(rss_function)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_status_t status;
|
||||
const char *err = NULL;
|
||||
struct dtmf_buffer dtb = { 0 };
|
||||
@@ -185,16 +185,12 @@ SWITCH_STANDARD_APP(rss_function)
|
||||
uint32_t matches = 0;
|
||||
switch_input_args_t args = { 0 };
|
||||
const char *vcf = NULL;
|
||||
char *chanvars = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
char *chanvars = switch_channel_build_param_string(channel, NULL, NULL);
|
||||
|
||||
if ((vcf = switch_channel_get_variable(channel, "rss_alt_config"))) {
|
||||
cf = vcf;
|
||||
}
|
||||
|
||||
chanvars = switch_channel_build_param_string(channel, NULL, NULL);
|
||||
if (!(cxml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
|
||||
return;
|
||||
|
||||
@@ -792,13 +792,9 @@ static switch_status_t vm_macro_get(switch_core_session_t *session,
|
||||
uint32_t timeout)
|
||||
{
|
||||
switch_input_args_t args = { 0 }, *ap = NULL;
|
||||
switch_channel_t *channel;
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
switch_size_t bslen;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (buf && buflen) {
|
||||
memset(buf, 0, buflen);
|
||||
args.input_callback = cancel_on_dtmf;
|
||||
@@ -870,7 +866,7 @@ typedef enum {
|
||||
static switch_status_t create_file(switch_core_session_t *session, vm_profile_t *profile,
|
||||
char *macro_name, char *file_path, switch_size_t *message_len, switch_bool_t limit)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
switch_file_handle_t fh = { 0 };
|
||||
switch_input_args_t args = { 0 };
|
||||
@@ -878,8 +874,6 @@ static switch_status_t create_file(switch_core_session_t *session, vm_profile_t
|
||||
char input[10] = "" , key_buf[80] = "";
|
||||
cc_t cc = { 0 };
|
||||
switch_codec_t *read_codec;
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
read_codec = switch_core_session_get_read_codec(session);
|
||||
|
||||
@@ -1040,15 +1034,13 @@ static void message_count(vm_profile_t *profile, const char *myid, const char *d
|
||||
|
||||
static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t *profile, listen_callback_t *cbt)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
switch_input_args_t args = { 0 };
|
||||
char term;
|
||||
char input[10] = "" , key_buf[80] = "";
|
||||
switch_file_handle_t fh = { 0 };
|
||||
cc_t cc = { 0 };
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if(switch_channel_ready(channel)) {
|
||||
|
||||
@@ -1227,10 +1219,10 @@ end:
|
||||
static void voicemail_check_main(switch_core_session_t *session, const char *profile_name, const char *domain_name, const char *id, int auth)
|
||||
{
|
||||
vm_check_state_t vm_check_state = VM_CHECK_START;
|
||||
switch_channel_t *channel;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_caller_profile_t *caller_profile;
|
||||
vm_profile_t *profile;
|
||||
switch_xml_t x_domain, x_domain_root, x_user, x_params, x_param;
|
||||
switch_xml_t x_domain = NULL, x_domain_root = NULL, x_user = NULL, x_params, x_param;
|
||||
switch_status_t status;
|
||||
char pass_buf[80] = "", *mypass = NULL, id_buf[80] = "", *myfolder = NULL;
|
||||
const char *thepass = NULL, *myid = id;
|
||||
@@ -1246,16 +1238,11 @@ static void voicemail_check_main(switch_core_session_t *session, const char *pro
|
||||
int heard_auto_saved = 0, heard_auto_new = 0;
|
||||
char *email_vm = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (!(profile = switch_core_hash_find(globals.profile_hash, profile_name))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error invalid profile %s\n", profile_name);
|
||||
return;
|
||||
}
|
||||
|
||||
x_user = x_domain = x_domain_root = NULL;
|
||||
|
||||
timeout = profile->digit_timeout;
|
||||
attempts = profile->max_login_attempts;
|
||||
|
||||
@@ -1684,7 +1671,7 @@ end:
|
||||
|
||||
static switch_status_t voicemail_leave_main(switch_core_session_t *session, const char *profile_name, const char *domain_name, const char *id)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
char *myfolder = "inbox";
|
||||
char sql[256];
|
||||
prefs_callback_t cbt;
|
||||
@@ -1693,7 +1680,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, cons
|
||||
char *file_path = NULL;
|
||||
char *dir_path = NULL;
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
switch_caller_profile_t *caller_profile = switch_channel_get_caller_profile(channel);
|
||||
switch_file_handle_t fh = { 0 };
|
||||
switch_input_args_t args = { 0 };
|
||||
char *email_vm = NULL;
|
||||
@@ -1719,10 +1706,6 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, cons
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
caller_profile = switch_channel_get_caller_profile(channel);
|
||||
if(switch_strlen_zero(profile->storage_dir)) {
|
||||
dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
|
||||
SWITCH_PATH_SEPARATOR,
|
||||
@@ -2059,10 +2042,7 @@ SWITCH_STANDARD_APP(voicemail_function)
|
||||
const char *id = NULL;
|
||||
const char *auth_var = NULL;
|
||||
int x = 0, check = 0, auth = 0;
|
||||
switch_channel_t *channel;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
|
||||
if (switch_dir_make_recursive(SWITCH_GLOBAL_dirs.storage_dir, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", SWITCH_GLOBAL_dirs.storage_dir);
|
||||
|
||||
Reference in new issue
Block a user