aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-26 15:49:18 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-26 15:49:18 +0000
commit4f3c4dc7f238b64a21172be86266311c9c645c77 (patch)
treede4bd130dafa592858306d2ac6bcc5f85fd51cc8 /main
parent07772bc9e3ef6636a3e99e07d2aea3a06988f0c9 (diff)
Do a massive conversion for using the ast_verb() macro
(closes issue #10277, patches by mvanbaak) Basically, this changes ... if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3, "Something\n"); to ... ast_verb(3, "Something\n"); git-svn-id: http://svn.digium.com/svn/asterisk/trunk@77299 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/abstract_jb.c6
-rw-r--r--main/app.c46
-rw-r--r--main/cdr.c3
-rw-r--r--main/channel.c16
-rw-r--r--main/config.c24
-rw-r--r--main/dial.c48
-rw-r--r--main/dnsmgr.c16
-rw-r--r--main/file.c13
-rw-r--r--main/image.c7
-rw-r--r--main/indications.c9
-rw-r--r--main/loader.c12
-rw-r--r--main/manager.c31
-rw-r--r--main/rtp.c9
-rw-r--r--main/say.c4
-rw-r--r--main/srv.c3
-rw-r--r--main/translate.c10
-rw-r--r--main/udptl.c6
17 files changed, 91 insertions, 172 deletions
diff --git a/main/abstract_jb.c b/main/abstract_jb.c
index 64c7f77ab..e108aa92c 100644
--- a/main/abstract_jb.c
+++ b/main/abstract_jb.c
@@ -511,8 +511,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
now, frr->ts, frr->len);
}
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "%s jitterbuffer created on channel %s\n", jbimpl->name, chan->name);
+ ast_verb(3, "%s jitterbuffer created on channel %s\n", jbimpl->name, chan->name);
/* Free the frame if it has not been queued in the jb */
if (res != JB_IMPL_OK)
@@ -545,8 +544,7 @@ void ast_jb_destroy(struct ast_channel *chan)
ast_clear_flag(jb, JB_CREATED);
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "%s jitterbuffer destroyed on channel %s\n", jbimpl->name, chan->name);
+ ast_verb(3, "%s jitterbuffer destroyed on channel %s\n", jbimpl->name, chan->name);
}
}
diff --git a/main/app.c b/main/app.c
index f46cb9b9a..41bbe1c50 100644
--- a/main/app.c
+++ b/main/app.c
@@ -205,8 +205,8 @@ int ast_app_has_voicemail(const char *mailbox, const char *folder)
if (ast_has_voicemail_func)
return ast_has_voicemail_func(mailbox, folder);
- if ((option_verbose > 2) && !warned) {
- ast_verbose(VERBOSE_PREFIX_3 "Message check requested for mailbox %s/folder %s but voicemail not loaded.\n", mailbox, folder ? folder : "INBOX");
+ if (!warned) {
+ ast_verb(3, "Message check requested for mailbox %s/folder %s but voicemail not loaded.\n", mailbox, folder ? folder : "INBOX");
warned++;
}
return 0;
@@ -223,9 +223,9 @@ int ast_app_inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs)
if (ast_inboxcount_func)
return ast_inboxcount_func(mailbox, newmsgs, oldmsgs);
- if (!warned && (option_verbose > 2)) {
+ if (!warned) {
warned++;
- ast_verbose(VERBOSE_PREFIX_3 "Message count requested for mailbox %s but voicemail not loaded.\n", mailbox);
+ ast_verb(3, "Message count requested for mailbox %s but voicemail not loaded.\n", mailbox);
}
return 0;
@@ -237,9 +237,9 @@ int ast_app_messagecount(const char *context, const char *mailbox, const char *f
if (ast_messagecount_func)
return ast_messagecount_func(context, mailbox, folder);
- if (!warned && (option_verbose > 2)) {
+ if (!warned) {
warned++;
- ast_verbose(VERBOSE_PREFIX_3 "Message count requested for mailbox %s@%s/%s but voicemail not loaded.\n", mailbox, context, folder);
+ ast_verb(3, "Message count requested for mailbox %s@%s/%s but voicemail not loaded.\n", mailbox, context, folder);
}
return 0;
@@ -454,13 +454,13 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file,
else if (end || offset < 0) {
if (offset == -8)
offset = 0;
- ast_verbose(VERBOSE_PREFIX_3 "ControlPlayback seek to offset %ld from end\n", offset);
+ ast_verb(3, "ControlPlayback seek to offset %ld from end\n", offset);
ast_seekstream(chan->stream, offset, SEEK_END);
end = NULL;
offset = 0;
} else if (offset) {
- ast_verbose(VERBOSE_PREFIX_3 "ControlPlayback seek to offset %ld\n", offset);
+ ast_verb(3, "ControlPlayback seek to offset %ld\n", offset);
ast_seekstream(chan->stream, offset, SEEK_SET);
offset = 0;
};
@@ -615,8 +615,7 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
end = start = time(NULL); /* pre-initialize end to be same as start in case we never get into loop */
for (x = 0; x < fmtcnt; x++) {
others[x] = ast_writefile(prepend ? prependfile : recordfile, sfmt[x], comment, O_TRUNC, 0, AST_FILE_MODE);
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "x=%d, open writing: %s format: %s, %p\n", x, prepend ? prependfile : recordfile, sfmt[x], others[x]);
+ ast_verb(3, "x=%d, open writing: %s format: %s, %p\n", x, prepend ? prependfile : recordfile, sfmt[x], others[x]);
if (!others[x])
break;
@@ -691,8 +690,7 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
if (totalsilence > maxsilence) {
/* Ended happily with silence */
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "Recording automatically stopped after a silence of %d seconds\n", totalsilence/1000);
+ ast_verb(3, "Recording automatically stopped after a silence of %d seconds\n", totalsilence/1000);
res = 'S';
outmsg = 2;
break;
@@ -709,22 +707,19 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
} else if (f->frametype == AST_FRAME_DTMF) {
if (prepend) {
/* stop recording with any digit */
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "User ended message by pressing %c\n", f->subclass);
+ ast_verb(3, "User ended message by pressing %c\n", f->subclass);
res = 't';
outmsg = 2;
break;
}
if (strchr(acceptdtmf, f->subclass)) {
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "User ended message by pressing %c\n", f->subclass);
+ ast_verb(3, "User ended message by pressing %c\n", f->subclass);
res = f->subclass;
outmsg = 2;
break;
}
if (strchr(canceldtmf, f->subclass)) {
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "User cancelled message by pressing %c\n", f->subclass);
+ ast_verb(3, "User cancelled message by pressing %c\n", f->subclass);
res = f->subclass;
outmsg = 0;
break;
@@ -733,8 +728,7 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
if (maxtime) {
end = time(NULL);
if (maxtime < (end - start)) {
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Took too long, cutting it short...\n");
+ ast_verb(3, "Took too long, cutting it short...\n");
res = 't';
outmsg = 2;
break;
@@ -743,8 +737,7 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
ast_frfree(f);
}
if (!f) {
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "User hung up\n");
+ ast_verb(3, "User hung up\n");
res = -1;
outmsg = 1;
} else {
@@ -792,8 +785,7 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
ast_closestream(others[x]);
ast_closestream(realfiles[x]);
ast_filerename(prependfile, recordfile, sfmt[x]);
- if (option_verbose > 3)
- ast_verbose(VERBOSE_PREFIX_4 "Recording Format: sfmts=%s, prependfile %s, recordfile %s\n", sfmt[x], prependfile, recordfile);
+ ast_verb(4, "Recording Format: sfmts=%s, prependfile %s, recordfile %s\n", sfmt[x], prependfile, recordfile);
ast_filedelete(prependfile, sfmt[x]);
}
}
@@ -1127,16 +1119,16 @@ int ast_record_review(struct ast_channel *chan, const char *playfile, const char
}
case '2':
/* Review */
- ast_verbose(VERBOSE_PREFIX_3 "Reviewing the recording\n");
+ ast_verb(3, "Reviewing the recording\n");
cmd = ast_stream_and_wait(chan, recordfile, AST_DIGIT_ANY);
break;
case '3':
message_exists = 0;
/* Record */
if (recorded == 1)
- ast_verbose(VERBOSE_PREFIX_3 "Re-recording\n");
+ ast_verb(3, "Re-recording\n");
else
- ast_verbose(VERBOSE_PREFIX_3 "Recording\n");
+ ast_verb(3, "Recording\n");
recorded = 1;
cmd = ast_play_and_record(chan, playfile, recordfile, maxtime, fmt, duration, silencethreshold, maxsilence, path);
if (cmd == -1) {
diff --git a/main/cdr.c b/main/cdr.c
index 9a61e0a0d..b337ededf 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -152,8 +152,7 @@ void ast_cdr_unregister(const char *name)
AST_RWLIST_TRAVERSE_SAFE_BEGIN(&be_list, i, list) {
if (!strcasecmp(name, i->name)) {
AST_RWLIST_REMOVE_CURRENT(&be_list, list);
- if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "Unregistered '%s' CDR backend\n", name);
+ ast_verb(2, "Unregistered '%s' CDR backend\n", name);
ast_free(i);
break;
}
diff --git a/main/channel.c b/main/channel.c
index 453b28736..bc47e0a60 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -435,9 +435,7 @@ int ast_channel_register(const struct ast_channel_tech *tech)
ast_debug(1, "Registered handler for '%s' (%s)\n", chan->tech->type, chan->tech->description);
- if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "Registered channel type '%s' (%s)\n", chan->tech->type,
- chan->tech->description);
+ ast_verb(2, "Registered channel type '%s' (%s)\n", chan->tech->type, chan->tech->description);
AST_RWLIST_UNLOCK(&channels);
return 0;
@@ -456,8 +454,7 @@ void ast_channel_unregister(const struct ast_channel_tech *tech)
if (chan->tech == tech) {
AST_LIST_REMOVE_CURRENT(&backends, list);
ast_free(chan);
- if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "Unregistered channel type '%s'\n", tech->type);
+ ast_verb(2, "Unregistered channel type '%s'\n", tech->type);
break;
}
}
@@ -4169,9 +4166,7 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
case AST_BRIDGE_RETRY:
continue;
default:
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Native bridging %s and %s ended\n",
- c0->name, c1->name);
+ ast_verb(3, "Native bridging %s and %s ended\n", c0->name, c1->name);
/* fallthrough */
case AST_BRIDGE_FAILED_NOWARN:
nativefailed++;
@@ -4452,10 +4447,7 @@ int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *inte
if (ast_moh_start_ptr)
return ast_moh_start_ptr(chan, mclass, interpclass);
- if (option_verbose > 2) {
- ast_verbose(VERBOSE_PREFIX_3 "Music class %s requested but no musiconhold loaded.\n",
- mclass ? mclass : (interpclass ? interpclass : "default"));
- }
+ ast_verb(3, "Music class %s requested but no musiconhold loaded.\n", mclass ? mclass : (interpclass ? interpclass : "default"));
return 0;
}
diff --git a/main/config.c b/main/config.c
index e9ba97fcc..4ce77798c 100644
--- a/main/config.c
+++ b/main/config.c
@@ -825,20 +825,16 @@ static struct ast_config *config_text_file_load(const char *database, const char
ast_log(LOG_WARNING, "'%s' is not a regular file, ignoring\n", fn);
continue;
}
- if (option_verbose > 1) {
- ast_verbose(VERBOSE_PREFIX_2 "Parsing '%s': ", fn);
+ ast_verb(2, "Parsing '%s': ", fn);
fflush(stdout);
- }
if (!(f = fopen(fn, "r"))) {
ast_debug(1, "No file to parse: %s\n", fn);
- if (option_verbose > 1)
- ast_verbose( "Not found (%s)\n", strerror(errno));
+ ast_verb(2, "Not found (%s)\n", strerror(errno));
continue;
}
count++;
ast_debug(1, "Parsing %s\n", fn);
- if (option_verbose > 1)
- ast_verbose("Found\n");
+ ast_verb(2, "Found\n");
while (!feof(f)) {
lineno++;
if (fgets(buf, sizeof(buf), f)) {
@@ -971,8 +967,7 @@ int config_text_file_save(const char *configfile, const struct ast_config *cfg,
#else
if ((f = fopen(fn, "w"))) {
#endif
- if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "Saving '%s': ", fn);
+ ast_verb(2, "Saving '%s': ", fn);
fprintf(f, ";!\n");
fprintf(f, ";! Automatically generated configuration file\n");
if (strcmp(configfile, fn))
@@ -1024,12 +1019,11 @@ int config_text_file_save(const char *configfile, const struct ast_config *cfg,
#endif
cat = cat->next;
}
- if ((option_verbose > 1) && !option_debug)
- ast_verbose("Saved\n");
+ if (!option_debug)
+ ast_verb(2, "Saved\n");
} else {
ast_debug(1, "Unable to open for writing: %s\n", fn);
- if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "Unable to write (%s)", strerror(errno));
+ ast_verb(2, "Unable to write (%s)", strerror(errno));
return -1;
}
fclose(f);
@@ -1078,9 +1072,7 @@ static int append_mapping(char *name, char *driver, char *database, char *table)
}
map->next = config_maps;
- if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "Binding %s to %s/%s/%s\n",
- map->name, map->driver, map->database, map->table ? map->table : map->name);
+ ast_verb(2, "Binding %s to %s/%s/%s\n", map->name, map->driver, map->database, map->table ? map->table : map->name);
config_maps = map;
return 0;
diff --git a/main/dial.c b/main/dial.c
index de30419ba..bde61ccb6 100644
--- a/main/dial.c
+++ b/main/dial.c
@@ -284,8 +284,7 @@ static int begin_dial(struct ast_dial *dial, struct ast_channel *chan)
channel->owner = NULL;
} else {
success++;
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Called %s\n", numsubst);
+ ast_verb(3, "Called %s\n", numsubst);
}
}
@@ -320,56 +319,47 @@ static void handle_frame(struct ast_dial *dial, struct ast_dial_channel *channel
if (fr->frametype == AST_FRAME_CONTROL) {
switch (fr->subclass) {
case AST_CONTROL_ANSWER:
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "%s answered %s\n", channel->owner->name, chan->name);
+ ast_verb(3, "%s answered %s\n", channel->owner->name, chan->name);
AST_LIST_REMOVE(&dial->channels, channel, list);
AST_LIST_INSERT_HEAD(&dial->channels, channel, list);
set_state(dial, AST_DIAL_RESULT_ANSWERED);
break;
case AST_CONTROL_BUSY:
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "%s is busy\n", channel->owner->name);
+ ast_verb(3, "%s is busy\n", channel->owner->name);
ast_hangup(channel->owner);
channel->owner = NULL;
break;
case AST_CONTROL_CONGESTION:
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "%s is circuit-busy\n", channel->owner->name);
+ ast_verb(3, "%s is circuit-busy\n", channel->owner->name);
ast_hangup(channel->owner);
channel->owner = NULL;
break;
case AST_CONTROL_RINGING:
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "%s is ringing\n", channel->owner->name);
+ ast_verb(3, "%s is ringing\n", channel->owner->name);
if (!dial->options[AST_DIAL_OPTION_MUSIC])
ast_indicate(chan, AST_CONTROL_RINGING);
set_state(dial, AST_DIAL_RESULT_RINGING);
break;
case AST_CONTROL_PROGRESS:
- if (option_verbose > 2)
- ast_verbose (VERBOSE_PREFIX_3 "%s is making progress, passing it to %s\n", channel->owner->name, chan->name);
+ ast_verb(3, "%s is making progress, passing it to %s\n", channel->owner->name, chan->name);
ast_indicate(chan, AST_CONTROL_PROGRESS);
set_state(dial, AST_DIAL_RESULT_PROGRESS);
break;
case AST_CONTROL_VIDUPDATE:
- if (option_verbose > 2)
- ast_verbose (VERBOSE_PREFIX_3 "%s requested a video update, passing it to %s\n", channel->owner->name, chan->name);
+ ast_verb(3, "%s requested a video update, passing it to %s\n", channel->owner->name, chan->name);
ast_indicate(chan, AST_CONTROL_VIDUPDATE);
break;
case AST_CONTROL_PROCEEDING:
- if (option_verbose > 2)
- ast_verbose (VERBOSE_PREFIX_3 "%s is proceeding, passing it to %s\n", channel->owner->name, chan->name);
+ ast_verb(3, "%s is proceeding, passing it to %s\n", channel->owner->name, chan->name);
ast_indicate(chan, AST_CONTROL_PROCEEDING);
set_state(dial, AST_DIAL_RESULT_PROCEEDING);
break;
case AST_CONTROL_HOLD:
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Call on %s placed on hold\n", chan->name);
+ ast_verb(3, "Call on %s placed on hold\n", chan->name);
ast_indicate(chan, AST_CONTROL_HOLD);
break;
case AST_CONTROL_UNHOLD:
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Call on %s left from hold\n", chan->name);
+ ast_verb(3, "Call on %s left from hold\n", chan->name);
ast_indicate(chan, AST_CONTROL_UNHOLD);
break;
case AST_CONTROL_OFFHOOK:
@@ -396,37 +386,31 @@ static void handle_frame_ownerless(struct ast_dial *dial, struct ast_dial_channe
switch (fr->subclass) {
case AST_CONTROL_ANSWER:
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "%s answered\n", channel->owner->name);
+ ast_verb(3, "%s answered\n", channel->owner->name);
AST_LIST_REMOVE(&dial->channels, channel, list);
AST_LIST_INSERT_HEAD(&dial->channels, channel, list);
set_state(dial, AST_DIAL_RESULT_ANSWERED);
break;
case AST_CONTROL_BUSY:
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "%s is busy\n", channel->owner->name);
+ ast_verb(3, "%s is busy\n", channel->owner->name);
ast_hangup(channel->owner);
channel->owner = NULL;
break;
case AST_CONTROL_CONGESTION:
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "%s is circuit-busy\n", channel->owner->name);
+ ast_verb(3, "%s is circuit-busy\n", channel->owner->name);
ast_hangup(channel->owner);
channel->owner = NULL;
break;
case AST_CONTROL_RINGING:
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "%s is ringing\n", channel->owner->name);
+ ast_verb(3, "%s is ringing\n", channel->owner->name);
set_state(dial, AST_DIAL_RESULT_RINGING);
break;
case AST_CONTROL_PROGRESS:
- if (option_verbose > 2)
- ast_verbose (VERBOSE_PREFIX_3 "%s is making progress\n", channel->owner->name);
+ ast_verb(3, "%s is making progress\n", channel->owner->name);
set_state(dial, AST_DIAL_RESULT_PROGRESS);
break;
case AST_CONTROL_PROCEEDING:
- if (option_verbose > 2)
- ast_verbose (VERBOSE_PREFIX_3 "%s is proceeding\n", channel->owner->name);
+ ast_verb(3, "%s is proceeding\n", channel->owner->name);
set_state(dial, AST_DIAL_RESULT_PROCEEDING);
break;
default:
diff --git a/main/dnsmgr.c b/main/dnsmgr.c
index 4270bb0c6..d3eb9a50f 100644
--- a/main/dnsmgr.c
+++ b/main/dnsmgr.c
@@ -113,8 +113,7 @@ void ast_dnsmgr_release(struct ast_dnsmgr_entry *entry)
AST_RWLIST_WRLOCK(&entry_list);
AST_RWLIST_REMOVE(&entry_list, entry, list);
AST_RWLIST_UNLOCK(&entry_list);
- if (option_verbose > 3)
- ast_verbose(VERBOSE_PREFIX_4 "removing dns manager for '%s'\n", entry->name);
+ ast_verb(4, "removing dns manager for '%s'\n", entry->name);
ast_mutex_destroy(&entry->lock);
ast_free(entry);
@@ -131,8 +130,7 @@ int ast_dnsmgr_lookup(const char *name, struct in_addr *result, struct ast_dnsmg
if (*dnsmgr && !strcasecmp((*dnsmgr)->name, name))
return 0;
- if (option_verbose > 3)
- ast_verbose(VERBOSE_PREFIX_4 "doing dnsmgr_lookup for '%s'\n", name);
+ ast_verb(4, "doing dnsmgr_lookup for '%s'\n", name);
/* if it's actually an IP address and not a name,
there's no need for a managed lookup */
@@ -147,8 +145,7 @@ int ast_dnsmgr_lookup(const char *name, struct in_addr *result, struct ast_dnsmg
if (!enabled)
return 0;
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_2 "adding dns manager for '%s'\n", name);
+ ast_verb(3, "adding dns manager for '%s'\n", name);
*dnsmgr = ast_dnsmgr_get(name, result);
return !*dnsmgr;
}
@@ -166,8 +163,8 @@ static int dnsmgr_refresh(struct ast_dnsmgr_entry *entry, int verbose)
int changed = 0;
ast_mutex_lock(&entry->lock);
- if (verbose && (option_verbose > 2))
- ast_verbose(VERBOSE_PREFIX_2 "refreshing '%s'\n", entry->name);
+ if (verbose)
+ ast_verb(3, "refreshing '%s'\n", entry->name);
if ((hp = ast_gethostbyname(entry->name, &ahp))) {
/* check to see if it has changed, do callback if requested (where de callback is defined ????) */
@@ -232,8 +229,7 @@ static int refresh_list(void *data)
return -1;
}
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_2 "Refreshing DNS lookups.\n");
+ ast_verb(3, "Refreshing DNS lookups.\n");
AST_RWLIST_RDLOCK(info->entries);
AST_RWLIST_TRAVERSE(info->entries, entry, list) {
if (info->regex_present && regexec(&info->filter, entry->name, 0, NULL, 0))
diff --git a/main/file.c b/main/file.c
index 699df5aa9..94760b89c 100644
--- a/main/file.c
+++ b/main/file.c
@@ -97,8 +97,7 @@ int __ast_format_register(const struct ast_format *f, struct ast_module *mod)
AST_RWLIST_INSERT_HEAD(&formats, tmp, list);
AST_RWLIST_UNLOCK(&formats);
- if (option_verbose > 1)
- ast_verbose( VERBOSE_PREFIX_2 "Registered file format %s, extension(s) %s\n", f->name, f->exts);
+ ast_verb(2, "Registered file format %s, extension(s) %s\n", f->name, f->exts);
return 0;
}
@@ -119,10 +118,9 @@ int ast_format_unregister(const char *name)
AST_RWLIST_TRAVERSE_SAFE_END
AST_RWLIST_UNLOCK(&formats);
- if (!res) {
- if (option_verbose > 1)
- ast_verbose( VERBOSE_PREFIX_2 "Unregistered format %s\n", name);
- } else
+ if (!res)
+ ast_verb(2, "Unregistered format %s\n", name);
+ else
ast_log(LOG_WARNING, "Tried to unregister format %s, already unregistered\n", name);
return res;
@@ -797,8 +795,7 @@ int ast_streamfile(struct ast_channel *chan, const char *filename, const char *p
ast_playstream(fs);
if (vfs)
ast_playstream(vfs);
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "<%s> Playing '%s.%s' (language '%s')\n", chan->name, filename, ast_getformatname(chan->writeformat), preflang ? preflang : "default");
+ ast_verb(3, "<%s> Playing '%s.%s' (language '%s')\n", chan->name, filename, ast_getformatname(chan->writeformat), preflang ? preflang : "default");
return 0;
}
diff --git a/main/image.c b/main/image.c
index a0a410048..718d463a9 100644
--- a/main/image.c
+++ b/main/image.c
@@ -51,8 +51,7 @@ static AST_RWLIST_HEAD_STATIC(imagers, ast_imager);
int ast_image_register(struct ast_imager *img)
{
- if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "Registered format '%s' (%s)\n", img->name, img->desc);
+ ast_verb(2, "Registered format '%s' (%s)\n", img->name, img->desc);
AST_RWLIST_WRLOCK(&imagers);
AST_RWLIST_INSERT_HEAD(&imagers, img, list);
AST_RWLIST_UNLOCK(&imagers);
@@ -72,8 +71,8 @@ void ast_image_unregister(struct ast_imager *img)
}
AST_RWLIST_TRAVERSE_SAFE_END
AST_RWLIST_UNLOCK(&imagers);
- if (i && (option_verbose > 1))
- ast_verbose(VERBOSE_PREFIX_2 "Unregistered format '%s' (%s)\n", img->name, img->desc);
+ if (i)
+ ast_verb(2, "Unregistered format '%s' (%s)\n", img->name, img->desc);
}
int ast_supports_images(struct ast_channel *chan)
diff --git a/main/indications.c b/main/indications.c
index cc714707f..61f3328b5 100644
--- a/main/indications.c
+++ b/main/indications.c
@@ -369,8 +369,7 @@ int ast_set_indication_country(const char *country)
if (!country || !(zone = ast_get_indication_zone(country)))
return 1;
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Setting default indication country to '%s'\n", country);
+ ast_verb(3, "Setting default indication country to '%s'\n", country);
/* Protect the current tonezone using the tone_zones lock as well */
AST_RWLIST_WRLOCK(&tone_zones);
@@ -494,8 +493,7 @@ int ast_register_indication_country(struct ind_tone_zone *zone)
/* It's all over. */
AST_RWLIST_UNLOCK(&tone_zones);
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Registered indication country '%s'\n", zone->country);
+ ast_verb(3, "Registered indication country '%s'\n", zone->country);
return 0;
}
@@ -518,8 +516,7 @@ int ast_unregister_indication_country(const char *country)
}
/* Remove from the list */
AST_RWLIST_REMOVE_CURRENT(&tone_zones, list);
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Unregistered indication country '%s'\n", tz->country);
+ ast_verb(3, "Unregistered indication country '%s'\n", tz->country);
free_zone(tz);
res = 0;
}
diff --git a/main/loader.c b/main/loader.c
index 2e6457285..f3db6841c 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -583,8 +583,7 @@ int ast_module_reload(const char *name)
}
res = 2;
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Reloading module '%s' (%s)\n", cur->resource, info->description);
+ ast_verb(3, "Reloading module '%s' (%s)\n", cur->resource, info->description);
info->reload();
}
AST_LIST_UNLOCK(&module_list);
@@ -665,13 +664,11 @@ static enum ast_module_load_result load_resource(const char *resource_name, unsi
switch (res) {
case AST_MODULE_LOAD_SUCCESS:
if (!ast_fully_booted) {
- if (option_verbose)
- ast_verbose("%s => (%s)\n", resource_name, term_color(tmp, mod->info->description, COLOR_BROWN, COLOR_BLACK, sizeof(tmp)));
+ ast_verb(1, "%s => (%s)\n", resource_name, term_color(tmp, mod->info->description, COLOR_BROWN, COLOR_BLACK, sizeof(tmp)));
if (ast_opt_console && !option_verbose)
ast_verbose( ".");
} else {
- if (option_verbose)
- ast_verbose(VERBOSE_PREFIX_1 "Loaded %s => (%s)\n", resource_name, mod->info->description);
+ ast_verb(1, "Loaded %s => (%s)\n", resource_name, mod->info->description);
}
mod->flags.running = 1;
@@ -742,8 +739,7 @@ int load_modules(unsigned int preload_only)
/* all embedded modules have registered themselves by now */
embedding = 0;
- if (option_verbose)
- ast_verbose("Asterisk Dynamic Loader Starting:\n");
+ ast_verb(1, "Asterisk Dynamic Loader Starting:\n");
AST_LIST_HEAD_INIT_NOLOCK(&load_order);
diff --git a/main/manager.c b/main/manager.c
index 6f0997519..9bddd4872 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1482,11 +1482,8 @@ static int action_login(struct mansession *s, const struct message *m)
return -1;
}
s->authenticated = 1;
- if (option_verbose > 1) {
- if (manager_displayconnects(s)) {
- ast_verbose(VERBOSE_PREFIX_2 "%sManager '%s' logged on from %s\n", (s->managerid ? "HTTP " : ""), s->username, ast_inet_ntoa(s->sin.sin_addr));
- }
- }
+ if (manager_displayconnects(s))
+ ast_verb(2, "%sManager '%s' logged on from %s\n", (s->managerid ? "HTTP " : ""), s->username, ast_inet_ntoa(s->sin.sin_addr));
ast_log(LOG_EVENT, "%sManager '%s' logged on from %s\n", (s->managerid ? "HTTP " : ""), s->username, ast_inet_ntoa(s->sin.sin_addr));
astman_send_ack(s, m, "Authentication accepted");
return 0;
@@ -2526,16 +2523,12 @@ static void *session_do(void *data)
}
/* session is over, explain why and terminate */
if (s->authenticated) {
- if (option_verbose > 1) {
if (manager_displayconnects(s))
- ast_verbose(VERBOSE_PREFIX_2 "Manager '%s' logged off from %s\n", s->username, ast_inet_ntoa(s->sin.sin_addr));
- }
+ ast_verb(2, "Manager '%s' logged off from %s\n", s->username, ast_inet_ntoa(s->sin.sin_addr));
ast_log(LOG_EVENT, "Manager '%s' logged off from %s\n", s->username, ast_inet_ntoa(s->sin.sin_addr));
} else {
- if (option_verbose > 1) {
if (displayconnects)
- ast_verbose(VERBOSE_PREFIX_2 "Connect attempt from '%s' unable to authenticate\n", ast_inet_ntoa(s->sin.sin_addr));
- }
+ ast_verb(2, "Connect attempt from '%s' unable to authenticate\n", ast_inet_ntoa(s->sin.sin_addr));
ast_log(LOG_EVENT, "Failed attempt from %s\n", ast_inet_ntoa(s->sin.sin_addr));
}
destroy_session(s);
@@ -2557,7 +2550,7 @@ static void purge_sessions(int n_max)
AST_LIST_REMOVE_CURRENT(&sessions, list);
ast_atomic_fetchadd_int(&num_sessions, -1);
if (s->authenticated && (option_verbose > 1) && manager_displayconnects(s)) {
- ast_verbose(VERBOSE_PREFIX_2 "HTTP Manager '%s' timed out from %s\n",
+ ast_verb(2, "HTTP Manager '%s' timed out from %s\n",
s->username, ast_inet_ntoa(s->sin.sin_addr));
}
free_session(s); /* XXX outside ? */
@@ -2680,8 +2673,7 @@ int ast_manager_unregister(char *action)
else
first_action = cur->next;
ast_free(cur);
- if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "Manager unregistered action %s\n", action);
+ ast_verb(2, "Manager unregistered action %s\n", action);
break;
}
}
@@ -2721,8 +2713,7 @@ static int ast_manager_register_struct(struct manager_action *act)
first_action = act;
act->next = cur;
- if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "Manager registered action %s\n", act->action);
+ ast_verb(2, "Manager registered action %s\n", act->action);
ast_rwlock_unlock(&actionlock);
return 0;
}
@@ -3091,16 +3082,12 @@ static struct ast_str *generic_http_callback(enum output_format format,
if (process_message(s, &m)) {
if (s->authenticated) {
- if (option_verbose > 1) {
if (manager_displayconnects(s))
- ast_verbose(VERBOSE_PREFIX_2 "HTTP Manager '%s' logged off from %s\n", s->username, ast_inet_ntoa(s->sin.sin_addr));
- }
+ ast_verb(2, "HTTP Manager '%s' logged off from %s\n", s->username, ast_inet_ntoa(s->sin.sin_addr));
ast_log(LOG_EVENT, "HTTP Manager '%s' logged off from %s\n", s->username, ast_inet_ntoa(s->sin.sin_addr));
} else {
- if (option_verbose > 1) {
if (displayconnects)
- ast_verbose(VERBOSE_PREFIX_2 "HTTP Connect attempt from '%s' unable to authenticate\n", ast_inet_ntoa(s->sin.sin_addr));
- }
+ ast_verb(2, "HTTP Connect attempt from '%s' unable to authenticate\n", ast_inet_ntoa(s->sin.sin_addr));
ast_log(LOG_EVENT, "HTTP Failed attempt from %s\n", ast_inet_ntoa(s->sin.sin_addr));
}
s->needdestroy = 1;
diff --git a/main/rtp.c b/main/rtp.c
index 52b0dcaac..c3c7acaed 100644
--- a/main/rtp.c
+++ b/main/rtp.c
@@ -3761,12 +3761,10 @@ enum ast_bridge_result ast_rtp_bridge(struct ast_channel *c0, struct ast_channel
return AST_BRIDGE_FAILED_NOWARN;
}
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Packet2Packet bridging %s and %s\n", c0->name, c1->name);
+ ast_verb(3, "Packet2Packet bridging %s and %s\n", c0->name, c1->name);
res = bridge_p2p_loop(c0, c1, p0, p1, timeoutms, flags, fo, rc, pvt0, pvt1);
} else {
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Native bridging %s and %s\n", c0->name, c1->name);
+ ast_verb(3, "Native bridging %s and %s\n", c0->name, c1->name);
res = bridge_native_loop(c0, c1, p0, p1, vp0, vp1, tp0, tp1, pr0, pr1, codec0, codec1, timeoutms, flags, fo, rc, pvt0, pvt1);
}
@@ -4046,8 +4044,7 @@ int ast_rtp_reload(void)
rtpstart = 5000;
rtpend = 31000;
}
- if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "RTP Allocating from port range %d -> %d\n", rtpstart, rtpend);
+ ast_verb(2, "RTP Allocating from port range %d -> %d\n", rtpstart, rtpend);
return 0;
}
diff --git a/main/say.c b/main/say.c
index 85fa93abc..3ad8e7327 100644
--- a/main/say.c
+++ b/main/say.c
@@ -1234,7 +1234,7 @@ static int ast_say_number_full_he(struct ast_channel *chan, int num,
int state = 0; /* no need to save anything */
int mf = 1; /* +1 = Masculin; -1 = Feminin */
char fn[SAY_NUM_BUF_SIZE] = "";
- ast_verbose(VERBOSE_PREFIX_3 "ast_say_digits_full: started. "
+ ast_verb(3, "ast_say_digits_full: started. "
"num: %d, options=\"%s\"\n",
num, options
);
@@ -1253,7 +1253,7 @@ static int ast_say_number_full_he(struct ast_channel *chan, int num,
* state==0 is the normal mode and it means that we continue
* to check if the number num has yet anything left.
*/
- ast_verbose(VERBOSE_PREFIX_3 "ast_say_digits_full: num: %d, "
+ ast_verb(3, "ast_say_digits_full: num: %d, "
"state=%d, options=\"%s\", mf=%d\n",
num, state, options, mf
);
diff --git a/main/srv.c b/main/srv.c
index 7cf072cda..4fe85a070 100644
--- a/main/srv.c
+++ b/main/srv.c
@@ -82,8 +82,7 @@ static int parse_srv(char *host, int hostlen, int *portno, unsigned char *answer
return -1;
}
if (res && strcmp(repl, ".")) {
- if (option_verbose > 3)
- ast_verbose( VERBOSE_PREFIX_3 "parse_srv: SRV mapped to host %s, port %d\n", repl, ntohs(srv->portnum));
+ ast_verb(3, "parse_srv: SRV mapped to host %s, port %d\n", repl, ntohs(srv->portnum));
if (host) {
ast_copy_string(host, repl, hostlen);
host[hostlen-1] = '\0';
diff --git a/main/translate.c b/main/translate.c
index 49ac519be..3f9ffd764 100644
--- a/main/translate.c
+++ b/main/translate.c
@@ -573,6 +573,7 @@ int __ast_register_translator(struct ast_translator *t, struct ast_module *mod)
{
static int added_cli = 0;
struct ast_translator *u;
+ char tmp[80];
if (!mod) {
ast_log(LOG_WARNING, "Missing module pointer, you need to supply one\n");
@@ -626,13 +627,9 @@ int __ast_register_translator(struct ast_translator *t, struct ast_module *mod)
calc_cost(t, 1);
- if (option_verbose > 1) {
- char tmp[80];
-
- ast_verbose(VERBOSE_PREFIX_2 "Registered translator '%s' from format %s to %s, cost %d\n",
+ ast_verb(2, "Registered translator '%s' from format %s to %s, cost %d\n",
term_color(tmp, t->name, COLOR_MAGENTA, COLOR_BLACK, sizeof(tmp)),
ast_getformatname(1 << t->srcfmt), ast_getformatname(1 << t->dstfmt), t->cost);
- }
if (!added_cli) {
ast_cli_register_multiple(cli_translate, sizeof(cli_translate) / sizeof(struct ast_cli_entry));
@@ -676,8 +673,7 @@ int ast_unregister_translator(struct ast_translator *t)
AST_RWLIST_TRAVERSE_SAFE_BEGIN(&translators, u, list) {
if (u == t) {
AST_RWLIST_REMOVE_CURRENT(&translators, list);
- if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "Unregistered translator '%s' from format %s to %s\n", term_color(tmp, t->name, COLOR_MAGENTA, COLOR_BLACK, sizeof(tmp)), ast_getformatname(1 << t->srcfmt), ast_getformatname(1 << t->dstfmt));
+ ast_verb(2, "Unregistered translator '%s' from format %s to %s\n", term_color(tmp, t->name, COLOR_MAGENTA, COLOR_BLACK, sizeof(tmp)), ast_getformatname(1 << t->srcfmt), ast_getformatname(1 << t->dstfmt));
found = 1;
break;
}
diff --git a/main/udptl.c b/main/udptl.c
index 75edfcabd..2385679a8 100644
--- a/main/udptl.c
+++ b/main/udptl.c
@@ -702,8 +702,7 @@ struct ast_frame *ast_udptl_read(struct ast_udptl *udptl)
}
if (udptl_debug_test_addr(&sin)) {
- if (option_verbose)
- ast_verbose("Got UDPTL packet from %s:%d (type %d, seq %d, len %d)\n",
+ ast_verb(1, "Got UDPTL packet from %s:%d (type %d, seq %d, len %d)\n",
ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), 0, seqno, res);
}
#if 0
@@ -1256,8 +1255,7 @@ void ast_udptl_reload(void)
udptlstart = 4500;
udptlend = 4999;
}
- if (option_verbose > 1)
- ast_verbose(VERBOSE_PREFIX_2 "UDPTL allocating from port range %d -> %d\n", udptlstart, udptlend);
+ ast_verb(2, "UDPTL allocating from port range %d -> %d\n", udptlstart, udptlend);
}
void ast_udptl_init(void)