diff options
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_agent.c | 35 | ||||
-rw-r--r-- | channels/chan_alsa.c | 6 | ||||
-rw-r--r-- | channels/chan_h323.c | 29 | ||||
-rw-r--r-- | channels/chan_iax2.c | 81 | ||||
-rw-r--r-- | channels/chan_mgcp.c | 178 | ||||
-rw-r--r-- | channels/chan_misdn.c | 8 | ||||
-rw-r--r-- | channels/chan_oss.c | 9 | ||||
-rw-r--r-- | channels/chan_phone.c | 3 | ||||
-rw-r--r-- | channels/chan_sip.c | 31 | ||||
-rw-r--r-- | channels/chan_skinny.c | 49 | ||||
-rw-r--r-- | channels/chan_vpb.cc | 432 | ||||
-rw-r--r-- | channels/chan_zap.c | 223 | ||||
-rw-r--r-- | channels/iax2-provision.c | 3 |
13 files changed, 378 insertions, 709 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c index 54840c534..6b3db5c93 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -458,8 +458,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast) case AST_FRAME_CONTROL: if (f->subclass == AST_CONTROL_ANSWER) { if (p->ackcall) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "%s answered, waiting for '#' to acknowledge\n", p->chan->name); + ast_verb(3, "%s answered, waiting for '#' to acknowledge\n", p->chan->name); /* Don't pass answer along */ ast_frfree(f); f = &ast_null_frame; @@ -475,8 +474,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast) case AST_FRAME_DTMF_BEGIN: case AST_FRAME_DTMF_END: if (!p->acknowledged && (f->subclass == '#')) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "%s acknowledged\n", p->chan->name); + ast_verb(3, "%s acknowledged\n", p->chan->name); p->acknowledged = 1; ast_frfree(f); f = &answer_frame; @@ -628,8 +626,7 @@ static int agent_call(struct ast_channel *ast, char *dest, int timeout) } else if (!ast_strlen_zero(p->loginchan)) { time(&p->start); /* Call on this agent */ - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "outgoing agentcall, to agent '%s', on '%s'\n", p->agent, p->chan->name); + ast_verb(3, "outgoing agentcall, to agent '%s', on '%s'\n", p->agent, p->chan->name); ast_set_callerid(p->chan, ast->cid.cid_num, ast->cid.cid_name, NULL); ast_channel_inherit_variables(ast, p->chan); @@ -638,7 +635,7 @@ static int agent_call(struct ast_channel *ast, char *dest, int timeout) ast_mutex_unlock(&p->lock); return res; } - ast_verbose( VERBOSE_PREFIX_3 "agent_call, call to agent '%s' call on '%s'\n", p->agent, p->chan->name); + ast_verb(3, "agent_call, call to agent '%s' call on '%s'\n", p->agent, p->chan->name); ast_debug(3, "Playing beep, lang '%s'\n", p->chan->language); res = ast_streamfile(p->chan, beep, p->chan->language); ast_debug(3, "Played beep, result '%d'\n", res); @@ -1748,8 +1745,7 @@ static int login_exec(struct ast_channel *chan, void *data) if (max_login_tries < 0) max_login_tries = 0; tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTMAXLOGINTRIES"); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTMAXLOGINTRIES=%s, setting max_login_tries to: %d on Channel '%s'.\n",tmpoptions,max_login_tries,chan->name); + ast_verb(3, "Saw variable AGENTMAXLOGINTRIES=%s, setting max_login_tries to: %d on Channel '%s'.\n",tmpoptions,max_login_tries,chan->name); } if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTUPDATECDR"))) { if (ast_true(pbx_builtin_getvar_helper(chan, "AGENTUPDATECDR"))) @@ -1757,14 +1753,12 @@ static int login_exec(struct ast_channel *chan, void *data) else update_cdr = 0; tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTUPDATECDR"); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTUPDATECDR=%s, setting update_cdr to: %d on Channel '%s'.\n",tmpoptions,update_cdr,chan->name); + ast_verb(3, "Saw variable AGENTUPDATECDR=%s, setting update_cdr to: %d on Channel '%s'.\n",tmpoptions,update_cdr,chan->name); } if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTGOODBYE"))) { strcpy(agent_goodbye, pbx_builtin_getvar_helper(chan, "AGENTGOODBYE")); tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTGOODBYE"); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTGOODBYE=%s, setting agent_goodbye to: %s on Channel '%s'.\n",tmpoptions,agent_goodbye,chan->name); + ast_verb(3, "Saw variable AGENTGOODBYE=%s, setting agent_goodbye to: %s on Channel '%s'.\n",tmpoptions,agent_goodbye,chan->name); } /* End Channel Specific Login Overrides */ @@ -1824,24 +1818,21 @@ static int login_exec(struct ast_channel *chan, void *data) else p->ackcall = 0; tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTACKCALL"); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTACKCALL=%s, setting ackcall to: %d for Agent '%s'.\n",tmpoptions,p->ackcall,p->agent); + ast_verb(3, "Saw variable AGENTACKCALL=%s, setting ackcall to: %d for Agent '%s'.\n",tmpoptions,p->ackcall,p->agent); } if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTAUTOLOGOFF"))) { p->autologoff = atoi(pbx_builtin_getvar_helper(chan, "AGENTAUTOLOGOFF")); if (p->autologoff < 0) p->autologoff = 0; tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTAUTOLOGOFF"); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTAUTOLOGOFF=%s, setting autologff to: %d for Agent '%s'.\n",tmpoptions,p->autologoff,p->agent); + ast_verb(3, "Saw variable AGENTAUTOLOGOFF=%s, setting autologff to: %d for Agent '%s'.\n",tmpoptions,p->autologoff,p->agent); } if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTWRAPUPTIME"))) { p->wrapuptime = atoi(pbx_builtin_getvar_helper(chan, "AGENTWRAPUPTIME")); if (p->wrapuptime < 0) p->wrapuptime = 0; tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTWRAPUPTIME"); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Saw variable AGENTWRAPUPTIME=%s, setting wrapuptime to: %d for Agent '%s'.\n",tmpoptions,p->wrapuptime,p->agent); + ast_verb(3, "Saw variable AGENTWRAPUPTIME=%s, setting wrapuptime to: %d for Agent '%s'.\n",tmpoptions,p->wrapuptime,p->agent); } /* End Channel Specific Agent Overrides */ if (!p->chan) { @@ -1887,8 +1878,7 @@ static int login_exec(struct ast_channel *chan, void *data) if (update_cdr && chan->cdr) snprintf(chan->cdr->channel, sizeof(chan->cdr->channel), "Agent/%s", p->agent); ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGIN", "%s", chan->name); - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "Agent '%s' logged in (format %s/%s)\n", p->agent, + ast_verb(2, "Agent '%s' logged in (format %s/%s)\n", p->agent, ast_getformatname(chan->readformat), ast_getformatname(chan->writeformat)); /* Login this channel and wait for it to go away */ p->chan = chan; @@ -1963,8 +1953,7 @@ static int login_exec(struct ast_channel *chan, void *data) "Uniqueid: %s\r\n", p->agent, logintime, chan->uniqueid); ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGOFF", "%s|%ld", chan->name, logintime); - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "Agent '%s' logged out\n", p->agent); + ast_verb(2, "Agent '%s' logged out\n", p->agent); /* If there is no owner, go ahead and kill it now */ ast_device_state_changed("Agent/%s", p->agent); if (p->dead && !p->owner) { diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c index de8f3ffef..d3decea05 100644 --- a/channels/chan_alsa.c +++ b/channels/chan_alsa.c @@ -1124,10 +1124,8 @@ static int load_module(void) } if (soundcard_init() < 0) { - if (option_verbose > 1) { - ast_verbose(VERBOSE_PREFIX_2 "No sound card detected -- console channel will be unavailable\n"); - ast_verbose(VERBOSE_PREFIX_2 "Turn off ALSA support by adding 'noload=chan_alsa.so' in /etc/asterisk/modules.conf\n"); - } + ast_verb(2, "No sound card detected -- console channel will be unavailable\n"); + ast_verb(2, "Turn off ALSA support by adding 'noload=chan_alsa.so' in /etc/asterisk/modules.conf\n"); return AST_MODULE_LOAD_DECLINE; } diff --git a/channels/chan_h323.c b/channels/chan_h323.c index d43fc7728..4e38a4eb5 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -656,8 +656,7 @@ static int oh323_call(struct ast_channel *c, char *dest, int timeout) /* indicate that this is an outgoing call */ pvt->outgoing = 1; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Requested transfer capability: 0x%.2x - %s\n", c->transfercapability, ast_transfercapability2str(c->transfercapability)); + ast_verb(3, "Requested transfer capability: 0x%.2x - %s\n", c->transfercapability, ast_transfercapability2str(c->transfercapability)); if (h323debug) ast_debug(1, "Placing outgoing call to %s, %d/%d\n", called_addr, pvt->options.dtmfcodec[0], pvt->options.dtmfcodec[1]); ast_mutex_unlock(&pvt->lock); @@ -2139,15 +2138,15 @@ static call_options_t *setup_incoming_call(call_details_t *cd) pvt->jointcapability = pvt->options.capability; if (h323debug) { - ast_verbose(VERBOSE_PREFIX_3 "Setting up Call\n"); - ast_verbose(VERBOSE_PREFIX_3 " \tCall token: [%s]\n", pvt->cd.call_token); - ast_verbose(VERBOSE_PREFIX_3 " \tCalling party name: [%s]\n", pvt->cd.call_source_name); - ast_verbose(VERBOSE_PREFIX_3 " \tCalling party number: [%s]\n", pvt->cd.call_source_e164); - ast_verbose(VERBOSE_PREFIX_3 " \tCalled party name: [%s]\n", pvt->cd.call_dest_alias); - ast_verbose(VERBOSE_PREFIX_3 " \tCalled party number: [%s]\n", pvt->cd.call_dest_e164); + ast_verb(3, "Setting up Call\n"); + ast_verb(3, " \tCall token: [%s]\n", pvt->cd.call_token); + ast_verb(3, " \tCalling party name: [%s]\n", pvt->cd.call_source_name); + ast_verb(3, " \tCalling party number: [%s]\n", pvt->cd.call_source_e164); + ast_verb(3, " \tCalled party name: [%s]\n", pvt->cd.call_dest_alias); + ast_verb(3, " \tCalled party number: [%s]\n", pvt->cd.call_dest_e164); if (pvt->cd.redirect_reason >= 0) - ast_verbose(VERBOSE_PREFIX_3 " \tRedirecting party number: [%s] (reason %d)\n", pvt->cd.redirect_number, pvt->cd.redirect_reason); - ast_verbose(VERBOSE_PREFIX_3 " \tCalling party IP: [%s]\n", pvt->cd.sourceIp); + ast_verb(3, " \tRedirecting party number: [%s] (reason %d)\n", pvt->cd.redirect_number, pvt->cd.redirect_reason); + ast_verb(3, " \tCalling party IP: [%s]\n", pvt->cd.sourceIp); } /* Decide if we are allowing Gatekeeper routed calls*/ @@ -2540,9 +2539,7 @@ static void *do_monitor(void *data) h323_reloading = 0; ast_mutex_unlock(&h323_reload_lock); if (reloading) { - if (option_verbose > 0) { - ast_verbose(VERBOSE_PREFIX_1 "Reloading H.323\n"); - } + ast_verb(1, "Reloading H.323\n"); h323_do_reload(); } /* Check for interfaces needing to be killed */ @@ -2691,9 +2688,9 @@ static int h323_ep_hangup(int fd, int argc, char *argv[]) return RESULT_SHOWUSAGE; } if (h323_soft_hangup(argv[2])) { - ast_verbose(VERBOSE_PREFIX_3 "Hangup succeeded on %s\n", argv[2]); + ast_verb(3, "Hangup succeeded on %s\n", argv[2]); } else { - ast_verbose(VERBOSE_PREFIX_3 "Hangup failed for %s\n", argv[2]); + ast_verb(3, "Hangup failed for %s\n", argv[2]); } return RESULT_SUCCESS; } @@ -2922,7 +2919,7 @@ static int reload_config(int is_reload) gkroute = ast_true(v->value); } else if (!strcasecmp(v->name, "context")) { ast_copy_string(default_context, v->value, sizeof(default_context)); - ast_verbose(VERBOSE_PREFIX_2 "Setting default context to %s\n", default_context); + ast_verb(2, "Setting default context to %s\n", default_context); } else if (!strcasecmp(v->name, "UserByAlias")) { userbyalias = ast_true(v->value); } else if (!strcasecmp(v->name, "AcceptAnonymous")) { diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index dc77f1d7c..1af356539 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -1736,8 +1736,7 @@ static void reload_firmware(void) if (de->d_name[0] != '.') { snprintf(fn, sizeof(fn), "%s/%s", dir, de->d_name); if (!try_firmware(fn)) { - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "Loaded firmware '%s'\n", de->d_name); + ast_verb(2, "Loaded firmware '%s'\n", de->d_name); } } } @@ -3223,8 +3222,7 @@ static int iax2_hangup(struct ast_channel *c) } } ast_mutex_unlock(&iaxsl[callno]); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Hungup '%s'\n", c->name); + ast_verb(3, "Hungup '%s'\n", c->name); return 0; } @@ -3333,8 +3331,7 @@ static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_cha for (/* ever */;;) { /* Check in case we got masqueraded into */ if ((c0->tech != &iax2_tech) || (c1->tech != &iax2_tech)) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Can't masquerade, we're different...\n"); + ast_verb(3, "Can't masquerade, we're different...\n"); /* Remove from native mode */ if (c0->tech == &iax2_tech) { ast_mutex_lock(&iaxsl[callno0]); @@ -3349,13 +3346,11 @@ static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_cha return AST_BRIDGE_FAILED_NOWARN; } if (c0->nativeformats != c1->nativeformats) { - if (option_verbose > 2) { char buf0[255]; char buf1[255]; ast_getformatname_multiple(buf0, sizeof(buf0) -1, c0->nativeformats); ast_getformatname_multiple(buf1, sizeof(buf1) -1, c1->nativeformats); - ast_verbose(VERBOSE_PREFIX_3 "Operating with different codecs %d[%s] %d[%s] , can't native bridge...\n", c0->nativeformats, buf0, c1->nativeformats, buf1); - } + ast_verb(3, "Operating with different codecs %d[%s] %d[%s] , can't native bridge...\n", c0->nativeformats, buf0, c1->nativeformats, buf1); /* Remove from native mode */ lock_both(callno0, callno1); if (iaxs[callno0]) @@ -5772,7 +5767,6 @@ static int iax2_ack_registry(struct iax_ies *ies, struct sockaddr_in *sin, int c ast_sched_del(sched, reg->expire); reg->expire = ast_sched_add(sched, (5 * reg->refresh / 6) * 1000, iax2_do_register_s, reg); if (inaddrcmp(&oldus, ®->us) || (reg->messages != oldmsgs)) { - if (option_verbose > 2) { if (reg->messages > 255) snprintf(msgstatus, sizeof(msgstatus), " with %d new and %d old messages waiting", reg->messages & 0xff, reg->messages >> 8); else if (reg->messages > 1) @@ -5782,8 +5776,7 @@ static int iax2_ack_registry(struct iax_ies *ies, struct sockaddr_in *sin, int c else snprintf(msgstatus, sizeof(msgstatus), " with no messages waiting\n"); snprintf(ourip, sizeof(ourip), "%s:%d", ast_inet_ntoa(reg->us.sin_addr), ntohs(reg->us.sin_port)); - ast_verbose(VERBOSE_PREFIX_3 "Registered IAX2 to '%s', who sees us as %s%s\n", ast_inet_ntoa(sin->sin_addr), ourip, msgstatus); - } + ast_verb(3, "Registered IAX2 to '%s', who sees us as %s%s\n", ast_inet_ntoa(sin->sin_addr), ourip, msgstatus); manager_event(EVENT_FLAG_SYSTEM, "Registry", "ChannelType: IAX2\r\nDomain: %s\r\nStatus: Registered\r\n", ast_inet_ntoa(sin->sin_addr)); } reg->regstate = REG_STATE_REGISTERED; @@ -5942,8 +5935,7 @@ static void reg_source_db(struct iax2_peer *p) if (d) { *d = '\0'; d++; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Seeding '%s' at %s:%d for %d\n", p->name, + ast_verb(3, "Seeding '%s' at %s:%d for %d\n", p->name, ast_inet_ntoa(in), atoi(c), atoi(d)); iax2_poke_peer(p, 0); p->expiry = atoi(d); @@ -5999,15 +5991,13 @@ static int update_registry(const char *name, struct sockaddr_in *sin, int callno snprintf(data, sizeof(data), "%s:%d:%d", ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port), p->expiry); if (!ast_test_flag(p, IAX_TEMPONLY) && sin->sin_addr.s_addr) { ast_db_put("IAX/Registry", p->name, data); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Registered IAX2 '%s' (%s) at %s:%d\n", p->name, + ast_verb(3, "Registered IAX2 '%s' (%s) at %s:%d\n", p->name, ast_test_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED) ? "AUTHENTICATED" : "UNAUTHENTICATED", ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port)); manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: IAX2/%s\r\nPeerStatus: Registered\r\n", p->name); register_peer_exten(p, 1); ast_device_state_changed("IAX2/%s", p->name); /* Activate notification */ } else if (!ast_test_flag(p, IAX_TEMPONLY)) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Unregistered IAX2 '%s' (%s)\n", p->name, + ast_verb(3, "Unregistered IAX2 '%s' (%s)\n", p->name, ast_test_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED) ? "AUTHENTICATED" : "UNAUTHENTICATED"); manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: IAX2/%s\r\nPeerStatus: Unregistered\r\n", p->name); register_peer_exten(p, 0); @@ -7578,8 +7568,7 @@ retryowner: send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACCEPT, 0, ied1.buf, ied1.pos, -1); if (strcmp(iaxs[fr->callno]->exten, "TBD")) { ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Accepting UNAUTHENTICATED call from %s:\n" + ast_verb(3, "Accepting UNAUTHENTICATED call from %s:\n" "%srequested format = %s,\n" "%srequested prefs = %s,\n" "%sactual format = %s,\n" @@ -7602,8 +7591,7 @@ retryowner: } else { ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_TBD); /* If this is a TBD call, we're ready but now what... */ - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Accepted unauthenticated TBD call from %s\n", ast_inet_ntoa(sin.sin_addr)); + ast_verb(3, "Accepted unauthenticated TBD call from %s\n", ast_inet_ntoa(sin.sin_addr)); } } } @@ -7701,8 +7689,7 @@ retryowner: else iaxs[fr->callno]->peerformat = iaxs[fr->callno]->capability; } - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Call accepted by %s (format %s)\n", ast_inet_ntoa(iaxs[fr->callno]->addr.sin_addr), ast_getformatname(iaxs[fr->callno]->peerformat)); + ast_verb(3, "Call accepted by %s (format %s)\n", ast_inet_ntoa(iaxs[fr->callno]->addr.sin_addr), ast_getformatname(iaxs[fr->callno]->peerformat)); if (!(iaxs[fr->callno]->peerformat & iaxs[fr->callno]->capability)) { memset(&ied0, 0, sizeof(ied0)); iax_ie_append_str(&ied0, IAX_IE_CAUSE, "Unable to negotiate codec"); @@ -7715,8 +7702,7 @@ retryowner: if (iaxs[fr->callno]->owner) { /* Switch us to use a compatible format */ iaxs[fr->callno]->owner->nativeformats = iaxs[fr->callno]->peerformat; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Format for call is %s\n", ast_getformatname(iaxs[fr->callno]->owner->nativeformats)); + ast_verb(3, "Format for call is %s\n", ast_getformatname(iaxs[fr->callno]->owner->nativeformats)); retryowner2: if (ast_mutex_trylock(&iaxs[fr->callno]->owner->lock)) { ast_mutex_unlock(&iaxsl[fr->callno]); @@ -7957,8 +7943,7 @@ retryowner2: send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACCEPT, 0, ied1.buf, ied1.pos, -1); if (strcmp(iaxs[fr->callno]->exten, "TBD")) { ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Accepting AUTHENTICATED call from %s:\n" + ast_verb(3, "Accepting AUTHENTICATED call from %s:\n" "%srequested format = %s,\n" "%srequested prefs = %s,\n" "%sactual format = %s,\n" @@ -8016,8 +8001,7 @@ retryowner2: } else { ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_TBD); /* If this is a TBD call, we're ready but now what... */ - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Accepted AUTHENTICATED TBD call from %s\n", ast_inet_ntoa(sin.sin_addr)); + ast_verb(3, "Accepted AUTHENTICATED TBD call from %s\n", ast_inet_ntoa(sin.sin_addr)); } } } @@ -8035,8 +8019,7 @@ retryowner2: send_command_final(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_REJECT, 0, ied0.buf, ied0.pos, -1); } else { ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Accepting DIAL from %s, formats = 0x%x\n", ast_inet_ntoa(sin.sin_addr), iaxs[fr->callno]->peerformat); + ast_verb(3, "Accepting DIAL from %s, formats = 0x%x\n", ast_inet_ntoa(sin.sin_addr), iaxs[fr->callno]->peerformat); ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED); send_command(iaxs[fr->callno], AST_FRAME_CONTROL, AST_CONTROL_PROGRESS, 0, NULL, 0, -1); if (!(c = ast_iax2_new(fr->callno, AST_STATE_RING, iaxs[fr->callno]->peerformat))) @@ -8141,8 +8124,7 @@ retryowner2: break; case IAX_COMMAND_TXREJ: iaxs[fr->callno]->transferring = 0; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Channel '%s' unable to transfer\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>"); + ast_verb(3, "Channel '%s' unable to transfer\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>"); memset(&iaxs[fr->callno]->transfer, 0, sizeof(iaxs[fr->callno]->transfer)); if (iaxs[fr->callno]->bridgecallno) { if (iaxs[iaxs[fr->callno]->bridgecallno]->transferring) { @@ -8158,15 +8140,13 @@ retryowner2: iaxs[fr->callno]->transferring = TRANSFER_MREADY; else iaxs[fr->callno]->transferring = TRANSFER_READY; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Channel '%s' ready to transfer\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>"); + ast_verb(3, "Channel '%s' ready to transfer\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>"); if (iaxs[fr->callno]->bridgecallno) { if ((iaxs[iaxs[fr->callno]->bridgecallno]->transferring == TRANSFER_READY) || (iaxs[iaxs[fr->callno]->bridgecallno]->transferring == TRANSFER_MREADY)) { /* They're both ready, now release them. */ if (iaxs[fr->callno]->transferring == TRANSFER_MREADY) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Attempting media bridge of %s and %s\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>", + ast_verb(3, "Attempting media bridge of %s and %s\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>", iaxs[iaxs[fr->callno]->bridgecallno]->owner ? iaxs[iaxs[fr->callno]->bridgecallno]->owner->name : "<Unknown>"); iaxs[iaxs[fr->callno]->bridgecallno]->transferring = TRANSFER_MEDIA; @@ -8179,8 +8159,7 @@ retryowner2: send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXMEDIA, 0, ied0.buf, ied0.pos, -1); send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXMEDIA, 0, ied1.buf, ied1.pos, -1); } else { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Releasing %s and %s\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>", + ast_verb(3, "Releasing %s and %s\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>", iaxs[iaxs[fr->callno]->bridgecallno]->owner ? iaxs[iaxs[fr->callno]->bridgecallno]->owner->name : "<Unknown>"); iaxs[iaxs[fr->callno]->bridgecallno]->transferring = TRANSFER_RELEASED; @@ -8604,8 +8583,7 @@ static int iax2_prov_app(struct ast_channel *chan, void *data) return -1; } res = iax2_provision(&iaxs[callno]->addr, iaxs[callno]->sockfd, NULL, sdata, force); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Provisioned IAXY at '%s' with '%s'= %d\n", + ast_verb(3, "Provisioned IAXY at '%s' with '%s'= %d\n", ast_inet_ntoa(iaxs[callno]->addr.sin_addr), sdata, res); return res; @@ -8923,8 +8901,7 @@ static int start_network_thread(void) } ast_pthread_create_background(&schedthreadid, NULL, sched_thread, NULL); ast_pthread_create_background(&netthreadid, NULL, network_thread, NULL); - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "%d helper threaads started\n", threadcount); + ast_verb(2, "%d helper threaads started\n", threadcount); return 0; } @@ -9764,12 +9741,10 @@ static int set_config(char *config_file, int reload) if (!(ns = ast_netsock_bind(netsock, io, v->value, portno, tos, cos, socket_read, NULL))) { ast_log(LOG_WARNING, "Unable apply binding to '%s' at line %d\n", v->value, v->lineno); } else { - if (option_verbose > 1) { if (strchr(v->value, ':')) - ast_verbose(VERBOSE_PREFIX_2 "Binding IAX2 to '%s'\n", v->value); + ast_verb(2, "Binding IAX2 to '%s'\n", v->value); else - ast_verbose(VERBOSE_PREFIX_2 "Binding IAX2 to '%s:%d'\n", v->value, portno); - } + ast_verb(2, "Binding IAX2 to '%s:%d'\n", v->value, portno); if (defaultsockfd < 0) defaultsockfd = ast_netsock_sockfd(ns); ast_netsock_unref(ns); @@ -9904,8 +9879,7 @@ static int set_config(char *config_file, int reload) if (!(ns = ast_netsock_bind(netsock, io, "0.0.0.0", portno, tos, cos, socket_read, NULL))) { ast_log(LOG_ERROR, "Unable to create network socket: %s\n", strerror(errno)); } else { - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "Binding IAX2 to default address 0.0.0.0:%d\n", portno); + ast_verb(2, "Binding IAX2 to default address 0.0.0.0:%d\n", portno); defaultsockfd = ast_netsock_sockfd(ns); ast_netsock_unref(ns); } @@ -10367,8 +10341,7 @@ static int iax2_exec(struct ast_channel *chan, const char *context, const char * } else { snprintf(req, sizeof(req), "IAX2/%s/%s", odata, exten); } - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Executing Dial('%s')\n", req); + ast_verb(3, "Executing Dial('%s')\n", req); } else { AST_LIST_UNLOCK(&dpcache); ast_log(LOG_WARNING, "Can't execute nonexistent extension '%s[@%s]' in data '%s'\n", exten, context, data); @@ -10957,8 +10930,8 @@ static int load_module(void) ast_log(LOG_ERROR, "Unable to start network thread\n"); __unload_module(); return AST_MODULE_LOAD_FAILURE; - } else if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "IAX Ready and Listening\n"); + } else + ast_verb(2, "IAX Ready and Listening\n"); AST_LIST_LOCK(®istrations); AST_LIST_TRAVERSE(®istrations, reg, entry) diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 76744cc10..2490cb1c0 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -854,7 +854,7 @@ static int mgcp_call(struct ast_channel *ast, char *dest, int timeout) struct ast_var_t *current; if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_call(%s)\n", ast->name); + ast_verb(3, "MGCP mgcp_call(%s)\n", ast->name); } sub = ast->tech_pvt; p = sub->parent; @@ -872,12 +872,12 @@ static int mgcp_call(struct ast_channel *ast, char *dest, int timeout) if (!ast_strlen_zero(distinctive_ring)) { snprintf(tone, sizeof(tone), "L/wt%s", distinctive_ring); if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP distinctive callwait %s\n", tone); + ast_verb(3, "MGCP distinctive callwait %s\n", tone); } } else { snprintf(tone, sizeof(tone), "L/wt"); if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP normal callwait %s\n", tone); + ast_verb(3, "MGCP normal callwait %s\n", tone); } } break; @@ -886,12 +886,12 @@ static int mgcp_call(struct ast_channel *ast, char *dest, int timeout) if (!ast_strlen_zero(distinctive_ring)) { snprintf(tone, sizeof(tone), "L/r%s", distinctive_ring); if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP distinctive ring %s\n", tone); + ast_verb(3, "MGCP distinctive ring %s\n", tone); } } else { snprintf(tone, sizeof(tone), "L/rg"); if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP default ring\n"); + ast_verb(3, "MGCP default ring\n"); } } break; @@ -952,7 +952,7 @@ static int mgcp_hangup(struct ast_channel *ast) } ast_mutex_lock(&sub->lock); if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_hangup(%s) on %s@%s\n", ast->name, p->name, p->parent->name); + ast_verb(3, "MGCP mgcp_hangup(%s) on %s@%s\n", ast->name, p->name, p->parent->name); } if ((p->dtmfmode & MGCP_DTMF_INBAND) && p->dsp) { @@ -961,7 +961,7 @@ static int mgcp_hangup(struct ast_channel *ast) if (p->dtmfmode & MGCP_DTMF_HYBRID) p->dtmfmode &= ~MGCP_DTMF_INBAND; if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_2 "MGCP free dsp on %s@%s\n", p->name, p->parent->name); + ast_verb(2, "MGCP free dsp on %s@%s\n", p->name, p->parent->name); } ast_dsp_free(p->dsp); p->dsp = NULL; @@ -1013,19 +1013,18 @@ static int mgcp_hangup(struct ast_channel *ast) if ((p->hookstate == MGCP_ONHOOK) && (!sub->next->rtp)) { p->hidecallerid = 0; if (p->hascallwaiting && !p->callwaiting) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Enabling call waiting on %s\n", ast->name); + ast_verb(3, "Enabling call waiting on %s\n", ast->name); p->callwaiting = -1; } if (has_voicemail(p)) { if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_hangup(%s) on %s@%s set vmwi(+)\n", + ast_verb(3, "MGCP mgcp_hangup(%s) on %s@%s set vmwi(+)\n", ast->name, p->name, p->parent->name); } transmit_notify_request(sub, "L/vmwi(+)"); } else { if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_hangup(%s) on %s@%s set vmwi(-)\n", + ast_verb(3, "MGCP mgcp_hangup(%s) on %s@%s set vmwi(-)\n", ast->name, p->name, p->parent->name); } transmit_notify_request(sub, "L/vmwi(-)"); @@ -1192,11 +1191,8 @@ static int mgcp_answer(struct ast_channel *ast) } else { transmit_modify_request(sub); } - /* verbose level check */ - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_answer(%s) on %s@%s-%d\n", + ast_verb(3, "MGCP mgcp_answer(%s) on %s@%s-%d\n", ast->name, p->name, p->parent->name, sub->id); - } if (ast->_state != AST_STATE_UP) { ast_setstate(ast, AST_STATE_UP); ast_debug(1, "mgcp_answer(%s)\n", ast->name); @@ -1410,7 +1406,7 @@ static int mgcp_indicate(struct ast_channel *ast, int ind, const void *data, siz int res = 0; if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP asked to indicate %d '%s' condition on channel %s\n", + ast_verb(3, "MGCP asked to indicate %d '%s' condition on channel %s\n", ind, control2str(ind), ast->name); } ast_mutex_lock(&sub->lock); @@ -1508,11 +1504,8 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state) tmp = NULL; } } - /* verbose level check */ - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_new(%s) created in state: %s\n", + ast_verb(3, "MGCP mgcp_new(%s) created in state: %s\n", tmp->name, ast_state2str(state)); - } } else { ast_log(LOG_WARNING, "Unable to allocate channel structure\n"); } @@ -1640,8 +1633,7 @@ static struct mgcp_subchannel *find_subchannel_and_lock(char *name, int msgid, s memcpy(&g->addr, sin, sizeof(g->addr)); if (ast_ouraddrfor(&g->addr.sin_addr, &g->ourip)) memcpy(&g->ourip, &__ourip, sizeof(g->ourip)); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Registered MGCP gateway '%s' at %s port %d\n", g->name, ast_inet_ntoa(g->addr.sin_addr), ntohs(g->addr.sin_port)); + ast_verb(3, "Registered MGCP gateway '%s' at %s port %d\n", g->name, ast_inet_ntoa(g->addr.sin_addr), ntohs(g->addr.sin_port)); } } /* not dynamic, check if the name matches */ @@ -2177,7 +2169,7 @@ static int transmit_connect_with_sdp(struct mgcp_subchannel *sub, struct ast_rtp } } if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "Creating connection for %s@%s-%d in cxmode: %s callid: %s\n", + ast_verb(3, "Creating connection for %s@%s-%d in cxmode: %s callid: %s\n", p->name, p->parent->name, sub->id, mgcp_cxmodes[sub->cxmode], sub->callid); } reqprep(&resp, p, "CRCX"); @@ -2200,7 +2192,7 @@ static int transmit_notify_request(struct mgcp_subchannel *sub, char *tone) struct mgcp_endpoint *p = sub->parent; if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP Asked to indicate tone: %s on %s@%s-%d in cxmode: %s\n", + ast_verb(3, "MGCP Asked to indicate tone: %s on %s@%s-%d in cxmode: %s\n", tone, p->name, p->parent->name, sub->id, mgcp_cxmodes[sub->cxmode]); } ast_copy_string(p->curtone, tone, sizeof(p->curtone)); @@ -2260,7 +2252,7 @@ static int transmit_notify_request_with_callerid(struct mgcp_subchannel *sub, ch add_header(&resp, "S", tone2); } if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP Asked to indicate tone: %s on %s@%s-%d in cxmode: %s\n", + ast_verb(3, "MGCP Asked to indicate tone: %s on %s@%s-%d in cxmode: %s\n", tone2, p->name, p->parent->name, sub->id, mgcp_cxmodes[sub->cxmode]); } /* fill in new fields */ @@ -2280,7 +2272,7 @@ static int transmit_modify_request(struct mgcp_subchannel *sub) return 0; } if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "Modified %s@%s-%d with new mode: %s on callid: %s\n", + ast_verb(3, "Modified %s@%s-%d with new mode: %s on callid: %s\n", p->name, p->parent->name, sub->id, mgcp_cxmodes[sub->cxmode], sub->callid); } reqprep(&resp, p, "MDCX"); @@ -2323,7 +2315,7 @@ static int transmit_connection_del(struct mgcp_subchannel *sub) struct mgcp_request resp; if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "Delete connection %s %s@%s-%d with new mode: %s on callid: %s\n", + ast_verb(3, "Delete connection %s %s@%s-%d with new mode: %s on callid: %s\n", sub->cxident, p->name, p->parent->name, sub->id, mgcp_cxmodes[sub->cxmode], sub->callid); } reqprep(&resp, p, "DLCX"); @@ -2346,7 +2338,7 @@ static int transmit_connection_del_w_params(struct mgcp_endpoint *p, char *calli struct mgcp_request resp; if (mgcpdebug) { - ast_verbose(VERBOSE_PREFIX_3 "Delete connection %s %s@%s on callid: %s\n", + ast_verb(3, "Delete connection %s %s@%s on callid: %s\n", cxident ? cxident : "", p->name, p->parent->name, callid ? callid : ""); } reqprep(&resp, p, "DLCX"); @@ -2448,10 +2440,8 @@ static void handle_response(struct mgcp_endpoint *p, struct mgcp_subchannel *sub req = find_command(p, sub, &p->cmd_queue, &p->cmd_queue_lock, ident); if (!req) { - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "No command found on [%s] for transaction %d. Ignoring...\n", + ast_verb(3, "No command found on [%s] for transaction %d. Ignoring...\n", gw->name, ident); - } return; } @@ -2534,10 +2524,8 @@ static void handle_response(struct mgcp_endpoint *p, struct mgcp_subchannel *sub if (len > (sizeof(cxident) - 1)) len = sizeof(cxident) - 1; ast_copy_string(cxident, v, len); - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Non existing connection id %s on %s@%s \n", + ast_verb(3, "Non existing connection id %s on %s@%s \n", cxident, p->name, gw->name); - } transmit_connection_del_w_params(p, NULL, cxident); } } @@ -2559,11 +2547,8 @@ static void handle_response(struct mgcp_endpoint *p, struct mgcp_subchannel *sub /* update the requested events according to the new hookstate */ transmit_notify_request(p->sub, ""); - /* verbose level check */ - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Setting hookstate of %s@%s to ONHOOK\n", p->name, gw->name); + ast_verb(3, "Setting hookstate of %s@%s to ONHOOK\n", p->name, gw->name); } - } } else if (strstr(c, "hd")) { if (p->hookstate != MGCP_OFFHOOK) { p->hookstate = MGCP_OFFHOOK; @@ -2571,15 +2556,12 @@ static void handle_response(struct mgcp_endpoint *p, struct mgcp_subchannel *sub /* update the requested events according to the new hookstate */ transmit_notify_request(p->sub, ""); - /* verbose level check */ - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Setting hookstate of %s@%s to OFFHOOK\n", p->name, gw->name); + ast_verb(3, "Setting hookstate of %s@%s to OFFHOOK\n", p->name, gw->name); } } } } } - } if (resp && resp->lines) { /* do not process sdp if we are hanging up. this may be a late response */ @@ -2662,10 +2644,8 @@ static void *mgcp_ss(void *data) if (getforward) { /* Record this as the forwarding extension */ ast_copy_string(p->call_forward, p->dtmf_buf, sizeof(p->call_forward)); - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Setting call forward to '%s' on channel %s\n", + ast_verb(3, "Setting call forward to '%s' on channel %s\n", p->call_forward, chan->name); - } /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/ transmit_notify_request(sub, "L/sl"); if (res) @@ -2716,9 +2696,7 @@ static void *mgcp_ss(void *data) ast_hangup(chan); return NULL; } else if (p->hascallwaiting && p->callwaiting && !strcmp(p->dtmf_buf, "*70")) { - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Disabling call waiting on %s\n", chan->name); - } + ast_verb(3, "Disabling call waiting on %s\n", chan->name); /* Disable call waiting if enabled */ p->callwaiting = 0; /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/ @@ -2740,9 +2718,7 @@ static void *mgcp_ss(void *data) ast_hangup(chan); return NULL; } else if (!p->hidecallerid && !strcmp(p->dtmf_buf, "*67")) { - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Disabling Caller*ID on %s\n", chan->name); - } + ast_verb(3, "Disabling Caller*ID on %s\n", chan->name); /* Disable Caller*ID if enabled */ p->hidecallerid = 1; ast_set_callerid(chan, "", "", NULL); @@ -2762,9 +2738,7 @@ static void *mgcp_ss(void *data) break; } else if (!strcmp(p->dtmf_buf, "*78")) { /* Do not disturb */ - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Enabled DND on channel %s\n", chan->name); - } + ast_verb(3, "Enabled DND on channel %s\n", chan->name); /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/ transmit_notify_request(sub, "L/sl"); p->dnd = 1; @@ -2773,9 +2747,7 @@ static void *mgcp_ss(void *data) len = 0; } else if (!strcmp(p->dtmf_buf, "*79")) { /* Do not disturb */ - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Disabled DND on channel %s\n", chan->name); - } + ast_verb(3, "Disabled DND on channel %s\n", chan->name); /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/ transmit_notify_request(sub, "L/sl"); p->dnd = 0; @@ -2789,9 +2761,7 @@ static void *mgcp_ss(void *data) memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf)); len = 0; } else if (p->cancallforward && !strcmp(p->dtmf_buf, "*73")) { - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Cancelling call forwarding on channel %s\n", chan->name); - } + ast_verb(3, "Cancelling call forwarding on channel %s\n", chan->name); /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/ transmit_notify_request(sub, "L/sl"); memset(p->call_forward, 0, sizeof(p->call_forward)); @@ -2803,14 +2773,10 @@ static void *mgcp_ss(void *data) /* This is a three way call, the main call being a real channel, and we're parking the first call. */ ast_masq_park_call(ast_bridged_channel(sub->next->owner), chan, 0, NULL); - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Parking call to '%s'\n", chan->name); - } + ast_verb(3, "Parking call to '%s'\n", chan->name); break; } else if (!ast_strlen_zero(p->lastcallerid) && !strcmp(p->dtmf_buf, "*60")) { - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Blacklisting number %s\n", p->lastcallerid); - } + ast_verb(3, "Blacklisting number %s\n", p->lastcallerid); res = ast_db_put("blacklist", p->lastcallerid, "1"); if (!res) { /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/ @@ -2819,9 +2785,7 @@ static void *mgcp_ss(void *data) len = 0; } } else if (p->hidecallerid && !strcmp(p->dtmf_buf, "*82")) { - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Enabling Caller*ID on %s\n", chan->name); - } + ast_verb(3, "Enabling Caller*ID on %s\n", chan->name); /* Enable Caller*ID if enabled */ p->hidecallerid = 0; ast_set_callerid(chan, p->cid_num, p->cid_name, NULL); @@ -2921,9 +2885,7 @@ static int attempt_transfer(struct mgcp_endpoint *p) return -1; } /*swap_subs(p, SUB_THREEWAY, SUB_REAL);*/ - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Swapping %d for %d on %s@%s\n", p->sub->id, p->sub->next->id, p->name, p->parent->name); - } + ast_verb(3, "Swapping %d for %d on %s@%s\n", p->sub->id, p->sub->next->id, p->name, p->parent->name); p->sub = p->sub->next; unalloc_sub(p->sub->next); /* Tell the caller not to hangup */ @@ -3037,15 +2999,14 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req, if (!strcasecmp(req->verb, "RSIP")) { /* Test if this RSIP request is just a keepalive */ if(!strcasecmp( get_header(req, "RM"), "X-keepalive")) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Received keepalive request from %s@%s\n", p->name, p->parent->name); + ast_verb(3, "Received keepalive request from %s@%s\n", p->name, p->parent->name); transmit_response(sub, "200", req, "OK"); } else { dump_queue(p->parent, p); dump_cmd_queues(p, NULL); - if (option_verbose > 2 && (strcmp(p->name, p->parent->wcardep) != 0)) { - ast_verbose(VERBOSE_PREFIX_3 "Resetting interface %s@%s\n", p->name, p->parent->name); + if ((strcmp(p->name, p->parent->wcardep) != 0)) { + ast_verb(3, "Resetting interface %s@%s\n", p->name, p->parent->name); } /* For RSIP on wildcard we reset all endpoints */ if (!strcmp(p->name, p->parent->wcardep)) { @@ -3058,9 +3019,7 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req, /*if ((strcmp(tmp_ep->name, "*") != 0) && (strcmp(tmp_ep->name, "aaln/" "*") != 0)) {*/ if (strcmp(tmp_ep->name, g->wcardep) != 0) { struct mgcp_subchannel *tmp_sub, *first_sub; - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Resetting interface %s@%s\n", tmp_ep->name, p->parent->name); - } + ast_verb(3, "Resetting interface %s@%s\n", tmp_ep->name, p->parent->name); first_sub = tmp_ep->sub; tmp_sub = tmp_ep->sub; @@ -3116,18 +3075,14 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req, return -1; if (p->callwaiting || p->transfer || p->threewaycalling) { - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Swapping %d for %d on %s@%s\n", p->sub->id, p->sub->next->id, p->name, p->parent->name); - } + ast_verb(3, "Swapping %d for %d on %s@%s\n", p->sub->id, p->sub->next->id, p->name, p->parent->name); p->sub = p->sub->next; /* transfer control to our next subchannel */ if (!sub->next->owner) { /* plave the first call on hold and start up a new call */ sub->cxmode = MGCP_CX_MUTE; - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP Muting %d on %s@%s\n", sub->id, p->name, p->parent->name); - } + ast_verb(3, "MGCP Muting %d on %s@%s\n", sub->id, p->name, p->parent->name); transmit_modify_request(sub); if (sub->owner && ast_bridged_channel(sub->owner)) ast_queue_control(sub->owner, AST_CONTROL_HOLD); @@ -3137,10 +3092,8 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req, /* We've got two active calls lets decide whether or not to conference or just flip flop */ if ((!sub->outgoing) && (!sub->next->outgoing)) { /* We made both calls lets conferenct */ - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP Conferencing %d and %d on %s@%s\n", + ast_verb(3, "MGCP Conferencing %d and %d on %s@%s\n", sub->id, sub->next->id, p->name, p->parent->name); - } sub->cxmode = MGCP_CX_CONF; sub->next->cxmode = MGCP_CX_CONF; if (ast_bridged_channel(sub->next->owner)) @@ -3151,14 +3104,10 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req, /* Let's flipflop between calls */ /* XXX Need to check for state up ??? */ /* XXX Need a way to indicate the current call, or maybe the call that's waiting */ - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "We didn't make one of the calls FLIPFLOP %d and %d on %s@%s\n", + ast_verb(3, "We didn't make one of the calls FLIPFLOP %d and %d on %s@%s\n", sub->id, sub->next->id, p->name, p->parent->name); - } sub->cxmode = MGCP_CX_MUTE; - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP Muting %d on %s@%s\n", sub->id, p->name, p->parent->name); - } + ast_verb(3, "MGCP Muting %d on %s@%s\n", sub->id, p->name, p->parent->name); transmit_modify_request(sub); if (ast_bridged_channel(sub->owner)) ast_queue_control(sub->owner, AST_CONTROL_HOLD); @@ -3220,11 +3169,8 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req, sub->alreadygone = 1; mgcp_queue_hangup(sub); } else { - /* verbose level check */ - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP handle_request(%s@%s-%d) ast_channel already destroyed, resending DLCX.\n", + ast_verb(3, "MGCP handle_request(%s@%s-%d) ast_channel already destroyed, resending DLCX.\n", p->name, p->parent->name, sub->id); - } /* Instruct the other side to remove the connection since it apparently * * still thinks the channel is active. * * For Cisco IAD2421 /BAK/ */ @@ -3234,19 +3180,14 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req, if ((p->hookstate == MGCP_ONHOOK) && (!sub->rtp) && (!sub->next->rtp)) { p->hidecallerid = 0; if (p->hascallwaiting && !p->callwaiting) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Enabling call waiting on MGCP/%s@%s-%d\n", p->name, p->parent->name, sub->id); + ast_verb(3, "Enabling call waiting on MGCP/%s@%s-%d\n", p->name, p->parent->name, sub->id); p->callwaiting = -1; } if (has_voicemail(p)) { - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP handle_request(%s@%s) set vmwi(+)\n", p->name, p->parent->name); - } + ast_verb(3, "MGCP handle_request(%s@%s) set vmwi(+)\n", p->name, p->parent->name); transmit_notify_request(sub, "L/vmwi(+)"); } else { - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP handle_request(%s@%s) set vmwi(-)\n", p->name, p->parent->name); - } + ast_verb(3, "MGCP handle_request(%s@%s) set vmwi(-)\n", p->name, p->parent->name); transmit_notify_request(sub, "L/vmwi(-)"); } } @@ -3432,8 +3373,7 @@ static void *do_monitor(void *data) mgcp_reloading = 0; ast_mutex_unlock(&mgcp_reload_lock); if (reloading) { - if (option_verbose > 0) - ast_verbose(VERBOSE_PREFIX_1 "Reloading MGCP\n"); + ast_verb(1, "Reloading MGCP\n"); mgcp_do_reload(); /* Add an I/O event to our UDP socket */ if (mgcpsock > -1) @@ -3551,11 +3491,9 @@ static struct ast_channel *mgcp_request(const char *type, int format, void *data return NULL; } - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_request(%s)\n", tmp); - ast_verbose(VERBOSE_PREFIX_3 "MGCP cw: %d, dnd: %d, so: %d, sno: %d\n", + ast_verb(3, "MGCP mgcp_request(%s)\n", tmp); + ast_verb(3, "MGCP cw: %d, dnd: %d, so: %d, sno: %d\n", sub->parent->callwaiting, sub->parent->dnd, sub->owner ? 1 : 0, sub->next->owner ? 1: 0); - } /* Must be busy */ if (((sub->parent->callwaiting) && ((sub->owner) && (sub->next->owner))) || ((!sub->parent->callwaiting) && (sub->owner)) || @@ -3789,7 +3727,7 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) for (i = 0; i < MAX_SUBS; i++) { sub = ast_calloc(1, sizeof(*sub)); if (sub) { - ast_verbose(VERBOSE_PREFIX_3 "Allocating subchannel '%d' on %s@%s\n", i, e->name, gw->name); + ast_verb(3, "Allocating subchannel '%d' on %s@%s\n", i, e->name, gw->name); ast_mutex_init(&sub->lock); ast_mutex_init(&sub->cx_queue_lock); sub->parent = e; @@ -3856,7 +3794,7 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) ast_copy_string(e->musicclass, musicclass, sizeof(e->musicclass)); ast_copy_string(e->mailbox, mailbox, sizeof(e->mailbox)); if (!ast_strlen_zero(mailbox)) { - ast_verbose(VERBOSE_PREFIX_3 "Setting mailbox '%s' on %s@%s\n", mailbox, gw->name, e->name); + ast_verb(3, "Setting mailbox '%s' on %s@%s\n", mailbox, gw->name, e->name); } if (!ep_reload) { /* XXX potential issue due to reload */ @@ -3903,7 +3841,7 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) if (sub) { if (!ep_reload) { - ast_verbose(VERBOSE_PREFIX_3 "Allocating subchannel '%d' on %s@%s\n", i, e->name, gw->name); + ast_verb(3, "Allocating subchannel '%d' on %s@%s\n", i, e->name, gw->name); ast_mutex_init(&sub->lock); ast_mutex_init(&sub->cx_queue_lock); ast_copy_string(sub->magic, MGCP_SUBCHANNEL_MAGIC, sizeof(sub->magic)); @@ -4184,9 +4122,7 @@ static int reload_config(void) ast_mutex_lock(&gatelock); g = build_gateway(cat, ast_variable_browse(cfg, cat)); if (g) { - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "Added gateway '%s'\n", g->name); - } + ast_verb(3, "Added gateway '%s'\n", g->name); g->next = gateways; gateways = g; } @@ -4237,10 +4173,8 @@ static int reload_config(void) close(mgcpsock); mgcpsock = -1; } else { - if (option_verbose > 1) { - ast_verbose(VERBOSE_PREFIX_2 "MGCP Listening on %s:%d\n", + ast_verb(2, "MGCP Listening on %s:%d\n", ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port)); - } ast_netsock_set_qos(mgcpsock, tos, cos); } } @@ -4254,7 +4188,7 @@ static int reload_config(void) while (e && e->needaudit) { e->needaudit = 0; transmit_audit_endpoint(e); - ast_verbose(VERBOSE_PREFIX_3 "MGCP Auditing endpoint %s@%s for hookstate\n", e->name, g->name); + ast_verb(3, "MGCP Auditing endpoint %s@%s for hookstate\n", e->name, g->name); e = e->next; } g = g->next; diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index 9fac67d3e..61a4198b1 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -2506,8 +2506,7 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame misdn_cfg_get(tmp->bc->port, MISDN_CFG_FAXDETECT_CONTEXT, &context_tmp, sizeof(context_tmp)); context = ast_strlen_zero(context_tmp) ? (ast_strlen_zero(ast->macrocontext) ? ast->context : ast->macrocontext) : context_tmp; if (ast_exists_extension(ast, context, "fax", 1, ast->cid.cid_num)) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Redirecting %s to fax extension (context:%s)\n", ast->name, context); + ast_verb(3, "Redirecting %s to fax extension (context:%s)\n", ast->name, context); /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */ pbx_builtin_setvar_helper(ast,"FAXEXTEN",ast->exten); if (ast_async_goto(ast, context, "fax", 1)) @@ -2519,7 +2518,7 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame } break; case 2: - ast_verbose(VERBOSE_PREFIX_3 "Not redirecting %s to fax extension, nojump is set.\n", ast->name); + ast_verb(3, "Not redirecting %s to fax extension, nojump is set.\n", ast->name); break; } } else { @@ -2745,8 +2744,7 @@ static enum ast_bridge_result misdn_bridge (struct ast_channel *c0, misdn_lib_bridge(ch1->bc, ch2->bc); } - 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); chan_misdn_log(1, ch1->bc->port, "* Making Native Bridge between %s and %s\n", ch1->bc->oad, ch2->bc->oad); diff --git a/channels/chan_oss.c b/channels/chan_oss.c index b101ed8ff..9dc2fca86 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -710,8 +710,7 @@ static int setformat(struct chan_oss_pvt *o, int mode) /* Check to see if duplex set (FreeBSD Bug) */ res = ioctl(fd, SNDCTL_DSP_GETCAPS, &fmt); if (res == 0 && (fmt & DSP_CAP_DUPLEX)) { - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "Console is full duplex\n"); + ast_verb(2, "Console is full duplex\n"); o->duplex = M_FULL; }; break; @@ -1551,10 +1550,8 @@ static struct chan_oss_pvt *store_config(struct ast_config *cfg, char *ctg) openit: #ifdef TRYOPEN if (setformat(o, O_RDWR) < 0) { /* open device */ - if (option_verbose > 0) { - ast_verbose(VERBOSE_PREFIX_2 "Device %s not detected\n", ctg); - ast_verbose(VERBOSE_PREFIX_2 "Turn off OSS support by adding " "'noload=chan_oss.so' in /etc/asterisk/modules.conf\n"); - } + ast_verb(1, "Device %s not detected\n", ctg); + ast_verb(1, "Turn off OSS support by adding " "'noload=chan_oss.so' in /etc/asterisk/modules.conf\n"); goto error; } if (o->duplex != M_FULL) diff --git a/channels/chan_phone.c b/channels/chan_phone.c index cf68d1d7f..a3f82bb5b 100644 --- a/channels/chan_phone.c +++ b/channels/chan_phone.c @@ -382,8 +382,7 @@ static int phone_hangup(struct ast_channel *ast) memset(p->ext, 0, sizeof(p->ext)); ((struct phone_pvt *)(ast->tech_pvt))->owner = NULL; ast_module_unref(ast_module_info->self); - if (option_verbose > 2) - ast_verbose( VERBOSE_PREFIX_3 "Hungup '%s'\n", ast->name); + ast_verb(3, "Hungup '%s'\n", ast->name); ast->tech_pvt = NULL; ast_setstate(ast, AST_STATE_DOWN); restart_monitor(); diff --git a/channels/chan_sip.c b/channels/chan_sip.c index d3756577a..bbc6ea5f3 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -8601,8 +8601,7 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st peer->sipoptions = 0; peer->lastms = 0; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Unregistered SIP '%s'\n", peer->name); + ast_verb(3, "Unregistered SIP '%s'\n", peer->name); manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: SIP/%s\r\nPeerStatus: Unregistered\r\n", peer->name); return PARSE_REGISTER_UPDATE; } @@ -8659,8 +8658,7 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st /* Is this a new IP address for us? */ if (inaddrcmp(&peer->addr, &oldsin)) { sip_poke_peer(peer); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Registered SIP '%s' at %s port %d expires %d\n", peer->name, ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port), expiry); + ast_verb(3, "Registered SIP '%s' at %s port %d expires %d\n", peer->name, ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port), expiry); register_peer_exten(peer, TRUE); } @@ -8668,8 +8666,7 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st useragent = get_header(req, "User-Agent"); if (strcasecmp(useragent, peer->useragent)) { /* XXX copy if they are different ? */ ast_copy_string(peer->useragent, useragent, sizeof(peer->useragent)); - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_3 "Saved useragent \"%s\" for peer %s\n", peer->useragent, peer->name); + ast_verb(4, "Saved useragent \"%s\" for peer %s\n", peer->useragent, peer->name); } return PARSE_REGISTER_UPDATE; } @@ -9011,7 +9008,7 @@ static int cb_extensionstate(char *context, char* exten, int state, void *data) if (p->autokillid > -1) sip_cancel_destroy(p); /* Remove subscription expiry for renewals */ sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); /* Delete subscription in 32 secs */ - ast_verbose(VERBOSE_PREFIX_2 "Extension state: Watcher for hint %s %s. Notify User %s\n", exten, state == AST_EXTENSION_DEACTIVATED ? "deactivated" : "removed", p->username); + ast_verb(2, "Extension state: Watcher for hint %s %s. Notify User %s\n", exten, state == AST_EXTENSION_DEACTIVATED ? "deactivated" : "removed", p->username); p->stateid = -1; p->subscribed = NONE; append_history(p, "Subscribestatus", "%s", state == AST_EXTENSION_REMOVED ? "HintRemoved" : "Deactivated"); @@ -9023,8 +9020,7 @@ static int cb_extensionstate(char *context, char* exten, int state, void *data) if (p->subscribed != NONE) /* Only send state NOTIFY if we know the format */ transmit_state_notify(p, state, 1, FALSE); - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_1 "Extension Changed %s new state %s for Notify User %s\n", exten, ast_extension_state2str(state), p->username); + ast_verb(2, "Extension Changed %s new state %s for Notify User %s\n", exten, ast_extension_state2str(state), p->username); sip_pvt_unlock(p); @@ -13498,8 +13494,8 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_ default: if ((resp >= 300) && (resp < 700)) { /* Fatal response */ - if ((option_verbose > 2) && (resp != 487)) - ast_verbose(VERBOSE_PREFIX_3 "Got SIP response %d \"%s\" back from %s\n", resp, rest, ast_inet_ntoa(p->sa.sin_addr)); + if ((resp != 487)) + ast_verb(3, "Got SIP response %d \"%s\" back from %s\n", resp, rest, ast_inet_ntoa(p->sa.sin_addr)); if (sipmethod == SIP_INVITE) stop_media_flows(p); /* Immediately stop RTP, VRTP and UDPTL as applicable */ @@ -13662,8 +13658,8 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_ } } if ((resp >= 300) && (resp < 700)) { - if ((option_verbose > 2) && (resp != 487)) - ast_verbose(VERBOSE_PREFIX_3 "Incoming call: Got SIP response %d \"%s\" back from %s\n", resp, rest, ast_inet_ntoa(p->sa.sin_addr)); + if ((resp != 487)) + ast_verb(3, "Incoming call: Got SIP response %d \"%s\" back from %s\n", resp, rest, ast_inet_ntoa(p->sa.sin_addr)); switch(resp) { case 488: /* Not acceptable here - codec error */ case 603: /* Decline */ @@ -16226,8 +16222,7 @@ static void *do_monitor(void *data) sip_reloading = FALSE; ast_mutex_unlock(&sip_reload_lock); if (reloading) { - if (option_verbose > 0) - ast_verbose(VERBOSE_PREFIX_1 "Reloading SIP\n"); + ast_verb(1, "Reloading SIP\n"); sip_do_reload(sip_reloadreason); /* Change the I/O fd of our UDP socket */ @@ -16831,8 +16826,7 @@ static struct sip_auth *add_realm_authentication(struct sip_auth *authlist, char else authlist = auth; - if (option_verbose > 2) - ast_verbose("Added authentication for realm %s\n", realm); + ast_verb(3, "Added authentication for realm %s\n", realm); return authlist; @@ -17866,8 +17860,7 @@ static int reload_config(enum channelreloadreason reason) close(sipsock); sipsock = -1; } else { - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "SIP Listening on %s:%d\n", + ast_verb(2, "SIP Listening on %s:%d\n", ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port)); ast_netsock_set_qos(sipsock, global_tos_sip, global_cos_sip); } diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 67ab62bc4..258e1f6ce 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -1884,7 +1884,7 @@ static int skinny_extensionstate_cb(char *context, char *exten, int state, void switch (state) { case AST_EXTENSION_DEACTIVATED: /* Retry after a while */ case AST_EXTENSION_REMOVED: /* Extension is gone */ - ast_verbose(VERBOSE_PREFIX_2 "Extension state: Watcher for hint %s %s. Notify Device %s\n", exten, state == AST_EXTENSION_DEACTIVATED ? "deactivated" : "removed", d->name); + ast_verb(2, "Extension state: Watcher for hint %s %s. Notify Device %s\n", exten, state == AST_EXTENSION_DEACTIVATED ? "deactivated" : "removed", d->name); sd->stateid = -1; callstate = SKINNY_ONHOOK; lamp = SKINNY_LAMP_OFF; @@ -2072,8 +2072,7 @@ static int skinny_reset_device(int fd, int argc, char *argv[]) else req->data.reset.resetType = 1; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "%s device %s.\n", (fullrestart) ? "Restarting" : "Resetting", d->id); + ast_verb(3, "%s device %s.\n", (fullrestart) ? "Restarting" : "Resetting", d->id); transmit_response(d->session, req); } } @@ -2404,10 +2403,8 @@ static struct skinny_device *build_device(const char *cat, struct ast_variable * ast_copy_string(l->mohsuggest, mohsuggest, sizeof(l->mohsuggest)); ast_copy_string(l->regexten, regexten, sizeof(l->regexten)); ast_copy_string(l->mailbox, mailbox, sizeof(l->mailbox)); - if (!ast_strlen_zero(mailbox)) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Setting mailbox '%s' on %s@%s\n", mailbox, d->name, l->name); - } + if (!ast_strlen_zero(mailbox)) + ast_verb(3, "Setting mailbox '%s' on %s@%s\n", mailbox, d->name, l->name); if (!ast_strlen_zero(device_vmexten)) ast_copy_string(l->vmexten, device_vmexten, sizeof(vmexten)); l->msgstate = -1; @@ -2536,8 +2533,7 @@ static void *skinny_ss(void *data) int getforward=0; int loop_pause = 100; - if (option_verbose > 2) - ast_verbose( VERBOSE_PREFIX_3 "Starting simple switch on '%s@%s'\n", l->name, d->name); + ast_verb(3, "Starting simple switch on '%s@%s'\n", l->name, d->name); len = strlen(d->exten); @@ -2564,8 +2560,7 @@ static void *skinny_ss(void *data) if (getforward) { /* Record this as the forwarding extension */ ast_copy_string(l->call_forward, d->exten, sizeof(l->call_forward)); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Setting call forward to '%s' on channel %s\n", + ast_verb(3, "Setting call forward to '%s' on channel %s\n", l->call_forward, c->name); transmit_tone(s, SKINNY_DIALTONE); if (res) { @@ -2643,7 +2638,7 @@ static int skinny_call(struct ast_channel *ast, char *dest, int timeout) } if (skinnydebug) - ast_verbose(VERBOSE_PREFIX_3 "skinny_call(%s)\n", ast->name); + ast_verb(3, "skinny_call(%s)\n", ast->name); if (l->dnd) { ast_queue_control(ast, AST_CONTROL_BUSY); @@ -2923,7 +2918,7 @@ static int skinny_indicate(struct ast_channel *ast, int ind, const void *data, s struct skinnysession *s = d->session; if (skinnydebug) - ast_verbose(VERBOSE_PREFIX_3 "Asked to indicate '%s' condition on channel %s\n", control2str(ind), ast->name); + ast_verb(3, "Asked to indicate '%s' condition on channel %s\n", control2str(ind), ast->name); switch(ind) { case AST_CONTROL_RINGING: if (ast->_state != AST_STATE_UP) { @@ -3170,8 +3165,7 @@ static int handle_register_message(struct skinny_req *req, struct skinnysession transmit_response(s, req); return 0; } - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Device '%s' successfully registered\n", name); + ast_verb(3, "Device '%s' successfully registered\n", name); if (!(req = req_alloc(sizeof(struct register_ack_message), REGISTER_ACK_MESSAGE))) return -1; @@ -3469,14 +3463,12 @@ static int handle_stimulus_message(struct skinny_req *req, struct skinnysession /* Do not disturb */ if (l->dnd != 0){ - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Disabling DND on %s@%s\n", l->name, d->name); + ast_verb(3, "Disabling DND on %s@%s\n", l->name, d->name); l->dnd = 0; transmit_lamp_indication(s, STIMULUS_FORWARDALL, 1, SKINNY_LAMP_ON); transmit_displaynotify(s, "DnD disabled", 10); } else { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Enabling DND on %s@%s\n", l->name, d->name); + ast_verb(3, "Enabling DND on %s@%s\n", l->name, d->name); l->dnd = 1; transmit_lamp_indication(s, STIMULUS_FORWARDALL, 1, SKINNY_LAMP_OFF); transmit_displaynotify(s, "DnD enabled", 10); @@ -4289,14 +4281,12 @@ static int handle_soft_key_event_message(struct skinny_req *req, struct skinnyse /* Do not disturb */ if (l->dnd != 0){ - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Disabling DND on %s@%s\n", l->name, d->name); + ast_verb(3, "Disabling DND on %s@%s\n", l->name, d->name); l->dnd = 0; transmit_lamp_indication(s, STIMULUS_FORWARDALL, 1, SKINNY_LAMP_ON); transmit_displaynotify(s, "DnD disabled", 10); } else { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Enabling DND on %s@%s\n", l->name, d->name); + ast_verb(3, "Enabling DND on %s@%s\n", l->name, d->name); l->dnd = 1; transmit_lamp_indication(s, STIMULUS_FORWARDALL, 1, SKINNY_LAMP_OFF); transmit_displaynotify(s, "DnD enabled", 10); @@ -4753,8 +4743,7 @@ static void *skinny_session(void *data) struct skinny_req *req; struct skinnysession *s = data; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Starting Skinny session from %s\n", ast_inet_ntoa(s->sin.sin_addr)); + ast_verb(3, "Starting Skinny session from %s\n", ast_inet_ntoa(s->sin.sin_addr)); for (;;) { res = get_input(s); @@ -4907,9 +4896,7 @@ static struct ast_channel *skinny_request(const char *type, int format, void *da ast_log(LOG_NOTICE, "No available lines on: %s\n", dest); return NULL; } - if (option_verbose > 2) { - ast_verbose(VERBOSE_PREFIX_3 "skinny_request(%s)\n", tmp); - } + ast_verb(3, "skinny_request(%s)\n", tmp); tmpc = skinny_new(l, AST_STATE_DOWN); if (!tmpc) { ast_log(LOG_WARNING, "Unable to make channel for '%s'\n", tmp); @@ -5062,8 +5049,7 @@ static int reload_config(void) } else { d = build_device(cat, ast_variable_browse(cfg, cat)); if (d) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Added device '%s'\n", d->name); + ast_verb(3, "Added device '%s'\n", d->name); ast_mutex_lock(&devicelock); d->next = devices; devices = d; @@ -5105,8 +5091,7 @@ static int reload_config(void) ast_config_destroy(cfg); return 0; } - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "Skinny listening on %s:%d\n", + ast_verb(2, "Skinny listening on %s:%d\n", ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port)); ast_pthread_create_background(&accept_t,NULL, accept_thread, NULL); } diff --git a/channels/chan_vpb.cc b/channels/chan_vpb.cc index 3cc76d66e..02c3faf48 100644 --- a/channels/chan_vpb.cc +++ b/channels/chan_vpb.cc @@ -476,17 +476,14 @@ static enum ast_bridge_result ast_vpb_bridge(struct ast_channel *c0, struct ast_ p1->bridge = &bridges[i]; } ast_mutex_unlock(&p1->lock); - if (option_verbose>1) - ast_verbose(VERBOSE_PREFIX_2 "%s: vpb_bridge: Bridging call entered with [%s, %s]\n",p0->dev, c0->name, c1->name); + ast_verb(2, "%s: vpb_bridge: Bridging call entered with [%s, %s]\n",p0->dev, c0->name, c1->name); } - 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); #ifdef HALF_DUPLEX_BRIDGE - if (option_verbose>1) - ast_verbose(VERBOSE_PREFIX_2 "%s: vpb_bridge: Starting half-duplex bridge [%s, %s]\n",p0->dev, c0->name, c1->name); + ast_verb(2, "%s: vpb_bridge: Starting half-duplex bridge [%s, %s]\n",p0->dev, c0->name, c1->name); int dir = 0; @@ -518,8 +515,7 @@ static enum ast_bridge_result ast_vpb_bridge(struct ast_channel *c0, struct ast_ vpb_play_buf_finish(p0->handle); vpb_play_buf_finish(p1->handle); - if (option_verbose>1) - ast_verbose(VERBOSE_PREFIX_2 "%s: vpb_bridge: Finished half-duplex bridge [%s, %s]\n",p0->dev, c0->name, c1->name); + ast_verb(2, "%s: vpb_bridge: Finished half-duplex bridge [%s, %s]\n",p0->dev, c0->name, c1->name); res = VPB_OK; @@ -602,8 +598,7 @@ static enum ast_bridge_result ast_vpb_bridge(struct ast_channel *c0, struct ast_ p1->bridge = NULL; - if (option_verbose>1) - ast_verbose(VERBOSE_PREFIX_2 "Bridging call done with [%s, %s] => %d\n", c0->name, c1->name, res); + ast_verb(2, "Bridging call done with [%s, %s] => %d\n", c0->name, c1->name, res); /* ast_mutex_unlock(&p0->lock); @@ -638,16 +633,14 @@ static void get_callerid(struct vpb_pvt *p) if( ast_mutex_trylock(&p->record_lock) == 0 ) { cid_record_time = ast_tvnow(); - if (option_verbose>3) - ast_verbose(VERBOSE_PREFIX_4 "CID record - start\n"); + ast_verb(4, "CID record - start\n"); /* Skip any trailing ringtone */ if (UsePolarityCID != 1){ vpb_sleep(RING_SKIP); } - if (option_verbose>3) - ast_verbose(VERBOSE_PREFIX_4 "CID record - skipped %dms trailing ring\n", + ast_verb(4, "CID record - skipped %dms trailing ring\n", ast_tvdiff_ms(ast_tvnow(), cid_record_time)); cid_record_time = ast_tvnow(); @@ -661,8 +654,7 @@ static void get_callerid(struct vpb_pvt *p) vpb_wave_close_write(ws); #endif - if (option_verbose>3) - ast_verbose(VERBOSE_PREFIX_4 "CID record - recorded %dms between rings\n", + ast_verb(4, "CID record - recorded %dms between rings\n", ast_tvdiff_ms(ast_tvnow(), cid_record_time)); ast_mutex_unlock(&p->record_lock); @@ -698,8 +690,7 @@ static void get_callerid(struct vpb_pvt *p) strcpy(p->cid_name, cli_struct->cn); } - if (option_verbose>3) - ast_verbose(VERBOSE_PREFIX_4 "CID record - got [%s] [%s]\n",owner->cid.cid_num,owner->cid.cid_name ); + ast_verb(4, "CID record - got [%s] [%s]\n",owner->cid.cid_num,owner->cid.cid_name ); snprintf(p->callerid,sizeof(p->callerid)-1,"%s %s",cli_struct->cldn,cli_struct->cn); } else { @@ -735,20 +726,19 @@ static void get_callerid_ast(struct vpb_pvt *p) #endif if(p->callerid_type == 1) { - if (option_verbose>3) ast_verbose(VERBOSE_PREFIX_4 "Collected caller ID already\n"); + ast_verb(4, "Collected caller ID already\n"); return; } else if(p->callerid_type == 2 ) { which_cid=CID_SIG_V23; - if (option_verbose>3) ast_verbose(VERBOSE_PREFIX_4 "Collecting Caller ID v23...\n"); + ast_verb(4, "Collecting Caller ID v23...\n"); } else if(p->callerid_type == 3) { which_cid=CID_SIG_BELL; - if (option_verbose>3) ast_verbose(VERBOSE_PREFIX_4 "Collecting Caller ID bell...\n"); + ast_verb(4, "Collecting Caller ID bell...\n"); } else { - if (option_verbose>3) - ast_verbose(VERBOSE_PREFIX_4 "Caller ID disabled\n"); + ast_verb(4, "Caller ID disabled\n"); return; } /* vpb_sleep(RING_SKIP); */ @@ -770,7 +760,7 @@ static void get_callerid_ast(struct vpb_pvt *p) vpb_wave_write(ws,(char*)buf,sizeof(buf)); #endif sam_count+=sizeof(buf); - if (option_verbose>3) ast_verbose(VERBOSE_PREFIX_4 "Collecting Caller ID samples [%d][%d]...\n",sam_count,rc); + ast_verb(4, "Collecting Caller ID samples [%d][%d]...\n",sam_count,rc); } vpb_record_buf_finish(p->handle); #ifdef ANALYSE_CID @@ -778,8 +768,7 @@ static void get_callerid_ast(struct vpb_pvt *p) #endif if (rc == 1){ callerid_get(cs, &name, &number, &flags); - if (option_verbose>0) - ast_verbose(VERBOSE_PREFIX_1 "%s: Caller ID name [%s] number [%s] flags [%d]\n",p->dev,name, number,flags); + ast_verb(1, "%s: Caller ID name [%s] number [%s] flags [%d]\n",p->dev,name, number,flags); } else { ast_log(LOG_ERROR, "%s: Failed to decode Caller ID \n", p->dev ); @@ -821,9 +810,7 @@ static void stoptone( int handle) vpb_tone_terminate(handle); ret = vpb_get_event_ch_async(handle,&je); if ((ret == VPB_OK)&&(je.type != VPB_DIALEND)){ - if (option_verbose > 3){ - ast_verbose(VERBOSE_PREFIX_4 "Stop tone collected a wrong event!![%d]\n",je.type); - } + ast_verb(4, "Stop tone collected a wrong event!![%d]\n",je.type); /* vpb_put_event(&je); */ } vpb_sleep(10); @@ -835,8 +822,7 @@ static int playtone( int handle, VPB_TONE *tone) { int ret=VPB_OK; stoptone(handle); - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "[%02d]: Playing tone\n", handle); + ast_verb(4, "[%02d]: Playing tone\n", handle); ret = vpb_playtone_async(handle, tone); return ret; } @@ -847,8 +833,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e) int endbridge = 0; int res=0; - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: handle_owned: got event: [%d=>%d]\n", p->dev, e->type, e->data); + ast_verb(4, "%s: handle_owned: got event: [%d=>%d]\n", p->dev, e->type, e->data); f.src = "vpb"; switch (e->type) { @@ -906,8 +891,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e) case VPB_TONEDETECT: if (e->data == VPB_BUSY || e->data == VPB_BUSY_308 || e->data == VPB_BUSY_AUST ) { - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: handle_owned: got event: BUSY\n", p->dev); + ast_verb(4, "%s: handle_owned: got event: BUSY\n", p->dev); if (p->owner->_state == AST_STATE_UP) { f.subclass = AST_CONTROL_HANGUP; } @@ -921,8 +905,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e) const char *target_context = S_OR(p->owner->macrocontext, p->owner->context); if (ast_exists_extension(p->owner, target_context, "fax", 1, p->owner->cid.cid_num)) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Redirecting %s to fax extension\n", p->owner->name); + ast_verb(3, "Redirecting %s to fax extension\n", p->owner->name); /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */ pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", p->owner->exten); if (ast_async_goto(p->owner, target_context, "fax", 1)) @@ -939,8 +922,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e) if ( ast_tvdiff_ms(ast_tvnow(), p->lastgrunt) > gruntdetect_timeout ) { /* Nothing heard on line for a very long time * Timeout connection */ - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "grunt timeout\n"); + ast_verb(3, "grunt timeout\n"); ast_log(LOG_NOTICE,"%s: Line hangup due of lack of conversation\n",p->dev); f.subclass = AST_CONTROL_HANGUP; } else { @@ -1001,8 +983,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e) case VPB_DIALEND: if (p->state < 5){ f.subclass = AST_CONTROL_ANSWER; - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "%s: Dialend\n", p->dev); + ast_verb(2, "%s: Dialend\n", p->dev); } else { f.frametype = AST_FRAME_NULL; } @@ -1024,9 +1005,9 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e) } /* - if (option_verbose > 3) ast_verbose("%s: LOCKING in handle_owned [%d]\n", p->dev,res); + ast_verb(4, "%s: LOCKING in handle_owned [%d]\n", p->dev,res); res = ast_mutex_lock(&p->lock); - if (option_verbose > 3) ast_verbose("%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); + ast_verb(4, "%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); */ { if (p->bridge) { /* Check what happened, see if we need to report it. */ @@ -1071,13 +1052,12 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e) if (endbridge){ res = ast_mutex_unlock(&p->lock); /* - if (option_verbose > 3) ast_verbose("%s: unLOCKING in handle_owned [%d]\n", p->dev,res); + ast_verb(4, "%s: unLOCKING in handle_owned [%d]\n", p->dev,res); */ return 0; } - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: handle_owned: Prepared frame type[%d]subclass[%d], bridge=%p owner=[%s]\n", + ast_verb(4, "%s: handle_owned: Prepared frame type[%d]subclass[%d], bridge=%p owner=[%s]\n", p->dev, f.frametype, f.subclass, (void *)p->bridge, p->owner->name); /* Trylock used here to avoid deadlock that can occur if we @@ -1088,8 +1068,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e) if (ast_mutex_trylock(&p->owner->lock)==0) { ast_queue_frame(p->owner, &f); ast_mutex_unlock(&p->owner->lock); - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: handled_owned: Queued Frame to [%s]\n", p->dev,p->owner->name); + ast_verb(4, "%s: handled_owned: Queued Frame to [%s]\n", p->dev,p->owner->name); } else { ast_verbose("%s: handled_owned: Missed event %d/%d \n", p->dev,f.frametype, f.subclass); @@ -1097,7 +1076,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e) } res = ast_mutex_unlock(&p->lock); /* - if (option_verbose > 3) ast_verbose("%s: unLOCKING in handle_owned [%d]\n", p->dev,res); + ast_verb(4, "%s: unLOCKING in handle_owned [%d]\n", p->dev,res); */ return 0; @@ -1113,22 +1092,17 @@ static inline int monitor_handle_notowned(struct vpb_pvt *p, VPB_EVENT *e) struct ast_channel *c; */ - if (option_verbose > 3) { char str[VPB_MAX_STR]; vpb_translate_event(e, str); - ast_verbose(VERBOSE_PREFIX_4 "%s: handle_notowned: mode=%d, event[%d][%s]=[%d]\n", - p->dev, p->mode, e->type,str, e->data); - } + ast_verb(4, "%s: handle_notowned: mode=%d, event[%d][%s]=[%d]\n", p->dev, p->mode, e->type,str, e->data); switch(e->type) { case VPB_LOOP_ONHOOK: case VPB_LOOP_POLARITY: if (UsePolarityCID == 1){ - if (option_verbose>3) - ast_verbose(VERBOSE_PREFIX_4 "Polarity reversal\n"); + ast_verb(4, "Polarity reversal\n"); if(p->callerid_type == 1) { - if (option_verbose>3) - ast_verbose(VERBOSE_PREFIX_4 "Using VPB Caller ID\n"); + ast_verb(4, "Using VPB Caller ID\n"); get_callerid(p); /* UK CID before 1st ring*/ } /* get_callerid_ast(p); */ /* Caller ID using the ast functions */ @@ -1139,8 +1113,7 @@ static inline int monitor_handle_notowned(struct vpb_pvt *p, VPB_EVENT *e) vpb_new(p, AST_STATE_RING, p->context); if (UsePolarityCID != 1){ if(p->callerid_type == 1) { - if (option_verbose>3) - ast_verbose(VERBOSE_PREFIX_4 "Using VPB Caller ID\n"); + ast_verb(4, "Using VPB Caller ID\n"); get_callerid(p); /* Australian CID only between 1st and 2nd ring */ } get_callerid_ast(p); /* Caller ID using the ast functions */ @@ -1164,7 +1137,7 @@ static inline int monitor_handle_notowned(struct vpb_pvt *p, VPB_EVENT *e) if (p->mode == MODE_IMMEDIATE) vpb_new(p,AST_STATE_RING, p->context); else { - ast_verbose(VERBOSE_PREFIX_4 "%s: handle_notowned: playing dialtone\n",p->dev); + ast_verb(4, "%s: handle_notowned: playing dialtone\n",p->dev); playtone(p->handle, &Dialtone); p->state=VPB_STATE_PLAYDIAL; p->wantdtmf = 1; @@ -1192,7 +1165,7 @@ static inline int monitor_handle_notowned(struct vpb_pvt *p, VPB_EVENT *e) } */ } else { - ast_verbose(VERBOSE_PREFIX_4 "%s: handle_notowned: Got a DIALEND when not really expected\n",p->dev); + ast_verb(4, "%s: handle_notowned: Got a DIALEND when not really expected\n",p->dev); } break; @@ -1205,8 +1178,7 @@ static inline int monitor_handle_notowned(struct vpb_pvt *p, VPB_EVENT *e) case VPB_TIMEREXP: if (e->data == p->dtmfidd_timer_id) { if (ast_exists_extension(NULL, p->context, p->ext, 1, p->callerid)){ - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: handle_notowned: DTMF IDD timer out, matching on [%s] in [%s]\n", p->dev,p->ext , p->context); + ast_verb(4, "%s: handle_notowned: DTMF IDD timer out, matching on [%s] in [%s]\n", p->dev,p->ext , p->context); vpb_new(p,AST_STATE_RING, p->context); } @@ -1234,8 +1206,7 @@ static inline int monitor_handle_notowned(struct vpb_pvt *p, VPB_EVENT *e) } else if ( e->data == DTMF_CID_STOP ) { /* CallerID End signal */ p->callerid[p->dtmf_caller_pos] = '\0'; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 " %s: DTMF CallerID %s\n",p->dev,p->callerid); + ast_verb(3, " %s: DTMF CallerID %s\n",p->dev,p->callerid); if (owner){ /* if (owner->cid.cid_num) @@ -1251,11 +1222,8 @@ static inline int monitor_handle_notowned(struct vpb_pvt *p, VPB_EVENT *e) ast_callerid_split(p->callerid, cid_name, sizeof(cid_name), cid_num, sizeof(cid_num)); ast_set_callerid(owner, cid_num, cid_name, cid_num); - } - else { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 " %s: DTMF CallerID: no owner to assign CID \n",p->dev); - } + } else + ast_verb(3, " %s: DTMF CallerID: no owner to assign CID \n",p->dev); } else if ( p->dtmf_caller_pos < AST_MAX_EXTENSION ) { if ( p->dtmf_caller_pos >= 0 ) p->callerid[p->dtmf_caller_pos] = e->data; @@ -1282,24 +1250,20 @@ static inline int monitor_handle_notowned(struct vpb_pvt *p, VPB_EVENT *e) #endif if (ast_exists_extension(NULL, p->context, p->ext, 1, p->callerid)){ if ( ast_canmatch_extension(NULL, p->context, p->ext, 1, p->callerid)){ - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: handle_notowned: Multiple matches on [%s] in [%s]\n", p->dev,p->ext , p->context); + ast_verb(4, "%s: handle_notowned: Multiple matches on [%s] in [%s]\n", p->dev,p->ext , p->context); /* Start DTMF IDD timer */ vpb_timer_stop(p->dtmfidd_timer); vpb_timer_start(p->dtmfidd_timer); } else { - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: handle_notowned: Matched on [%s] in [%s]\n", p->dev,p->ext , p->context); + ast_verb(4, "%s: handle_notowned: Matched on [%s] in [%s]\n", p->dev,p->ext , p->context); vpb_new(p,AST_STATE_UP, p->context); } } else if (!ast_canmatch_extension(NULL, p->context, p->ext, 1, p->callerid)){ if (ast_exists_extension(NULL, "default", p->ext, 1, p->callerid)) { vpb_new(p,AST_STATE_UP, "default"); } else if (!ast_canmatch_extension(NULL, "default", p->ext, 1, p->callerid)) { - if (option_verbose > 3) { - ast_verbose(VERBOSE_PREFIX_4 "%s: handle_notowned: can't match anything in %s or default\n", p->dev, p->context); - } + ast_verb(4, "%s: handle_notowned: can't match anything in %s or default\n", p->dev, p->context); playtone(p->handle, &Busytone); vpb_timer_stop(p->busy_timer); vpb_timer_start(p->busy_timer); @@ -1313,9 +1277,7 @@ static inline int monitor_handle_notowned(struct vpb_pvt *p, VPB_EVENT *e) break; } - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: handle_notowned: mode=%d, [%d=>%d]\n", - p->dev, p->mode, e->type, e->data); + ast_verb(4, "%s: handle_notowned: mode=%d, [%d=>%d]\n", p->dev, p->mode, e->type, e->data); return 0; } @@ -1325,8 +1287,7 @@ static void *do_monitor(void *unused) /* Monitor thread, doesn't die until explicitly killed. */ - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "Starting vpb monitor thread[%ld]\n", + ast_verb(2, "Starting vpb monitor thread[%ld]\n", pthread_self()); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); @@ -1338,20 +1299,17 @@ static void *do_monitor(void *unused) struct vpb_pvt *p; /* - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "Monitor waiting for event\n"); + ast_verb(4, "Monitor waiting for event\n"); */ int res = vpb_get_event_sync(&e, VPB_WAIT_TIMEOUT); if( (res==VPB_NO_EVENTS) || (res==VPB_TIME_OUT) ){ /* - if (option_verbose > 3){ if (res == VPB_NO_EVENTS){ - ast_verbose(VERBOSE_PREFIX_4 "No events....\n"); + ast_verb(4, "No events....\n"); } else { - ast_verbose(VERBOSE_PREFIX_4 "No events, timed out....\n"); + ast_verb(4, "No events, timed out....\n"); } - } */ continue; } @@ -1367,11 +1325,9 @@ static void *do_monitor(void *unused) p = NULL; ast_mutex_lock(&monlock); { - - if (e.type == VPB_NULL_EVENT) { - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "Monitor got null event\n"); - } + //XXX useless braces, remove them and fix indenting + if (e.type == VPB_NULL_EVENT) + ast_verb(4, "Monitor got null event\n"); else { vpb_translate_event(&e, str); if (strlen(str)>1){ @@ -1384,8 +1340,8 @@ static void *do_monitor(void *unused) p = p->next; } ast_mutex_unlock(&iflock); - if (p && (option_verbose > 3)) - ast_verbose(VERBOSE_PREFIX_4 "%s: Event [%d=>%s] \n", + if (p) + ast_verb(4, "%s: Event [%d=>%s] \n", p ? p->dev : "null", e.type, str ); } @@ -1394,19 +1350,15 @@ static void *do_monitor(void *unused) if (!p) { if (e.type != VPB_NULL_EVENT){ ast_log(LOG_WARNING, "Got event [%s][%d], no matching iface!\n", str,e.type); - if (option_verbose > 3){ - ast_verbose(VERBOSE_PREFIX_4 "vpb/ERR: No interface for Event [%d=>%s] \n",e.type,str ); + ast_verb(4, "vpb/ERR: No interface for Event [%d=>%s] \n",e.type,str ); } - } continue; } /* flush the event from the channel event Q */ vpb_get_event_ch_async(e.handle,&je); - if (option_verbose > 4){ vpb_translate_event(&je, str); - ast_verbose("%s: Flushing event [%d]=>%s\n",p->dev,je.type,str); - } + ast_verb(5, "%s: Flushing event [%d]=>%s\n",p->dev,je.type,str); /* Check for ownership and locks */ if ((p->owner)&&(!p->golock)){ @@ -1451,15 +1403,13 @@ static int restart_monitor(void) if (mthreadactive == -2) return 0; - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "Restarting monitor\n"); + ast_verb(4, "Restarting monitor\n"); ast_mutex_lock(&monlock); { if (monitor_thread == pthread_self()) { ast_log(LOG_WARNING, "Cannot kill myself\n"); error = -1; - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "Monitor trying to kill monitor\n"); + ast_verb(4, "Monitor trying to kill monitor\n"); } else { if (mthreadactive != -1) { @@ -1469,15 +1419,13 @@ static int restart_monitor(void) e.type = VPB_NULL_EVENT; e.data = 0; - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "Trying to reawake monitor\n"); + ast_verb(4, "Trying to reawake monitor\n"); vpb_put_event(&e); } else { /* Start a new monitor */ int pid = ast_pthread_create(&monitor_thread, NULL, do_monitor, NULL); - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "Created new monitor thread %d\n",pid); + ast_verb(4, "Created new monitor thread %d\n",pid); if (pid < 0) { ast_log(LOG_ERROR, "Unable to start monitor thread.\n"); error = -1; @@ -1487,8 +1435,7 @@ static int restart_monitor(void) } } ast_mutex_unlock(&monlock); - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "Monitor restarted\n"); + ast_verb(4, "Monitor restarted\n"); return error; } @@ -1718,23 +1665,21 @@ static int vpb_indicate(struct ast_channel *ast, int condition, const void *data int tmp = 0; if (use_ast_ind == 1) { - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: vpb_indicate called when using Ast Indications !?!\n", p->dev); + ast_verb(4, "%s: vpb_indicate called when using Ast Indications !?!\n", p->dev); return 0; } - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: vpb_indicate [%d] state[%d]\n", p->dev, condition,ast->_state); + ast_verb(4, "%s: vpb_indicate [%d] state[%d]\n", p->dev, condition,ast->_state); /* if (ast->_state != AST_STATE_UP) { - ast_verbose(VERBOSE_PREFIX_4 "%s: vpb_indicate Not in AST_STATE_UP\n", p->dev, condition,ast->_state); + ast_verb(4, "%s: vpb_indicate Not in AST_STATE_UP\n", p->dev, condition,ast->_state); return res; } */ /* - if (option_verbose > 3) ast_verbose("%s: LOCKING in indicate \n", p->dev); - if (option_verbose > 3) ast_verbose("%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); + ast_verb(4, "%s: LOCKING in indicate \n", p->dev); + ast_verb(4, "%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); */ ast_mutex_lock(&p->lock); switch(condition) { @@ -1751,8 +1696,7 @@ static int vpb_indicate(struct ast_channel *ast, int condition, const void *data if (ast->_state == AST_STATE_UP) { playtone(p->handle, &Ringbacktone); p->state = VPB_STATE_PLAYRING; - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: vpb indicate: setting ringback timer [%d]\n", p->dev,p->ringback_timer_id); + ast_verb(4, "%s: vpb indicate: setting ringback timer [%d]\n", p->dev,p->ringback_timer_id); vpb_timer_stop(p->ringback_timer); vpb_timer_start(p->ringback_timer); @@ -1784,7 +1728,7 @@ static int vpb_indicate(struct ast_channel *ast, int condition, const void *data } tmp = ast_mutex_unlock(&p->lock); /* - if (option_verbose > 3) ast_verbose("%s: unLOCKING in indicate [%d]\n", p->dev,tmp); + ast_verb(4, "%s: unLOCKING in indicate [%d]\n", p->dev,tmp); */ return res; } @@ -1795,8 +1739,8 @@ static int vpb_fixup(struct ast_channel *oldchan, struct ast_channel *newchan) int res = 0; /* - if (option_verbose > 3) ast_verbose("%s: LOCKING in fixup \n", p->dev); - if (option_verbose > 3) ast_verbose("%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); + ast_verb(4, "%s: LOCKING in fixup \n", p->dev); + ast_verb(4, "%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); */ ast_mutex_lock(&p->lock); ast_debug(1, "New owner for channel %s is %s\n", p->dev, newchan->name); @@ -1807,20 +1751,18 @@ static int vpb_fixup(struct ast_channel *oldchan, struct ast_channel *newchan) if (newchan->_state == AST_STATE_RINGING){ if (use_ast_ind == 1) { - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: vpb_fixup Calling ast_indicate\n", p->dev); + ast_verb(4, "%s: vpb_fixup Calling ast_indicate\n", p->dev); ast_indicate(newchan, AST_CONTROL_RINGING); } else { - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: vpb_fixup Calling vpb_indicate\n", p->dev); + ast_verb(4, "%s: vpb_fixup Calling vpb_indicate\n", p->dev); vpb_indicate(newchan, AST_CONTROL_RINGING, NULL, 0); } } res= ast_mutex_unlock(&p->lock); /* - if (option_verbose > 3) ast_verbose("%s: unLOCKING in fixup [%d]\n", p->dev,res); + ast_verb(4, "%s: unLOCKING in fixup [%d]\n", p->dev,res); */ return 0; } @@ -1837,14 +1779,13 @@ static int vpb_digit_end(struct ast_channel *ast, char digit, unsigned int durat int res = 0; if (use_ast_dtmf){ - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: vpb_digit: asked to play digit[%c] but we are using asterisk dtmf play back?!\n", p->dev, digit); + ast_verb(4, "%s: vpb_digit: asked to play digit[%c] but we are using asterisk dtmf play back?!\n", p->dev, digit); return 0; } /* - if (option_verbose > 3) ast_verbose("%s: LOCKING in digit \n", p->dev); - if (option_verbose > 3) ast_verbose("%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); + ast_verb(4, "%s: LOCKING in digit \n", p->dev); + ast_verb(4, "%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); */ ast_mutex_lock(&p->lock); @@ -1852,8 +1793,7 @@ static int vpb_digit_end(struct ast_channel *ast, char digit, unsigned int durat s[0] = digit; s[1] = '\0'; - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: vpb_digit: asked to play digit[%s]\n", p->dev, s); + ast_verb(4, "%s: vpb_digit: asked to play digit[%s]\n", p->dev, s); ast_mutex_lock(&p->play_dtmf_lock); strncat(p->play_dtmf,s,sizeof(*p->play_dtmf)); @@ -1861,7 +1801,7 @@ static int vpb_digit_end(struct ast_channel *ast, char digit, unsigned int durat res = ast_mutex_unlock(&p->lock); /* - if (option_verbose > 3) ast_verbose("%s: unLOCKING in digit [%d]\n", p->dev,res); + ast_verb(4, "%s: unLOCKING in digit [%d]\n", p->dev,res); */ return 0; } @@ -1876,12 +1816,11 @@ static int vpb_call(struct ast_channel *ast, char *dest, int timeout) int tmp = 0; /* - if (option_verbose > 3) ast_verbose("%s: LOCKING in call \n", p->dev); - if (option_verbose > 3) ast_verbose("%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); + ast_verb(4, "%s: LOCKING in call \n", p->dev); + ast_verb(4, "%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); */ ast_mutex_lock(&p->lock); - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: starting call to [%s]\n", p->dev,dest); + ast_verb(4, "%s: starting call to [%s]\n", p->dev,dest); if (s) s = s + 1; @@ -1899,7 +1838,7 @@ static int vpb_call(struct ast_channel *ast, char *dest, int timeout) ast_log(LOG_WARNING, "vpb_call on %s neither down nor reserved!\n", ast->name); tmp = ast_mutex_unlock(&p->lock); /* - if (option_verbose > 3) ast_verbose("%s: unLOCKING in call [%d]\n", p->dev,tmp); + ast_verb(4, "%s: unLOCKING in call [%d]\n", p->dev,tmp); */ return -1; } @@ -1923,35 +1862,29 @@ static int vpb_call(struct ast_channel *ast, char *dest, int timeout) memcpy( &call.tone_map, DialToneMap, sizeof(DialToneMap) ); vpb_set_call(p->handle, &call); - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "%s: Calling %s on %s \n",p->dev, dialstring, ast->name); + ast_verb(2, "%s: Calling %s on %s \n",p->dev, dialstring, ast->name); - if (option_verbose > 2) { int j; - ast_verbose(VERBOSE_PREFIX_2 "%s: Dial parms for %s %d/%dms/%dms/%dms/%dms\n", p->dev + ast_verb(2, "%s: Dial parms for %s %d/%dms/%dms/%dms/%dms\n", p->dev , ast->name, call.dialtones, call.dialtone_timeout , call.ringback_timeout, call.inter_ringback_timeout , call.answer_timeout ); for( j=0; !call.tone_map[j].terminate; j++ ) - ast_verbose(VERBOSE_PREFIX_2 "%s: Dial parms for %s tone %d->%d\n", p->dev, + ast_verb(2, "%s: Dial parms for %s tone %d->%d\n", p->dev, ast->name, call.tone_map[j].tone_id, call.tone_map[j].call_id); - } - if (option_verbose > 3) - ast_verbose("%s: Disabling Loop Drop detection\n",p->dev); + ast_verb(4, "%s: Disabling Loop Drop detection\n",p->dev); vpb_disable_event(p->handle, VPB_MDROP); vpb_sethook_sync(p->handle,VPB_OFFHOOK); p->state=VPB_STATE_OFFHOOK; #ifndef DIAL_WITH_CALL_PROGRESS vpb_sleep(300); - if (option_verbose > 3) - ast_verbose("%s: Enabling Loop Drop detection\n",p->dev); + ast_verb(4, "%s: Enabling Loop Drop detection\n",p->dev); vpb_enable_event(p->handle, VPB_MDROP); res = vpb_dial_async(p->handle, dialstring); #else - if (option_verbose > 3) - ast_verbose("%s: Enabling Loop Drop detection\n",p->dev); + ast_verb(4, "%s: Enabling Loop Drop detection\n",p->dev); vpb_enable_event(p->handle, VPB_MDROP); res = vpb_call_async(p->handle, dialstring); #endif @@ -1963,8 +1896,7 @@ static int vpb_call(struct ast_channel *ast, char *dest, int timeout) res = 0; } - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "%s: VPB Calling %s [t=%d] on %s returned %d\n",p->dev , s, timeout, ast->name, res); + ast_verb(3, "%s: VPB Calling %s [t=%d] on %s returned %d\n",p->dev , s, timeout, ast->name, res); if (res == 0) { ast_setstate(ast, AST_STATE_RINGING); ast_queue_control(ast,AST_CONTROL_RINGING); @@ -1976,7 +1908,7 @@ static int vpb_call(struct ast_channel *ast, char *dest, int timeout) tmp = ast_mutex_unlock(&p->lock); /* - if (option_verbose > 3) ast_verbose("%s: unLOCKING in call [%d]\n", p->dev,tmp); + ast_verb(4, "%s: unLOCKING in call [%d]\n", p->dev,tmp); */ return res; } @@ -1989,19 +1921,18 @@ static int vpb_hangup(struct ast_channel *ast) int res =0 ; /* - if (option_verbose > 3) ast_verbose("%s: LOCKING in hangup \n", p->dev); - if (option_verbose > 3) ast_verbose("%s: LOCKING in hangup count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); - if (option_verbose > 3) ast_verbose("%s: LOCKING pthread_self(%d)\n", p->dev,pthread_self()); + ast_verb(4, "%s: LOCKING in hangup \n", p->dev); + ast_verb(4, "%s: LOCKING in hangup count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); + ast_verb(4, "%s: LOCKING pthread_self(%d)\n", p->dev,pthread_self()); ast_mutex_lock(&p->lock); */ - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "%s: Hangup requested\n", ast->name); + ast_verb(2, "%s: Hangup requested\n", ast->name); if (!ast->tech || !ast->tech_pvt) { ast_log(LOG_WARNING, "%s: channel not connected?\n", ast->name); res = ast_mutex_unlock(&p->lock); /* - if (option_verbose > 3) ast_verbose("%s: unLOCKING in hangup [%d]\n", p->dev,res); + ast_verb(4, "%s: unLOCKING in hangup [%d]\n", p->dev,res); */ /* Free up ast dsp if we have one */ if ((use_ast_dtmfdet)&&(p->vad)) { @@ -2017,29 +1948,26 @@ static int vpb_hangup(struct ast_channel *ast) p->stopreads = 1; if( p->readthread ){ pthread_join(p->readthread, NULL); - if(option_verbose>3) - ast_verbose( VERBOSE_PREFIX_4 "%s: stopped record thread \n",ast->name); + ast_verb(4, "%s: stopped record thread \n",ast->name); } /* Stop play */ if (p->lastoutput != -1) { - if(option_verbose>1) - ast_verbose( VERBOSE_PREFIX_2 "%s: Ending play mode \n",ast->name); + ast_verb(2, "%s: Ending play mode \n",ast->name); vpb_play_terminate(p->handle); ast_mutex_lock(&p->play_lock); { vpb_play_buf_finish(p->handle); } ast_mutex_unlock(&p->play_lock); } - if(option_verbose>3) - ast_verbose( VERBOSE_PREFIX_4 "%s: Setting state down\n",ast->name); + ast_verb(4, "%s: Setting state down\n",ast->name); ast_setstate(ast,AST_STATE_DOWN); /* - if (option_verbose > 3) ast_verbose("%s: LOCKING in hangup \n", p->dev); - if (option_verbose > 3) ast_verbose("%s: LOCKING in hangup count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); - if (option_verbose > 3) ast_verbose("%s: LOCKING pthread_self(%d)\n", p->dev,pthread_self()); + ast_verb(4, "%s: LOCKING in hangup \n", p->dev); + ast_verb(4, "%s: LOCKING in hangup count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); + ast_verb(4, "%s: LOCKING pthread_self(%d)\n", p->dev,pthread_self()); */ ast_mutex_lock(&p->lock); @@ -2050,8 +1978,7 @@ static int vpb_hangup(struct ast_channel *ast) /* This is causing a "dial end" "play tone" loop playtone(p->handle, &Busytone); p->state = VPB_STATE_PLAYBUSY; - if(option_verbose>4) - ast_verbose( VERBOSE_PREFIX_4 "%s: Station offhook[%d], playing busy tone\n", + ast_verb(5, "%s: Station offhook[%d], playing busy tone\n", ast->name,p->state); */ } @@ -2069,11 +1996,9 @@ static int vpb_hangup(struct ast_channel *ast) p->state=VPB_STATE_ONHOOK; } while (VPB_OK==vpb_get_event_ch_async(p->handle,&je)){ - if(option_verbose>3) { vpb_translate_event(&je, str); - ast_verbose( VERBOSE_PREFIX_4 "%s: Flushing event [%d]=>%s\n",ast->name,je.type,str); + ast_verb(4, "%s: Flushing event [%d]=>%s\n",ast->name,je.type,str); } - } p->readthread = 0; p->lastoutput = -1; @@ -2091,17 +2016,16 @@ static int vpb_hangup(struct ast_channel *ast) p->vad = NULL; } - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "%s: Hangup complete\n", ast->name); + ast_verb(2, "%s: Hangup complete\n", ast->name); restart_monitor(); /* - if (option_verbose > 3) ast_verbose("%s: LOCKING in hangup count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); + ast_verb(4, "%s: LOCKING in hangup count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); */ res = ast_mutex_unlock(&p->lock); /* - if (option_verbose > 3) ast_verbose("%s: unLOCKING in hangup [%d]\n", p->dev,res); - if (option_verbose > 3) ast_verbose("%s: LOCKING in hangup count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); + ast_verb(4, "%s: unLOCKING in hangup [%d]\n", p->dev,res); + ast_verb(4, "%s: LOCKING in hangup count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); */ return 0; } @@ -2113,17 +2037,15 @@ static int vpb_answer(struct ast_channel *ast) /* VPB_EVENT je; int ret; - if (option_verbose > 3) ast_verbose("%s: LOCKING in answer \n", p->dev); - if (option_verbose > 3) ast_verbose("%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); + ast_verb(4, "%s: LOCKING in answer \n", p->dev); + ast_verb(4, "%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); */ ast_mutex_lock(&p->lock); - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_4 "%s: Answering channel\n",p->dev); + ast_verb(4, "%s: Answering channel\n",p->dev); if (p->mode == MODE_FXO){ - if (option_verbose > 3) - ast_verbose("%s: Disabling Loop Drop detection\n",p->dev); + ast_verb(4, "%s: Disabling Loop Drop detection\n",p->dev); vpb_disable_event(p->handle, VPB_MDROP); } @@ -2134,21 +2056,14 @@ static int vpb_answer(struct ast_channel *ast) /* vpb_sleep(500); ret = vpb_get_event_ch_async(p->handle,&je); if ((ret == VPB_OK)&&((je.type != VPB_DROP)&&(je.type != VPB_RING))){ - if (option_verbose > 3){ - ast_verbose(VERBOSE_PREFIX_4 "%s: Answer collected a wrong event!!\n",p->dev); - } + ast_verb(4, "%s: Answer collected a wrong event!!\n",p->dev); vpb_put_event(&je); } */ } ast_setstate(ast, AST_STATE_UP); - if(option_verbose>1) -/* - ast_verbose( VERBOSE_PREFIX_2 "%s: Answered call from %s on %s [%s]\n", p->dev, - p->owner->callerid, ast->name,(p->mode == MODE_FXO)?"FXO":"FXS"); -*/ - ast_verbose( VERBOSE_PREFIX_2 "%s: Answered call on %s [%s]\n", p->dev, + ast_verb(2, "%s: Answered call on %s [%s]\n", p->dev, ast->name,(p->mode == MODE_FXO)?"FXO":"FXS"); ast->rings = 0; @@ -2157,25 +2072,21 @@ static int vpb_answer(struct ast_channel *ast) /* ast_verbose("%s: unLOCKING in answer [%d]\n", p->dev,res); */ ast_pthread_create(&p->readthread, NULL, do_chanreads, (void *)p); } else { - if(option_verbose>3) - ast_verbose(VERBOSE_PREFIX_4 "%s: Record thread already running!!\n",p->dev); + ast_verb(4, "%s: Record thread already running!!\n",p->dev); } } else { - if(option_verbose>3) { - ast_verbose(VERBOSE_PREFIX_4 "%s: Answered state is up\n",p->dev); - } + ast_verb(4, "%s: Answered state is up\n",p->dev); /* res = ast_mutex_unlock(&p->lock); */ /* ast_verbose("%s: unLOCKING in answer [%d]\n", p->dev,res); */ } vpb_sleep(500); if (p->mode == MODE_FXO){ - if (option_verbose > 3) - ast_verbose("%s: Re-enabling Loop Drop detection\n",p->dev); + ast_verb(4, "%s: Re-enabling Loop Drop detection\n",p->dev); vpb_enable_event(p->handle,VPB_MDROP); } res = ast_mutex_unlock(&p->lock); /* - if(option_verbose>3) ast_verbose("%s: unLOCKING in answer [%d]\n", p->dev,res); + ast_verb(4, "%s: unLOCKING in answer [%d]\n", p->dev,res); */ return 0; } @@ -2263,17 +2174,14 @@ static int vpb_write(struct ast_channel *ast, struct ast_frame *frame) int tdiff; /* ast_mutex_lock(&p->lock); */ - if(option_verbose>5) - ast_verbose("%s: vpb_write: Writing to channel\n", p->dev); + ast_verb(6, "%s: vpb_write: Writing to channel\n", p->dev); if (frame->frametype != AST_FRAME_VOICE) { - if(option_verbose>3) - ast_verbose("%s: vpb_write: Don't know how to handle from type %d\n", ast->name, frame->frametype); + ast_verb(4, "%s: vpb_write: Don't know how to handle from type %d\n", ast->name, frame->frametype); /* ast_mutex_unlock(&p->lock); */ return 0; } else if (ast->_state != AST_STATE_UP) { - if(option_verbose>3) - ast_verbose("%s: vpb_write: Attempt to Write frame type[%d]subclass[%d] on not up chan(state[%d])\n",ast->name, frame->frametype, frame->subclass,ast->_state); + ast_verb(4, "%s: vpb_write: Attempt to Write frame type[%d]subclass[%d] on not up chan(state[%d])\n",ast->name, frame->frametype, frame->subclass,ast->_state); p->lastoutput = -1; /* ast_mutex_unlock(&p->lock); */ return 0; @@ -2307,17 +2215,14 @@ static int vpb_write(struct ast_channel *ast, struct ast_frame *frame) /* Check if we have set up the play_buf */ if (p->lastoutput == -1) { vpb_play_buf_start(p->handle, fmt); - if(option_verbose>1) { - ast_verbose("%s: vpb_write: Starting play mode (codec=%d)[%s]\n",p->dev,fmt,ast2vpbformatname(frame->subclass)); - } + ast_verb(2, "%s: vpb_write: Starting play mode (codec=%d)[%s]\n",p->dev,fmt,ast2vpbformatname(frame->subclass)); p->lastoutput = fmt; ast_mutex_unlock(&p->play_lock); return 0; } else if (p->lastoutput != fmt) { vpb_play_buf_finish(p->handle); vpb_play_buf_start(p->handle, fmt); - if(option_verbose>1) - ast_verbose("%s: vpb_write: Changed play format (%d=>%d)\n",p->dev,p->lastoutput,fmt); + ast_verb(2, "%s: vpb_write: Changed play format (%d=>%d)\n",p->dev,p->lastoutput,fmt); ast_mutex_unlock(&p->play_lock); return 0; } @@ -2336,9 +2241,9 @@ static int vpb_write(struct ast_channel *ast, struct ast_frame *frame) play_buf_time_start = ast_tvnow(); /* res = vpb_play_buf_sync(p->handle, (char*)frame->data, tdiff*8*2); */ res = vpb_play_buf_sync(p->handle, (char*)frame->data, frame->datalen); - if( res == VPB_OK && option_verbose > 5 ) { + if(res == VPB_OK) { short * data = (short*)frame->data; - ast_verbose("%s: vpb_write: Wrote chan (codec=%d) %d %d\n", p->dev, fmt, data[0],data[1]); + ast_verb(6, "%s: vpb_write: Wrote chan (codec=%d) %d %d\n", p->dev, fmt, data[0],data[1]); } p->play_buf_time = ast_tvdiff_ms(ast_tvnow(), play_buf_time_start); } @@ -2350,8 +2255,7 @@ static int vpb_write(struct ast_channel *ast, struct ast_frame *frame) ast_mutex_unlock(&p->play_lock); /* ast_mutex_unlock(&p->lock); */ - if(option_verbose>5) - ast_verbose("%s: vpb_write: Done Writing to channel\n", p->dev); + ast_verb(6, "%s: vpb_write: Done Writing to channel\n", p->dev); return 0; } @@ -2375,19 +2279,15 @@ static void *do_chanreads(void *pvt) fr->offset = AST_FRIENDLY_OFFSET; memset(p->buf, 0, sizeof p->buf); - if (option_verbose > 2) { - ast_verbose("%s: chanreads: starting thread\n", p->dev); - } + ast_verb(3, "%s: chanreads: starting thread\n", p->dev); ast_mutex_lock(&p->record_lock); p->stopreads = 0; p->read_state = 1; while (!p->stopreads && p->owner) { - if (option_verbose > 4) - ast_verbose("%s: chanreads: Starting cycle ...\n", p->dev); - if (option_verbose > 4) - ast_verbose("%s: chanreads: Checking bridge \n", p->dev); + ast_verb(5, "%s: chanreads: Starting cycle ...\n", p->dev); + ast_verb(5, "%s: chanreads: Checking bridge \n", p->dev); if (p->bridge) { if (p->bridge->c0 == p->owner && (p->bridge->flags & AST_BRIDGE_REC_CHANNEL_0)) bridgerec = 1; @@ -2396,12 +2296,9 @@ static void *do_chanreads(void *pvt) else bridgerec = 0; } else { - if (option_verbose > 4) - ast_verbose("%s: chanreads: No native bridge.\n", p->dev); + ast_verb(5, "%s: chanreads: No native bridge.\n", p->dev); if (p->owner->_bridge){ - if (option_verbose > 4){ - ast_verbose("%s: chanreads: Got Asterisk bridge with [%s].\n", p->dev,p->owner->_bridge->name); - } + ast_verb(5, "%s: chanreads: Got Asterisk bridge with [%s].\n", p->dev,p->owner->_bridge->name); bridgerec = 1; } else { @@ -2412,12 +2309,10 @@ static void *do_chanreads(void *pvt) /* if ( (p->owner->_state != AST_STATE_UP) || !bridgerec) */ if ( (p->owner->_state != AST_STATE_UP) ) { - if (option_verbose > 4) { if (p->owner->_state != AST_STATE_UP) - ast_verbose("%s: chanreads: Im not up[%d]\n", p->dev,p->owner->_state); + ast_verb(5, "%s: chanreads: Im not up[%d]\n", p->dev,p->owner->_state); else - ast_verbose("%s: chanreads: No bridgerec[%d]\n", p->dev,bridgerec); - } + ast_verb(5, "%s: chanreads: No bridgerec[%d]\n", p->dev,bridgerec); vpb_sleep(10); continue; } @@ -2433,8 +2328,7 @@ static void *do_chanreads(void *pvt) ignore_dtmf = 0; if(( ignore_dtmf != p->last_ignore_dtmf ) &&(!use_ast_dtmfdet)){ - if(option_verbose>1) - ast_verbose( VERBOSE_PREFIX_2 "%s:Now %s DTMF \n", + ast_verb(2, "%s:Now %s DTMF \n", p->dev, ignore_dtmf ? "ignoring" : "listening for"); vpb_set_event_mask(p->handle, ignore_dtmf ? VPB_EVENTS_NODTMF : VPB_EVENTS_ALL ); } @@ -2443,9 +2337,7 @@ static void *do_chanreads(void *pvt) /* Play DTMF digits here to avoid problem you get if playing a digit during * a record operation */ - if (option_verbose > 5) { - ast_verbose("%s: chanreads: Checking dtmf's \n", p->dev); - } + ast_verb(6, "%s: chanreads: Checking dtmf's \n", p->dev); ast_mutex_lock(&p->play_dtmf_lock); if( p->play_dtmf[0] ) { /* Try to ignore DTMF event we get after playing digit */ @@ -2454,12 +2346,10 @@ static void *do_chanreads(void *pvt) vpb_set_event_mask(p->handle, VPB_EVENTS_NODTMF ); if (p->bridge == NULL){ vpb_dial_sync(p->handle,p->play_dtmf); - if(option_verbose>1) - ast_verbose( VERBOSE_PREFIX_2 "%s: chanreads: Played DTMF %s\n",p->dev,p->play_dtmf); + ast_verb(2, "%s: chanreads: Played DTMF %s\n",p->dev,p->play_dtmf); } else { - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "%s: chanreads: Not playing DTMF frame on native bridge\n", p->dev); + ast_verb(2, "%s: chanreads: Not playing DTMF frame on native bridge\n", p->dev); } p->play_dtmf[0] = '\0'; ast_mutex_unlock(&p->play_dtmf_lock); @@ -2490,32 +2380,24 @@ static void *do_chanreads(void *pvt) vpb_record_buf_start(p->handle, fmt); vpb_reset_record_fifo_alarm(p->handle); p->lastinput = fmt; - if(option_verbose>1) - ast_verbose( VERBOSE_PREFIX_2 "%s: Starting record mode (codec=%d)[%s]\n",p->dev,fmt,ast2vpbformatname(afmt)); + ast_verb(2, "%s: Starting record mode (codec=%d)[%s]\n",p->dev,fmt,ast2vpbformatname(afmt)); continue; } else if (p->lastinput != fmt) { vpb_record_buf_finish(p->handle); vpb_record_buf_start(p->handle, fmt); p->lastinput = fmt; - if(option_verbose>1) - ast_verbose( VERBOSE_PREFIX_2 "%s: Changed record format (%d=>%d)\n",p->dev,p->lastinput,fmt); + ast_verb(2, "%s: Changed record format (%d=>%d)\n",p->dev,p->lastinput,fmt); continue; } /* Read only if up and not bridged, or a bridge for which we can read. */ - if (option_verbose > 5) { - ast_verbose("%s: chanreads: getting buffer!\n", p->dev); - } + ast_verb(6, "%s: chanreads: getting buffer!\n", p->dev); if( (res = vpb_record_buf_sync(p->handle, readbuf, readlen) ) == VPB_OK ) { - if (option_verbose > 5) { - ast_verbose("%s: chanreads: got buffer!\n", p->dev); - } + ast_verb(6, "%s: chanreads: got buffer!\n", p->dev); /* Apply extra gain ! */ if( p->rxswgain > MAX_VPB_GAIN ) a_gain_vector(p->rxswgain - MAX_VPB_GAIN , (short*)readbuf, readlen/sizeof(short)); - if (option_verbose > 5) { - ast_verbose("%s: chanreads: applied gain\n", p->dev); - } + ast_verb(6, "%s: chanreads: applied gain\n", p->dev); fr->subclass = afmt; fr->data = readbuf; @@ -2543,9 +2425,7 @@ static void *do_chanreads(void *pvt) * (ast_hangup() immediately gets lock) */ if (p->owner && !p->stopreads ) { - if (option_verbose > 5) { - ast_verbose("%s: chanreads: queueing buffer on read frame q (state[%d])\n", p->dev,p->owner->_state); - } + ast_verb(6, "%s: chanreads: queueing buffer on read frame q (state[%d])\n", p->dev,p->owner->_state); do { res = ast_mutex_trylock(&p->owner->lock); trycnt++; @@ -2554,8 +2434,7 @@ static void *do_chanreads(void *pvt) ast_queue_frame(p->owner, fr); ast_mutex_unlock(&p->owner->lock); } else { - if (option_verbose > 4) - ast_verbose("%s: chanreads: Couldnt get lock after %d tries!\n", p->dev,trycnt); + ast_verb(5, "%s: chanreads: Couldnt get lock after %d tries!\n", p->dev,trycnt); } trycnt=0; @@ -2566,9 +2445,9 @@ static void *do_chanreads(void *pvt) ast_mutex_unlock(&p->owner->lock); } else { if (res == EINVAL ) - if (option_verbose > 4) ast_verbose("%s: chanreads: try owner->lock gave me EINVAL[%d]\n", p->dev,res); + ast_verb(5, "%s: chanreads: try owner->lock gave me EINVAL[%d]\n", p->dev,res); else if (res == EBUSY ) - if (option_verbose > 4) ast_verbose("%s: chanreads: try owner->lock gave me EBUSY[%d]\n", p->dev,res); + ast_verb(5, "%s: chanreads: try owner->lock gave me EBUSY[%d]\n", p->dev,res); while(res !=0){ res = ast_mutex_trylock(&p->owner->lock); } @@ -2578,27 +2457,22 @@ static void *do_chanreads(void *pvt) } else { if (res == EINVAL ) - if (option_verbose > 4) ast_verbose("%s: chanreads: try owner->lock gave me EINVAL[%d]\n", p->dev,res); + ast_verb(5, "%s: chanreads: try owner->lock gave me EINVAL[%d]\n", p->dev,res); else if (res == EBUSY ) - if (option_verbose > 4) ast_verbose("%s: chanreads: try owner->lock gave me EBUSY[%d]\n", p->dev,res); - if (option_verbose > 4) ast_verbose("%s: chanreads: Couldnt get lock on owner[%s][%d][%d] channel to send frame!\n", p->dev,p->owner->name,(int)p->owner->lock.__m_owner,(int)p->owner->lock.__m_count); + ast_verb(5, "%s: chanreads: try owner->lock gave me EBUSY[%d]\n", p->dev,res); + ast_verb(5, "%s: chanreads: Couldnt get lock on owner[%s][%d][%d] channel to send frame!\n", p->dev,p->owner->name,(int)p->owner->lock.__m_owner,(int)p->owner->lock.__m_count); } } */ - if (option_verbose > 6) { short * data = (short*)readbuf; - ast_verbose("%s: Read channel (codec=%d) %d %d\n", p->dev, fmt, data[0], data[1] ); + ast_verb(7, "%s: Read channel (codec=%d) %d %d\n", p->dev, fmt, data[0], data[1] ); } - } else { - if (option_verbose > 4) { - ast_verbose("%s: p->stopreads[%d] p->owner[%p]\n", p->dev, p->stopreads,(void *)p->owner); + ast_verb(5, "%s: p->stopreads[%d] p->owner[%p]\n", p->dev, p->stopreads,(void *)p->owner); } } + ast_verb(5, "%s: chanreads: Finished cycle...\n", p->dev); } - if (option_verbose > 4) - ast_verbose("%s: chanreads: Finished cycle...\n", p->dev); - } p->read_state=0; /* When stopreads seen, go away! */ @@ -2606,8 +2480,7 @@ static void *do_chanreads(void *pvt) p->read_state=0; ast_mutex_unlock(&p->record_lock); - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "%s: Ending record mode (%d/%s)\n", + ast_verb(2, "%s: Ending record mode (%d/%s)\n", p->dev, p->stopreads, p->owner? "yes" : "no"); return NULL; } @@ -2622,8 +2495,7 @@ static struct ast_channel *vpb_new(struct vpb_pvt *me, enum ast_channel_state st ast_log(LOG_WARNING, "Called vpb_new on owned channel (%s) ?!\n", me->dev); return NULL; } - if (option_verbose > 3) - ast_verbose("%s: New call for context [%s]\n",me->dev,context); + ast_verb(4, "%s: New call for context [%s]\n",me->dev,context); tmp = ast_channel_alloc(1, state, 0, 0, "", me->ext, me->context, 0, me->dev); if (tmp) { @@ -2736,9 +2608,7 @@ static struct ast_channel *vpb_request(const char *type, int format, void *data, } ast_mutex_unlock(&iflock); - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 " %s requested, got: [%s]\n", - name, tmp ? tmp->name : "None"); + ast_verb(2, " %s requested, got: [%s]\n", name, tmp ? tmp->name : "None"); ast_free(name); diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 182eb5559..323a7f08e 100644 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -1848,8 +1848,7 @@ static int send_cwcidspill(struct zt_pvt *p) p->cidlen += READ_SIZE * 4; p->cidpos = 0; send_callerid(p); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "CPE supports Call Waiting Caller*ID. Sending '%s/%s'\n", p->callwait_name, p->callwait_num); + ast_verb(3, "CPE supports Call Waiting Caller*ID. Sending '%s/%s'\n", p->callwait_name, p->callwait_num); return 0; } @@ -2385,8 +2384,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout) if (p->pri->facilityenable) pri_facility_enable(p->pri->pri); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Requested transfer capability: 0x%.2x - %s\n", ast->transfercapability, ast_transfercapability2str(ast->transfercapability)); + ast_verb(3, "Requested transfer capability: 0x%.2x - %s\n", ast->transfercapability, ast_transfercapability2str(ast->transfercapability)); dp_strip = 0; pridialplan = p->pri->dialplan - 1; if (pridialplan == -2 || pridialplan == -3) { /* compute dynamically */ @@ -2995,8 +2993,7 @@ static int zt_hangup(struct ast_channel *ast) ast->tech_pvt = NULL; ast_mutex_unlock(&p->lock); ast_module_unref(ast_module_info->self); - if (option_verbose > 2) - ast_verbose( VERBOSE_PREFIX_3 "Hungup '%s'\n", ast->name); + ast_verb(3, "Hungup '%s'\n", ast->name); ast_mutex_lock(&iflock); tmp = iflist; @@ -3613,8 +3610,7 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann return AST_BRIDGE_FAILED; } - 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); if (!(flags & AST_BRIDGE_DTMF_CHANNEL_0) && (oi0 == SUB_REAL)) disable_dtmf_detect(op0); @@ -3865,8 +3861,7 @@ static int check_for_conference(struct zt_pvt *p) if we're in a conference, it's probably a MeetMe room or some such, so don't let us 3-way out! */ if ((p->subs[SUB_REAL].curconf.confno != ci.confno) || (p->subs[SUB_REAL].curconf.confmode != ci.confmode)) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Avoiding 3-way call when in an external conference\n"); + ast_verb(3, "Avoiding 3-way call when in an external conference\n"); return 1; } return 0; @@ -3922,8 +3917,7 @@ static void zt_handle_dtmfup(struct ast_channel *ast, int index, struct ast_fram const char *target_context = S_OR(ast->macrocontext, ast->context); if (ast_exists_extension(ast, target_context, "fax", 1, ast->cid.cid_num)) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Redirecting %s to fax extension\n", ast->name); + ast_verb(3, "Redirecting %s to fax extension\n", ast->name); /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */ pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast->exten); if (ast_async_goto(ast, target_context, "fax", 1)) @@ -4017,8 +4011,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast) switch (res) { #ifdef ZT_EVENT_EC_DISABLED case ZT_EVENT_EC_DISABLED: - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Channel %d echo canceler disabled due to CED detection\n", p->channel); + ast_verb(3, "Channel %d echo canceler disabled due to CED detection\n", p->channel); p->echocanon = 0; break; #endif @@ -4140,8 +4133,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast) if (p->subs[SUB_CALLWAIT].owner) { /* There's a call waiting call, so ring the phone, but make it unowned in the mean time */ swap_subs(p, SUB_CALLWAIT, SUB_REAL); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Channel %d still has (callwait) call, ringing phone\n", p->channel); + ast_verb(3, "Channel %d still has (callwait) call, ringing phone\n", p->channel); unalloc_sub(p, SUB_CALLWAIT); #if 0 p->subs[index].needanswer = 0; @@ -4555,8 +4547,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast) zt_enable_ec(p); ast_hangup(chan); } else { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Started three way call on channel %d\n", p->channel); + ast_verb(3, "Started three way call on channel %d\n", p->channel); /* Start music on hold if appropriate */ if (ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) { ast_queue_control_data(p->subs[SUB_THREEWAY].owner, AST_CONTROL_HOLD, @@ -4578,8 +4569,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast) p->owner = p->subs[SUB_REAL].owner; } /* Drop the last call and stop the conference */ - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Dropping three-way call on %s\n", p->subs[SUB_THREEWAY].owner->name); + ast_verb(3, "Dropping three-way call on %s\n", p->subs[SUB_THREEWAY].owner->name); p->subs[SUB_THREEWAY].owner->_softhangup |= AST_SOFTHANGUP_DEV; p->subs[SUB_REAL].inthreeway = 0; p->subs[SUB_THREEWAY].inthreeway = 0; @@ -4589,8 +4579,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast) (p->transfertobusy || (ast->_state != AST_STATE_BUSY))) { int otherindex = SUB_THREEWAY; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Building conference on call on %s and %s\n", p->subs[SUB_THREEWAY].owner->name, p->subs[SUB_REAL].owner->name); + ast_verb(3, "Building conference on call on %s and %s\n", p->subs[SUB_THREEWAY].owner->name, p->subs[SUB_REAL].owner->name); /* Put them in the threeway, and flip */ p->subs[SUB_THREEWAY].inthreeway = 1; p->subs[SUB_REAL].inthreeway = 1; @@ -4608,8 +4597,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast) res = tone_zone_play_tone(p->subs[SUB_THREEWAY].zfd, ZT_TONE_RINGTONE); } } else { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Dumping incomplete call on on %s\n", p->subs[SUB_THREEWAY].owner->name); + ast_verb(3, "Dumping incomplete call on on %s\n", p->subs[SUB_THREEWAY].owner->name); swap_subs(p, SUB_THREEWAY, SUB_REAL); p->subs[SUB_THREEWAY].owner->_softhangup |= AST_SOFTHANGUP_DEV; p->owner = p->subs[SUB_REAL].owner; @@ -4814,8 +4802,7 @@ static struct ast_frame *__zt_exception(struct ast_channel *ast) case ZT_EVENT_ONHOOK: zt_disable_ec(p); if (p->owner) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Channel %s still has call, ringing phone\n", p->owner->name); + ast_verb(3, "Channel %s still has call, ringing phone\n", p->owner->name); zt_ring_phone(p); p->callwaitingrepeat = 0; p->cidcwexpire = 0; @@ -4838,8 +4825,7 @@ static struct ast_frame *__zt_exception(struct ast_channel *ast) case ZT_EVENT_WINKFLASH: p->flashtime = ast_tvnow(); if (p->owner) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Channel %d flashed to other channel %s\n", p->channel, p->owner->name); + ast_verb(3, "Channel %d flashed to other channel %s\n", p->channel, p->owner->name); if (p->owner->_state != AST_STATE_UP) { /* Answer if necessary */ usedindex = zt_get_index(p->owner, p, 0); @@ -5099,8 +5085,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast) } /* Expire CID/CW */ if (p->cidcwexpire == 1) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "CPE does not support Call Waiting Caller*ID.\n"); + ast_verb(3, "CPE does not support Call Waiting Caller*ID.\n"); restore_conference(p); } if (p->subs[index].linear) { @@ -5745,8 +5730,7 @@ static void *ss_thread(void *data) return NULL; } - if (option_verbose > 2) - ast_verbose( VERBOSE_PREFIX_3 "Starting simple switch on '%s'\n", chan->name); + ast_verb(3, "Starting simple switch on '%s'\n", chan->name); index = zt_get_index(chan, p, 1); if (index < 0) { ast_log(LOG_WARNING, "Huh?\n"); @@ -5784,8 +5768,7 @@ static void *ss_thread(void *data) } /* if no extension was received ('unspecified') on overlap call, use the 's' extension */ if (ast_strlen_zero(exten)) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Going to extension s|1 because of empty extension received on overlap call\n"); + ast_verb(3, "Going to extension s|1 because of empty extension received on overlap call\n"); exten[0] = 's'; exten[1] = '\0'; } @@ -6061,8 +6044,7 @@ static void *ss_thread(void *data) } return NULL; } else { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_2 "Unknown extension '%s' in context '%s' requested\n", exten, chan->context); + ast_verb(2, "Unknown extension '%s' in context '%s' requested\n", exten, chan->context); sleep(2); res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_INFO); if (res < 0) @@ -6112,8 +6094,7 @@ static void *ss_thread(void *data) if (getforward) { /* Record this as the forwarding extension */ ast_copy_string(p->call_forward, exten, sizeof(p->call_forward)); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Setting call forward to '%s' on channel %d\n", p->call_forward, p->channel); + ast_verb(3, "Setting call forward to '%s' on channel %d\n", p->call_forward, p->channel); res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL); if (res) break; @@ -6158,8 +6139,7 @@ static void *ss_thread(void *data) ast_hangup(chan); return NULL; } else if (p->callwaiting && !strcmp(exten, "*70")) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Disabling call waiting on %s\n", chan->name); + ast_verb(3, "Disabling call waiting on %s\n", chan->name); /* Disable call waiting if enabled */ p->callwaiting = 0; res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL); @@ -6201,8 +6181,7 @@ static void *ss_thread(void *data) } } else if (!p->hidecallerid && !strcmp(exten, "*67")) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Disabling Caller*ID on %s\n", chan->name); + ast_verb(3, "Disabling Caller*ID on %s\n", chan->name); /* Disable Caller*ID if enabled */ p->hidecallerid = 1; if (chan->cid.cid_num) @@ -6229,8 +6208,7 @@ static void *ss_thread(void *data) break; } else if (!strcmp(exten, "*78")) { /* Do not disturb */ - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Enabled DND on channel %d\n", p->channel); + ast_verb(3, "Enabled DND on channel %d\n", p->channel); manager_event(EVENT_FLAG_SYSTEM, "DNDState", "Channel: Zap/%d\r\n" "Status: enabled\r\n", p->channel); @@ -6241,8 +6219,7 @@ static void *ss_thread(void *data) len = 0; } else if (!strcmp(exten, "*79")) { /* Do not disturb */ - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Disabled DND on channel %d\n", p->channel); + ast_verb(3, "Disabled DND on channel %d\n", p->channel); manager_event(EVENT_FLAG_SYSTEM, "DNDState", "Channel: Zap/%d\r\n" "Status: disabled\r\n", p->channel); @@ -6257,8 +6234,7 @@ static void *ss_thread(void *data) memset(exten, 0, sizeof(exten)); len = 0; } else if (p->cancallforward && !strcmp(exten, "*73")) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Cancelling call forwarding on channel %d\n", p->channel); + ast_verb(3, "Cancelling call forwarding on channel %d\n", p->channel); res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL); memset(p->call_forward, 0, sizeof(p->call_forward)); getforward = 0; @@ -6270,12 +6246,10 @@ static void *ss_thread(void *data) /* This is a three way call, the main call being a real channel, and we're parking the first call. */ ast_masq_park_call(ast_bridged_channel(p->subs[SUB_THREEWAY].owner), chan, 0, NULL); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Parking call to '%s'\n", chan->name); + ast_verb(3, "Parking call to '%s'\n", chan->name); break; } else if (!ast_strlen_zero(p->lastcid_num) && !strcmp(exten, "*60")) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Blacklisting number %s\n", p->lastcid_num); + ast_verb(3, "Blacklisting number %s\n", p->lastcid_num); res = ast_db_put("blacklist", p->lastcid_num, "1"); if (!res) { res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL); @@ -6283,8 +6257,7 @@ static void *ss_thread(void *data) len = 0; } } else if (p->hidecallerid && !strcmp(exten, "*82")) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Enabling Caller*ID on %s\n", chan->name); + ast_verb(3, "Enabling Caller*ID on %s\n", chan->name); /* Enable Caller*ID if enabled */ p->hidecallerid = 0; if (chan->cid.cid_num) @@ -6603,23 +6576,22 @@ static void *ss_thread(void *data) } } } - if (option_verbose > 2) /* this only shows up if you have n of the dring patterns filled in */ - ast_verbose( VERBOSE_PREFIX_3 "Detected ring pattern: %d,%d,%d\n",curRingData[0],curRingData[1],curRingData[2]); + ast_verb(3, "Detected ring pattern: %d,%d,%d\n",curRingData[0],curRingData[1],curRingData[2]); for (counter = 0; counter < 3; counter++) { /* Check to see if the rings we received match any of the ones in zapata.conf for this channel */ distMatches = 0; for (counter1 = 0; counter1 < 3; counter1++) { - ast_verbose( VERBOSE_PREFIX_3 "Ring pattern check range: %d\n", p->drings.ringnum[counter].range); + ast_verb(3, "Ring pattern check range: %d\n", p->drings.ringnum[counter].range); if (p->drings.ringnum[counter].ring[counter1] == -1) { - ast_verbose( VERBOSE_PREFIX_3 "Pattern ignore (-1) detected, so matching pattern %d regardless.\n", + ast_verb(3, "Pattern ignore (-1) detected, so matching pattern %d regardless.\n", curRingData[counter1]); distMatches++; } else if (curRingData[counter1] <= (p->drings.ringnum[counter].ring[counter1] + p->drings.ringnum[counter].range) && curRingData[counter1] >= (p->drings.ringnum[counter].ring[counter1] - p->drings.ringnum[counter].range)) { - ast_verbose( VERBOSE_PREFIX_3 "Ring pattern matched in range: %d to %d\n", + ast_verb(3, "Ring pattern matched in range: %d to %d\n", (p->drings.ringnum[counter].ring[counter1] - p->drings.ringnum[counter].range), (p->drings.ringnum[counter].ring[counter1] + p->drings.ringnum[counter].range)); distMatches++; @@ -6630,8 +6602,7 @@ static void *ss_thread(void *data) /* The ring matches, set the context to whatever is for distinctive ring.. */ ast_copy_string(p->context, p->drings.ringContext[counter].contextData, sizeof(p->context)); ast_copy_string(chan->context, p->drings.ringContext[counter].contextData, sizeof(chan->context)); - if (option_verbose > 2) - ast_verbose( VERBOSE_PREFIX_3 "Distinctive Ring matched context %s\n",p->context); + ast_verb(3, "Distinctive Ring matched context %s\n",p->context); break; } } @@ -6775,8 +6746,7 @@ static void *ss_thread(void *data) curRingData[receivedRingT] = 0; } receivedRingT = 0; - if (option_verbose > 2) - ast_verbose( VERBOSE_PREFIX_3 "Detecting post-CID distinctive ring\n"); + ast_verb(3, "Detecting post-CID distinctive ring\n"); for (;;) { i = ZT_IOMUX_READ | ZT_IOMUX_SIGEVENT; if ((res = ioctl(p->subs[index].zfd, ZT_IOMUX, &i))) { @@ -6820,30 +6790,28 @@ static void *ss_thread(void *data) } } if (p->usedistinctiveringdetection == 1) { - if (option_verbose > 2) /* this only shows up if you have n of the dring patterns filled in */ - ast_verbose( VERBOSE_PREFIX_3 "Detected ring pattern: %d,%d,%d\n",curRingData[0],curRingData[1],curRingData[2]); + ast_verb(3, "Detected ring pattern: %d,%d,%d\n",curRingData[0],curRingData[1],curRingData[2]); for (counter = 0; counter < 3; counter++) { /* Check to see if the rings we received match any of the ones in zapata.conf for this channel */ - if (option_verbose > 2) /* this only shows up if you have n of the dring patterns filled in */ - ast_verbose( VERBOSE_PREFIX_3 "Checking %d,%d,%d\n", + ast_verb(3, "Checking %d,%d,%d\n", p->drings.ringnum[counter].ring[0], p->drings.ringnum[counter].ring[1], p->drings.ringnum[counter].ring[2]); distMatches = 0; for (counter1 = 0; counter1 < 3; counter1++) { - ast_verbose( VERBOSE_PREFIX_3 "Ring pattern check range: %d\n", p->drings.ringnum[counter].range); + ast_verb(3, "Ring pattern check range: %d\n", p->drings.ringnum[counter].range); if (p->drings.ringnum[counter].ring[counter1] == -1) { - ast_verbose( VERBOSE_PREFIX_3 "Pattern ignore (-1) detected, so matching pattern %d regardless.\n", + ast_verb(3, "Pattern ignore (-1) detected, so matching pattern %d regardless.\n", curRingData[counter1]); distMatches++; } else if (curRingData[counter1] <= (p->drings.ringnum[counter].ring[counter1] + p->drings.ringnum[counter].range) && curRingData[counter1] >= (p->drings.ringnum[counter].ring[counter1] - p->drings.ringnum[counter].range)) { - ast_verbose( VERBOSE_PREFIX_3 "Ring pattern matched in range: %d to %d\n", + ast_verb(3, "Ring pattern matched in range: %d to %d\n", (p->drings.ringnum[counter].ring[counter1] - p->drings.ringnum[counter].range), (p->drings.ringnum[counter].ring[counter1] + p->drings.ringnum[counter].range)); distMatches++; @@ -6853,8 +6821,7 @@ static void *ss_thread(void *data) /* The ring matches, set the context to whatever is for distinctive ring.. */ ast_copy_string(p->context, p->drings.ringContext[counter].contextData, sizeof(p->context)); ast_copy_string(chan->context, p->drings.ringContext[counter].contextData, sizeof(chan->context)); - if (option_verbose > 2) - ast_verbose( VERBOSE_PREFIX_3 "Distinctive Ring matched context %s\n",p->context); + ast_verb(3, "Distinctive Ring matched context %s\n",p->context); break; } } @@ -7102,7 +7069,7 @@ static int handle_init_event(struct zt_pvt *i, int event) case SIG_FXSGS: if (i->cid_start == CID_START_POLARITY || i->cid_start == CID_START_POLARITY_IN) { i->polarity = POLARITY_REV; - ast_verbose(VERBOSE_PREFIX_2 "Starting post polarity " + ast_verb(2, "Starting post polarity " "CID detection on channel %d\n", i->channel); chan = zt_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0); @@ -8490,7 +8457,7 @@ static void ss7_start_call(struct zt_pvt *p, struct zt_ss7 *linkset) c = zt_new(p, AST_STATE_RING, 1, SUB_REAL, law, 0); ast_mutex_lock(&linkset->lock); if (c) - ast_verbose(VERBOSE_PREFIX_3 "Accepting call to '%s' on CIC %d\n", p->exten, p->cic); + ast_verb(3, "Accepting call to '%s' on CIC %d\n", p->exten, p->cic); else ast_log(LOG_WARNING, "Unable to start PBX on CIC %d\n", p->cic); } @@ -9002,8 +8969,7 @@ static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c) if (pri->pvts[x]->call == c) { /* Found our call */ if (principle != x) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Moving call from channel %d to channel %d\n", + ast_verb(3, "Moving call from channel %d to channel %d\n", pri->pvts[x]->channel, pri->pvts[principle]->channel); if (pri->pvts[principle]->owner) { ast_log(LOG_WARNING, "Can't fix up channel from %d to %d because %d is already in use\n", @@ -9066,8 +9032,7 @@ static void *do_idle_thread(void *vchan) char ex[80]; /* Wait up to 30 seconds for an answer */ int newms, ms = 30000; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Initiating idle call on channel %s\n", chan->name); + ast_verb(3, "Initiating idle call on channel %s\n", chan->name); snprintf(ex, sizeof(ex), "%d/%s", pvt->channel, pvt->pri->idledial); if (ast_call(chan, ex, 0)) { ast_log(LOG_WARNING, "Idle dial failed on '%s' to '%s'\n", chan->name, ex); @@ -9087,18 +9052,15 @@ static void *do_idle_thread(void *vchan) ast_copy_string(chan->exten, pvt->pri->idleext, sizeof(chan->exten)); ast_copy_string(chan->context, pvt->pri->idlecontext, sizeof(chan->context)); chan->priority = 1; - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_3 "Idle channel '%s' answered, sending to %s@%s\n", chan->name, chan->exten, chan->context); + ast_verb(4, "Idle channel '%s' answered, sending to %s@%s\n", chan->name, chan->exten, chan->context); ast_pbx_run(chan); /* It's already hungup, return immediately */ return NULL; case AST_CONTROL_BUSY: - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_3 "Idle channel '%s' busy, waiting...\n", chan->name); + ast_verb(4, "Idle channel '%s' busy, waiting...\n", chan->name); break; case AST_CONTROL_CONGESTION: - if (option_verbose > 3) - ast_verbose(VERBOSE_PREFIX_3 "Idle channel '%s' congested, waiting...\n", chan->name); + ast_verb(4, "Idle channel '%s' congested, waiting...\n", chan->name); break; }; } @@ -9497,8 +9459,7 @@ static void *pri_dchannel(void *vpri) switch (e->e) { case PRI_EVENT_DCHAN_UP: - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "%s D-Channel on span %d up\n", pri_order(which), pri->span); + ast_verb(2, "%s D-Channel on span %d up\n", pri_order(which), pri->span); pri->dchanavail[which] |= DCHAN_UP; if (!pri->pri) pri_find_dchan(pri); @@ -9518,8 +9479,7 @@ static void *pri_dchannel(void *vpri) } break; case PRI_EVENT_DCHAN_DOWN: - if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "%s D-Channel on span %d down\n", pri_order(which), pri->span); + ast_verb(2, "%s D-Channel on span %d down\n", pri_order(which), pri->span); pri->dchanavail[which] &= ~DCHAN_UP; pri_find_dchan(pri); if (!pri_is_up(pri)) { @@ -9555,8 +9515,7 @@ static void *pri_dchannel(void *vpri) ast_log(LOG_WARNING, "Restart requested on odd/unavailable channel number %d/%d on span %d\n", PRI_SPAN(e->restart.channel), PRI_CHANNEL(e->restart.channel), pri->span); else { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "B-channel %d/%d restarted on span %d\n", + ast_verb(3, "B-channel %d/%d restarted on span %d\n", PRI_SPAN(e->restart.channel), PRI_CHANNEL(e->restart.channel), pri->span); ast_mutex_lock(&pri->pvts[chanpos]->lock); if (pri->pvts[chanpos]->call) { @@ -9571,8 +9530,7 @@ static void *pri_dchannel(void *vpri) ast_mutex_unlock(&pri->pvts[chanpos]->lock); } } else { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_2 "Restart on requested on entire span %d\n", pri->span); + ast_verb(3, "Restart on requested on entire span %d\n", pri->span); for (x = 0; x < pri->numchans; x++) if (pri->pvts[x]) { ast_mutex_lock(&pri->pvts[x]->lock); @@ -9721,8 +9679,7 @@ static void *pri_dchannel(void *vpri) e->ring.redirectingnum, e->ring.callingplanrdnis); /* If immediate=yes go to s|1 */ if (pri->pvts[chanpos]->immediate) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Going to extension s|1 because of immediate=yes\n"); + ast_verb(3, "Going to extension s|1 because of immediate=yes\n"); pri->pvts[chanpos]->exten[0] = 's'; pri->pvts[chanpos]->exten[1] = '\0'; } @@ -9737,8 +9694,7 @@ static void *pri_dchannel(void *vpri) ast_copy_string(pri->pvts[chanpos]->dnid, e->ring.callednum, sizeof(pri->pvts[chanpos]->dnid)); /* No number yet, but received "sending complete"? */ if (e->ring.complete && (ast_strlen_zero(e->ring.callednum))) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Going to extension s|1 because of Complete received\n"); + ast_verb(3, "Going to extension s|1 because of Complete received\n"); pri->pvts[chanpos]->exten[0] = 's'; pri->pvts[chanpos]->exten[1] = '\0'; } @@ -9810,8 +9766,7 @@ static void *pri_dchannel(void *vpri) ast_mutex_lock(&pri->lock); if (c && !ast_pthread_create_detached(&threadid, NULL, ss_thread, c)) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Accepting overlap call from '%s' to '%s' on channel %d/%d, span %d\n", + ast_verb(3, "Accepting overlap call from '%s' to '%s' on channel %d/%d, span %d\n", plancallingnum, S_OR(pri->pvts[chanpos]->exten, "<unspecified>"), pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span); } else { @@ -9847,8 +9802,7 @@ static void *pri_dchannel(void *vpri) snprintf(calledtonstr, sizeof(calledtonstr)-1, "%d", e->ring.calledplan); pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Accepting call from '%s' to '%s' on channel %d/%d, span %d\n", + ast_verb(3, "Accepting call from '%s' to '%s' on channel %d/%d, span %d\n", plancallingnum, pri->pvts[chanpos]->exten, pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span); zt_enable_ec(pri->pvts[chanpos]); @@ -9860,8 +9814,7 @@ static void *pri_dchannel(void *vpri) } } } else { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Extension '%s' in context '%s' from '%s' does not exist. Rejecting call on channel %d/%d, span %d\n", + ast_verb(3, "Extension '%s' in context '%s' from '%s' does not exist. Rejecting call on channel %d/%d, span %d\n", pri->pvts[chanpos]->exten, pri->pvts[chanpos]->context, pri->pvts[chanpos]->cid_num, pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span); pri_hangup(pri->pri, e->ring.call, PRI_CAUSE_UNALLOCATED); @@ -9932,14 +9885,12 @@ static void *pri_dchannel(void *vpri) struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROGRESS, }; if (e->proceeding.cause > -1) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "PROGRESS with cause code %d received\n", e->proceeding.cause); + ast_verb(3, "PROGRESS with cause code %d received\n", e->proceeding.cause); /* Work around broken, out of spec USER_BUSY cause in a progress message */ if (e->proceeding.cause == AST_CAUSE_USER_BUSY) { if (pri->pvts[chanpos]->owner) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "PROGRESS with 'user busy' received, signaling AST_CONTROL_BUSY instead of AST_CONTROL_PROGRESS\n"); + ast_verb(3, "PROGRESS with 'user busy' received, signaling AST_CONTROL_BUSY instead of AST_CONTROL_PROGRESS\n"); pri->pvts[chanpos]->owner->hangupcause = e->proceeding.cause; f.subclass = AST_CONTROL_BUSY; @@ -10113,23 +10064,20 @@ static void *pri_dchannel(void *vpri) } } } - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d got hangup, cause %d\n", + ast_verb(3, "Channel %d/%d, span %d got hangup, cause %d\n", pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span, e->hangup.cause); } else { pri_hangup(pri->pri, pri->pvts[chanpos]->call, e->hangup.cause); pri->pvts[chanpos]->call = NULL; } if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Forcing restart of channel %d/%d on span %d since channel reported in use\n", + ast_verb(3, "Forcing restart of channel %d/%d on span %d since channel reported in use\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span); pri_reset(pri->pri, PVT_TO_CHANNEL(pri->pvts[chanpos])); pri->pvts[chanpos]->resetting = 1; } if (e->hangup.aoc_units > -1) - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d received AOC-E charging %d unit%s\n", + ast_verb(3, "Channel %d/%d, span %d received AOC-E charging %d unit%s\n", pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span, (int)e->hangup.aoc_units, (e->hangup.aoc_units == 1) ? "" : "s"); #ifdef SUPPORT_USERUSER @@ -10180,19 +10128,16 @@ static void *pri_dchannel(void *vpri) pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV; } } - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d got hangup request, cause %d\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span, e->hangup.cause); + ast_verb(3, "Channel %d/%d, span %d got hangup request, cause %d\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span, e->hangup.cause); if (e->hangup.aoc_units > -1) - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d received AOC-E charging %d unit%s\n", + ast_verb(3, "Channel %d/%d, span %d received AOC-E charging %d unit%s\n", pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span, (int)e->hangup.aoc_units, (e->hangup.aoc_units == 1) ? "" : "s"); } else { pri_hangup(pri->pri, pri->pvts[chanpos]->call, e->hangup.cause); pri->pvts[chanpos]->call = NULL; } if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Forcing restart of channel %d/%d span %d since channel reported in use\n", + ast_verb(3, "Forcing restart of channel %d/%d span %d since channel reported in use\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span); pri_reset(pri->pri, PVT_TO_CHANNEL(pri->pvts[chanpos])); pri->pvts[chanpos]->resetting = 1; @@ -10222,8 +10167,7 @@ static void *pri_dchannel(void *vpri) pri->pvts[chanpos]->call = NULL; pri->pvts[chanpos]->resetting = 0; if (pri->pvts[chanpos]->owner) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d got hangup ACK\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span); + ast_verb(3, "Channel %d/%d, span %d got hangup ACK\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span); } #ifdef SUPPORT_USERUSER @@ -10259,8 +10203,7 @@ static void *pri_dchannel(void *vpri) pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV; } pri->pvts[chanpos]->resetting = 0; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "B-channel %d/%d successfully restarted on span %d\n", pri->pvts[chanpos]->logicalspan, + ast_verb(3, "B-channel %d/%d successfully restarted on span %d\n", pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span); ast_mutex_unlock(&pri->pvts[chanpos]->lock); if (pri->resetting) @@ -10284,8 +10227,7 @@ static void *pri_dchannel(void *vpri) } pri->pvts[chanpos]->resetting = 0; pri->pvts[chanpos]->inservice = 1; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "B-channel %d/%d successfully restarted on span %d\n", pri->pvts[chanpos]->logicalspan, + ast_verb(3, "B-channel %d/%d successfully restarted on span %d\n", pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span); ast_mutex_unlock(&pri->pvts[chanpos]->lock); if (pri->resetting) @@ -10757,8 +10699,7 @@ static int zap_destroy_channel(int fd, int argc, char **argv) static int setup_zap(int reload); static int zap_restart(void) { - if (option_verbose > 0) - ast_verbose(VERBOSE_PREFIX_1 "Destroying channels and reloading zaptel configuration.\n"); + ast_verb(1, "Destroying channels and reloading zaptel configuration.\n"); while (iflist) { ast_debug(1, "Destroying zaptel channel no. %d\n", iflist->channel); /* Also updates iflist: */ @@ -11453,7 +11394,7 @@ static int __unload_module(void) /* Free associated memory */ if (pl) destroy_zt_pvt(&pl); - ast_verbose(VERBOSE_PREFIX_3 "Unregistered channel %d\n", x); + ast_verb(3, "Unregistered channel %d\n", x); } iflist = NULL; ifcount = 0; @@ -11879,14 +11820,12 @@ static int build_channels(struct zt_chan_conf conf, int iscrv, const char *value #endif if (tmp) { - if (option_verbose > 2) { #ifdef HAVE_PRI if (pri) - ast_verbose(VERBOSE_PREFIX_3 "%s CRV %d:%d, %s signalling\n", reload ? "Reconfigured" : "Registered", trunkgroup, x, sig2str(tmp->sig)); + ast_verb(3, "%s CRV %d:%d, %s signalling\n", reload ? "Reconfigured" : "Registered", trunkgroup, x, sig2str(tmp->sig)); else #endif - ast_verbose(VERBOSE_PREFIX_3 "%s channel %d, %s signalling\n", reload ? "Reconfigured" : "Registered", x, sig2str(tmp->sig)); - } + ast_verb(3, "%s channel %d, %s signalling\n", reload ? "Reconfigured" : "Registered", x, sig2str(tmp->sig)); } else { ast_log(LOG_ERROR, "Unable to %s channel '%s'\n", (reload == 1) ? "reconfigure" : "register", value); @@ -12598,8 +12537,7 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r else { cadences[num_cadence] = new_cadence; cidrings[num_cadence++] = cid_location; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "cadence 'r%d' added: %s\n",num_cadence,original_args); + ast_verb(3, "cadence 'r%d' added: %s\n",num_cadence,original_args); } } } @@ -12671,8 +12609,7 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r tmp = mkintf(CHAN_PSEUDO, *confp, NULL, reload); if (tmp) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Automatically generated pseudo channel\n"); + ast_verb(3, "Automatically generated pseudo channel\n"); } else { ast_log(LOG_WARNING, "Unable to register pseudo channel!\n"); } @@ -12729,8 +12666,8 @@ static int setup_zap(int reload) if (i) { if (pri_create_trunkgroup(trunkgroup, dchannels)) { ast_log(LOG_WARNING, "Unable to create trunk group %d with Primary D-channel %d at line %d of zapata.conf\n", trunkgroup, dchannels[0], v->lineno); - } else if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "Created trunk group %d with Primary D-channel %d and %d backup%s\n", trunkgroup, dchannels[0], i - 1, (i == 1) ? "" : "s"); + } else + ast_verb(2, "Created trunk group %d with Primary D-channel %d and %d backup%s\n", trunkgroup, dchannels[0], i - 1, (i == 1) ? "" : "s"); } else ast_log(LOG_WARNING, "Trunk group %d lacks any valid D-channels at line %d of zapata.conf\n", trunkgroup, v->lineno); } else @@ -12750,8 +12687,8 @@ static int setup_zap(int reload) if (logicalspan >= 0) { if (pri_create_spanmap(spanno - 1, trunkgroup, logicalspan)) { ast_log(LOG_WARNING, "Failed to map span %d to trunk group %d (logical span %d)\n", spanno, trunkgroup, logicalspan); - } else if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "Mapped span %d to trunk group %d (logical span %d)\n", spanno, trunkgroup, logicalspan); + } else + ast_verb(2, "Mapped span %d to trunk group %d (logical span %d)\n", spanno, trunkgroup, logicalspan); } else ast_log(LOG_WARNING, "Logical span must be a postive number, or '0' (for unspecified) at line %d of zapata.conf\n", v->lineno); } else @@ -12804,8 +12741,8 @@ static int setup_zap(int reload) if (start_pri(pris + x)) { ast_log(LOG_ERROR, "Unable to start D-channel on span %d\n", x + 1); return -1; - } else if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "Starting D-Channel on span %d\n", x + 1); + } else + ast_verb(2, "Starting D-Channel on span %d\n", x + 1); } } } @@ -12817,8 +12754,8 @@ static int setup_zap(int reload) if (ast_pthread_create(&linksets[x].master, NULL, ss7_linkset, &linksets[x])) { ast_log(LOG_ERROR, "Unable to start SS7 linkset on span %d\n", x + 1); return -1; - } else if (option_verbose > 1) - ast_verbose(VERBOSE_PREFIX_2 "Starting SS7 linkset on span %d\n", x + 1); + } else + ast_verb(2, "Starting SS7 linkset on span %d\n", x + 1); } } } diff --git a/channels/iax2-provision.c b/channels/iax2-provision.c index 962e6d958..dd3419a9e 100644 --- a/channels/iax2-provision.c +++ b/channels/iax2-provision.c @@ -507,8 +507,7 @@ int iax_provision_reload(void) if (strcasecmp(cat, "general")) { iax_process_template(cfg, cat, found ? "default" : NULL); found++; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Loaded provisioning template '%s'\n", cat); + ast_verb(3, "Loaded provisioning template '%s'\n", cat); } cat = ast_category_browse(cfg, cat); } |