From fe9821cc1066c5233eda63b5d747096f41e8a24c Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Tue, 5 Feb 2008 23:00:15 +0000 Subject: Get rid of any remaining ast_verbose calls in the code in favor of ast_verb (closes issue #11934) Reported by: mvanbaak Patches: 20080205_astverb-2.diff.txt uploaded by mvanbaak (license 7) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@102525 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_alarmreceiver.c | 37 +++++++++++++------------------------ apps/app_dial.c | 6 ++---- apps/app_dumpchan.c | 4 ++-- apps/app_followme.c | 6 ++---- apps/app_minivm.c | 10 ++++------ apps/app_privacy.c | 8 +++----- apps/app_zapras.c | 17 +++++++---------- 7 files changed, 33 insertions(+), 55 deletions(-) (limited to 'apps') diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c index c4fa81109..02a985a9a 100644 --- a/apps/app_alarmreceiver.c +++ b/apps/app_alarmreceiver.c @@ -121,15 +121,14 @@ static void database_increment( char *key ) sscanf(value, "%u", &v); v++; - if(option_verbose >= 4) - ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: New value for %s: %u\n", key, v); + ast_verb(4, "AlarmReceiver: New value for %s: %u\n", key, v); snprintf(value, sizeof(value), "%u", v); res = ast_db_put(db_family, key, value); - if((res)&&(option_verbose >= 4)) - ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: database_increment write error\n"); + if (res) + ast_verb(4, "AlarmReceiver: database_increment write error\n"); return; } @@ -240,8 +239,7 @@ static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int /* if outa time, leave */ if (ast_tvdiff_ms(ast_tvnow(), lastdigittime) > ((i > 0) ? sdto : fdto)){ - if(option_verbose >= 4) - ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: DTMF Digit Timeout on %s\n", chan->name); + ast_verb(4, "AlarmReceiver: DTMF Digit Timeout on %s\n", chan->name); ast_debug(1,"AlarmReceiver: DTMF timeout on chan %s\n",chan->name); @@ -342,8 +340,7 @@ static int write_metadata( FILE *logfile, char *signalling_type, struct ast_chan res = fprintf(logfile, "[events]\n\n"); if(res < 0){ - if (option_verbose >= 3 ) - ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: can't write metadata\n"); + ast_verb(3, "AlarmReceiver: can't write metadata\n"); ast_debug(1,"AlarmReceiver: can't write metadata\n"); } @@ -394,8 +391,7 @@ static int log_events(struct ast_channel *chan, char *signalling_type, event_no fd = mkstemp(workstring); if(fd == -1) { - if (option_verbose >= 3) - ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: can't make temporary file\n"); + ast_verb(3, "AlarmReceiver: can't make temporary file\n"); ast_debug(1,"AlarmReceiver: can't make temporary file\n"); res = -1; } @@ -451,8 +447,7 @@ static int receive_ademco_contact_id( struct ast_channel *chan, void *data, int /* Wait for first event */ - if(option_verbose >= 4) - ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: Waiting for first event from panel\n"); + ast_verb(4, "AlarmReceiver: Waiting for first event from panel\n"); while(res >= 0){ @@ -461,8 +456,7 @@ static int receive_ademco_contact_id( struct ast_channel *chan, void *data, int /* Send ACK tone sequence */ - if(option_verbose >= 4) - ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: Sending 1400Hz 100ms burst (ACK)\n"); + ast_verb(4, "AlarmReceiver: Sending 1400Hz 100ms burst (ACK)\n"); res = send_tone_burst(chan, 1400.0, 100, tldn); @@ -471,8 +465,7 @@ static int receive_ademco_contact_id( struct ast_channel *chan, void *data, int res = ast_safe_sleep(chan, 100); if(!res){ - if(option_verbose >= 4) - ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: Sending 2300Hz 100ms burst (ACK)\n"); + ast_verb(4, "AlarmReceiver: Sending 2300Hz 100ms burst (ACK)\n"); res = send_tone_burst(chan, 2300.0, 100, tldn); } @@ -489,22 +482,19 @@ static int receive_ademco_contact_id( struct ast_channel *chan, void *data, int database_increment("no-events-received"); else{ if(ack_retries){ - if(option_verbose >= 4) - ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: ACK retries during this call: %d\n", ack_retries); + ast_verb(4, "AlarmReceiver: ACK retries during this call: %d\n", ack_retries); database_increment("ack-retries"); } } - if(option_verbose >= 4) - ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: App exiting...\n"); + ast_verb(4, "AlarmReceiver: App exiting...\n"); res = -1; break; } if(res != 0){ /* Didn't get all of the digits */ - if(option_verbose >= 2) - ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: Incomplete string: %s, trying again...\n", event); + ast_verb(2, "AlarmReceiver: Incomplete string: %s, trying again...\n", event); if(!got_some_digits){ got_some_digits = (!ast_strlen_zero(event)) ? 1 : 0; @@ -716,8 +706,7 @@ static int load_config(void) if(!cfg){ - if(option_verbose >= 4) - ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: No config file\n"); + ast_verb(4, "AlarmReceiver: No config file\n"); return 0; } else{ diff --git a/apps/app_dial.c b/apps/app_dial.c index 39886a11b..8cc91c141 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -1770,13 +1770,11 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags peer->whentohangup = time(NULL) + calldurationlimit; } if (!ast_strlen_zero(dtmfcalled)) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Sending DTMF '%s' to the called party.\n", dtmfcalled); + ast_verb(3, "Sending DTMF '%s' to the called party.\n", dtmfcalled); res = ast_dtmf_stream(peer, chan, dtmfcalled, 250, 0); } if (!ast_strlen_zero(dtmfcalling)) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Sending DTMF '%s' to the calling party.\n", dtmfcalling); + ast_verb(3, "Sending DTMF '%s' to the calling party.\n", dtmfcalling); res = ast_dtmf_stream(chan, peer, dtmfcalling, 250, 0); } } diff --git a/apps/app_dumpchan.c b/apps/app_dumpchan.c index 48fb6215d..649c57a9e 100644 --- a/apps/app_dumpchan.c +++ b/apps/app_dumpchan.c @@ -141,8 +141,8 @@ static int dumpchan_exec(struct ast_channel *chan, void *data) pbx_builtin_serialize_variables(chan, &vars); serialize_showchan(chan, info, sizeof(info)); - if (option_verbose >= level) - ast_verbose("\nDumping Info For Channel: %s:\n%s\nInfo:\n%s\nVariables:\n%s%s\n", chan->name, line, info, vars->str, line); + if (level > 0) + ast_verb(level, "\nDumping Info For Channel: %s:\n%s\nInfo:\n%s\nVariables:\n%s%s\n", chan->name, line, info, vars->str, line); return 0; } diff --git a/apps/app_followme.c b/apps/app_followme.c index 2586637fa..c3c0d88a4 100644 --- a/apps/app_followme.c +++ b/apps/app_followme.c @@ -609,8 +609,7 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us if (f->frametype == AST_FRAME_CONTROL) { switch(f->subclass) { case AST_CONTROL_HANGUP: - if (option_verbose > 2) - ast_verb(3, "%s received a hangup frame.\n", winner->name); + ast_verb(3, "%s received a hangup frame.\n", winner->name); if (dg == 0) { ast_verb(3, "The calling channel hungup. Need to drop everyone else.\n"); clear_calling_tree(findme_user_list); @@ -618,8 +617,7 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us } break; case AST_CONTROL_ANSWER: - if (option_verbose > 2) - ast_verb(3, "%s answered %s\n", winner->name, caller->name); + ast_verb(3, "%s answered %s\n", winner->name, caller->name); /* If call has been answered, then the eventual hangup is likely to be normal hangup */ winner->hangupcause = AST_CAUSE_NORMAL_CLEARING; caller->hangupcause = AST_CAUSE_NORMAL_CLEARING; diff --git a/apps/app_minivm.c b/apps/app_minivm.c index 77497fb19..148ebf494 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -1263,12 +1263,10 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re case '3': message_exists = 0; /* Record */ - if (option_verbose > 2) { - if (recorded == 1) - ast_verb(3, "Re-recording the message\n"); - else - ast_verb(3, "Recording the message\n"); - } + if (recorded == 1) + ast_verb(3, "Re-recording the message\n"); + else + ast_verb(3, "Recording the message\n"); if (recorded && outsidecaller) cmd = ast_play_and_wait(chan, "beep"); recorded = 1; diff --git a/apps/app_privacy.c b/apps/app_privacy.c index dacfd704c..e8e0f4d1c 100644 --- a/apps/app_privacy.c +++ b/apps/app_privacy.c @@ -76,8 +76,7 @@ static int privacy_exec (struct ast_channel *chan, void *data) ); if (!ast_strlen_zero(chan->cid.cid_num)) { - if (option_verbose > 2) - ast_verbose (VERBOSE_PREFIX_3 "CallerID Present: Skipping\n"); + ast_verb(3, "CallerID Present: Skipping\n"); } else { /*Answer the channel if it is not already*/ if (chan->_state != AST_STATE_UP) { @@ -148,9 +147,8 @@ static int privacy_exec (struct ast_channel *chan, void *data) */ chan->cid.cid_pres &= (AST_PRES_UNAVAILABLE ^ 0xFF); - if (option_verbose > 2) { - ast_verbose (VERBOSE_PREFIX_3 "Changed Caller*ID to %s, callerpres to %d\n",phone,chan->cid.cid_pres); - } + ast_verb(3, "Changed Caller*ID to %s, callerpres to %d\n",phone,chan->cid.cid_pres); + pbx_builtin_setvar_helper(chan, "PRIVACYMGRSTATUS", "SUCCESS"); } else { pbx_builtin_setvar_helper(chan, "PRIVACYMGRSTATUS", "FAILED"); diff --git a/apps/app_zapras.c b/apps/app_zapras.c index 480e5f643..31f208d22 100644 --- a/apps/app_zapras.c +++ b/apps/app_zapras.c @@ -165,16 +165,13 @@ static void run_ras(struct ast_channel *chan, char *args) if (res < 0) { ast_log(LOG_WARNING, "wait4 returned %d: %s\n", res, strerror(errno)); } - if (option_verbose > 2) { - if (WIFEXITED(status)) { - ast_verbose(VERBOSE_PREFIX_3 "RAS on %s terminated with status %d\n", chan->name, WEXITSTATUS(status)); - } else if (WIFSIGNALED(status)) { - ast_verbose(VERBOSE_PREFIX_3 "RAS on %s terminated with signal %d\n", - chan->name, WTERMSIG(status)); - } else { - ast_verbose(VERBOSE_PREFIX_3 "RAS on %s terminated weirdly.\n", chan->name); - } - } + if (WIFEXITED(status)) + ast_verb(3, "RAS on %s terminated with status %d\n", chan->name, WEXITSTATUS(status)); + else if (WIFSIGNALED(status)) + ast_verb(3, "RAS on %s terminated with signal %d\n", chan->name, WTERMSIG(status)); + else + ast_verbose(VERBOSE_PREFIX_3 "RAS on %s terminated weirdly.\n", chan->name); + /* Throw back into audio mode */ x = 1; ioctl(chan->fds[0], ZT_AUDIOMODE, &x); -- cgit v1.2.3