Index: channels/chan_jingle.c =================================================================== --- channels/chan_jingle.c (revision 69052) +++ channels/chan_jingle.c (working copy) @@ -407,8 +407,7 @@ struct jingle *client = p->parent; int res = 0; - if (option_debug) - ast_log(LOG_DEBUG, "Answer!\n"); + ast_debug(1, "Answer!\n"); ast_mutex_lock(&p->lock); jingle_accept_call(client, p); ast_mutex_unlock(&p->lock); @@ -495,8 +494,7 @@ { struct jingle_pvt *tmp; - if (option_debug) - ast_log(LOG_DEBUG, "The client is %s\n", client->name); + ast_debug(1, "The client is %s\n", client->name); /* Make sure our new call doesn't exist yet */ for (tmp = client->p; tmp; tmp = tmp->next) { if (iks_find_with_attrib(pak->x, GOOGLE_NODE, GOOGLE_SID, tmp->sid)) @@ -564,8 +562,7 @@ { struct jingle_pvt *tmp; - if (option_debug) - ast_log(LOG_DEBUG, "The client is %s\n", client->name); + ast_debug(1, "The client is %s\n", client->name); /* Make sure our new call doesn't exist yet */ for (tmp = client->p; tmp; tmp = tmp->next) { if (iks_find_with_attrib(pak->x, GOOGLE_NODE, GOOGLE_SID, tmp->sid)) @@ -710,8 +707,7 @@ struct aji_buddy *buddy; char idroster[200]; - if (option_debug) - ast_log(LOG_DEBUG, "The client is %s for alloc\n", client->name); + ast_debug(1, "The client is %s for alloc\n", client->name); if (!sid && !strchr(from, '/')) { /* I started call! */ if (!strcasecmp(client->name, "guest")) { buddy = ASTOBJ_CONTAINER_FIND(&client->connection->buddies, from); @@ -1095,8 +1091,7 @@ /* We already hold the channel lock */ if (f->frametype == AST_FRAME_VOICE) { if (f->subclass != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) { - if (option_debug) - ast_log(LOG_DEBUG, "Oooh, format changed to %d\n", f->subclass); + ast_debug(1, "Oooh, format changed to %d\n", f->subclass); p->owner->nativeformats = (p->owner->nativeformats & AST_FORMAT_VIDEO_MASK) | f->subclass; ast_set_read_format(p->owner, p->owner->readformat); @@ -1104,8 +1099,8 @@ } /* if ((ast_test_flag(p, SIP_DTMF) == SIP_DTMF_INBAND) && p->vad) { f = ast_dsp_process(p->owner, p->vad, f); - if (option_debug && f && (f->frametype == AST_FRAME_DTMF)) - ast_log(LOG_DEBUG, "* Detected inband DTMF '%c'\n", f->subclass); + if (f && (f->frametype == AST_FRAME_DTMF)) + ast_debug(1, "* Detected inband DTMF '%c'\n", f->subclass); } */ } } @@ -1443,11 +1438,9 @@ /* New call */ jingle_newcall(client, pak); } else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", GOOGLE_NEGOTIATE)) { - if (option_debug > 2) - ast_log(LOG_DEBUG, "About to add candidate!\n"); + ast_debug(3, "About to add candidate!\n"); jingle_add_candidate(client, pak); - if (option_debug > 2) - ast_log(LOG_DEBUG, "Candidate Added!\n"); + ast_debug(3, "Candidate Added!\n"); } else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", GOOGLE_ACCEPT)) { jingle_is_answered(client, pak); } else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", "content-info")) { Index: channels/chan_phone.c =================================================================== --- channels/chan_phone.c (revision 69052) +++ channels/chan_phone.c (working copy) @@ -208,8 +208,7 @@ { struct phone_pvt *p = chan->tech_pvt; int res=-1; - if (option_debug) - ast_log(LOG_DEBUG, "Requested indication %d on channel %s\n", condition, chan->name); + ast_debug(1, "Requested indication %d on channel %s\n", condition, chan->name); switch(condition) { case AST_CONTROL_FLASH: ioctl(p->fd, IXJCTL_PSTN_SET_STATE, PSTN_ON_HOOK); @@ -249,7 +248,7 @@ struct phone_pvt *p; int outdigit; p = ast->tech_pvt; - ast_log(LOG_DEBUG, "Dialed %c\n", digit); + ast_debug(1, "Dialed %c\n", digit); switch(digit) { case '0': case '1': @@ -280,7 +279,7 @@ ast_log(LOG_WARNING, "Unknown digit '%c'\n", digit); return -1; } - ast_log(LOG_DEBUG, "Dialed %d\n", outdigit); + ast_debug(1, "Dialed %d\n", outdigit); ioctl(p->fd, PHONE_PLAY_TONE, outdigit); p->lastformat = -1; return 0; @@ -320,8 +319,7 @@ ast_log(LOG_WARNING, "phone_call called on %s, neither down nor reserved\n", ast->name); return -1; } - if (option_debug) - ast_log(LOG_DEBUG, "Ringing %s on %s (%d)\n", dest, ast->name, ast->fds[0]); + ast_debug(1, "Ringing %s on %s (%d)\n", dest, ast->name, ast->fds[0]); start = IXJ_PHONE_RING_START(cid); if (start == -1) @@ -346,8 +344,7 @@ { struct phone_pvt *p; p = ast->tech_pvt; - if (option_debug) - ast_log(LOG_DEBUG, "phone_hangup(%s)\n", ast->name); + ast_debug(1, "phone_hangup(%s)\n", ast->name); if (!ast->tech_pvt) { ast_log(LOG_WARNING, "Asked to hangup channel not connected\n"); return 0; @@ -365,16 +362,13 @@ /* If it's an FXO, hang them up */ if (p->mode == MODE_FXO) { - if (ioctl(p->fd, PHONE_PSTN_SET_STATE, PSTN_ON_HOOK)) { - if (option_debug) - ast_log(LOG_DEBUG, "ioctl(PHONE_PSTN_SET_STATE) failed on %s (%s)\n",ast->name, strerror(errno)); - } + if (ioctl(p->fd, PHONE_PSTN_SET_STATE, PSTN_ON_HOOK)) + ast_debug(1, "ioctl(PHONE_PSTN_SET_STATE) failed on %s (%s)\n",ast->name, strerror(errno)); } /* If they're off hook, give a busy signal */ if (ioctl(p->fd, PHONE_HOOKSTATE)) { - if (option_debug) - ast_log(LOG_DEBUG, "Got hunghup, giving busy signal\n"); + ast_debug(1, "Got hunghup, giving busy signal\n"); ioctl(p->fd, PHONE_BUSY); p->cpt = 1; } @@ -467,18 +461,13 @@ p = ast->tech_pvt; /* In case it's a LineJack, take it off hook */ if (p->mode == MODE_FXO) { - if (ioctl(p->fd, PHONE_PSTN_SET_STATE, PSTN_OFF_HOOK)) { - if (option_debug) - ast_log(LOG_DEBUG, "ioctl(PHONE_PSTN_SET_STATE) failed on %s (%s)\n", ast->name, strerror(errno)); - } - else { - if (option_debug) - ast_log(LOG_DEBUG, "Took linejack off hook\n"); - } + if (ioctl(p->fd, PHONE_PSTN_SET_STATE, PSTN_OFF_HOOK)) + ast_debug(1, "ioctl(PHONE_PSTN_SET_STATE) failed on %s (%s)\n", ast->name, strerror(errno)); + else + ast_debug(1, "Took linejack off hook\n"); } phone_setup(ast); - if (option_debug) - ast_log(LOG_DEBUG, "phone_answer(%s)\n", ast->name); + ast_debug(1, "phone_answer(%s)\n", ast->name); ast->rings = 0; ast_setstate(ast, AST_STATE_UP); return 0; @@ -516,8 +505,7 @@ phonee.bytes = ioctl(p->fd, PHONE_EXCEPTION); if (phonee.bits.dtmf_ready) { - if (option_debug) - ast_log(LOG_DEBUG, "phone_exception(): DTMF\n"); + ast_debug(1, "phone_exception(): DTMF\n"); /* We've got a digit -- Just handle this nicely and easily */ digit = ioctl(p->fd, PHONE_GET_DTMF_ASCII); @@ -526,12 +514,10 @@ return &p->fr; } if (phonee.bits.hookstate) { - if (option_debug) - ast_log(LOG_DEBUG, "Hookstate changed\n"); + ast_debug(1, "Hookstate changed\n"); res = ioctl(p->fd, PHONE_HOOKSTATE); /* See if we've gone on hook, if so, notify by returning NULL */ - if (option_debug) - ast_log(LOG_DEBUG, "New hookstate: %d\n", res); + ast_debug(1, "New hookstate: %d\n", res); if (!res && (p->mode != MODE_FXO)) return NULL; else { @@ -943,8 +929,7 @@ union telephony_exception phonee; /* XXX Do something XXX */ #if 0 - if (option_debug) - ast_log(LOG_DEBUG, "Exception!\n"); + ast_debug(1, "Exception!\n"); #endif phonee.bytes = ioctl(i->fd, PHONE_EXCEPTION); if (phonee.bits.dtmf_ready) { @@ -972,8 +957,7 @@ /* XXX This should probably be justified better XXX */ } else if (!ast_canmatch_extension(NULL, "default", i->ext, 1, i->cid_num)) { /* It's not a valid extension, give a busy signal */ - if (option_debug) - ast_log(LOG_DEBUG, "%s can't match anything in %s or default\n", i->ext, i->context); + ast_debug(1, "%s can't match anything in %s or default\n", i->ext, i->context); ioctl(i->fd, PHONE_BUSY); i->cpt = 1; } @@ -1100,8 +1084,7 @@ } /* Okay, select has finished. Let's see what happened. */ if (res < 0) { - if (option_debug) - ast_log(LOG_DEBUG, "select return %d: %s\n", res, strerror(errno)); + ast_debug(1, "select return %d: %s\n", res, strerror(errno)); continue; } /* If there are no fd's changed, just continue, it's probably time @@ -1189,22 +1172,19 @@ } if (mode == MODE_FXO) { if (ioctl(tmp->fd, IXJCTL_PORT, PORT_PSTN)) { - if (option_debug) - ast_log(LOG_DEBUG, "Unable to set port to PSTN\n"); + ast_debug(1, "Unable to set port to PSTN\n"); } } else { if (ioctl(tmp->fd, IXJCTL_PORT, PORT_POTS)) if (mode != MODE_FXS) - ast_log(LOG_DEBUG, "Unable to set port to POTS\n"); + ast_debug(1, "Unable to set port to POTS\n"); } ioctl(tmp->fd, PHONE_PLAY_STOP); ioctl(tmp->fd, PHONE_REC_STOP); ioctl(tmp->fd, PHONE_RING_STOP); ioctl(tmp->fd, PHONE_CPT_STOP); - if (ioctl(tmp->fd, PHONE_PSTN_SET_STATE, PSTN_ON_HOOK)) { - if (option_debug) - ast_log(LOG_DEBUG, "ioctl(PHONE_PSTN_SET_STATE) failed on %s (%s)\n",iface, strerror(errno)); - } + if (ioctl(tmp->fd, PHONE_PSTN_SET_STATE, PSTN_ON_HOOK)) + ast_debug(1, "ioctl(PHONE_PSTN_SET_STATE) failed on %s (%s)\n",iface, strerror(errno)); if (echocancel != AEC_OFF) ioctl(tmp->fd, IXJCTL_AEC_START, echocancel); if (silencesupression) Index: channels/chan_features.c =================================================================== --- channels/chan_features.c (revision 69052) +++ channels/chan_features.c (working copy) @@ -209,8 +209,7 @@ int tinthreeway; struct ast_channel *towner; - if (option_debug) - ast_log(LOG_DEBUG, "Swapping %d and %d\n", a, b); + ast_debug(1, "Swapping %d and %d\n", a, b); towner = p->subs[a].owner; tinthreeway = p->subs[a].inthreeway; Index: channels/chan_h323.c =================================================================== --- channels/chan_h323.c (revision 69052) +++ channels/chan_h323.c (working copy) @@ -287,14 +287,14 @@ static void oh323_destroy_alias(struct oh323_alias *alias) { if (h323debug) - ast_log(LOG_DEBUG, "Destroying alias '%s'\n", alias->name); + ast_debug(1, "Destroying alias '%s'\n", alias->name); ast_free(alias); } static void oh323_destroy_user(struct oh323_user *user) { if (h323debug) - ast_log(LOG_DEBUG, "Destroying user '%s'\n", user->name); + ast_debug(1, "Destroying user '%s'\n", user->name); ast_free_ha(user->ha); ast_free(user); } @@ -302,7 +302,7 @@ static void oh323_destroy_peer(struct oh323_peer *peer) { if (h323debug) - ast_log(LOG_DEBUG, "Destroying peer '%s'\n", peer->name); + ast_debug(1, "Destroying peer '%s'\n", peer->name); ast_free_ha(peer->ha); ast_free(peer); } @@ -343,14 +343,14 @@ { if (c->nativeformats != pvt->nativeformats) { if (h323debug) - ast_log(LOG_DEBUG, "Preparing %s for new native format\n", c->name); + ast_debug(1, "Preparing %s for new native format\n", c->name); c->nativeformats = pvt->nativeformats; ast_set_read_format(c, c->readformat); ast_set_write_format(c, c->writeformat); } if (pvt->needhangup) { if (h323debug) - ast_log(LOG_DEBUG, "Process pending hangup for %s\n", c->name); + ast_debug(1, "Process pending hangup for %s\n", c->name); c->_softhangup |= AST_SOFTHANGUP_DEV; c->hangupcause = pvt->hangupcause; ast_queue_hangup(c); @@ -475,7 +475,7 @@ if (pvt->owner) { ast_channel_lock(pvt->owner); if (h323debug) - ast_log(LOG_DEBUG, "Detaching from %s\n", pvt->owner->name); + ast_debug(1, "Detaching from %s\n", pvt->owner->name); pvt->owner->tech_pvt = NULL; ast_channel_unlock(pvt->owner); } @@ -503,7 +503,7 @@ static void oh323_destroy(struct oh323_pvt *pvt) { if (h323debug) { - ast_log(LOG_DEBUG, "Destroying channel %s\n", (pvt->owner ? pvt->owner->name : "")); + ast_debug(1, "Destroying channel %s\n", (pvt->owner ? pvt->owner->name : "")); } ast_mutex_lock(&iflock); ast_mutex_lock(&pvt->lock); @@ -599,7 +599,7 @@ char called_addr[1024]; if (h323debug) { - ast_log(LOG_DEBUG, "Calling to %s on %s\n", dest, c->name); + ast_debug(1, "Calling to %s on %s\n", dest, c->name); } if ((c->_state != AST_STATE_DOWN) && (c->_state != AST_STATE_RESERVED)) { ast_log(LOG_WARNING, "Line is already in use (%s)\n", c->name); @@ -659,7 +659,7 @@ if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Requested transfer capability: 0x%.2x - %s\n", c->transfercapability, ast_transfercapability2str(c->transfercapability)); if (h323debug) - ast_log(LOG_DEBUG, "Placing outgoing call to %s, %d/%d\n", called_addr, pvt->options.dtmfcodec[0], pvt->options.dtmfcodec[1]); + 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); res = h323_make_call(called_addr, &(pvt->cd), &pvt->options); if (res) { @@ -677,7 +677,7 @@ char *token; if (h323debug) - ast_log(LOG_DEBUG, "Answering on %s\n", c->name); + ast_debug(1, "Answering on %s\n", c->name); ast_mutex_lock(&pvt->lock); token = pvt->cd.call_token ? strdup(pvt->cd.call_token) : NULL; @@ -701,7 +701,7 @@ if (h323debug) - ast_log(LOG_DEBUG, "Hanging up and scheduling destroy of call %s\n", c->name); + ast_debug(1, "Hanging up and scheduling destroy of call %s\n", c->name); if (!c->tech_pvt) { ast_log(LOG_WARNING, "Asked to hangup channel not connected\n"); @@ -785,7 +785,7 @@ return &ast_null_frame; } if (h323debug) - ast_log(LOG_DEBUG, "Oooh, format changed to %d\n", f->subclass); + ast_debug(1, "Oooh, format changed to %d\n", f->subclass); pvt->owner->nativeformats = f->subclass; pvt->nativeformats = f->subclass; ast_set_read_format(pvt->owner, pvt->owner->readformat); @@ -886,7 +886,7 @@ ast_mutex_unlock(&pvt->lock); if (h323debug) - ast_log(LOG_DEBUG, "OH323: Indicating %d on %s (%s)\n", condition, token, c->name); + ast_debug(1, "OH323: Indicating %d on %s (%s)\n", condition, token, c->name); switch(condition) { case AST_CONTROL_RINGING: @@ -937,7 +937,7 @@ } if (h323debug) - ast_log(LOG_DEBUG, "OH323: Indicated %d on %s, res=%d\n", condition, token, res); + ast_debug(1, "OH323: Indicated %d on %s, res=%d\n", condition, token, res); if (token) ast_free(token); oh323_update_info(c); @@ -978,12 +978,12 @@ return -1; } if (h323debug) - ast_log(LOG_DEBUG, "Created RTP channel\n"); + ast_debug(1, "Created RTP channel\n"); ast_rtp_setqos(pvt->rtp, tos, cos); if (h323debug) - ast_log(LOG_DEBUG, "Setting NAT on RTP to %d\n", pvt->options.nat); + ast_debug(1, "Setting NAT on RTP to %d\n", pvt->options.nat); ast_rtp_setnat(pvt->rtp, pvt->options.nat); if (pvt->dtmf_pt[0] > 0) @@ -1617,7 +1617,7 @@ u = realtime_user(cd); if (!u && h323debug) - ast_log(LOG_DEBUG, "Could not find user by name %s or address %s\n", cd->call_source_aliases, cd->sourceIp); + ast_debug(1, "Could not find user by name %s or address %s\n", cd->call_source_aliases, cd->sourceIp); return u; } @@ -1647,7 +1647,7 @@ p = realtime_peer(peer, sin); if (!p && h323debug) - ast_log(LOG_DEBUG, "Could not find peer by name %s or address %s\n", (peer ? peer : ""), (sin ? ast_inet_ntoa(sin->sin_addr) : "")); + ast_debug(1, "Could not find peer by name %s or address %s\n", (peer ? peer : ""), (sin ? ast_inet_ntoa(sin->sin_addr) : "")); return p; } @@ -1735,7 +1735,7 @@ char tmp[256], tmp1[256]; if (h323debug) - ast_log(LOG_DEBUG, "type=%s, format=%d, data=%s.\n", type, format, (char *)data); + ast_debug(1, "type=%s, format=%d, data=%s.\n", type, format, (char *)data); pvt = oh323_alloc(0); if (!pvt) { @@ -1771,7 +1771,7 @@ ast_copy_string(pvt->exten, ext, sizeof(pvt->exten)); } if (h323debug) - ast_log(LOG_DEBUG, "Extension: %s Host: %s\n", pvt->exten, host); + ast_debug(1, "Extension: %s Host: %s\n", pvt->exten, host); if (gatekeeper_disable) { if (create_addr(pvt, host)) { @@ -1933,7 +1933,7 @@ ast_copy_string(info->addr, ast_inet_ntoa(us.sin_addr), sizeof(info->addr)); info->port = ntohs(us.sin_port); if (h323debug) - ast_log(LOG_DEBUG, "Sending RTP 'US' %s:%d\n", info->addr, info->port); + ast_debug(1, "Sending RTP 'US' %s:%d\n", info->addr, info->port); return info; } @@ -1960,7 +1960,7 @@ enum { NEED_NONE, NEED_HOLD, NEED_UNHOLD } rtp_change = NEED_NONE; if (h323debug) - ast_log(LOG_DEBUG, "Setting up RTP connection for %s\n", token); + ast_debug(1, "Setting up RTP connection for %s\n", token); /* Find the call or allocate a private structure if call not found */ pvt = find_call_locked(call_reference, token); @@ -2004,7 +2004,7 @@ if (pt != 128 && pvt->rtp) { /* Payload type is invalid, so try to use previously decided */ rtptype = ast_rtp_lookup_pt(pvt->rtp, pt); if (h323debug) - ast_log(LOG_DEBUG, "Native format is set to %d from %d by RTP payload type %d\n", rtptype.code, pvt->nativeformats, pt); + ast_debug(1, "Native format is set to %d from %d by RTP payload type %d\n", rtptype.code, pvt->nativeformats, pt); if (pvt->nativeformats != rtptype.code) { pvt->nativeformats = rtptype.code; nativeformats_changed = 1; @@ -2018,7 +2018,7 @@ /* Re-build translation path only if native format(s) has been changed */ if (pvt->owner->nativeformats != pvt->nativeformats) { if (h323debug) - ast_log(LOG_DEBUG, "Native format changed to %d from %d, read format is %d, write format is %d\n", pvt->nativeformats, pvt->owner->nativeformats, pvt->owner->readformat, pvt->owner->writeformat); + ast_debug(1, "Native format changed to %d from %d, read format is %d, write format is %d\n", pvt->nativeformats, pvt->owner->nativeformats, pvt->owner->readformat, pvt->owner->writeformat); pvt->owner->nativeformats = pvt->nativeformats; ast_set_read_format(pvt->owner, pvt->owner->readformat); ast_set_write_format(pvt->owner, pvt->owner->writeformat); @@ -2045,13 +2045,13 @@ else if (rtp_change == NEED_UNHOLD) pvt->newcontrol = AST_CONTROL_UNHOLD; if (h323debug) - ast_log(LOG_DEBUG, "RTP connection preparation for %s is pending...\n", token); + ast_debug(1, "RTP connection preparation for %s is pending...\n", token); } } ast_mutex_unlock(&pvt->lock); if (h323debug) - ast_log(LOG_DEBUG, "RTP connection prepared for %s\n", token); + ast_debug(1, "RTP connection prepared for %s\n", token); return; } @@ -2065,7 +2065,7 @@ struct oh323_pvt *pvt; if (h323debug) - ast_log(LOG_DEBUG, "Call %s answered\n", token); + ast_debug(1, "Call %s answered\n", token); pvt = find_call_locked(call_reference, token); if (!pvt) { @@ -2092,7 +2092,7 @@ struct oh323_pvt *pvt; if (h323debug) - ast_log(LOG_DEBUG, "Received ALERT/PROGRESS message for %s tones\n", (inband ? "inband" : "self-generated")); + ast_debug(1, "Received ALERT/PROGRESS message for %s tones\n", (inband ? "inband" : "self-generated")); pvt = find_call_locked(call_reference, token); if (!pvt) { @@ -2122,7 +2122,7 @@ struct oh323_alias *alias = NULL; if (h323debug) - ast_log(LOG_DEBUG, "Setting up incoming call for %s\n", cd->call_token); + ast_debug(1, "Setting up incoming call for %s\n", cd->call_token); /* allocate the call*/ pvt = oh323_alloc(cd->call_reference); @@ -2187,7 +2187,7 @@ ast_copy_string(pvt->exten, cd->call_dest_alias, sizeof(pvt->exten)); } if (h323debug) - ast_log(LOG_DEBUG, "Sending %s@%s to context [%s] extension %s\n", cd->call_source_aliases, cd->sourceIp, pvt->context, pvt->exten); + ast_debug(1, "Sending %s@%s to context [%s] extension %s\n", cd->call_source_aliases, cd->sourceIp, pvt->context, pvt->exten); } else { if (user->host) { if (strcasecmp(cd->sourceIp, ast_inet_ntoa(user->addr.sin_addr))) { @@ -2243,7 +2243,7 @@ char tmp_exten[sizeof(pvt->exten)]; if (h323debug) - ast_log(LOG_DEBUG, "Preparing Asterisk to answer for %s\n", token); + ast_debug(1, "Preparing Asterisk to answer for %s\n", token); /* Find the call or allocate a private structure if call not found */ pvt = find_call_locked(call_reference, token); @@ -2293,7 +2293,7 @@ return 0; } else if ((try_exten != ext_original) && (strcmp(pvt->exten, tmp_exten) != 0)) { if (h323debug) - ast_log(LOG_DEBUG, "Going to extension %s@%s because %s@%s isn't exists\n", tmp_exten, pvt->context, pvt->exten, pvt->context); + ast_debug(1, "Going to extension %s@%s because %s@%s isn't exists\n", tmp_exten, pvt->context, pvt->exten, pvt->context); ast_copy_string(pvt->exten, tmp_exten, sizeof(pvt->exten)); } @@ -2331,7 +2331,7 @@ struct oh323_pvt *pvt; if (h323debug) - ast_log(LOG_DEBUG, "Ringing on %s\n", token); + ast_debug(1, "Ringing on %s\n", token); pvt = find_call_locked(call_reference, token); if (!pvt) { @@ -2357,13 +2357,13 @@ struct oh323_pvt *pvt; if (h323debug) - ast_log(LOG_DEBUG, "Cleaning connection to %s\n", call_token); + ast_debug(1, "Cleaning connection to %s\n", call_token); while (1) { pvt = find_call_locked(call_reference, call_token); if (!pvt) { if (h323debug) - ast_log(LOG_DEBUG, "No connection for %s\n", call_token); + ast_debug(1, "No connection for %s\n", call_token); return; } if (!pvt->owner || !ast_channel_trylock(pvt->owner)) @@ -2398,7 +2398,7 @@ } ast_mutex_unlock(&pvt->lock); if (h323debug) - ast_log(LOG_DEBUG, "Connection to %s cleaned\n", call_token); + ast_debug(1, "Connection to %s cleaned\n", call_token); return; } @@ -2406,15 +2406,13 @@ { struct oh323_pvt *pvt; - if (h323debug) { - ast_log(LOG_DEBUG, "Hanging up connection to %s with cause %d\n", token, cause); - } + if (h323debug) + ast_debug(1, "Hanging up connection to %s with cause %d\n", token, cause); pvt = find_call_locked(call_reference, token); if (!pvt) { - if (h323debug) { - ast_log(LOG_DEBUG, "Connection to %s already cleared\n", token); - } + if (h323debug) + ast_debug(1, "Connection to %s already cleared\n", token); return; } if (pvt->owner && !ast_channel_trylock(pvt->owner)) { @@ -2427,7 +2425,7 @@ pvt->needhangup = 1; pvt->hangupcause = cause; if (h323debug) - ast_log(LOG_DEBUG, "Hangup for %s is pending\n", token); + ast_debug(1, "Hangup for %s is pending\n", token); } ast_mutex_unlock(&pvt->lock); } @@ -2437,7 +2435,7 @@ struct oh323_pvt *pvt; if (h323debug) - ast_log(LOG_DEBUG, "Setting %s DTMF payload to %d on %s\n", (is_cisco ? "Cisco" : "RFC2833"), payload, token); + ast_debug(1, "Setting %s DTMF payload to %d on %s\n", (is_cisco ? "Cisco" : "RFC2833"), payload, token); pvt = find_call_locked(call_reference, token); if (!pvt) { @@ -2449,7 +2447,7 @@ pvt->dtmf_pt[is_cisco ? 1 : 0] = payload; ast_mutex_unlock(&pvt->lock); if (h323debug) - ast_log(LOG_DEBUG, "DTMF payload on %s set to %d\n", token, payload); + ast_debug(1, "DTMF payload on %s set to %d\n", token, payload); } static void set_peer_capabilities(unsigned call_reference, const char *token, int capabilities, struct ast_codec_pref *prefs) @@ -2457,7 +2455,7 @@ struct oh323_pvt *pvt; if (h323debug) - ast_log(LOG_DEBUG, "Got remote capabilities from connection %s\n", token); + ast_debug(1, "Got remote capabilities from connection %s\n", token); pvt = find_call_locked(call_reference, token); if (!pvt) @@ -2471,7 +2469,7 @@ for (i = 0; i < 32; ++i) { if (!prefs->order[i]) break; - ast_log(LOG_DEBUG, "prefs[%d]=%s:%d\n", i, (prefs->order[i] ? ast_getformatname(1 << (prefs->order[i]-1)) : ""), prefs->framing[i]); + ast_debug(1, "prefs[%d]=%s:%d\n", i, (prefs->order[i] ? ast_getformatname(1 << (prefs->order[i]-1)) : ""), prefs->framing[i]); } } if (pvt->rtp) @@ -2487,7 +2485,7 @@ struct ast_codec_pref prefs; if (h323debug) - ast_log(LOG_DEBUG, "Setting capabilities for connection %s\n", token); + ast_debug(1, "Setting capabilities for connection %s\n", token); pvt = find_call_locked(call_reference, token); if (!pvt) @@ -2500,7 +2498,7 @@ h323_set_capabilities(token, capability, dtmfmode, &prefs, pref_codec); if (h323debug) - ast_log(LOG_DEBUG, "Capabilities for connection %s is set\n", token); + ast_debug(1, "Capabilities for connection %s is set\n", token); } static void remote_hold(unsigned call_reference, const char *token, int is_hold) @@ -2508,7 +2506,7 @@ struct oh323_pvt *pvt; if (h323debug) - ast_log(LOG_DEBUG, "Setting %shold status for connection %s\n", (is_hold ? "" : "un"), token); + ast_debug(1, "Setting %shold status for connection %s\n", (is_hold ? "" : "un"), token); pvt = find_call_locked(call_reference, token); if (!pvt) Index: channels/chan_agent.c =================================================================== --- channels/chan_agent.c (revision 69052) +++ channels/chan_agent.c (working copy) @@ -184,12 +184,10 @@ #define CHECK_FORMATS(ast, p) do { \ if (p->chan) {\ if (ast->nativeformats != p->chan->nativeformats) { \ - if (option_debug) \ - ast_log(LOG_DEBUG, "Native formats changing from %d to %d\n", ast->nativeformats, p->chan->nativeformats); \ + ast_debug(1, "Native formats changing from %d to %d\n", ast->nativeformats, p->chan->nativeformats); \ /* Native formats changed, reset things */ \ ast->nativeformats = p->chan->nativeformats; \ - if (option_debug) \ - ast_log(LOG_DEBUG, "Resetting read to %d and write to %d\n", ast->readformat, ast->writeformat);\ + ast_debug(1, "Resetting read to %d and write to %d\n", ast->readformat, ast->writeformat);\ ast_set_read_format(ast, ast->readformat); \ ast_set_write_format(ast, ast->writeformat); \ } \ @@ -434,8 +432,8 @@ /* Note that we don't hangup if it's not a callback because Asterisk will do it for us when the PBX instance that called login finishes */ if (!ast_strlen_zero(p->loginchan)) { - if (p->chan && option_debug) - ast_log(LOG_DEBUG, "Bridge on '%s' being cleared (2)\n", p->chan->name); + if (p->chan) + ast_debug(1, "Bridge on '%s' being cleared (2)\n", p->chan->name); status = pbx_builtin_getvar_helper(p->chan, "CHANLOCALSTATUS"); if (autologoffunavail && status && !strcasecmp(status, "CHANUNAVAIL")) { @@ -505,8 +503,8 @@ if (p->chan && !p->chan->_bridge) { if (strcasecmp(p->chan->tech->type, "Local")) { p->chan->_bridge = ast; - if (p->chan && option_debug) - ast_log(LOG_DEBUG, "Bridge on '%s' being set to '%s' (3)\n", p->chan->name, p->chan->_bridge->name); + if (p->chan) + ast_debug(1, "Bridge on '%s' being set to '%s' (3)\n", p->chan->name, p->chan->_bridge->name); } } ast_mutex_unlock(&p->lock); @@ -551,10 +549,9 @@ (f->subclass == p->chan->writeformat)) { res = ast_write(p->chan, f); } else { - if (option_debug) - ast_log(LOG_DEBUG, "Dropping one incompatible %s frame on '%s' to '%s'\n", - f->frametype == AST_FRAME_VOICE ? "audio" : "video", - ast->name, p->chan->name); + ast_debug(1, "Dropping one incompatible %s frame on '%s' to '%s'\n", + f->frametype == AST_FRAME_VOICE ? "audio" : "video", + ast->name, p->chan->name); res = 0; } } @@ -617,8 +614,7 @@ p->acknowledged = 0; if (!p->chan) { if (p->pending) { - if (option_debug) - ast_log(LOG_DEBUG, "Pretending to dial on pending agent\n"); + ast_debug(1, "Pretending to dial on pending agent\n"); newstate = AST_STATE_DIALING; res = 0; } else { @@ -643,20 +639,16 @@ return res; } ast_verbose( VERBOSE_PREFIX_3 "agent_call, call to agent '%s' call on '%s'\n", p->agent, p->chan->name); - if (option_debug > 2) - ast_log(LOG_DEBUG, "Playing beep, lang '%s'\n", p->chan->language); + ast_debug(3, "Playing beep, lang '%s'\n", p->chan->language); res = ast_streamfile(p->chan, beep, p->chan->language); - if (option_debug > 2) - ast_log(LOG_DEBUG, "Played beep, result '%d'\n", res); + ast_debug(3, "Played beep, result '%d'\n", res); if (!res) { res = ast_waitstream(p->chan, ""); - if (option_debug > 2) - ast_log(LOG_DEBUG, "Waited for stream, result '%d'\n", res); + ast_debug(3, "Waited for stream, result '%d'\n", res); } if (!res) { res = ast_set_read_format(p->chan, ast_best_codec(p->chan->nativeformats)); - if (option_debug > 2) - ast_log(LOG_DEBUG, "Set read format, result '%d'\n", res); + ast_debug(3, "Set read format, result '%d'\n", res); if (res) ast_log(LOG_WARNING, "Unable to set read format to %s\n", ast_getformatname(ast_best_codec(p->chan->nativeformats))); } else { @@ -666,8 +658,7 @@ if (!res) { res = ast_set_write_format(p->chan, ast_best_codec(p->chan->nativeformats)); - if (option_debug > 2) - ast_log(LOG_DEBUG, "Set write format, result '%d'\n", res); + ast_debug(3, "Set write format, result '%d'\n", res); if (res) ast_log(LOG_WARNING, "Unable to set write format to %s\n", ast_getformatname(ast_best_codec(p->chan->nativeformats))); } @@ -721,8 +712,7 @@ * as in apps/app_chanisavail.c:chanavail_exec() */ - if (option_debug) - ast_log(LOG_DEBUG, "Hangup called for state %s\n", ast_state2str(ast->_state)); + ast_debug(1, "Hangup called for state %s\n", ast_state2str(ast->_state)); if (p->start && (ast->_state != AST_STATE_UP)) { howlong = time(NULL) - p->start; p->start = 0; @@ -751,8 +741,7 @@ ast_hangup(p->chan); p->chan = NULL; } - if (option_debug) - ast_log(LOG_DEBUG, "Hungup, howlong is %d, autologoff is %d\n", howlong, p->autologoff); + ast_debug(1, "Hungup, howlong is %d, autologoff is %d\n", howlong, p->autologoff); if ((p->deferlogoff) || (howlong && p->autologoff && (howlong > p->autologoff))) { long logintime = time(NULL) - p->loginstart; p->loginstart = 0; @@ -830,8 +819,8 @@ } ast_mutex_unlock(&p->lock); - if (option_debug > 4 && !res) - ast_log(LOG_DEBUG, "agent_cont_sleep() returning %d\n", res ); + if (!res) + ast_debug(5, "agent_cont_sleep() returning %d\n", res ); return res; } @@ -889,8 +878,7 @@ ret = p->chan; } - if (option_debug) - ast_log(LOG_DEBUG, "Asked for bridged channel on '%s'/'%s', returning '%s'\n", chan->name, bridge->name, ret ? ret->name : ""); + ast_debug(1, "Asked for bridged channel on '%s'/'%s', returning '%s'\n", chan->name, bridge->name, ret ? ret->name : ""); return ret; } @@ -1145,8 +1133,7 @@ struct agent_pvt *p; int res; - if (option_debug) - ast_log(LOG_DEBUG, "Checking availability of '%s'\n", newlyavailable->agent); + ast_debug(1, "Checking availability of '%s'\n", newlyavailable->agent); if (needlock) AST_LIST_LOCK(&agents); AST_LIST_TRAVERSE(&agents, p, list) { @@ -1155,8 +1142,7 @@ } ast_mutex_lock(&p->lock); if (!p->abouttograb && p->pending && ((p->group && (newlyavailable->group & p->group)) || !strcmp(p->agent, newlyavailable->agent))) { - if (option_debug) - ast_log(LOG_DEBUG, "Call '%s' looks like a winner for agent '%s'\n", p->owner->name, newlyavailable->agent); + ast_debug(1, "Call '%s' looks like a winner for agent '%s'\n", p->owner->name, newlyavailable->agent); /* We found a pending call, time to merge */ chan = agent_new(newlyavailable, AST_STATE_DOWN); parent = p->owner; @@ -1173,15 +1159,12 @@ /* Don't do beep here */ res = 0; } else { - if (option_debug > 2) - ast_log(LOG_DEBUG, "Playing beep, lang '%s'\n", newlyavailable->chan->language); + ast_debug(3, "Playing beep, lang '%s'\n", newlyavailable->chan->language); res = ast_streamfile(newlyavailable->chan, beep, newlyavailable->chan->language); - if (option_debug > 2) - ast_log(LOG_DEBUG, "Played beep, result '%d'\n", res); + ast_debug(3, "Played beep, result '%d'\n", res); if (!res) { res = ast_waitstream(newlyavailable->chan, ""); - if (option_debug) - ast_log(LOG_DEBUG, "Waited for stream, result '%d'\n", res); + ast_debug(1, "Waited for stream, result '%d'\n", res); } } if (!res) { @@ -1200,13 +1183,11 @@ ast_mutex_unlock(&parent->lock); p->abouttograb = 0; } else { - if (option_debug) - ast_log(LOG_DEBUG, "Sneaky, parent disappeared in the mean time...\n"); + ast_debug(1, "Sneaky, parent disappeared in the mean time...\n"); agent_cleanup(newlyavailable); } } else { - if (option_debug) - ast_log(LOG_DEBUG, "Ugh... Agent hung up at exactly the wrong time\n"); + ast_debug(1, "Ugh... Agent hung up at exactly the wrong time\n"); agent_cleanup(newlyavailable); } } @@ -1218,8 +1199,7 @@ struct agent_pvt *p; int res=0; - if (option_debug) - ast_log(LOG_DEBUG, "Checking beep availability of '%s'\n", newlyavailable->agent); + ast_debug(1, "Checking beep availability of '%s'\n", newlyavailable->agent); if (needlock) AST_LIST_LOCK(&agents); AST_LIST_TRAVERSE(&agents, p, list) { @@ -1228,8 +1208,7 @@ } ast_mutex_lock(&p->lock); if (!p->abouttograb && p->pending && ((p->group && (newlyavailable->group & p->group)) || !strcmp(p->agent, newlyavailable->agent))) { - if (option_debug) - ast_log(LOG_DEBUG, "Call '%s' looks like a would-be winner for agent '%s'\n", p->owner->name, newlyavailable->agent); + ast_debug(1, "Call '%s' looks like a would-be winner for agent '%s'\n", p->owner->name, newlyavailable->agent); ast_mutex_unlock(&p->lock); break; } @@ -1239,15 +1218,12 @@ AST_LIST_UNLOCK(&agents); if (p) { ast_mutex_unlock(&newlyavailable->lock); - if (option_debug > 2) - ast_log(LOG_DEBUG, "Playing beep, lang '%s'\n", newlyavailable->chan->language); + ast_debug(3, "Playing beep, lang '%s'\n", newlyavailable->chan->language); res = ast_streamfile(newlyavailable->chan, beep, newlyavailable->chan->language); - if (option_debug > 2) - ast_log(LOG_DEBUG, "Played beep, result '%d'\n", res); + ast_debug(1, "Played beep, result '%d'\n", res); if (!res) { res = ast_waitstream(newlyavailable->chan, ""); - if (option_debug) - ast_log(LOG_DEBUG, "Waited for stream, result '%d'\n", res); + ast_debug(1, "Waited for stream, result '%d'\n", res); } ast_mutex_lock(&newlyavailable->lock); } @@ -1353,16 +1329,14 @@ /* No agent available -- but we're requesting to wait for one. Allocate a place holder */ if (hasagent) { - if (option_debug) - ast_log(LOG_DEBUG, "Creating place holder for '%s'\n", s); + ast_debug(1, "Creating place holder for '%s'\n", s); p = add_agent(data, 1); p->group = groupmatch; chan = agent_new(p, AST_STATE_DOWN); if (!chan) ast_log(LOG_WARNING, "Weird... Fix this to drop the unused pending agent\n"); } else { - if (option_debug) - ast_log(LOG_DEBUG, "Not creating place holder for '%s' since nobody logged in\n", s); + ast_debug(1, "Not creating place holder for '%s' since nobody logged in\n", s); } } *cause = hasagent ? AST_CAUSE_BUSY : AST_CAUSE_UNREGISTERED; @@ -2053,8 +2027,7 @@ ast_mutex_lock(&p->lock); if (p->lastdisc.tv_sec) { if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > p->wrapuptime) { - if (option_debug) - ast_log(LOG_DEBUG, "Wrapup time for %s expired!\n", p->agent); + ast_debug(1, "Wrapup time for %s expired!\n", p->agent); p->lastdisc = ast_tv(0, 0); if (p->ackcall > 1) check_beep(p, 0); @@ -2259,8 +2232,8 @@ snprintf(buf, sizeof(buf), "%s;%s", cur_agent->loginchan, cur_agent->logincallerid); if (ast_db_put(pa_family, cur_agent->agent, buf)) ast_log(LOG_WARNING, "failed to create persistent entry in ASTdb for %s!\n", buf); - else if (option_debug) - ast_log(LOG_DEBUG, "Saved Agent: %s on %s\n", cur_agent->agent, cur_agent->loginchan); + else + ast_debug(1, "Saved Agent: %s on %s\n", cur_agent->agent, cur_agent->loginchan); } else { /* Delete - no agent or there is an error */ ast_db_del(pa_family, cur_agent->agent); @@ -2299,8 +2272,7 @@ } else ast_mutex_unlock(&cur_agent->lock); if (!ast_db_get(pa_family, agent_num, agent_data, sizeof(agent_data)-1)) { - if (option_debug) - ast_log(LOG_DEBUG, "Reload Agent from AstDB: %s on %s\n", cur_agent->agent, agent_data); + ast_debug(1, "Reload Agent from AstDB: %s on %s\n", cur_agent->agent, agent_data); parse = agent_data; agent_chan = strsep(&parse, ";"); agent_callerid = strsep(&parse, ";"); Index: channels/iax2-provision.c =================================================================== --- channels/iax2-provision.c (revision 69052) +++ channels/iax2-provision.c (working copy) @@ -249,12 +249,12 @@ if (sscanf(tmp, "v%x", version) != 1) { if (strcmp(tmp, "u")) { ret = iax_provision_build(&ied, version, template, force); - if (ret && option_debug) - ast_log(LOG_DEBUG, "Unable to create provisioning packet for '%s'\n", template); + if (ret) + ast_debug(1, "Unable to create provisioning packet for '%s'\n", template); } else ret = -1; - } else if (option_debug) - ast_log(LOG_DEBUG, "Retrieved cached version '%s' = '%08x'\n", tmp, *version); + } else + ast_debug(1, "Retrieved cached version '%s' = '%08x'\n", tmp, *version); ast_mutex_unlock(&provlock); return ret; } Index: channels/chan_iax2.c =================================================================== --- channels/chan_iax2.c (revision 69052) +++ channels/chan_iax2.c (working copy) @@ -1240,8 +1240,8 @@ max = x + 1; } maxtrunkcall = max; - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "New max trunk callno is %d\n", max); + if (iaxdebug) + ast_debug(1, "New max trunk callno is %d\n", max); } static void update_max_nontrunk(void) @@ -1254,8 +1254,8 @@ max = x + 1; } maxnontrunkcall = max; - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "New max nontrunk callno is %d\n", max); + if (iaxdebug) + ast_debug(1, "New max nontrunk callno is %d\n", max); } static int make_trunk(unsigned short callno, int locked) @@ -1298,8 +1298,7 @@ ast_log(LOG_WARNING, "Unable to trunk call: Insufficient space\n"); return -1; } - if (option_debug) - ast_log(LOG_DEBUG, "Made call %d into trunk call %d\n", callno, x); + ast_debug(1, "Made call %d into trunk call %d\n", callno, x); /* We move this call from a non-trunked to a trunked call */ update_max_trunk(); update_max_nontrunk(); @@ -1372,8 +1371,8 @@ iaxs[x] = new_iax(sin, lockpeer, host); update_max_nontrunk(); if (iaxs[x]) { - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "Creating new call structure %d\n", x); + if (iaxdebug) + ast_debug(1, "Creating new call structure %d\n", x); iaxs[x]->sockfd = sockfd; iaxs[x]->addr.sin_port = sin->sin_port; iaxs[x]->addr.sin_family = sin->sin_family; @@ -1752,8 +1751,7 @@ res = sendto(sockfd, f->data, f->datalen, 0,(struct sockaddr *)sin, sizeof(*sin)); if (res < 0) { - if (option_debug) - ast_log(LOG_DEBUG, "Received error: %s\n", strerror(errno)); + ast_debug(1, "Received error: %s\n", strerror(errno)); handle_error(); } else res = 0; @@ -1770,8 +1768,8 @@ return -1; /* Called with iaxsl held */ - if (option_debug > 2 && iaxdebug) - ast_log(LOG_DEBUG, "Sending %d on %d/%d to %s:%d\n", f->ts, callno, iaxs[callno]->peercallno, ast_inet_ntoa(iaxs[callno]->addr.sin_addr), ntohs(iaxs[callno]->addr.sin_port)); + if (iaxdebug) + ast_debug(3, "Sending %d on %d/%d to %s:%d\n", f->ts, callno, iaxs[callno]->peercallno, ast_inet_ntoa(iaxs[callno]->addr.sin_addr), ntohs(iaxs[callno]->addr.sin_port)); if (f->transfer) { if (iaxdebug) iax_showframe(f, NULL, 0, &iaxs[callno]->transfer, f->datalen - sizeof(struct ast_iax2_full_hdr)); @@ -1784,8 +1782,8 @@ sizeof(iaxs[callno]->addr)); } if (res < 0) { - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "Received error: %s\n", strerror(errno)); + if (iaxdebug) + ast_debug(1, "Received error: %s\n", strerror(errno)); handle_error(); } else res = 0; @@ -2329,8 +2327,8 @@ gotten the update from the main packet. We'll just pretend that we did, and update the timestamp appropriately. */ fr->ts = ( (iaxs[fr->callno]->last & 0xFFFF0000) + 0x10000) | (fr->ts & 0xFFFF); - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "schedule_delivery: pushed forward timestamp\n"); + if (iaxdebug) + ast_debug(1, "schedule_delivery: pushed forward timestamp\n"); } if (x > 50000) { /* Sudden apparent big jump forwards in timestamp: @@ -2338,8 +2336,8 @@ top-16-bit timestamp that has turned up out of order. Adjust the timestamp appropriately. */ fr->ts = ( (iaxs[fr->callno]->last & 0xFFFF0000) - 0x10000) | (fr->ts & 0xFFFF); - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "schedule_delivery: pushed back timestamp\n"); + if (iaxdebug) + ast_debug(1, "schedule_delivery: pushed back timestamp\n"); } } } @@ -2473,8 +2471,7 @@ fr->af.delivery = ast_tvadd(iaxs[fr->callno]->rxcore, ast_samp2tv(fr->ts, 1000)); else { #if 0 - if (option_debug) - ast_log(LOG_DEBUG, "schedule_delivery: set delivery to 0 as we don't have an rxcore yet, or frame is from trunk.\n"); + ast_debug(1, "schedule_delivery: set delivery to 0 as we don't have an rxcore yet, or frame is from trunk.\n"); #endif fr->af.delivery = ast_tv(0,0); } @@ -2681,14 +2678,12 @@ if ((nowtime - regseconds) > IAX_DEFAULT_REG_EXPIRE) { memset(&peer->addr, 0, sizeof(peer->addr)); realtime_update_peer(peer->name, &peer->addr, 0); - if (option_debug) - ast_log(LOG_DEBUG, "realtime_peer: Bah, '%s' is expired (%d/%d/%d)!\n", - peername, (int)(nowtime - regseconds), (int)regseconds, (int)nowtime); + ast_debug(1, "realtime_peer: Bah, '%s' is expired (%d/%d/%d)!\n", + peername, (int)(nowtime - regseconds), (int)regseconds, (int)nowtime); } else { - if (option_debug) - ast_log(LOG_DEBUG, "realtime_peer: Registration for '%s' still active (%d/%d/%d)!\n", - peername, (int)(nowtime - regseconds), (int)regseconds, (int)nowtime); + ast_debug(1, "realtime_peer: Registration for '%s' still active (%d/%d/%d)!\n", + peername, (int)(nowtime - regseconds), (int)regseconds, (int)nowtime); } } @@ -3110,8 +3105,8 @@ } } else ast_log(LOG_WARNING, "OSP token is too long\n"); - } else if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "OSP token is undefined\n"); + } else if (iaxdebug) + ast_debug(1, "OSP token is undefined\n"); /* send the command using the appropriate socket for this peer */ iaxs[callno]->sockfd = cai.sockfd; @@ -3146,8 +3141,7 @@ memset(&ied, 0, sizeof(ied)); ast_mutex_lock(&iaxsl[callno]); if (callno && iaxs[callno]) { - if (option_debug) - ast_log(LOG_DEBUG, "We're hanging up %s now...\n", c->name); + ast_debug(1, "We're hanging up %s now...\n", c->name); alreadygone = ast_test_flag(iaxs[callno], IAX_ALREADYGONE); /* Send the hangup unless we have had a transmission error or are already gone */ iax_ie_append_byte(&ied, IAX_IE_CAUSECODE, (unsigned char)c->hangupcause); @@ -3157,8 +3151,7 @@ iax2_predestroy(callno); /* If we were already gone to begin with, destroy us now */ if (alreadygone) { - if (option_debug) - ast_log(LOG_DEBUG, "Really destroying %s now...\n", c->name); + ast_debug(1, "Really destroying %s now...\n", c->name); iax2_destroy(callno); } } @@ -3396,8 +3389,7 @@ static int iax2_answer(struct ast_channel *c) { unsigned short callno = PTR_TO_CALLNO(c->tech_pvt); - if (option_debug) - ast_log(LOG_DEBUG, "Answering IAX2 call\n"); + ast_debug(1, "Answering IAX2 call\n"); ast_mutex_lock(&iaxsl[callno]); if (iaxs[callno]) iax2_ami_channelupdate(iaxs[callno]); @@ -3411,8 +3403,8 @@ struct chan_iax2_pvt *pvt; int res = 0; - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "Indicating condition %d\n", condition); + if (iaxdebug) + ast_debug(1, "Indicating condition %d\n", condition); ast_mutex_lock(&iaxsl[callno]); pvt = iaxs[callno]; @@ -3452,8 +3444,7 @@ iax_ie_append_str(&ied, IAX_IE_CALLED_NUMBER, tmp); if (context) iax_ie_append_str(&ied, IAX_IE_CALLED_CONTEXT, context); - if (option_debug) - ast_log(LOG_DEBUG, "Transferring '%s' to '%s'\n", c->name, dest); + ast_debug(1, "Transferring '%s' to '%s'\n", c->name, dest); return send_command_locked(callno, AST_FRAME_IAX, IAX_COMMAND_TRANSFER, 0, ied.buf, ied.pos, -1); } @@ -3627,8 +3618,8 @@ /* If we have a time that the frame arrived, always use it to make our timestamp */ if (delivery && !ast_tvzero(*delivery)) { ms = ast_tvdiff_ms(*delivery, p->offset); - if (option_debug > 2 && iaxdebug) - ast_log(LOG_DEBUG, "calc_timestamp: call %d/%d: Timestamp slaved to delivery time\n", p->callno, iaxs[p->callno]->peercallno); + if (iaxdebug) + ast_debug(3, "calc_timestamp: call %d/%d: Timestamp slaved to delivery time\n", p->callno, iaxs[p->callno]->peercallno); } else { ms = ast_tvdiff_ms(ast_tvnow(), p->offset); if (ms < 0) @@ -3677,7 +3668,7 @@ * frame size too) */ if (iaxdebug && abs(ms - p->nextpred) > MAX_TIMESTAMP_SKEW ) - ast_log(LOG_DEBUG, "predicted timestamp skew (%u) > max (%u), using real ts instead.\n", + ast_debug(1, "predicted timestamp skew (%u) > max (%u), using real ts instead.\n", abs(ms - p->nextpred), MAX_TIMESTAMP_SKEW); if (f->samples >= 8) /* check to make sure we dont core dump */ @@ -3720,13 +3711,13 @@ /* Setup rxcore if necessary */ if (ast_tvzero(p->rxcore)) { p->rxcore = ast_tvnow(); - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "calc_rxstamp: call=%d: rxcore set to %d.%6.6d - %dms\n", + if (iaxdebug) + ast_debug(1, "calc_rxstamp: call=%d: rxcore set to %d.%6.6d - %dms\n", p->callno, (int)(p->rxcore.tv_sec), (int)(p->rxcore.tv_usec), offset); p->rxcore = ast_tvsub(p->rxcore, ast_samp2tv(offset, 1000)); #if 1 - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "calc_rxstamp: call=%d: works out as %d.%6.6d\n", + if (iaxdebug) + ast_debug(1, "calc_rxstamp: call=%d: works out as %d.%6.6d\n", p->callno, (int)(p->rxcore.tv_sec),(int)( p->rxcore.tv_usec)); #endif } @@ -3774,8 +3765,7 @@ #ifdef SO_NO_CHECK setsockopt(tpeer->sockfd, SOL_SOCKET, SO_NO_CHECK, &nochecksums, sizeof(nochecksums)); #endif - if (option_debug) - ast_log(LOG_DEBUG, "Created trunk peer for '%s:%d'\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port)); + ast_debug(1, "Created trunk peer for '%s:%d'\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port)); AST_LIST_INSERT_TAIL(&tpeers, tpeer, list); } } @@ -3808,8 +3798,7 @@ tpeer->trunkdataalloc += DEFAULT_TRUNKDATA; tpeer->trunkdata = tmp; - if (option_debug) - ast_log(LOG_DEBUG, "Expanded trunk '%s:%d' to %d bytes\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), tpeer->trunkdataalloc); + ast_debug(1, "Expanded trunk '%s:%d' to %d bytes\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), tpeer->trunkdataalloc); } else { ast_log(LOG_WARNING, "Maximum trunk data space exceeded to %s:%d\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port)); ast_mutex_unlock(&tpeer->lock); @@ -3926,8 +3915,8 @@ memcpy_decrypt(workspace, efh->encdata, *datalen - sizeof(struct ast_iax2_full_enc_hdr), dcx); padding = 16 + (workspace[15] & 0xf); - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "Decoding full frame with length %d (padding = %d) (15=%02x)\n", *datalen, padding, workspace[15]); + if (iaxdebug) + ast_debug(1, "Decoding full frame with length %d (padding = %d) (15=%02x)\n", *datalen, padding, workspace[15]); if (*datalen < padding + sizeof(struct ast_iax2_full_hdr)) return -1; @@ -3941,8 +3930,8 @@ } } else { struct ast_iax2_mini_enc_hdr *efh = (struct ast_iax2_mini_enc_hdr *)fh; - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "Decoding mini with length %d\n", *datalen); + if (iaxdebug) + ast_debug(1, "Decoding mini with length %d\n", *datalen); if (*datalen < 16 + sizeof(struct ast_iax2_mini_hdr)) return -1; /* Decrypt */ @@ -3965,24 +3954,24 @@ return -1; if (ntohs(fh->scallno) & IAX_FLAG_FULL) { struct ast_iax2_full_enc_hdr *efh = (struct ast_iax2_full_enc_hdr *)fh; - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "Encoding full frame %d/%d with length %d\n", fh->type, fh->csub, *datalen); + if (iaxdebug) + ast_debug(1, "Encoding full frame %d/%d with length %d\n", fh->type, fh->csub, *datalen); padding = 16 - ((*datalen - sizeof(struct ast_iax2_full_enc_hdr)) % 16); padding = 16 + (padding & 0xf); memcpy(workspace, poo, padding); memcpy(workspace + padding, efh->encdata, *datalen - sizeof(struct ast_iax2_full_enc_hdr)); workspace[15] &= 0xf0; workspace[15] |= (padding & 0xf); - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "Encoding full frame %d/%d with length %d + %d padding (15=%02x)\n", fh->type, fh->csub, *datalen, padding, workspace[15]); + if (iaxdebug) + ast_debug(1, "Encoding full frame %d/%d with length %d + %d padding (15=%02x)\n", fh->type, fh->csub, *datalen, padding, workspace[15]); *datalen += padding; memcpy_encrypt(efh->encdata, workspace, *datalen - sizeof(struct ast_iax2_full_enc_hdr), ecx); if (*datalen >= 32 + sizeof(struct ast_iax2_full_enc_hdr)) memcpy(poo, workspace + *datalen - 32, 32); } else { struct ast_iax2_mini_enc_hdr *efh = (struct ast_iax2_mini_enc_hdr *)fh; - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "Encoding mini frame with length %d\n", *datalen); + if (iaxdebug) + ast_debug(1, "Encoding mini frame with length %d\n", *datalen); padding = 16 - ((*datalen - sizeof(struct ast_iax2_mini_enc_hdr)) % 16); padding = 16 + (padding & 0xf); memcpy(workspace, poo, padding); @@ -4786,8 +4775,7 @@ /* Simple, just queue for transmission */ res = iax2_send(iaxs[callno], f, 0, -1, 0, 0, 0); } else { - if (option_debug) - ast_log(LOG_DEBUG, "Write error: %s\n", strerror(errno)); + ast_debug(1, "Write error: %s\n", strerror(errno)); } } /* If it's already gone, just return */ @@ -5066,7 +5054,7 @@ #if 0 if (option_debug) #endif - ast_log(LOG_DEBUG, "Raw Hangup %s:%d, src=%d, dst=%d\n", + ast_debug(1, "Raw Hangup %s:%d, src=%d, dst=%d\n", ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port), src, dst); return sendto(sockfd, &fh, sizeof(fh), 0, (struct sockaddr *)sin, sizeof(*sin)); } @@ -5779,8 +5767,7 @@ if (!p) return; - if (option_debug) - ast_log(LOG_DEBUG, "Expiring registration for peer '%s'\n", p->name); + ast_debug(1, "Expiring registration for peer '%s'\n", p->name); if (ast_test_flag((&globalflags), IAX_RTUPDATE) && (ast_test_flag(p, IAX_TEMPONLY|IAX_RTCACHEFRIENDS))) realtime_update_peer(p->name, &p->addr, 0); manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: IAX2/%s\r\nPeerStatus: Unregistered\r\nCause: Expired\r\n", p->name); @@ -6213,8 +6200,7 @@ res = transmit_trunk(fr, &tpeer->addr, tpeer->sockfd); calls = tpeer->calls; #if 0 - if (option_debug) - ast_log(LOG_DEBUG, "Trunking %d call chunks in %d bytes to %s:%d, ts=%d\n", calls, fr->datalen, ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), ntohl(mth->ts)); + ast_debug(1, "Trunking %d call chunks in %d bytes to %s:%d, ts=%d\n", calls, fr->datalen, ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), ntohl(mth->ts)); #endif /* Reset transmit trunk side data */ tpeer->trunkdatalen = 0; @@ -6290,8 +6276,7 @@ ast_mutex_lock(&drop->lock); /* Once we have this lock, we're sure nobody else is using it or could use it once we release it, because by the time they could get tpeerlock, we've already grabbed it */ - if (option_debug) - ast_log(LOG_DEBUG, "Dropping unused iax2 trunk peer '%s:%d'\n", ast_inet_ntoa(drop->addr.sin_addr), ntohs(drop->addr.sin_port)); + ast_debug(1, "Dropping unused iax2 trunk peer '%s:%d'\n", ast_inet_ntoa(drop->addr.sin_addr), ntohs(drop->addr.sin_port)); ast_free(drop->trunkdata); ast_mutex_unlock(&drop->lock); ast_mutex_destroy(&drop->lock); @@ -6459,8 +6444,7 @@ snprintf(rsi, sizeof(rsi), "si-%s", si); if (iax_provision_version(&ourver, rsi, 1)) return 0; - if (option_debug) - ast_log(LOG_DEBUG, "Service identifier '%s', we think '%08x', they think '%08x'\n", si, ourver, ver); + ast_debug(1, "Service identifier '%s', we think '%08x', they think '%08x'\n", si, ourver, ver); if (ourver != ver) iax2_provision(sin, sockfd, NULL, rsi, 1); return 0; @@ -6880,16 +6864,15 @@ iaxs[fr->callno]->peercallno = (unsigned short)(ntohs(mh->callno) & ~IAX_FLAG_FULL); } if (ntohs(mh->callno) & IAX_FLAG_FULL) { - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "Received packet %d, (%d, %d)\n", fh->oseqno, f.frametype, f.subclass); + if (iaxdebug) + ast_debug(1, "Received packet %d, (%d, %d)\n", fh->oseqno, f.frametype, f.subclass); /* Check if it's out of order (and not an ACK or INVAL) */ fr->oseqno = fh->oseqno; fr->iseqno = fh->iseqno; fr->ts = ntohl(fh->ts); #ifdef IAXTESTS if (test_resync) { - if (option_debug) - ast_log(LOG_DEBUG, "Simulating frame ts resync, was %u now %u\n", fr->ts, fr->ts + test_resync); + ast_debug(1, "Simulating frame ts resync, was %u now %u\n", fr->ts, fr->ts + test_resync); fr->ts += test_resync; } #endif /* IAXTESTS */ @@ -6922,15 +6905,13 @@ (f.subclass != IAX_COMMAND_VNAK)) || (f.frametype != AST_FRAME_IAX)) { /* If it's not an ACK packet, it's out of order. */ - if (option_debug) - ast_log(LOG_DEBUG, "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n", + ast_debug(1, "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n", iaxs[fr->callno]->iseqno, fr->oseqno, f.frametype, f.subclass); if (iaxs[fr->callno]->iseqno > fr->oseqno) { /* If we've already seen it, ack it XXX There's a border condition here XXX */ if ((f.frametype != AST_FRAME_IAX) || ((f.subclass != IAX_COMMAND_ACK) && (f.subclass != IAX_COMMAND_INVAL))) { - if (option_debug) - ast_log(LOG_DEBUG, "Acking anyway\n"); + ast_debug(1, "Acking anyway\n"); /* XXX Maybe we should handle its ack to us, but then again, it's probably outdated anyway, and if we have anything to send, we'll retransmit and get an ACK back anyway XXX */ send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr->ts, NULL, 0,fr->iseqno); @@ -6985,8 +6966,8 @@ that it says to */ for (x=iaxs[fr->callno]->rseqno; x != fr->iseqno; x++) { /* Ack the packet with the given timestamp */ - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "Cancelling transmission of packet %d\n", x); + if (iaxdebug) + ast_debug(1, "Cancelling transmission of packet %d\n", x); call_to_destroy = 0; AST_LIST_LOCK(&queue); AST_LIST_TRAVERSE(&queue, cur, list) { @@ -7000,8 +6981,8 @@ } AST_LIST_UNLOCK(&queue); if (call_to_destroy) { - if (iaxdebug && option_debug) - ast_log(LOG_DEBUG, "Really destroying %d, having been acked on final message\n", call_to_destroy); + if (iaxdebug) + ast_debug(1, "Really destroying %d, having been acked on final message\n", call_to_destroy); iax2_destroy(call_to_destroy); } } @@ -7014,8 +6995,7 @@ return 1; } } else { - if (option_debug) - ast_log(LOG_DEBUG, "Received iseqno %d not within window %d->%d\n", fr->iseqno, iaxs[fr->callno]->rseqno, iaxs[fr->callno]->oseqno); + ast_debug(1, "Received iseqno %d not within window %d->%d\n", fr->iseqno, iaxs[fr->callno]->rseqno, iaxs[fr->callno]->oseqno); } } if (inaddrcmp(&sin, &iaxs[fr->callno]->addr) && @@ -7066,8 +7046,7 @@ if (f.frametype == AST_FRAME_VOICE) { if (f.subclass != iaxs[fr->callno]->voiceformat) { iaxs[fr->callno]->voiceformat = f.subclass; - if (option_debug) - ast_log(LOG_DEBUG, "Ooh, voice format changed to %d\n", f.subclass); + ast_debug(1, "Ooh, voice format changed to %d\n", f.subclass); if (iaxs[fr->callno]->owner) { int orignative; retryowner: @@ -7087,8 +7066,7 @@ ast_mutex_unlock(&iaxs[fr->callno]->owner->lock); } } else { - if (option_debug) - ast_log(LOG_DEBUG, "Neat, somebody took away the channel at a magical time but i found it!\n"); + ast_debug(1, "Neat, somebody took away the channel at a magical time but i found it!\n"); /* Free remote variables (if any) */ if (ies.vars) ast_variables_destroy(ies.vars); @@ -7100,8 +7078,7 @@ } if (f.frametype == AST_FRAME_VIDEO) { if (f.subclass != iaxs[fr->callno]->videoformat) { - if (option_debug) - ast_log(LOG_DEBUG, "Ooh, video format changed to %d\n", f.subclass & ~0x1); + ast_debug(1, "Ooh, video format changed to %d\n", f.subclass & ~0x1); iaxs[fr->callno]->videoformat = f.subclass & ~0x1; } } @@ -7112,8 +7089,8 @@ iaxs[fr->callno]->initid = -1; } /* Handle the IAX pseudo frame itself */ - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "IAX subclass %d received\n", f.subclass); + if (iaxdebug) + ast_debug(1, "IAX subclass %d received\n", f.subclass); /* Update last ts unless the frame's timestamp originated with us. */ if (iaxs[fr->callno]->last < fr->ts && @@ -7121,8 +7098,8 @@ f.subclass != IAX_COMMAND_PONG && f.subclass != IAX_COMMAND_LAGRP) { iaxs[fr->callno]->last = fr->ts; - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "For call=%d, set last=%d\n", fr->callno, fr->ts); + if (iaxdebug) + ast_debug(1, "For call=%d, set last=%d\n", fr->callno, fr->ts); } switch(f.subclass) { @@ -7387,8 +7364,7 @@ break; case IAX_COMMAND_HANGUP: ast_set_flag(iaxs[fr->callno], IAX_ALREADYGONE); - if (option_debug) - ast_log(LOG_DEBUG, "Immediately destroying %d, having received hangup\n", fr->callno); + ast_debug(1, "Immediately destroying %d, having received hangup\n", fr->callno); /* Set hangup cause according to remote */ if (ies.causecode && iaxs[fr->callno]->owner) iaxs[fr->callno]->owner->hangupcause = ies.causecode; @@ -7406,9 +7382,8 @@ ast_log(LOG_WARNING, "Call rejected by %s: %s\n", ast_inet_ntoa(iaxs[fr->callno]->addr.sin_addr), ies.cause ? ies.cause : ""); - if (option_debug) - ast_log(LOG_DEBUG, "Immediately destroying %d, having received reject\n", - fr->callno); + ast_debug(1, "Immediately destroying %d, having received reject\n", + fr->callno); } /* Send ack immediately, before we destroy */ send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, @@ -7426,22 +7401,19 @@ if (iax_park(ast_bridged_channel(iaxs[fr->callno]->owner), iaxs[fr->callno]->owner)) { ast_log(LOG_WARNING, "Failed to park call on '%s'\n", ast_bridged_channel(iaxs[fr->callno]->owner)->name); } else if (ast_bridged_channel(iaxs[fr->callno]->owner)) { - if (option_debug) - ast_log(LOG_DEBUG, "Parked call on '%s'\n", ast_bridged_channel(iaxs[fr->callno]->owner)->name); + ast_debug(1, "Parked call on '%s'\n", ast_bridged_channel(iaxs[fr->callno]->owner)->name); } } else { if (ast_async_goto(ast_bridged_channel(iaxs[fr->callno]->owner), iaxs[fr->callno]->context, ies.called_number, 1)) ast_log(LOG_WARNING, "Async goto of '%s' to '%s@%s' failed\n", ast_bridged_channel(iaxs[fr->callno]->owner)->name, ies.called_number, iaxs[fr->callno]->context); else { - if (option_debug) - ast_log(LOG_DEBUG, "Async goto of '%s' to '%s@%s' started\n", ast_bridged_channel(iaxs[fr->callno]->owner)->name, - ies.called_number, iaxs[fr->callno]->context); + ast_debug(1, "Async goto of '%s' to '%s@%s' started\n", ast_bridged_channel(iaxs[fr->callno]->owner)->name, + ies.called_number, iaxs[fr->callno]->context); } } } else { - if (option_debug) - ast_log(LOG_DEBUG, "Async goto not applicable on call %d\n", fr->callno); + ast_debug(1, "Async goto not applicable on call %d\n", fr->callno); } break; case IAX_COMMAND_ACCEPT: @@ -7558,8 +7530,7 @@ /* And wrap up the qualify call */ iax2_destroy(fr->callno); peer->callno = 0; - if (option_debug) - ast_log(LOG_DEBUG, "Peer %s: got pong, lastms %d, historicms %d, maxms %d\n", peer->name, peer->lastms, peer->historicms, peer->maxms); + ast_debug(1, "Peer %s: got pong, lastms %d, historicms %d, maxms %d\n", peer->name, peer->lastms, peer->historicms, peer->maxms); } break; case IAX_COMMAND_LAGRQ: @@ -7579,8 +7550,8 @@ /* This is a reply we've been given, actually measure the difference */ ts = calc_timestamp(iaxs[fr->callno], 0, &fr->af); iaxs[fr->callno]->lag = ts - fr->ts; - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "Peer %s lag measured as %dms\n", + if (iaxdebug) + ast_debug(1, "Peer %s lag measured as %dms\n", ast_inet_ntoa(iaxs[fr->callno]->addr.sin_addr), iaxs[fr->callno]->lag); } break; @@ -7655,8 +7626,7 @@ } if (!format) { if(!ast_test_flag(iaxs[fr->callno], IAX_CODEC_NOCAP)) { - if (option_debug) - ast_log(LOG_DEBUG, "We don't do requested format %s, falling back to peer capability %d\n", ast_getformatname(iaxs[fr->callno]->peerformat), iaxs[fr->callno]->peercapability); + ast_debug(1, "We don't do requested format %s, falling back to peer capability %d\n", ast_getformatname(iaxs[fr->callno]->peerformat), iaxs[fr->callno]->peercapability); format = iaxs[fr->callno]->peercapability & iaxs[fr->callno]->capability; } if (!format) { @@ -7775,15 +7745,12 @@ break; case IAX_COMMAND_INVAL: iaxs[fr->callno]->error = ENOTCONN; - if (option_debug) - ast_log(LOG_DEBUG, "Immediately destroying %d, having received INVAL\n", fr->callno); + ast_debug(1, "Immediately destroying %d, having received INVAL\n", fr->callno); iax2_destroy(fr->callno); - if (option_debug) - ast_log(LOG_DEBUG, "Destroying call %d\n", fr->callno); + ast_debug(1, "Destroying call %d\n", fr->callno); break; case IAX_COMMAND_VNAK: - if (option_debug) - ast_log(LOG_DEBUG, "Received VNAK: resending outstanding frames\n"); + ast_debug(1, "Received VNAK: resending outstanding frames\n"); /* Force retransmission */ vnak_retransmit(fr->callno, fr->iseqno); break; @@ -7939,8 +7906,7 @@ send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_FWDATA, 0, ied0.buf, ied0.pos, -1); break; default: - if (option_debug) - ast_log(LOG_DEBUG, "Unknown IAX command %d on %d/%d\n", f.subclass, fr->callno, iaxs[fr->callno]->peercallno); + ast_debug(1, "Unknown IAX command %d on %d/%d\n", f.subclass, fr->callno, iaxs[fr->callno]->peercallno); memset(&ied0, 0, sizeof(ied0)); iax_ie_append_byte(&ied0, IAX_IE_IAX_UNKNOWN, f.subclass); send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_UNSUPPORT, 0, ied0.buf, ied0.pos, -1); @@ -8038,8 +8004,8 @@ /*iaxs[fr->callno]->last = fr->ts; (do it afterwards cos schedule/forward_delivery needs the last ts too)*/ fr->outoforder = 0; } else { - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "Received out of order packet... (type=%d, subclass %d, ts = %d, last = %d)\n", f.frametype, f.subclass, fr->ts, iaxs[fr->callno]->last); + if (iaxdebug) + ast_debug(1, "Received out of order packet... (type=%d, subclass %d, ts = %d, last = %d)\n", f.frametype, f.subclass, fr->ts, iaxs[fr->callno]->last); fr->outoforder = -1; } duped_fr = iaxfrdup2(fr); @@ -8049,8 +8015,8 @@ if (iaxs[fr->callno] && iaxs[fr->callno]->last < fr->ts) { iaxs[fr->callno]->last = fr->ts; #if 1 - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "For call=%d, set last=%d\n", fr->callno, fr->ts); + if (iaxdebug) + ast_debug(1, "For call=%d, set last=%d\n", fr->callno, fr->ts); #endif } @@ -8149,8 +8115,8 @@ static int iax2_do_register(struct iax2_registry *reg) { struct iax_ie_data ied; - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "Sending registration request for '%s'\n", reg->username); + if (iaxdebug) + ast_debug(1, "Sending registration request for '%s'\n", reg->username); if (reg->dnsmgr && ((reg->regstate == REG_STATE_TIMEOUT) || !reg->addr.sin_addr.s_addr)) { @@ -8169,8 +8135,8 @@ reg->callno = 0; } if (!reg->addr.sin_addr.s_addr) { - if (option_debug && iaxdebug) - ast_log(LOG_DEBUG, "Unable to send registration request for '%s' without IP address\n", reg->username); + if (iaxdebug) + ast_debug(1, "Unable to send registration request for '%s' without IP address\n", reg->username); /* Setup the next registration attempt */ if (reg->expire > -1) ast_sched_del(sched, reg->expire); @@ -8179,14 +8145,13 @@ } if (!reg->callno) { - if (option_debug) - ast_log(LOG_DEBUG, "Allocate call number\n"); + ast_debug(1, "Allocate call number\n"); reg->callno = find_callno(0, 0, ®->addr, NEW_FORCE, 1, defaultsockfd); if (reg->callno < 1) { ast_log(LOG_WARNING, "Unable to create call for registration\n"); return -1; - } else if (option_debug) - ast_log(LOG_DEBUG, "Registration created on call %d\n", reg->callno); + } else + ast_debug(1, "Registration created on call %d\n", reg->callno); iaxs[reg->callno]->reg = reg; } /* Schedule the next registration attempt */ @@ -8223,12 +8188,10 @@ memset(&cai, 0, sizeof(cai)); - if (option_debug) - ast_log(LOG_DEBUG, "Provisioning '%s' from template '%s'\n", dest, template); + ast_debug(1, "Provisioning '%s' from template '%s'\n", dest, template); if (iax_provision_build(&provdata, &sig, template, force)) { - if (option_debug) - ast_log(LOG_DEBUG, "No provisioning found for template '%s'\n", template); + ast_debug(1, "No provisioning found for template '%s'\n", template); return 0; } @@ -8513,8 +8476,8 @@ pthread_testcancel(); count = ast_sched_runq(sched); - if (count >= 20 && option_debug) - ast_log(LOG_DEBUG, "chan_iax2: ast_sched_runq ran %d scheduled tasks all at once\n", count); + if (count >= 20) + ast_debug(1, "chan_iax2: ast_sched_runq ran %d scheduled tasks all at once\n", count); } return NULL; @@ -8573,14 +8536,14 @@ AST_LIST_UNLOCK(&queue); pthread_testcancel(); - if (count >= 20 && option_debug) - ast_log(LOG_DEBUG, "chan_iax2: Sent %d queued outbound frames all at once\n", count); + if (count >= 20) + ast_debug(1, "chan_iax2: Sent %d queued outbound frames all at once\n", count); /* Now do the IO, and run scheduled tasks */ res = ast_io_wait(io, wakeup); if (res >= 0) { - if (res >= 20 && option_debug) - ast_log(LOG_DEBUG, "chan_iax2: ast_io_wait ran %d I/Os all at once\n", res); + if (res >= 20) + ast_debug(1, "chan_iax2: ast_io_wait ran %d I/Os all at once\n", res); } } return NULL; @@ -8654,8 +8617,7 @@ res = bind(sd, sa, salen); if (res < 0) { - if (option_debug) - ast_log(LOG_DEBUG, "Can't bind: %s\n", strerror(errno)); + ast_debug(1, "Can't bind: %s\n", strerror(errno)); close(sd); return 1; } @@ -8734,8 +8696,7 @@ srcaddr, peer->name); return -1; } else { - if (option_debug) - ast_log(LOG_DEBUG, "Using sourceaddress %s for '%s'\n", srcaddr, peer->name); + ast_debug(1, "Using sourceaddress %s for '%s'\n", srcaddr, peer->name); return 0; } } @@ -9792,9 +9753,8 @@ if (create_addr(pds.peer, &sin, &cai)) return -1; - if (option_debug) - ast_log(LOG_DEBUG, "peer: %s, username: %s, password: %s, context: %s\n", - pds.peer, pds.username, pds.password, pds.context); + ast_debug(1, "peer: %s, username: %s, password: %s, context: %s\n", + pds.peer, pds.username, pds.password, pds.context); callno = find_callno(0, 0, &sin, NEW_FORCE, 1, cai.sockfd); if (callno < 1) { @@ -10231,17 +10191,15 @@ if (ast_strlen_zero(pds.peer)) return res; - if (option_debug > 2) - ast_log(LOG_DEBUG, "Checking device state for device %s\n", pds.peer); + ast_debug(3, "Checking device state for device %s\n", pds.peer); /* SLD: FIXME: second call to find_peer during registration */ if (!(p = find_peer(pds.peer, 1))) return res; res = AST_DEVICE_UNAVAILABLE; - if (option_debug > 2) - ast_log(LOG_DEBUG, "iax2_devicestate: Found peer. What's device state of %s? addr=%d, defaddr=%d maxms=%d, lastms=%d\n", - pds.peer, p->addr.sin_addr.s_addr, p->defaddr.sin_addr.s_addr, p->maxms, p->lastms); + ast_debug(3, "iax2_devicestate: Found peer. What's device state of %s? addr=%d, defaddr=%d maxms=%d, lastms=%d\n", + pds.peer, p->addr.sin_addr.s_addr, p->defaddr.sin_addr.s_addr, p->maxms, p->lastms); if ((p->addr.sin_addr.s_addr || p->defaddr.sin_addr.s_addr) && (!p->maxms || ((p->lastms > -1) && (p->historicms <= p->maxms)))) { Index: channels/chan_misdn.c =================================================================== --- channels/chan_misdn.c (revision 69052) +++ channels/chan_misdn.c (working copy) @@ -727,8 +727,7 @@ ast_playtones_start(chan,0,dtmf_tones[15], 0); else { /* not handled */ - if (option_debug) - ast_log(LOG_DEBUG, "Unable to handle DTMF tone '%c' for '%s'\n", digit, chan->name); + ast_debug(1, "Unable to handle DTMF tone '%c' for '%s'\n", digit, chan->name); } } /*** CLI HANDLING ***/ @@ -2300,8 +2299,7 @@ struct misdn_bchannel *bc = NULL; const char *varcause = NULL; - if (option_debug) - ast_log(LOG_DEBUG, "misdn_hangup(%s)\n", ast->name); + ast_debug(1, "misdn_hangup(%s)\n", ast->name); if (!ast || ! (p=MISDN_ASTERISK_TECH_PVT(ast) ) ) return -1; @@ -2322,8 +2320,7 @@ CLEAN_CH: /* between request and call */ - if (option_debug) - ast_log(LOG_DEBUG, "State Reserved (or nothing) => chanIsAvail\n"); + ast_debug(1, "State Reserved (or nothing) => chanIsAvail\n"); MISDN_ASTERISK_TECH_PVT(ast) = NULL; cl_dequeue_chan(&cl_te, p); @@ -2467,8 +2464,7 @@ if (!f || (f->frametype != AST_FRAME_DTMF)) return frame; - if (option_debug) - ast_log(LOG_DEBUG, "Detected inband DTMF digit: %c\n", f->subclass); + ast_debug(1, "Detected inband DTMF digit: %c\n", f->subclass); if (tmp->faxdetect && (f->subclass == 'f')) { /* Fax tone -- Handle and return NULL */ @@ -2504,8 +2500,7 @@ } else ast_log(LOG_NOTICE, "Fax detected, but no fax extension ctx:%s exten:%s\n", context, ast->exten); } else { - if (option_debug) - ast_log(LOG_DEBUG, "Already in a fax extension, not redirecting\n"); + ast_debug(1, "Already in a fax extension, not redirecting\n"); } break; case 2: @@ -2513,8 +2508,7 @@ break; } } else { - if (option_debug) - ast_log(LOG_DEBUG, "Fax already handled\n"); + ast_debug(1, "Fax already handled\n"); } } @@ -2654,10 +2648,10 @@ { int i, max = 5 > frame->samples ? frame->samples : 5; - ast_log(LOG_DEBUG, "write2mISDN %p %d bytes: ", p, frame->samples); + ast_debug(1, "write2mISDN %p %d bytes: ", p, frame->samples); for (i = 0; i < max ; i++) - ast_log(LOG_DEBUG, "%2.2x ", ((char*) frame->data)[i]); + ast_debug(1, "%2.2x ", ((char*) frame->data)[i]); } #endif Index: channels/chan_alsa.c =================================================================== --- channels/chan_alsa.c (revision 69052) +++ channels/chan_alsa.c (working copy) @@ -365,8 +365,7 @@ ast_log(LOG_ERROR, "snd_pcm_open failed: %s\n", snd_strerror(err)); return NULL; } else { - if (option_debug) - ast_log(LOG_DEBUG, "Opening device %s in %s mode\n", dev, (stream == SND_PCM_STREAM_CAPTURE) ? "read" : "write"); + ast_debug(1, "Opening device %s in %s mode\n", dev, (stream == SND_PCM_STREAM_CAPTURE) ? "read" : "write"); } snd_pcm_hw_params_alloca(&hwparams); @@ -394,8 +393,7 @@ if (err < 0) ast_log(LOG_ERROR, "period_size(%ld frames) is bad: %s\n", period_size, snd_strerror(err)); else { - if (option_debug) - ast_log(LOG_DEBUG, "Period size is %d\n", err); + ast_debug(1, "Period size is %d\n", err); } buffer_size = 4096 * 2; /* period_size * 16; */ @@ -403,8 +401,7 @@ if (err < 0) ast_log(LOG_WARNING, "Problem setting buffer size of %ld: %s\n", buffer_size, snd_strerror(err)); else { - if (option_debug) - ast_log(LOG_DEBUG, "Buffer size is set to %d frames\n", err); + ast_debug(1, "Buffer size is set to %d frames\n", err); } #if 0 @@ -465,13 +462,11 @@ if (err <= 0) ast_log(LOG_ERROR, "Unable to get a poll descriptors count, error is %s\n", snd_strerror(err)); if (err != 1) { - if (option_debug) - ast_log(LOG_DEBUG, "Can't handle more than one device\n"); + ast_debug(1, "Can't handle more than one device\n"); } snd_pcm_poll_descriptors(handle, &pfd, err); - if (option_debug) - ast_log(LOG_DEBUG, "Acquired fd %d from the poll descriptor\n", pfd.fd); + ast_debug(1, "Acquired fd %d from the poll descriptor\n", pfd.fd); if (stream == SND_PCM_STREAM_CAPTURE) readdev = pfd.fd; @@ -634,8 +629,7 @@ res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2); if (res == -EPIPE) { #if DEBUG - if (option_debug) - ast_log(LOG_DEBUG, "XRUN write\n"); + ast_debug(1, "XRUN write\n"); #endif snd_pcm_prepare(alsa.ocard); res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2); Index: channels/chan_nbs.c =================================================================== --- channels/chan_nbs.c (revision 69052) +++ channels/chan_nbs.c (working copy) @@ -102,8 +102,7 @@ } /* When we call, it just works, really, there's no destination... Just ring the phone and wait for someone to answer */ - if (option_debug) - ast_log(LOG_DEBUG, "Calling %s on %s\n", dest, ast->name); + ast_debug(1, "Calling %s on %s\n", dest, ast->name); /* If we can't connect, return congestion */ if (nbs_connect(p->nbs)) { @@ -173,8 +172,7 @@ { struct nbs_pvt *p; p = ast->tech_pvt; - if (option_debug) - ast_log(LOG_DEBUG, "nbs_hangup(%s)\n", ast->name); + ast_debug(1, "nbs_hangup(%s)\n", ast->name); if (!ast->tech_pvt) { ast_log(LOG_WARNING, "Asked to hangup channel not connected\n"); return 0; @@ -200,8 +198,7 @@ p->fr.delivery.tv_sec = 0; p->fr.delivery.tv_usec = 0; - if (option_debug) - ast_log(LOG_DEBUG, "Returning null frame on %s\n", ast->name); + ast_debug(1, "Returning null frame on %s\n", ast->name); return &p->fr; } Index: channels/chan_mgcp.c =================================================================== --- channels/chan_mgcp.c (revision 69052) +++ channels/chan_mgcp.c (working copy) @@ -490,8 +490,7 @@ ast_log(LOG_WARNING, "Trying to unalloc the real channel %s@%s?!?\n", p->name, p->parent->name); return -1; } - if (option_debug) - ast_log(LOG_DEBUG, "Released sub %d of channel %s@%s\n", sub->id, p->name, p->parent->name); + ast_debug(1, "Released sub %d of channel %s@%s\n", sub->id, p->name, p->parent->name); sub->owner = NULL; if (!ast_strlen_zero(sub->cxident)) { @@ -757,8 +756,7 @@ /* XXX Should schedule retransmission XXX */ /* SC } else - if (option_debug) - ast_log(LOG_DEBUG, "Deferring transmission of transaction %d\n", seqno); + ast_debug(1, "Deferring transmission of transaction %d\n", seqno); */ return 0; } @@ -771,8 +769,7 @@ struct mgcp_request **queue, *q, *r, *t; ast_mutex_t *l; - if (option_debug) - ast_log(LOG_DEBUG, "Slow sequence is %d\n", p->slowsequence); + ast_debug(1, "Slow sequence is %d\n", p->slowsequence); if (p->slowsequence) { queue = &p->cmd_queue; l = &p->cmd_queue_lock; @@ -948,17 +945,13 @@ struct mgcp_subchannel *sub = ast->tech_pvt; struct mgcp_endpoint *p = sub->parent; - if (option_debug) { - ast_log(LOG_DEBUG, "mgcp_hangup(%s)\n", ast->name); - } + ast_debug(1, "mgcp_hangup(%s)\n", ast->name); if (!ast->tech_pvt) { - if (option_debug) - ast_log(LOG_DEBUG, "Asked to hangup channel not connected\n"); + ast_debug(1, "Asked to hangup channel not connected\n"); return 0; } if (strcmp(sub->magic, MGCP_SUBCHANNEL_MAGIC)) { - if (option_debug) - ast_log(LOG_DEBUG, "Invalid magic. MGCP subchannel freed up already.\n"); + ast_debug(1, "Invalid magic. MGCP subchannel freed up already.\n"); return 0; } ast_mutex_lock(&sub->lock); @@ -1210,8 +1203,7 @@ } if (ast->_state != AST_STATE_UP) { ast_setstate(ast, AST_STATE_UP); - if (option_debug) - ast_log(LOG_DEBUG, "mgcp_answer(%s)\n", ast->name); + ast_debug(1, "mgcp_answer(%s)\n", ast->name); transmit_notify_request(sub, ""); transmit_modify_request(sub); } @@ -1232,8 +1224,7 @@ /* We already hold the channel lock */ if (f->frametype == AST_FRAME_VOICE) { if (f->subclass != sub->owner->nativeformats) { - if (option_debug) - ast_log(LOG_DEBUG, "Oooh, format changed to %d\n", f->subclass); + ast_debug(1, "Oooh, format changed to %d\n", f->subclass); sub->owner->nativeformats = f->subclass; ast_set_read_format(sub->owner, sub->owner->readformat); ast_set_write_format(sub->owner, sub->owner->writeformat); @@ -1678,20 +1669,17 @@ /* SC */ p = g->endpoints; while(p) { - if (option_debug) - ast_log(LOG_DEBUG, "Searching on %s@%s for subchannel\n", - p->name, g->name); + ast_debug(1, "Searching on %s@%s for subchannel\n", + p->name, g->name); if (msgid) { #if 0 /* new transport mech */ sub = p->sub; do { - if (option_debug) - ast_log(LOG_DEBUG, "Searching on %s@%s-%d for subchannel with lastout: %d\n", - p->name, g->name, sub->id, msgid); + ast_debug(1, "Searching on %s@%s-%d for subchannel with lastout: %d\n", + p->name, g->name, sub->id, msgid); if (sub->lastout == msgid) { - if (option_debug) - ast_log(LOG_DEBUG, "Found subchannel sub%d to handle request %d sub->lastout: %d\n", - sub->id, msgid, sub->lastout); + ast_debug(1, "Found subchannel sub%d to handle request %d sub->lastout: %d\n", + sub->id, msgid, sub->lastout); found = 1; break; } @@ -1707,9 +1695,8 @@ /* SC */ break; } else if (name && !strcasecmp(p->name, tmp)) { - if (option_debug) - ast_log(LOG_DEBUG, "Coundn't determine subchannel, assuming current master %s@%s-%d\n", - p->name, g->name, p->sub->id); + ast_debug(1, "Coundn't determine subchannel, assuming current master %s@%s-%d\n", + p->name, g->name, p->sub->id); sub = p->sub; found = 1; break; @@ -2727,8 +2714,7 @@ timeout = matchdigittimeout; } } else if (res == 0) { - if (option_debug) - ast_log(LOG_DEBUG, "not enough digits (and no ambiguous match)...\n"); + ast_debug(1, "not enough digits (and no ambiguous match)...\n"); /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);*/ transmit_notify_request(sub, "G/cg"); /*zt_wait_event(p->subs[index].zfd);*/ @@ -2851,8 +2837,7 @@ timeout = firstdigittimeout; } else if (!ast_canmatch_extension(chan, chan->context, p->dtmf_buf, 1, chan->cid.cid_num) && ((p->dtmf_buf[0] != '*') || (strlen(p->dtmf_buf) > 2))) { - if (option_debug) - ast_log(LOG_DEBUG, "Can't match %s from '%s' in context %s\n", p->dtmf_buf, chan->cid.cid_num ? chan->cid.cid_num : "", chan->context); + ast_debug(1, "Can't match %s from '%s' in context %s\n", p->dtmf_buf, chan->cid.cid_num ? chan->cid.cid_num : "", chan->context); break; } if (!timeout) @@ -2865,13 +2850,11 @@ for (;;) { res = ast_waitfordigit(chan, to); if (!res) { - if (option_debug) - ast_log(LOG_DEBUG, "Timeout...\n"); + ast_debug(1, "Timeout...\n"); break; } if (res < 0) { - if (option_debug) - ast_log(LOG_DEBUG, "Got hangup...\n"); + ast_debug(1, "Got hangup...\n"); ast_hangup(chan); break; } @@ -2951,9 +2934,8 @@ /* Tell the caller not to hangup */ return 1; } else { - if (option_debug) - ast_log(LOG_DEBUG, "Neither %s nor %s are in a bridge, nothing to transfer\n", - p->sub->owner->name, p->sub->next->owner->name); + ast_debug(1, "Neither %s nor %s are in a bridge, nothing to transfer\n", + p->sub->owner->name, p->sub->next->owner->name); p->sub->next->owner->_softhangup |= AST_SOFTHANGUP_DEV; if (p->sub->next->owner) { p->sub->next->alreadygone = 1; @@ -3116,8 +3098,7 @@ ev = get_header(req, "O"); s = strchr(ev, '/'); if (s) ev = s + 1; - if (option_debug) - ast_log(LOG_DEBUG, "Endpoint '%s@%s-%d' observed '%s'\n", p->name, p->parent->name, sub->id, ev); + ast_debug(1, "Endpoint '%s@%s-%d' observed '%s'\n", p->name, p->parent->name, sub->id, ev); /* Keep looking for events unless this was a hangup */ if (strcasecmp(ev, "hu") && strcasecmp(ev, "hd") && strcasecmp(ev, "ping")) { transmit_notify_request(sub, p->curtone); @@ -3215,8 +3196,7 @@ } else if (!strcasecmp(ev, "hu")) { p->hookstate = MGCP_ONHOOK; sub->cxmode = MGCP_CX_RECVONLY; - if (option_debug) - ast_log(LOG_DEBUG, "MGCP %s@%s Went on hook\n", p->name, p->parent->name); + ast_debug(1, "MGCP %s@%s Went on hook\n", p->name, p->parent->name); /* Do we need to send MDCX before a DLCX ? if (sub->rtp) { transmit_modify_request(sub); @@ -3388,8 +3368,7 @@ ast_mutex_lock(&gw->msgs_lock); for (prev = NULL, cur = gw->msgs; cur; prev = cur, cur = cur->next) { if (cur->seqno == ident) { - if (option_debug) - ast_log(LOG_DEBUG, "Got response back on transaction %d\n", ident); + ast_debug(1, "Got response back on transaction %d\n", ident); if (prev) prev->next = cur->next; else Index: channels/chan_local.c =================================================================== --- channels/chan_local.c (revision 69052) +++ channels/chan_local.c (working copy) @@ -142,8 +142,7 @@ if ((opts = strchr(context, '/'))) *opts = '\0'; - if (option_debug > 2) - ast_log(LOG_DEBUG, "Checking if extension %s@%s exists (devicestate)\n", exten, context); + ast_debug(3, "Checking if extension %s@%s exists (devicestate)\n", exten, context); res = ast_exists_extension(NULL, context, exten, 1, NULL); if (!res) @@ -303,8 +302,7 @@ if (!ast_test_flag(p, LOCAL_ALREADY_MASQED)) res = local_queue_frame(p, isoutbound, f, ast); else { - if (option_debug) - ast_log(LOG_DEBUG, "Not posting to queue since already masked on '%s'\n", ast->name); + ast_debug(1, "Not posting to queue since already masked on '%s'\n", ast->name); res = 0; } if (!res) Index: channels/chan_gtalk.c =================================================================== --- channels/chan_gtalk.c (revision 69052) +++ channels/chan_gtalk.c (working copy) @@ -515,8 +515,7 @@ struct gtalk_pvt *p = ast->tech_pvt; int res = 0; - if (option_debug) - ast_log(LOG_DEBUG, "Answer!\n"); + ast_debug(1, "Answer!\n"); ast_mutex_lock(&p->lock); gtalk_invite(p, p->them, p->us,p->sid, 0); ast_mutex_unlock(&p->lock); @@ -603,8 +602,7 @@ { struct gtalk_pvt *tmp; char *from; - if (option_debug) - ast_log(LOG_DEBUG, "The client is %s\n", client->name); + ast_debug(1, "The client is %s\n", client->name); /* Make sure our new call doesn't exist yet */ for (tmp = client->p; tmp; tmp = tmp->next) { if (iks_find_with_attrib(pak->x, "session", "id", tmp->sid)) @@ -682,8 +680,7 @@ struct gtalk_pvt *tmp; char *from; - if (option_debug) - ast_log(LOG_DEBUG, "The client is %s\n", client->name); + ast_debug(1, "The client is %s\n", client->name); /* Make sure our new call doesn't exist yet */ for (tmp = client->p; tmp; tmp = tmp->next) { if (iks_find_with_attrib(pak->x, "session", "id", tmp->sid)) @@ -839,8 +836,7 @@ char idroster[200]; char *data, *exten = NULL; - if (option_debug) - ast_log(LOG_DEBUG, "The client is %s for alloc\n", client->name); + ast_debug(1, "The client is %s for alloc\n", client->name); if (!sid && !strchr(them, '/')) { /* I started call! */ if (!strcasecmp(client->name, "guest")) { buddy = ASTOBJ_CONTAINER_FIND(&client->connection->buddies, them); @@ -1173,9 +1169,9 @@ else ast_rtp_stun_request(p->rtp, &sin, username); - if (aux.sin_addr.s_addr && option_debug > 3) { - ast_log(LOG_DEBUG, "Receiving RTP traffic from IP %s, matches with remote candidate's IP %s\n", ast_inet_ntoa(aux.sin_addr), tmp->ip); - ast_log(LOG_DEBUG, "Sending STUN request to %s\n", tmp->ip); + if (aux.sin_addr.s_addr) { + ast_debug(4, "Receiving RTP traffic from IP %s, matches with remote candidate's IP %s\n", ast_inet_ntoa(aux.sin_addr), tmp->ip); + ast_debug(4, "Sending STUN request to %s\n", tmp->ip); } tmp = tmp->next; @@ -1280,8 +1276,7 @@ /* We already hold the channel lock */ if (f->frametype == AST_FRAME_VOICE) { if (f->subclass != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) { - if (option_debug) - ast_log(LOG_DEBUG, "Oooh, format changed to %d\n", f->subclass); + ast_debug(1, "Oooh, format changed to %d\n", f->subclass); p->owner->nativeformats = (p->owner->nativeformats & AST_FORMAT_VIDEO_MASK) | f->subclass; ast_set_read_format(p->owner, p->owner->readformat); @@ -1290,8 +1285,7 @@ /* if ((ast_test_flag(p, SIP_DTMF) == SIP_DTMF_INBAND) && p->vad) { f = ast_dsp_process(p->owner, p->vad, f); if (option_debug && f && (f->frametype == AST_FRAME_DTMF)) - if (option_debug) - ast_log(LOG_DEBUG, "* Detected inband DTMF '%c'\n", f->subclass); + ast_debug(1, "* Detected inband DTMF '%c'\n", f->subclass); } */ } } @@ -1577,11 +1571,9 @@ /* New call */ gtalk_newcall(client, pak); } else if (iks_find_with_attrib(pak->x, "session", "type", "candidates") || iks_find_with_attrib(pak->x, "session", "type", "transport-info")) { - if (option_debug > 2) - ast_log(LOG_DEBUG, "About to add candidate!\n"); + ast_debug(3, "About to add candidate!\n"); gtalk_add_candidate(client, pak); - if (option_debug > 2) - ast_log(LOG_DEBUG, "Candidate Added!\n"); + ast_debug(3, "Candidate Added!\n"); } else if (iks_find_with_attrib(pak->x, "session", "type", "accept") || iks_find_with_attrib(pak->x, "session", "type", "transport-accept")) { gtalk_is_answered(client, pak); } else if (iks_find_with_attrib(pak->x, "session", "type", "content-info")) {