diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-25 20:20:10 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-25 20:20:10 +0000 |
commit | 48f62970c31279141d519f7f64bd5d6d875d7215 (patch) | |
tree | 6a302ccb7b6599b8c7d7de1daeebed89f8fc3544 /apps | |
parent | 784c0931ff31bfb0ac1ada811359779d3133333d (diff) |
Whitespace changes only
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@114667 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_dial.c | 8 | ||||
-rw-r--r-- | apps/app_externalivr.c | 4 | ||||
-rw-r--r-- | apps/app_followme.c | 2 | ||||
-rw-r--r-- | apps/app_minivm.c | 17 | ||||
-rw-r--r-- | apps/app_parkandannounce.c | 2 | ||||
-rw-r--r-- | apps/app_playback.c | 92 | ||||
-rw-r--r-- | apps/app_queue.c | 55 | ||||
-rw-r--r-- | apps/app_rpt.c | 2 | ||||
-rw-r--r-- | apps/app_sms.c | 10 | ||||
-rw-r--r-- | apps/app_speech_utils.c | 95 | ||||
-rw-r--r-- | apps/app_waitforring.c | 6 | ||||
-rw-r--r-- | apps/app_zapscan.c | 254 |
12 files changed, 283 insertions, 264 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c index e7a81636b..0cc865a1a 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -26,7 +26,7 @@ */ /*** MODULEINFO - <depend>chan_local</depend> + <depend>chan_local</depend> ***/ @@ -1934,9 +1934,9 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags } if (res != AST_PBX_NO_HANGUP_PEER) { if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) { - replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]); - ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]); - ast_pbx_start(peer); + replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]); + ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]); + ast_pbx_start(peer); } else { if (!ast_check_hangup(chan)) chan->hangupcause = peer->hangupcause; diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c index 6d3e86830..3bf7dd1c7 100644 --- a/apps/app_externalivr.c +++ b/apps/app_externalivr.c @@ -87,8 +87,8 @@ struct gen_state { }; static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u, - int eivr_events_fd, int eivr_commands_fd, int eivr_errors_fd, - const char *args); + int eivr_events_fd, int eivr_commands_fd, int eivr_errors_fd, + const char *args); int eivr_connect_socket(struct ast_channel *chan, const char *host, int port); diff --git a/apps/app_followme.c b/apps/app_followme.c index 0dc9bc081..35ce6f749 100644 --- a/apps/app_followme.c +++ b/apps/app_followme.c @@ -29,7 +29,7 @@ */ /*** MODULEINFO - <depend>chan_local</depend> + <depend>chan_local</depend> ***/ #include "asterisk.h" diff --git a/apps/app_minivm.c b/apps/app_minivm.c index 6c56e6c3f..8a66a9579 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -736,8 +736,9 @@ static void prep_email_sub_vars(struct ast_channel *channel, const struct minivm return; } - for (var = vmu->chanvars ; var ; var = var->next) - pbx_builtin_setvar_helper(channel, var->name, var->value); + for (var = vmu->chanvars ; var ; var = var->next) { + pbx_builtin_setvar_helper(channel, var->name, var->value); + } /* Prepare variables for substition in email body and subject */ pbx_builtin_setvar_helper(channel, "MVM_NAME", vmu->fullname); @@ -2778,12 +2779,12 @@ static int minivm_account_func_read(struct ast_channel *chan, const char *cmd, c */ static int vm_lock_path(const char *path) { - switch (ast_lock_path(path)) { - case AST_LOCK_TIMEOUT: - return -1; - default: - return 0; - } + switch (ast_lock_path(path)) { + case AST_LOCK_TIMEOUT: + return -1; + default: + return 0; + } } /*! \brief Access counter file, lock directory, read and possibly write it again changed diff --git a/apps/app_parkandannounce.c b/apps/app_parkandannounce.c index 7ad7a6416..d1066fd2c 100644 --- a/apps/app_parkandannounce.c +++ b/apps/app_parkandannounce.c @@ -129,7 +129,7 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data) ast_verb(4, "Channel %s was answered.\n", dchan->name); } else { ast_verb(4, "Channel %s was never answered.\n", dchan->name); - ast_log(LOG_WARNING, "PARK: Channel %s was never answered for the announce.\n", dchan->name); + ast_log(LOG_WARNING, "PARK: Channel %s was never answered for the announce.\n", dchan->name); ast_hangup(dchan); return -1; } diff --git a/apps/app_playback.c b/apps/app_playback.c index c7d8ff620..561600ad4 100644 --- a/apps/app_playback.c +++ b/apps/app_playback.c @@ -75,16 +75,16 @@ static void save_say_mode(const void *arg) int i = 0; say_api_buf[i++] = arg; - say_api_buf[i++] = ast_say_number_full; - say_api_buf[i++] = ast_say_enumeration_full; - say_api_buf[i++] = ast_say_digit_str_full; - say_api_buf[i++] = ast_say_character_str_full; - say_api_buf[i++] = ast_say_phonetic_str_full; - say_api_buf[i++] = ast_say_datetime; - say_api_buf[i++] = ast_say_time; - say_api_buf[i++] = ast_say_date; - say_api_buf[i++] = ast_say_datetime_from_now; - say_api_buf[i++] = ast_say_date_with_format; + say_api_buf[i++] = ast_say_number_full; + say_api_buf[i++] = ast_say_enumeration_full; + say_api_buf[i++] = ast_say_digit_str_full; + say_api_buf[i++] = ast_say_character_str_full; + say_api_buf[i++] = ast_say_phonetic_str_full; + say_api_buf[i++] = ast_say_datetime; + say_api_buf[i++] = ast_say_time; + say_api_buf[i++] = ast_say_date; + say_api_buf[i++] = ast_say_datetime_from_now; + say_api_buf[i++] = ast_say_date_with_format; } static void restore_say_mode(void *arg) @@ -92,16 +92,16 @@ static void restore_say_mode(void *arg) int i = 0; say_api_buf[i++] = arg; - ast_say_number_full = say_api_buf[i++]; - ast_say_enumeration_full = say_api_buf[i++]; - ast_say_digit_str_full = say_api_buf[i++]; - ast_say_character_str_full = say_api_buf[i++]; - ast_say_phonetic_str_full = say_api_buf[i++]; - ast_say_datetime = say_api_buf[i++]; - ast_say_time = say_api_buf[i++]; - ast_say_date = say_api_buf[i++]; - ast_say_datetime_from_now = say_api_buf[i++]; - ast_say_date_with_format = say_api_buf[i++]; + ast_say_number_full = say_api_buf[i++]; + ast_say_enumeration_full = say_api_buf[i++]; + ast_say_digit_str_full = say_api_buf[i++]; + ast_say_character_str_full = say_api_buf[i++]; + ast_say_phonetic_str_full = say_api_buf[i++]; + ast_say_datetime = say_api_buf[i++]; + ast_say_time = say_api_buf[i++]; + ast_say_date = say_api_buf[i++]; + ast_say_datetime_from_now = say_api_buf[i++]; + ast_say_date_with_format = say_api_buf[i++]; } /* @@ -111,25 +111,25 @@ static void restore_say_mode(void *arg) * parameter. */ typedef struct { - struct ast_channel *chan; - const char *ints; - const char *language; - int audiofd; - int ctrlfd; + struct ast_channel *chan; + const char *ints; + const char *language; + int audiofd; + int ctrlfd; } say_args_t; static int s_streamwait3(const say_args_t *a, const char *fn) { - int res = ast_streamfile(a->chan, fn, a->language); - if (res) { - ast_log(LOG_WARNING, "Unable to play message %s\n", fn); - return res; - } - res = (a->audiofd > -1 && a->ctrlfd > -1) ? - ast_waitstream_full(a->chan, a->ints, a->audiofd, a->ctrlfd) : - ast_waitstream(a->chan, a->ints); - ast_stopstream(a->chan); - return res; + int res = ast_streamfile(a->chan, fn, a->language); + if (res) { + ast_log(LOG_WARNING, "Unable to play message %s\n", fn); + return res; + } + res = (a->audiofd > -1 && a->ctrlfd > -1) ? + ast_waitstream_full(a->chan, a->ints, a->audiofd, a->ctrlfd) : + ast_waitstream(a->chan, a->ints); + ast_stopstream(a->chan); + return res; } /* @@ -247,11 +247,11 @@ static int do_say(say_args_t *a, const char *s, const char *options, int depth) } static int say_full(struct ast_channel *chan, const char *string, - const char *ints, const char *lang, const char *options, - int audiofd, int ctrlfd) + const char *ints, const char *lang, const char *options, + int audiofd, int ctrlfd) { - say_args_t a = { chan, ints, lang, audiofd, ctrlfd }; - return do_say(&a, string, options, 0); + say_args_t a = { chan, ints, lang, audiofd, ctrlfd }; + return do_say(&a, string, options, 0); } static int say_number_full(struct ast_channel *chan, int num, @@ -259,9 +259,9 @@ static int say_number_full(struct ast_channel *chan, int num, int audiofd, int ctrlfd) { char buf[64]; - say_args_t a = { chan, ints, lang, audiofd, ctrlfd }; + say_args_t a = { chan, ints, lang, audiofd, ctrlfd }; snprintf(buf, sizeof(buf), "num:%d", num); - return do_say(&a, buf, options, 0); + return do_say(&a, buf, options, 0); } static int say_enumeration_full(struct ast_channel *chan, int num, @@ -269,9 +269,9 @@ static int say_enumeration_full(struct ast_channel *chan, int num, int audiofd, int ctrlfd) { char buf[64]; - say_args_t a = { chan, ints, lang, audiofd, ctrlfd }; + say_args_t a = { chan, ints, lang, audiofd, ctrlfd }; snprintf(buf, sizeof(buf), "enum:%d", num); - return do_say(&a, buf, options, 0); + return do_say(&a, buf, options, 0); } static int say_date_generic(struct ast_channel *chan, time_t t, @@ -280,7 +280,7 @@ static int say_date_generic(struct ast_channel *chan, time_t t, char buf[128]; struct ast_tm tm; struct timeval tv = { t, 0 }; - say_args_t a = { chan, ints, lang, -1, -1 }; + say_args_t a = { chan, ints, lang, -1, -1 }; if (format == NULL) format = ""; @@ -296,7 +296,7 @@ static int say_date_generic(struct ast_channel *chan, time_t t, tm.tm_sec, tm.tm_wday, tm.tm_yday); - return do_say(&a, buf, NULL, 0); + return do_say(&a, buf, NULL, 0); } static int say_date_with_format(struct ast_channel *chan, time_t t, @@ -515,7 +515,7 @@ static int load_module(void) } } - ast_cli_register_multiple(cli_playback, sizeof(cli_playback) / sizeof(struct ast_cli_entry)); + ast_cli_register_multiple(cli_playback, sizeof(cli_playback) / sizeof(struct ast_cli_entry)); return ast_register_application(app, playback_exec, synopsis, descrip); } diff --git a/apps/app_queue.c b/apps/app_queue.c index 06a5c0ba2..3999e4dc3 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -57,7 +57,7 @@ */ /*** MODULEINFO - <depend>res_monitor</depend> + <depend>res_monitor</depend> ***/ #include "asterisk.h" @@ -135,7 +135,7 @@ static const struct strategy { #define DEFAULT_TIMEOUT 15 #define RECHECK 1 /*!< Recheck every second to see we we're at the top yet */ #define MAX_PERIODIC_ANNOUNCEMENTS 10 /*!< The maximum periodic announcements we can have */ -#define DEFAULT_MIN_ANNOUNCE_FREQUENCY 15 /*!< The minimum number of seconds between position announcements +#define DEFAULT_MIN_ANNOUNCE_FREQUENCY 15 /*!< The minimum number of seconds between position announcements \ The default value of 15 provides backwards compatibility */ #define MAX_QUEUE_BUCKETS 53 @@ -581,7 +581,7 @@ static void set_queue_variables(struct queue_ent *qe) { char interfacevar[256]=""; float sl = 0; - + if (qe->parent->setqueuevar) { sl = 0; if (qe->parent->callscompleted > 0) @@ -1904,10 +1904,11 @@ playout: /* Don't restart music on hold if we're about to exit the caller from the queue */ if (!res) { - if (ringing) - ast_indicate(qe->chan, AST_CONTROL_RINGING); - else - ast_moh_start(qe->chan, qe->moh, NULL); + if (ringing) { + ast_indicate(qe->chan, AST_CONTROL_RINGING); + } else { + ast_moh_start(qe->chan, qe->moh, NULL); + } } return res; } @@ -3113,12 +3114,12 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce case 'H': ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT); break; - case 'k': - ast_set_flag(&(bridge_config.features_callee), AST_FEATURE_PARKCALL); - break; - case 'K': - ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_PARKCALL); - break; + case 'k': + ast_set_flag(&(bridge_config.features_callee), AST_FEATURE_PARKCALL); + break; + case 'K': + ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_PARKCALL); + break; case 'n': if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY || qe->parent->strategy == QUEUE_STRATEGY_LINEAR) (*tries)++; @@ -4643,8 +4644,8 @@ static int queue_function_var(struct ast_channel *chan, const char *cmd, char *d .name = data, }; - char interfacevar[256]=""; - float sl = 0; + char interfacevar[256] = ""; + float sl = 0; if (ast_strlen_zero(data)) { ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd); @@ -4653,24 +4654,26 @@ static int queue_function_var(struct ast_channel *chan, const char *cmd, char *d if ((q = ao2_find(queues, &tmpq, OBJ_POINTER))) { ao2_lock(q); - if (q->setqueuevar) { - sl = 0; + if (q->setqueuevar) { + sl = 0; res = 0; - if (q->callscompleted > 0) - sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted); + if (q->callscompleted > 0) { + sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted); + } - snprintf(interfacevar, sizeof(interfacevar), - "QUEUEMAX=%d,QUEUESTRATEGY=%s,QUEUECALLS=%d,QUEUEHOLDTIME=%d,QUEUECOMPLETED=%d,QUEUEABANDONED=%d,QUEUESRVLEVEL=%d,QUEUESRVLEVELPERF=%2.1f", - q->maxlen, int2strat(q->strategy), q->count, q->holdtime, q->callscompleted, q->callsabandoned, q->servicelevel, sl); + snprintf(interfacevar, sizeof(interfacevar), + "QUEUEMAX=%d,QUEUESTRATEGY=%s,QUEUECALLS=%d,QUEUEHOLDTIME=%d,QUEUECOMPLETED=%d,QUEUEABANDONED=%d,QUEUESRVLEVEL=%d,QUEUESRVLEVELPERF=%2.1f", + q->maxlen, int2strat(q->strategy), q->count, q->holdtime, q->callscompleted, q->callsabandoned, q->servicelevel, sl); - pbx_builtin_setvar_multiple(chan, interfacevar); - } + pbx_builtin_setvar_multiple(chan, interfacevar); + } ao2_unlock(q); queue_unref(q); - } else + } else { ast_log(LOG_WARNING, "queue %s was not found\n", data); + } snprintf(buf, len, "%d", res); @@ -4865,7 +4868,7 @@ static int queue_function_memberpenalty_read(struct ast_channel *chan, const cha AST_DECLARE_APP_ARGS(args, AST_APP_ARG(queuename); AST_APP_ARG(interface); - ); + ); /* Make sure the returned value on error is NULL. */ buf[0] = '\0'; diff --git a/apps/app_rpt.c b/apps/app_rpt.c index 1246e39e8..d91b45f52 100644 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -202,7 +202,7 @@ enum {DLY_TELEM, DLY_ID, DLY_UNKEY, DLY_CALLTERM}; enum {REM_MODE_FM, REM_MODE_USB, REM_MODE_LSB, REM_MODE_AM}; enum {HF_SCAN_OFF, HF_SCAN_DOWN_SLOW, HF_SCAN_DOWN_QUICK, - HF_SCAN_DOWN_FAST, HF_SCAN_UP_SLOW, HF_SCAN_UP_QUICK, HF_SCAN_UP_FAST}; + HF_SCAN_DOWN_FAST, HF_SCAN_UP_SLOW, HF_SCAN_UP_QUICK, HF_SCAN_UP_FAST}; #include "asterisk.h" diff --git a/apps/app_sms.c b/apps/app_sms.c index 2af6a2590..0272468d6 100644 --- a/apps/app_sms.c +++ b/apps/app_sms.c @@ -260,8 +260,9 @@ static void numcpy(char *d, char *s) if (*s == '+') *d++ = *s++; while (*s) { - if (isdigit(*s)) - *d++ = *s; + if (isdigit(*s)) { + *d++ = *s; + } s++; } *d = 0; @@ -600,8 +601,9 @@ static void unpacksms7(unsigned char *i, unsigned char l, unsigned char *udh, in } /*! \brief unpacks bytes (8 bit encoding) at i, len l septets, - and places in udh and ud setting udhl and udl. udh not used - if udhi not set */ + * and places in udh and ud setting udhl and udl. udh not used + * if udhi not set. + */ static void unpacksms8(unsigned char *i, unsigned char l, unsigned char *udh, int *udhl, unsigned short *ud, int *udl, char udhi) { unsigned short *o = ud; diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c index 221d2eb5c..6033923ee 100644 --- a/apps/app_speech_utils.c +++ b/apps/app_speech_utils.c @@ -137,8 +137,9 @@ static struct ast_speech_result *find_result(struct ast_speech_result *results, char *tmp = NULL; int nbest_num = 0, wanted_num = 0, i = 0; - if (!result) + if (!result) { return NULL; + } if ((tmp = strchr(result_num, '/'))) { *tmp++ = '\0'; @@ -167,8 +168,9 @@ static int speech_score(struct ast_channel *chan, const char *cmd, char *data, struct ast_speech *speech = find_speech(chan); char tmp[128] = ""; - if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) + if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) { return -1; + } snprintf(tmp, sizeof(tmp), "%d", result->score); @@ -178,65 +180,69 @@ static int speech_score(struct ast_channel *chan, const char *cmd, char *data, } static struct ast_custom_function speech_score_function = { - .name = "SPEECH_SCORE", - .synopsis = "Gets the confidence score of a result.", - .syntax = "SPEECH_SCORE([nbest number/]result number)", - .desc = - "Gets the confidence score of a result.\n", - .read = speech_score, - .write = NULL, + .name = "SPEECH_SCORE", + .synopsis = "Gets the confidence score of a result.", + .syntax = "SPEECH_SCORE([nbest number/]result number)", + .desc = + "Gets the confidence score of a result.\n", + .read = speech_score, + .write = NULL, }; /*! \brief SPEECH_TEXT() Dialplan Function */ static int speech_text(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) { - struct ast_speech_result *result = NULL; - struct ast_speech *speech = find_speech(chan); + struct ast_speech_result *result = NULL; + struct ast_speech *speech = find_speech(chan); - if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) - return -1; + if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) { + return -1; + } - if (result->text != NULL) + if (result->text != NULL) { ast_copy_string(buf, result->text, len); + } - return 0; + return 0; } static struct ast_custom_function speech_text_function = { - .name = "SPEECH_TEXT", - .synopsis = "Gets the recognized text of a result.", - .syntax = "SPEECH_TEXT([nbest number/]result number)", - .desc = - "Gets the recognized text of a result.\n", - .read = speech_text, - .write = NULL, + .name = "SPEECH_TEXT", + .synopsis = "Gets the recognized text of a result.", + .syntax = "SPEECH_TEXT([nbest number/]result number)", + .desc = + "Gets the recognized text of a result.\n", + .read = speech_text, + .write = NULL, }; /*! \brief SPEECH_GRAMMAR() Dialplan Function */ static int speech_grammar(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) { - struct ast_speech_result *result = NULL; - struct ast_speech *speech = find_speech(chan); + struct ast_speech_result *result = NULL; + struct ast_speech *speech = find_speech(chan); - if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) - return -1; + if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) { + return -1; + } - if (result->grammar != NULL) + if (result->grammar != NULL) { ast_copy_string(buf, result->grammar, len); + } - return 0; + return 0; } static struct ast_custom_function speech_grammar_function = { - .name = "SPEECH_GRAMMAR", - .synopsis = "Gets the matched grammar of a result if available.", - .syntax = "SPEECH_GRAMMAR([nbest number/]result number)", - .desc = - "Gets the matched grammar of a result if available.\n", - .read = speech_grammar, - .write = NULL, + .name = "SPEECH_GRAMMAR", + .synopsis = "Gets the matched grammar of a result if available.", + .syntax = "SPEECH_GRAMMAR([nbest number/]result number)", + .desc = + "Gets the matched grammar of a result if available.\n", + .read = speech_grammar, + .write = NULL, }; /*! \brief SPEECH_ENGINE() Dialplan Function */ @@ -244,8 +250,9 @@ static int speech_engine_write(struct ast_channel *chan, const char *cmd, char * { struct ast_speech *speech = find_speech(chan); - if (data == NULL || speech == NULL) + if (data == NULL || speech == NULL) { return -1; + } ast_speech_change(speech, data, value); @@ -329,16 +336,16 @@ static int speech_read(struct ast_channel *chan, const char *cmd, char *data, } static struct ast_custom_function speech_function = { - .name = "SPEECH", - .synopsis = "Gets information about speech recognition results.", - .syntax = "SPEECH(argument)", - .desc = + .name = "SPEECH", + .synopsis = "Gets information about speech recognition results.", + .syntax = "SPEECH(argument)", + .desc = "Gets information about speech recognition results.\n" "status: Returns 1 upon speech object existing, or 0 if not\n" "spoke: Returns 1 if spoker spoke, or 0 if not\n" "results: Returns number of results that were recognized\n", - .read = speech_read, - .write = NULL, + .read = speech_read, + .write = NULL, }; @@ -645,14 +652,14 @@ static int speech_background(struct ast_channel *chan, void *data) if (!strlen(dtmf)) { if (chan->stream == NULL) { if (speech->processing_sound != NULL) { - if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound,"none")) { + if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) { speech_streamfile(chan, speech->processing_sound, chan->language); } } } else if (chan->streamid == -1 && chan->timingfunc == NULL) { ast_stopstream(chan); if (speech->processing_sound != NULL) { - if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound,"none")) { + if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) { speech_streamfile(chan, speech->processing_sound, chan->language); } } diff --git a/apps/app_waitforring.c b/apps/app_waitforring.c index b4248fee9..f2d21e516 100644 --- a/apps/app_waitforring.c +++ b/apps/app_waitforring.c @@ -53,12 +53,12 @@ static int waitforring_exec(struct ast_channel *chan, void *data) int ms; if (!data || (sscanf(data, "%lg", &s) != 1)) { - ast_log(LOG_WARNING, "WaitForRing requires an argument (minimum seconds)\n"); + ast_log(LOG_WARNING, "WaitForRing requires an argument (minimum seconds)\n"); return 0; } - ms = s*1000.0; - while(ms > 0) { + ms = s * 1000.0; + while (ms > 0) { ms = ast_waitfor(chan, ms); if (ms < 0) { res = ms; diff --git a/apps/app_zapscan.c b/apps/app_zapscan.c index 5367d99d1..2f46f52dd 100644 --- a/apps/app_zapscan.c +++ b/apps/app_zapscan.c @@ -66,21 +66,22 @@ static char *descrip = static struct ast_channel *get_zap_channel_locked(int num) { char name[80]; - snprintf(name,sizeof(name),"Zap/%d-1",num); + snprintf(name, sizeof(name), "Zap/%d-1", num); return ast_get_channel_by_name_locked(name); } static int careful_write(int fd, unsigned char *data, int len) { int res; - while(len) { + while (len) { res = write(fd, data, len); if (res < 1) { if (errno != EAGAIN) { ast_log(LOG_WARNING, "Failed to write audio data to conference: %s\n", strerror(errno)); return -1; - } else + } else { return 0; + } } len -= res; data += res; @@ -104,7 +105,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags) int origfd; int ret = -1; char input[4]; - int ic=0; + int ic = 0; ZT_BUFFERINFO bi; char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET]; @@ -136,7 +137,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags) if (flags < 0) { ast_log(LOG_WARNING, "Unable to get flags: %s\n", strerror(errno)); close(fd); - goto outrun; + goto outrun; } if (fcntl(fd, F_SETFL, flags | O_NONBLOCK)) { ast_log(LOG_WARNING, "Unable to set flags: %s\n", strerror(errno)); @@ -154,7 +155,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags) close(fd); goto outrun; } - nfds = 1; + nfds = 1; } else { /* XXX Make sure we're not running on a pseudo channel XXX */ fd = chan->fds[0]; @@ -162,118 +163,119 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags) } memset(&ztc, 0, sizeof(ztc)); /* Check to see if we're in a conference... */ - ztc.chan = 0; - if (ioctl(fd, ZT_GETCONF, &ztc)) { - ast_log(LOG_WARNING, "Error getting conference\n"); - close(fd); - goto outrun; - } - if (ztc.confmode) { - /* Whoa, already in a conference... Retry... */ - if (!retryzap) { - ast_debug(1, "Zap channel is in a conference already, retrying with pseudo\n"); - retryzap = 1; + ztc.chan = 0; + if (ioctl(fd, ZT_GETCONF, &ztc)) { + ast_log(LOG_WARNING, "Error getting conference\n"); + close(fd); + goto outrun; + } + if (ztc.confmode) { + /* Whoa, already in a conference... Retry... */ + if (!retryzap) { + ast_debug(1, "Zap channel is in a conference already, retrying with pseudo\n"); + retryzap = 1; + goto zapretry; + } + } + memset(&ztc, 0, sizeof(ztc)); + /* Add us to the conference */ + ztc.chan = 0; + ztc.confno = confno; + ztc.confmode = ZT_CONF_MONITORBOTH; + + if (ioctl(fd, ZT_SETCONF, &ztc)) { + ast_log(LOG_WARNING, "Error setting conference\n"); + close(fd); + goto outrun; + } + ast_debug(1, "Placed channel %s in ZAP channel %d monitor\n", chan->name, confno); + + for (;;) { + outfd = -1; + ms = -1; + c = ast_waitfor_nandfds(&chan, 1, &fd, nfds, NULL, &outfd, &ms); + if (c) { + if (c->fds[0] != origfd) { + if (retryzap) { + /* Kill old pseudo */ + close(fd); + } + ast_debug(1, "Ooh, something swapped out under us, starting over\n"); + retryzap = 0; goto zapretry; } - } - memset(&ztc, 0, sizeof(ztc)); - /* Add us to the conference */ - ztc.chan = 0; - ztc.confno = confno; - ztc.confmode = ZT_CONF_MONITORBOTH; - - if (ioctl(fd, ZT_SETCONF, &ztc)) { - ast_log(LOG_WARNING, "Error setting conference\n"); - close(fd); - goto outrun; - } - ast_debug(1, "Placed channel %s in ZAP channel %d monitor\n", chan->name, confno); - - for(;;) { - outfd = -1; - ms = -1; - c = ast_waitfor_nandfds(&chan, 1, &fd, nfds, NULL, &outfd, &ms); - if (c) { - if (c->fds[0] != origfd) { - if (retryzap) { - /* Kill old pseudo */ - close(fd); - } - ast_debug(1, "Ooh, something swapped out under us, starting over\n"); - retryzap = 0; - goto zapretry; + f = ast_read(c); + if (!f) { + break; + } + if (f->frametype == AST_FRAME_DTMF) { + if (f->subclass == '#') { + ret = 0; + break; + } else if (f->subclass == '*') { + ret = -1; + break; + } else { + input[ic++] = f->subclass; } - f = ast_read(c); - if (!f) + if (ic == 3) { + input[ic++] = '\0'; + ic = 0; + ret = atoi(input); + ast_verb(3, "Zapscan: change channel to %d\n", ret); break; - if(f->frametype == AST_FRAME_DTMF) { - if(f->subclass == '#') { - ret = 0; - break; - } - else if (f->subclass == '*') { - ret = -1; - break; - - } - else { - input[ic++] = f->subclass; - } - if(ic == 3) { - input[ic++] = '\0'; - ic=0; - ret = atoi(input); - ast_verb(3, "Zapscan: change channel to %d\n",ret); - break; - } } - - if (fd != chan->fds[0]) { - if (f->frametype == AST_FRAME_VOICE) { - if (f->subclass == AST_FORMAT_ULAW) { - /* Carefully write */ - careful_write(fd, f->data, f->datalen); - } else - ast_log(LOG_WARNING, "Huh? Got a non-ulaw (%d) frame in the conference\n", f->subclass); + } + + if (fd != chan->fds[0]) { + if (f->frametype == AST_FRAME_VOICE) { + if (f->subclass == AST_FORMAT_ULAW) { + /* Carefully write */ + careful_write(fd, f->data, f->datalen); + } else { + ast_log(LOG_WARNING, "Huh? Got a non-ulaw (%d) frame in the conference\n", f->subclass); } } - ast_frfree(f); - } else if (outfd > -1) { - res = read(outfd, buf, CONF_SIZE); - if (res > 0) { - memset(&fr, 0, sizeof(fr)); - fr.frametype = AST_FRAME_VOICE; - fr.subclass = AST_FORMAT_ULAW; - fr.datalen = res; - fr.samples = res; - fr.data = buf; - fr.offset = AST_FRIENDLY_OFFSET; - if (ast_write(chan, &fr) < 0) { - ast_log(LOG_WARNING, "Unable to write frame to channel: %s\n", strerror(errno)); - /* break; */ - } - } else - ast_log(LOG_WARNING, "Failed to read frame: %s\n", strerror(errno)); } - } - if (f) + ast_frfree(f); + } else if (outfd > -1) { + res = read(outfd, buf, CONF_SIZE); + if (res > 0) { + memset(&fr, 0, sizeof(fr)); + fr.frametype = AST_FRAME_VOICE; + fr.subclass = AST_FORMAT_ULAW; + fr.datalen = res; + fr.samples = res; + fr.data = buf; + fr.offset = AST_FRIENDLY_OFFSET; + if (ast_write(chan, &fr) < 0) { + ast_log(LOG_WARNING, "Unable to write frame to channel: %s\n", strerror(errno)); + /* break; */ + } + } else { + ast_log(LOG_WARNING, "Failed to read frame: %s\n", strerror(errno)); + } + } + } + if (f) { ast_frfree(f); - if (fd != chan->fds[0]) - close(fd); - else { - /* Take out of conference */ - /* Add us to the conference */ - ztc.chan = 0; - ztc.confno = 0; - ztc.confmode = 0; - if (ioctl(fd, ZT_SETCONF, &ztc)) { - ast_log(LOG_WARNING, "Error setting conference\n"); - } - } - + } + if (fd != chan->fds[0]) { + close(fd); + } else { + /* Take out of conference */ + /* Add us to the conference */ + ztc.chan = 0; + ztc.confno = 0; + ztc.confmode = 0; + if (ioctl(fd, ZT_SETCONF, &ztc)) { + ast_log(LOG_WARNING, "Error setting conference\n"); + } + } + outrun: - - return ret; + + return ret; } static int conf_exec(struct ast_channel *chan, void *data) @@ -282,16 +284,16 @@ static int conf_exec(struct ast_channel *chan, void *data) int confflags = 0; int confno = 0; char confstr[80] = "", *tmp = NULL; - struct ast_channel *tempchan = NULL, *lastchan = NULL,*ichan = NULL; + struct ast_channel *tempchan = NULL, *lastchan = NULL, *ichan = NULL; struct ast_frame *f; char *desired_group; - int input=0,search_group=0; - + int input = 0, search_group = 0; + if (chan->_state != AST_STATE_UP) ast_answer(chan); - + desired_group = ast_strdupa(data); - if(!ast_strlen_zero(desired_group)) { + if (!ast_strlen_zero(desired_group)) { ast_verb(3, "Scanning for group %s\n", desired_group); search_group = 1; } @@ -299,7 +301,7 @@ static int conf_exec(struct ast_channel *chan, void *data) for (;;) { if (ast_waitfor(chan, 100) < 0) break; - + f = ast_read(chan); if (!f) break; @@ -313,15 +315,16 @@ static int conf_exec(struct ast_channel *chan, void *data) ichan = get_zap_channel_locked(input); input = 0; } - + tempchan = ichan ? ichan : ast_channel_walk_locked(tempchan); - - if ( !tempchan && !lastchan ) + + if (!tempchan && !lastchan) { break; - + } + if (tempchan && search_group) { const char *mygroup; - if((mygroup = pbx_builtin_getvar_helper(tempchan, "GROUP")) && (!strcmp(mygroup, desired_group))) { + if ((mygroup = pbx_builtin_getvar_helper(tempchan, "GROUP")) && (!strcmp(mygroup, desired_group))) { ast_verb(3, "Found Matching Channel %s in group %s\n", tempchan->name, desired_group); } else { ast_channel_unlock(tempchan); @@ -329,21 +332,24 @@ static int conf_exec(struct ast_channel *chan, void *data) continue; } } - if (tempchan && (!strcmp(tempchan->tech->type, "Zap")) && (tempchan != chan) ) { + if (tempchan && (!strcmp(tempchan->tech->type, "Zap")) && (tempchan != chan)) { ast_verb(3, "Zap channel %s is in-use, monitoring...\n", tempchan->name); ast_copy_string(confstr, tempchan->name, sizeof(confstr)); ast_channel_unlock(tempchan); - if ((tmp = strchr(confstr,'-'))) { + if ((tmp = strchr(confstr, '-'))) { *tmp = '\0'; } - confno = atoi(strchr(confstr,'/') + 1); + confno = atoi(strchr(confstr, '/') + 1); ast_stopstream(chan); ast_say_number(chan, confno, AST_DIGIT_ANY, chan->language, (char *) NULL); res = conf_run(chan, confno, confflags); - if (res<0) break; + if (res < 0) { + break; + } input = res; - } else if (tempchan) + } else if (tempchan) { ast_channel_unlock(tempchan); + } lastchan = tempchan; } return res; |