[mod_dptools] Fix dead nested assignments.
This commit is contained in:
parent
c062f85e16
commit
688984f8b9
|
@ -115,7 +115,6 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t
|
|||
switch_core_session_t *session = (switch_core_session_t *) match->user_data;
|
||||
switch_channel_t *channel;
|
||||
switch_event_t *event;
|
||||
switch_status_t status;
|
||||
switch_core_session_t *use_session = session;
|
||||
|
||||
if (switch_ivr_dmachine_get_target(match->dmachine) == DIGIT_TARGET_PEER) {
|
||||
|
@ -135,7 +134,7 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t
|
|||
if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "digits", match->match_digits);
|
||||
|
||||
if ((status = switch_core_session_queue_event(use_session, &event)) != SWITCH_STATUS_SUCCESS) {
|
||||
if (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_core_session_get_name(use_session));
|
||||
|
@ -157,7 +156,6 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
|
|||
{
|
||||
struct action_binding *act = (struct action_binding *) match->user_data;
|
||||
switch_event_t *event;
|
||||
switch_status_t status;
|
||||
int exec = 0;
|
||||
int api = 0;
|
||||
char *string = NULL;
|
||||
|
@ -218,7 +216,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
|
|||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute", exec == 1 ? "non-blocking" : "blocking");
|
||||
}
|
||||
|
||||
if ((status = switch_core_session_queue_event(use_session, &event)) != SWITCH_STATUS_SUCCESS) {
|
||||
if (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_core_session_get_name(use_session));
|
||||
|
@ -651,11 +649,10 @@ SWITCH_STANDARD_APP(keepalive_function)
|
|||
SWITCH_STANDARD_APP(exe_function)
|
||||
{
|
||||
char *argv[4] = { 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]))))) {
|
||||
&& switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) {
|
||||
switch_core_session_execute_exten(session, argv[0], argv[1], argv[2]);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", EXE_SYNTAX);
|
||||
|
@ -695,11 +692,10 @@ SWITCH_STANDARD_APP(rename_function)
|
|||
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_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) {
|
||||
switch_core_session_t *nsession = NULL;
|
||||
|
||||
switch_core_session_get_partner(session, &nsession);
|
||||
|
@ -717,11 +713,10 @@ SWITCH_STANDARD_APP(transfer_vars_function)
|
|||
SWITCH_STANDARD_APP(soft_hold_function)
|
||||
{
|
||||
char *argv[3] = { 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_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) {
|
||||
switch_ivr_soft_hold(session, argv[0], argv[1], argv[2]);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", SOFT_HOLD_SYNTAX);
|
||||
|
@ -774,11 +769,10 @@ SWITCH_STANDARD_APP(dtmf_unbind_function)
|
|||
SWITCH_STANDARD_APP(dtmf_bind_function)
|
||||
{
|
||||
char *argv[4] = { 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])))) == 4) {
|
||||
&& switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) == 4) {
|
||||
int kval = switch_dtmftoi(argv[0]);
|
||||
switch_bind_flag_t bind_flags = 0;
|
||||
|
||||
|
@ -849,14 +843,13 @@ SWITCH_STANDARD_APP(dtmf_bind_function)
|
|||
#define INTERCEPT_SYNTAX "[-bleg] <uuid>"
|
||||
SWITCH_STANDARD_APP(intercept_function)
|
||||
{
|
||||
int argc;
|
||||
char *argv[4] = { 0 };
|
||||
char *mydata;
|
||||
char *uuid;
|
||||
switch_bool_t bleg = SWITCH_FALSE;
|
||||
|
||||
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
|
||||
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
|
||||
if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) {
|
||||
if (!strcasecmp(argv[0], "-bleg")) {
|
||||
if (argv[1]) {
|
||||
uuid = argv[1];
|
||||
|
@ -1196,14 +1189,13 @@ SWITCH_STANDARD_APP(flush_dtmf_function)
|
|||
|
||||
SWITCH_STANDARD_APP(transfer_function)
|
||||
{
|
||||
int argc;
|
||||
char *argv[4] = { 0 };
|
||||
char *mydata;
|
||||
int bleg = 0, both = 0;
|
||||
|
||||
|
||||
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
|
||||
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
|
||||
if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) {
|
||||
bleg = !strcasecmp(argv[0], "-bleg");
|
||||
both = !strcasecmp(argv[0], "-both");
|
||||
|
||||
|
@ -1233,12 +1225,11 @@ SWITCH_STANDARD_APP(transfer_function)
|
|||
|
||||
SWITCH_STANDARD_APP(sched_transfer_function)
|
||||
{
|
||||
int argc;
|
||||
char *argv[4] = { 0 };
|
||||
char *mydata;
|
||||
|
||||
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
|
||||
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) {
|
||||
if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 2) {
|
||||
time_t when;
|
||||
uint32_t id;
|
||||
char ids[80] = "";
|
||||
|
@ -1260,12 +1251,11 @@ SWITCH_STANDARD_APP(sched_transfer_function)
|
|||
|
||||
SWITCH_STANDARD_APP(sched_hangup_function)
|
||||
{
|
||||
int argc;
|
||||
char *argv[5] = { 0 };
|
||||
char *mydata;
|
||||
|
||||
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
|
||||
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
|
||||
if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) {
|
||||
time_t when;
|
||||
switch_call_cause_t cause = SWITCH_CAUSE_ALLOTTED_TIMEOUT;
|
||||
switch_bool_t bleg = SWITCH_FALSE;
|
||||
|
@ -1298,12 +1288,11 @@ SWITCH_STANDARD_APP(sched_hangup_function)
|
|||
|
||||
SWITCH_STANDARD_APP(sched_broadcast_function)
|
||||
{
|
||||
int argc;
|
||||
char *argv[6] = { 0 };
|
||||
char *mydata;
|
||||
|
||||
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
|
||||
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) {
|
||||
if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 2) {
|
||||
time_t when;
|
||||
switch_media_flag_t flags = SMF_NONE;
|
||||
uint32_t id;
|
||||
|
@ -1992,11 +1981,10 @@ SWITCH_STANDARD_APP(privacy_function)
|
|||
SWITCH_STANDARD_APP(strftime_function)
|
||||
{
|
||||
char *argv[2] = { 0 };
|
||||
int argc;
|
||||
char *lbuf;
|
||||
|
||||
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
|
||||
&& (argc = switch_separate_string(lbuf, '=', argv, (sizeof(argv) / sizeof(argv[0])))) > 1) {
|
||||
&& switch_separate_string(lbuf, '=', argv, (sizeof(argv) / sizeof(argv[0]))) > 1) {
|
||||
switch_size_t retsize;
|
||||
switch_time_exp_t tm;
|
||||
char date[80] = "";
|
||||
|
@ -2135,10 +2123,9 @@ SWITCH_STANDARD_API(presence_api_function)
|
|||
SWITCH_STANDARD_API(chat_api_function)
|
||||
{
|
||||
char *lbuf = NULL, *argv[5];
|
||||
int argc = 0;
|
||||
|
||||
if (!zstr(cmd) && (lbuf = strdup(cmd))
|
||||
&& (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) >= 4) {
|
||||
&& switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0]))) >= 4) {
|
||||
|
||||
if (switch_core_chat_send_args(argv[0], "global", argv[1], argv[2], "", argv[3], !zstr(argv[4]) ? argv[4] : NULL, "", SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
|
||||
stream->write_function(stream, "Sent");
|
||||
|
@ -2270,7 +2257,6 @@ SWITCH_STANDARD_APP(bgsystem_session_function)
|
|||
SWITCH_STANDARD_APP(tone_detect_session_function)
|
||||
{
|
||||
char *argv[7] = { 0 };
|
||||
int argc;
|
||||
char *mydata = NULL;
|
||||
time_t to = 0;
|
||||
int hits = 0;
|
||||
|
@ -2281,7 +2267,7 @@ SWITCH_STANDARD_APP(tone_detect_session_function)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]))) < 2) {
|
||||
if (switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0])) < 2) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID ARGS!\n");
|
||||
return;
|
||||
}
|
||||
|
@ -3226,14 +3212,13 @@ SWITCH_STANDARD_APP(stop_displace_session_function)
|
|||
SWITCH_STANDARD_APP(capture_function)
|
||||
{
|
||||
char *argv[3] = { 0 };
|
||||
int argc;
|
||||
switch_regex_t *re = NULL;
|
||||
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) {
|
||||
&& 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])))) {
|
||||
switch_capture_regex(re, proceed, argv[1], ovector, argv[0], switch_regex_set_var_callback, session);
|
||||
}
|
||||
|
@ -4587,11 +4572,10 @@ SWITCH_STANDARD_APP(wait_for_silence_function)
|
|||
{
|
||||
char *argv[5] = { 0 };
|
||||
uint32_t thresh, silence_hits, listen_hits, timeout_ms = 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])))) >= 4) {
|
||||
&& switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 4) {
|
||||
thresh = atoi(argv[0]);
|
||||
silence_hits = atoi(argv[1]);
|
||||
listen_hits = atoi(argv[2]);
|
||||
|
@ -4615,11 +4599,10 @@ SWITCH_STANDARD_APP(detect_audio_function)
|
|||
{
|
||||
char *argv[4] = { 0 };
|
||||
uint32_t thresh, audio_hits, timeout_ms = 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])))) >= 3) {
|
||||
&& switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 3) {
|
||||
thresh = atoi(argv[0]);
|
||||
audio_hits = atoi(argv[1]);
|
||||
timeout_ms = atoi(argv[2]);
|
||||
|
@ -4639,11 +4622,10 @@ SWITCH_STANDARD_APP(detect_silence_function)
|
|||
{
|
||||
char *argv[4] = { 0 };
|
||||
uint32_t thresh, silence_hits, timeout_ms = 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])))) >= 3) {
|
||||
&& switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 3) {
|
||||
thresh = atoi(argv[0]);
|
||||
silence_hits = atoi(argv[1]);
|
||||
timeout_ms = atoi(argv[2]);
|
||||
|
@ -5070,11 +5052,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;
|
||||
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,
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL)) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_file_open(&fh, context->file, handle->channels, handle->samplerate,
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_status_t stat;
|
||||
|
||||
do {
|
||||
len = SWITCH_RECOMMENDED_BUFFER_SIZE / handle->channels;
|
||||
if ((stat = switch_core_file_read(&fh, buf, &len)) == SWITCH_STATUS_SUCCESS) {
|
||||
|
|
Loading…
Reference in New Issue