Replace ast_log(LOG_DEBUG, ...) with ast_debug()
authorPaul Belanger <paul.belanger@polybeacon.com>
Fri, 4 Feb 2011 16:55:39 +0000 (16:55 +0000)
committerPaul Belanger <paul.belanger@polybeacon.com>
Fri, 4 Feb 2011 16:55:39 +0000 (16:55 +0000)
(closes issue #18556)
Reported by: kkm

Review: https://reviewboard.asterisk.org/r/1071/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@306258 65c4cc65-6c06-0410-ace0-fbb531ad65f3

39 files changed:
addons/chan_ooh323.c
apps/app_fax.c
apps/app_meetme.c
apps/app_rpt.c
apps/app_voicemail.c
cel/cel_radius.c
channels/chan_dahdi.c
channels/chan_gtalk.c
channels/chan_iax2.c
channels/chan_misdn.c
channels/chan_sip.c
channels/chan_skinny.c
channels/sig_pri.c
codecs/codec_ilbc.c
include/asterisk/channel.h
include/asterisk/sched.h
main/app.c
main/audiohook.c
main/channel.c
main/features.c
main/http.c
main/logger.c
main/manager.c
main/pbx.c
main/say.c
main/taskprocessor.c
main/xmldoc.c
pbx/pbx_loopback.c
pbx/pbx_spool.c
res/ais/evt.c
res/res_agi.c
res/res_config_ldap.c
res/res_http_post.c
res/res_jabber.c
res/res_musiconhold.c
res/res_odbc.c
res/res_rtp_asterisk.c
res/res_smdi.c
utils/extconf.c

index df4965b..6da6c1c 100644 (file)
@@ -1037,13 +1037,13 @@ static int ooh323_hangup(struct ast_channel *ast)
 
                if (gH323Debug)
                        ast_verbose("    hanging %s with cause: %d\n", p->username, q931cause);
-               ast->tech_pvt = NULL; 
+               ast->tech_pvt = NULL;
                if (!ast_test_flag(p, H323_ALREADYGONE)) {
-                       ooHangCall(p->callToken, 
+                       ooHangCall(p->callToken,
                                ooh323_convert_hangupcause_asteriskToH323(q931cause), q931cause);
                        ast_set_flag(p, H323_ALREADYGONE);
                        /* ast_mutex_unlock(&p->lock); */
-               } else 
+               } else
                        ast_set_flag(p, H323_NEEDDESTROY);
                /* detach channel here */
                if (p->owner) {
@@ -1059,11 +1059,11 @@ static int ooh323_hangup(struct ast_channel *ast)
 
                /* Notify the module monitors that use count for resource has changed */
                ast_update_use_count();
-         
+
        } else {
                ast_debug(1, "No call to hangup\n" );
        }
-       
+
        if (gH323Debug)
                ast_verbose("+++   ooh323_hangup\n");
 
@@ -1083,8 +1083,7 @@ static int ooh323_answer(struct ast_channel *ast)
                if (ast->_state != AST_STATE_UP) {
                        ast_channel_lock(ast);
                        ast_setstate(ast, AST_STATE_UP);
-                       if (option_debug)
-                               ast_debug(1, "ooh323_answer(%s)\n", ast->name);
+                       ast_debug(1, "ooh323_answer(%s)\n", ast->name);
                        ast_channel_unlock(ast);
                        ooAnswerCall(p->callToken);
                }
@@ -1133,11 +1132,10 @@ static int ooh323_write(struct ast_channel *ast, struct ast_frame *f)
                        return res;
                }
 
-       
                if (f->frametype == AST_FRAME_VOICE) {
 /* sending progress for first */
                        if (!ast_test_flag(p, H323_OUTGOING) && !p->progsent &&
-                                       p->callToken) {
+                                       p->callToken) {
                                ooManualProgress(p->callToken);
                                p->progsent = 1;
                        }
@@ -1201,48 +1199,50 @@ static int ooh323_indicate(struct ast_channel *ast, int condition, const void *d
 
        if (gH323Debug)
                ast_verbose("----- ooh323_indicate %d on call %s\n", condition, callToken);
-        
-       ast_mutex_lock(&p->lock);
+
+       ast_mutex_lock(&p->lock);
        switch (condition) {
        case AST_CONTROL_CONGESTION:
                if (!ast_test_flag(p, H323_ALREADYGONE)) {
-                       ooHangCall(callToken, OO_REASON_LOCAL_CONGESTED, 
+                       ooHangCall(callToken, OO_REASON_LOCAL_CONGESTED,
                                                AST_CAUSE_SWITCH_CONGESTION);
                        ast_set_flag(p, H323_ALREADYGONE);
                }
                break;
        case AST_CONTROL_BUSY:
                if (!ast_test_flag(p, H323_ALREADYGONE)) {
-                       ooHangCall(callToken, OO_REASON_LOCAL_BUSY, AST_CAUSE_USER_BUSY);
+                       ooHangCall(callToken, OO_REASON_LOCAL_BUSY, AST_CAUSE_USER_BUSY);
                        ast_set_flag(p, H323_ALREADYGONE);
                }
                break;
        case AST_CONTROL_HOLD:
-               ast_moh_start(ast, data, NULL);         
+               ast_moh_start(ast, data, NULL);
                break;
        case AST_CONTROL_UNHOLD:
                ast_moh_stop(ast);
                break;
        case AST_CONTROL_PROGRESS:
                if (ast->_state != AST_STATE_UP) {
-                       if (!p->progsent) {
-                               if (gH323Debug) 
-                                       ast_log(LOG_DEBUG,"Sending manual progress for %s, res = %d\n", callToken,
-                                       ooManualProgress(callToken));   
-                               else
-                                       ooManualProgress(callToken);
-                               p->progsent = 1;
-                       }
+                       if (!p->progsent) {
+                               if (gH323Debug) {
+                                       ast_debug(1, "Sending manual progress for %s, res = %d\n", callToken,
+                                       ooManualProgress(callToken));
+                               } else {
+                                       ooManualProgress(callToken);
+                               }
+                               p->progsent = 1;
+                       }
                }
            break;
       case AST_CONTROL_RINGING:
            if (ast->_state == AST_STATE_RING || ast->_state == AST_STATE_RINGING) {
-               if (gH323Debug) 
-                       ast_log(LOG_DEBUG,"Sending manual ringback for %s, res = %d\n", 
+               if (gH323Debug) {
+                       ast_debug(1, "Sending manual ringback for %s, res = %d\n",
                        callToken,
-                       ooManualRingback(callToken));
-                else
-                       ooManualRingback(callToken);
+                       ooManualRingback(callToken));
+               } else {
+                       ooManualRingback(callToken);
+               }
            }
         break;
        case AST_CONTROL_SRCUPDATE:
@@ -1256,9 +1256,10 @@ static int ooh323_indicate(struct ast_channel *ast, int condition, const void *d
                        || ast_strlen_zero(ast->connected.id.name.str)) {
                        break;
                }
-               if (gH323Debug)
-                       ast_log(LOG_DEBUG, "Sending connected line info for %s (%s)\n",
+               if (gH323Debug) {
+                       ast_debug(1, "Sending connected line info for %s (%s)\n",
                                callToken, ast->connected.id.name.str);
+               }
                ooSetANI(callToken, ast->connected.id.name.str);
                break;
 
@@ -1373,8 +1374,8 @@ static int ooh323_queryoption(struct ast_channel *ast, int option, void *data, i
 
        if (gH323Debug)
                ast_verbose("+++++ ooh323_queryoption %d on channel %s\n", option, ast->name);
-        
-       ast_mutex_unlock(&p->lock);
+
+       ast_mutex_unlock(&p->lock);
 
        return res;
 }
@@ -1418,9 +1419,9 @@ void ooh323_set_write_format(ooCallData *call, struct ast_format *fmt, int txfra
        char formats[FORMAT_STRING_SIZE];
 
        if (gH323Debug)
-               ast_verbose("---   ooh323_update_writeformat %s/%d\n", 
+               ast_verbose("---   ooh323_update_writeformat %s/%d\n",
                                ast_getformatname(fmt), txframes);
-       
+
        p = find_call(call);
        if (!p) {
                ast_log(LOG_ERROR, "No matching call found for %s\n", call->callToken);
@@ -1433,7 +1434,7 @@ void ooh323_set_write_format(ooCallData *call, struct ast_format *fmt, int txfra
 
        if (p->owner) {
                while (p->owner && ast_channel_trylock(p->owner)) {
-                       ast_debug(1,"Failed to grab lock, trying again\n");
+                       ast_debug(1, "Failed to grab lock, trying again\n");
                        DEADLOCK_AVOIDANCE(&p->lock);
                }
                if (!p->owner) {
@@ -1442,7 +1443,7 @@ void ooh323_set_write_format(ooCallData *call, struct ast_format *fmt, int txfra
                        return;
                }
                if (gH323Debug)
-                       ast_verbose("Writeformat before update %s/%s\n", 
+                       ast_verbose("Writeformat before update %s/%s\n",
                          ast_getformatname(&p->owner->writeformat),
                          ast_getformatname_multiple(formats, sizeof(formats), p->owner->nativeformats));
                if (txframes)
@@ -1478,7 +1479,7 @@ void ooh323_set_read_format(ooCallData *call, struct ast_format *fmt)
        if (gH323Debug)
                ast_verbose("---   ooh323_update_readformat %s\n", 
                                ast_getformatname(fmt));
-       
+
        p = find_call(call);
        if (!p) {
                ast_log(LOG_ERROR, "No matching call found for %s\n", call->callToken);
@@ -1491,7 +1492,7 @@ void ooh323_set_read_format(ooCallData *call, struct ast_format *fmt)
 
        if (p->owner) {
                while (p->owner && ast_channel_trylock(p->owner)) {
-                       ast_debug(1,"Failed to grab lock, trying again\n");
+                       ast_debug(1, "Failed to grab lock, trying again\n");
                        DEADLOCK_AVOIDANCE(&p->lock);
                }
                if (!p->owner) {
@@ -1501,12 +1502,12 @@ void ooh323_set_read_format(ooCallData *call, struct ast_format *fmt)
                }
 
                if (gH323Debug)
-                       ast_verbose("Readformat before update %s\n", 
+                       ast_verbose("Readformat before update %s\n",
                                  ast_getformatname(&p->owner->readformat));
                ast_format_cap_set(p->owner->nativeformats, fmt);
-               ast_set_read_format(p->owner, &p->owner->readformat);
+               ast_set_read_format(p->owner, &p->owner->readformat);
                ast_channel_unlock(p->owner);
-       } else
+       } else
                ast_log(LOG_ERROR, "No owner found\n");
 
        ast_mutex_unlock(&p->lock);
@@ -1524,12 +1525,12 @@ int onAlerting(ooCallData *call)
        if (gH323Debug)
                ast_verbose("--- onAlerting %s\n", call->callToken);
 
-       p = find_call(call);
+       p = find_call(call);
 
-       if(!p) {
+       if(!p) {
                ast_log(LOG_ERROR, "No matching call found\n");
                return -1;
-       }  
+       }
        ast_mutex_lock(&p->lock);
        if (!p->owner) {
                ast_mutex_unlock(&p->lock);
@@ -1537,7 +1538,7 @@ int onAlerting(ooCallData *call)
                return 0;
        }
        while (p->owner && ast_channel_trylock(p->owner)) {
-               ast_debug(1,"Failed to grab lock, trying again\n");
+               ast_debug(1, "Failed to grab lock, trying again\n");
                DEADLOCK_AVOIDANCE(&p->lock);
        }
        if (!p->owner) {
@@ -1580,12 +1581,12 @@ int onProgress(ooCallData *call)
        if (gH323Debug)
                ast_verbose("--- onProgress %s\n", call->callToken);
 
-       p = find_call(call);
+       p = find_call(call);
 
-       if(!p) {
+       if(!p) {
                ast_log(LOG_ERROR, "No matching call found\n");
                return -1;
-       }  
+       }
        ast_mutex_lock(&p->lock);
        if (!p->owner) {
                ast_mutex_unlock(&p->lock);
@@ -1593,7 +1594,7 @@ int onProgress(ooCallData *call)
                return 0;
        }
        while (p->owner && ast_channel_trylock(p->owner)) {
-               ast_debug(1,"Failed to grab lock, trying again\n");
+               ast_debug(1, "Failed to grab lock, trying again\n");
                DEADLOCK_AVOIDANCE(&p->lock);
        }
        if (!p->owner) {
@@ -1619,8 +1620,8 @@ int onProgress(ooCallData *call)
                ast_setstate(c, AST_STATE_RINGING);
 
        ast_queue_control(c, AST_CONTROL_PROGRESS);
-       ast_channel_unlock(c);
-       ast_mutex_unlock(&p->lock);
+       ast_channel_unlock(c);
+       ast_mutex_unlock(&p->lock);
 
        if (gH323Debug)
                ast_verbose("+++ onProgress %s\n", call->callToken);
@@ -1660,7 +1661,7 @@ int ooh323_onReceivedDigit(OOH323CallData *call, const char *digit)
        f.src = "SEND_DIGIT";
 
        while (p->owner && ast_channel_trylock(p->owner)) {
-               ast_debug(1,"Failed to grab lock, trying again\n");
+               ast_debug(1, "Failed to grab lock, trying again\n");
                DEADLOCK_AVOIDANCE(&p->lock);
        }
        if (!p->owner) {
@@ -1998,16 +1999,16 @@ int onCallEstablished(ooCallData *call)
                return -1;
        }
 
-       if(ast_test_flag(p, H323_OUTGOING)) {
+       if(ast_test_flag(p, H323_OUTGOING)) {
                ast_mutex_lock(&p->lock);
                if (!p->owner) {
                        ast_mutex_unlock(&p->lock);
                        ast_log(LOG_ERROR, "Channel has no owner\n");
                        return -1;
                }
-       
+
                while (p->owner && ast_channel_trylock(p->owner)) {
-                       ast_debug(1,"Failed to grab lock, trying again\n");
+                       ast_debug(1, "Failed to grab lock, trying again\n");
                        DEADLOCK_AVOIDANCE(&p->lock);
                }
                if (p->owner) {
@@ -2027,7 +2028,7 @@ int onCallEstablished(ooCallData *call)
                        }
 
                        ast_queue_control(c, AST_CONTROL_ANSWER);
-                       ast_channel_unlock(p->owner);
+                       ast_channel_unlock(p->owner);
                        manager_event(EVENT_FLAG_SYSTEM,"ChannelUpdate","Channel: %s\r\nChanneltype: %s\r\n"
                                "CallRef: %d\r\n", c->name, "OOH323", p->call_reference);
                }
@@ -2052,42 +2053,42 @@ int onCallCleared(ooCallData *call)
 
    if ((p = find_call(call))) {
        ast_mutex_lock(&p->lock);
-  
+
        while (p->owner) {
                if (ast_channel_trylock(p->owner)) {
                        ooTrace(OOTRCLVLINFO, "Failed to grab lock, trying again\n");
-                       ast_log(LOG_DEBUG,"Failed to grab lock, trying again\n");
+                       ast_debug(1, "Failed to grab lock, trying again\n");
                        DEADLOCK_AVOIDANCE(&p->lock);
                } else {
-                       ownerLock = 1; break;
+                       ownerLock = 1; break;
                }
        }
 
        if (ownerLock) {
-               if (!ast_test_flag(p, H323_ALREADYGONE)) { 
+               if (!ast_test_flag(p, H323_ALREADYGONE)) {
 
                        ast_set_flag(p, H323_ALREADYGONE);
                        p->owner->hangupcause = call->q931cause;
                        p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
                        ast_queue_hangup_with_cause(p->owner,call->q931cause);
                }
-       }
+       }
 
-       if(p->owner) {
-               p->owner->tech_pvt = NULL;
+       if(p->owner) {
+               p->owner->tech_pvt = NULL;
                ast_channel_unlock(p->owner);
-               p->owner = NULL;
+               p->owner = NULL;
                ast_module_unref(myself);
        }
 
        ast_set_flag(p, H323_NEEDDESTROY);
 
-       ooh323c_stop_call_thread(call);
+       ooh323c_stop_call_thread(call);
 
        ast_mutex_unlock(&p->lock);
-       ast_mutex_lock(&usecnt_lock);
-       usecnt--;
-       ast_mutex_unlock(&usecnt_lock);
+       ast_mutex_lock(&usecnt_lock);
+       usecnt--;
+       ast_mutex_unlock(&usecnt_lock);
 
     }
 
@@ -3526,7 +3527,7 @@ int ooh323_destroy(struct ooh323_pvt *p)
                        free(cur->callerid_name);
                        cur->callerid_name = 0;
                }
-               
+
                if (cur->callerid_num) {
                        free(cur->callerid_num);
                        cur->callerid_num = 0;
@@ -3541,20 +3542,20 @@ int ooh323_destroy(struct ooh323_pvt *p)
                        ast_udptl_destroy(cur->udptl);
                        cur->udptl = NULL;
                }
-       
+
                /* Unlink us from the owner if we have one */
                if (cur->owner) {
-                       while(ast_channel_trylock(cur->owner)) {
-                               ast_debug(1,"Failed to grab lock, trying again\n");
+                       while(ast_channel_trylock(cur->owner)) {
+                               ast_debug(1, "Failed to grab lock, trying again\n");
                                DEADLOCK_AVOIDANCE(&cur->lock);
-                       }           
+                       }
                        ast_debug(1, "Detaching from %s\n", cur->owner->name);
                        cur->owner->tech_pvt = NULL;
                        ast_channel_unlock(cur->owner);
                        cur->owner = NULL;
                        ast_module_unref(myself);
                }
-  
+
                if (cur->vad) {
                        ast_dsp_free(cur->vad);
                        cur->vad = NULL;
@@ -4105,7 +4106,7 @@ void setup_udptl_connection(ooCallData *call, const char *remoteIp,
                ast_verbose("---   setup_udptl_connection\n");
 
        /* Find the call or allocate a private structure if call not found */
-       p = find_call(call); 
+       p = find_call(call);
 
        if (!p) {
                ast_log(LOG_ERROR, "Something is wrong: rtp\n");
@@ -4115,7 +4116,7 @@ void setup_udptl_connection(ooCallData *call, const char *remoteIp,
        ast_mutex_lock(&p->lock);
        if (p->owner) {
                while (p->owner && ast_channel_trylock(p->owner)) {
-                       ast_debug(1,"Failed to grab lock, trying again\n");
+                       ast_debug(1, "Failed to grab lock, trying again\n");
                        DEADLOCK_AVOIDANCE(&p->lock);
                }
                if (!p->owner) {
@@ -4142,7 +4143,7 @@ void setup_udptl_connection(ooCallData *call, const char *remoteIp,
                ast_queue_control_data(p->owner, AST_CONTROL_T38_PARAMETERS, &parameters, sizeof(parameters));
        }
        if (gH323Debug)
-               ast_debug(1, "Receiving UDPTL  %s:%d\n", ast_inet_ntoa(them.sin_addr), 
+               ast_debug(1, "Receiving UDPTL  %s:%d\n", ast_inet_ntoa(them.sin_addr),
                                                         ntohs(them.sin_port));
 
        ast_channel_unlock(p->owner);
@@ -4158,19 +4159,19 @@ void close_udptl_connection(ooCallData *call)
 {
        struct ooh323_pvt *p = NULL;
 
-       if(gH323Debug)
+       if(gH323Debug)
                ast_verbose("---   close_udptl_connection\n");
 
        p = find_call(call);
        if (!p) {
-               ast_log(LOG_ERROR, "Couldn't find matching call to close udptl "
+               ast_log(LOG_ERROR, "Couldn't find matching call to close udptl "
                          "connection\n");
                return;
        }
        ast_mutex_lock(&p->lock);
        if (p->owner) {
                while (p->owner && ast_channel_trylock(p->owner)) {
-                       ast_debug(1,"Failed to grab lock, trying again\n");
+                       ast_debug(1, "Failed to grab lock, trying again\n");
                        DEADLOCK_AVOIDANCE(&p->lock);
                }
                if (!p->owner) {
@@ -4251,8 +4252,10 @@ struct ast_frame *ooh323_rtp_read(struct ast_channel *ast, struct ooh323_pvt *p)
                break;
        case 5:
                f = ast_udptl_read(p->udptl);           /* UDPTL t.38 data */
-               if (gH323Debug) ast_debug(1, "Got UDPTL %d/%d len %d for %s\n",
+               if (gH323Debug) {
+                       ast_debug(1, "Got UDPTL %d/%d len %d for %s\n",
                                f->frametype, f->subclass.integer, f->datalen, ast->name);
+               }
                break;
 
        default:
@@ -4263,7 +4266,7 @@ struct ast_frame *ooh323_rtp_read(struct ast_channel *ast, struct ooh323_pvt *p)
                /* We already hold the channel lock */
                if (f->frametype == AST_FRAME_VOICE && !p->faxmode) {
                        if (!(ast_format_cap_iscompatible(p->owner->nativeformats, &f->subclass.format))) {
-                               ast_debug(1, "Oooh, voice format changed to %s\n", ast_getformatname(&f->subclass.format));
+                               ast_debug(1, "Oooh, voice format changed to %s\n", ast_getformatname(&f->subclass.format));
                                ast_format_cap_set(p->owner->nativeformats, &f->subclass.format);
                                ast_set_read_format(p->owner, &p->owner->readformat);
                                ast_set_write_format(p->owner, &p->owner->writeformat);
@@ -4273,8 +4276,9 @@ struct ast_frame *ooh323_rtp_read(struct ast_channel *ast, struct ooh323_pvt *p)
                                (f->subclass.format.id == AST_FORMAT_SLINEAR || f->subclass.format.id == AST_FORMAT_ALAW ||
                                        f->subclass.format.id == AST_FORMAT_ULAW)) {
                                f = ast_dsp_process(p->owner, p->vad, f);
-                               if (f && (f->frametype == AST_FRAME_DTMF)) 
-                                               ast_debug(1, "* Detected inband DTMF '%c'\n", f->subclass.integer);
+                               if (f && (f->frametype == AST_FRAME_DTMF)) {
+                                       ast_debug(1, "* Detected inband DTMF '%c'\n", f->subclass.integer);
+                               }
                        }
                }
        }
@@ -4292,13 +4296,15 @@ void onModeChanged(ooCallData *call, int t38mode) {
 
        ast_mutex_lock(&p->lock);
 
-       if (gH323Debug)
-                       ast_debug(1, "change mode to %d for %s\n", t38mode, call->callToken);
+       if (gH323Debug) {
+               ast_debug(1, "change mode to %d for %s\n", t38mode, call->callToken);
+       }
 
        if (t38mode == p->faxmode) {
-               if (gH323Debug)
+               if (gH323Debug) {
                        ast_debug(1, "mode for %s is already %d\n", call->callToken,
                                        t38mode);
+               }
                ast_mutex_unlock(&p->lock);
                return;
        }
index ce85419..39c6ad1 100644 (file)
@@ -17,7 +17,7 @@
        <depend>spandsp</depend>
        <conflict>res_fax</conflict>
 ***/
+
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
@@ -172,7 +172,7 @@ static void span_message(int level, const char *msg)
        } else if (level == SPAN_LOG_WARNING) {
                ast_log(LOG_WARNING, "%s", msg);
        } else {
-               ast_log(LOG_DEBUG, "%s", msg);
+               ast_debug(1, "%s", msg);
        }
 }
 
@@ -224,13 +224,13 @@ static void phase_e_handler(t30_state_t *f, void *user_data, int result)
 
                return;
        }
-       
-       s->finished = 1; 
-       
+
+       s->finished = 1;
+
        local_ident = S_OR(t30_get_tx_ident(f), "");
        far_ident = S_OR(t30_get_rx_ident(f), "");
-       pbx_builtin_setvar_helper(s->chan, "FAXSTATUS", "SUCCESS"); 
-       pbx_builtin_setvar_helper(s->chan, "FAXERROR", NULL); 
+       pbx_builtin_setvar_helper(s->chan, "FAXSTATUS", "SUCCESS");
+       pbx_builtin_setvar_helper(s->chan, "FAXERROR", NULL);
        pbx_builtin_setvar_helper(s->chan, "REMOTESTATIONID", far_ident);
 #if SPANDSP_RELEASE_DATE >= 20090220
        pages_transferred = (s->direction) ? stat.pages_tx : stat.pages_rx;
@@ -242,14 +242,14 @@ static void phase_e_handler(t30_state_t *f, void *user_data, int result)
        snprintf(buf, sizeof(buf), "%d", stat.y_resolution);
        pbx_builtin_setvar_helper(s->chan, "FAXRESOLUTION", buf);
        snprintf(buf, sizeof(buf), "%d", stat.bit_rate);
-       pbx_builtin_setvar_helper(s->chan, "FAXBITRATE", buf); 
-       
+       pbx_builtin_setvar_helper(s->chan, "FAXBITRATE", buf);
+
        ast_debug(1, "Fax transmitted successfully.\n");
        ast_debug(1, "  Remote station ID: %s\n", far_ident);
        ast_debug(1, "  Pages transferred: %d\n", pages_transferred);
        ast_debug(1, "  Image resolution:  %d x %d\n", stat.x_resolution, stat.y_resolution);
        ast_debug(1, "  Transfer Rate:     %d\n", stat.bit_rate);
-       
+
        ast_manager_event(s->chan, EVENT_FLAG_CALL,
                s->direction ? "FaxSent" : "FaxReceived",
                "Channel: %s\r\n"
@@ -400,7 +400,7 @@ static int transmit_audio(fax_session *s)
                        /* wait up to five seconds for negotiation to complete */
                        unsigned int timeout = 5000;
                        int ms;
-                       
+
                        ast_debug(1, "Negotiating T.38 for receive on %s\n", s->chan->name);
                        while (timeout > 0) {
                                ms = ast_waitfor(s->chan, 1000);
@@ -425,7 +425,7 @@ static int transmit_audio(fax_session *s)
                                    (inf->subclass.integer == AST_CONTROL_T38_PARAMETERS) &&
                                    (inf->datalen == sizeof(t38_parameters))) {
                                        struct ast_control_t38_parameters *parameters = inf->data.ptr;
-                                       
+
                                        switch (parameters->request_response) {
                                        case AST_T38_NEGOTIATED:
                                                ast_debug(1, "Negotiated T.38 for receive on %s\n", s->chan->name);
@@ -670,7 +670,7 @@ static int transmit_t38(fax_session *s)
                        res = -1;
                        break;
                }
-               
+
                t38_terminal_send_timeout(&t38, ast_tvdiff_us(now, last_frame) / (1000000 / 8000));
 
                if (!res) {
@@ -727,7 +727,7 @@ disable_t38:
                        /* wait up to five seconds for negotiation to complete */
                        unsigned int timeout = 5000;
                        int ms;
-                       
+
                        ast_debug(1, "Shutting down T.38 on %s\n", s->chan->name);
                        while (timeout > 0) {
                                ms = ast_waitfor(s->chan, 1000);
@@ -752,7 +752,7 @@ disable_t38:
                                    (inf->subclass.integer == AST_CONTROL_T38_PARAMETERS) &&
                                    (inf->datalen == sizeof(t38_parameters))) {
                                        struct ast_control_t38_parameters *parameters = inf->data.ptr;
-                                       
+
                                        switch (parameters->request_response) {
                                        case AST_T38_TERMINATED:
                                                ast_debug(1, "Shut down T.38 on %s\n", s->chan->name);
index ae60cfb..edf987e 100644 (file)
@@ -2051,7 +2051,7 @@ static int rt_extend_conf(const char *confno)
 
 static void conf_start_moh(struct ast_channel *chan, const char *musicclass)
 {
-       char *original_moh;
+       char *original_moh;
 
        ast_channel_lock(chan);
        original_moh = ast_strdupa(chan->musicclass);
@@ -2106,7 +2106,7 @@ static void *announce_thread(void *data)
                }
 
                for (res = 1; !conf->announcethread_stop && (current = AST_LIST_REMOVE_HEAD(&local_list, entry)); ao2_ref(current, -1)) {
-                       ast_log(LOG_DEBUG, "About to play %s\n", current->namerecloc);
+                       ast_debug(1, "About to play %s\n", current->namerecloc);
                        if (!ast_fileexists(current->namerecloc, NULL, NULL))
                                continue;
                        if ((current->confchan) && (current->confusers > 1) && !ast_check_hangup(current->confchan)) {
@@ -2251,16 +2251,16 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
        char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
        char *buf = __buf + AST_FRIENDLY_OFFSET;
        char *exitkeys = NULL;
-       unsigned int calldurationlimit = 0;
-       long timelimit = 0;
-       long play_warning = 0;
-       long warning_freq = 0;
-       const char *warning_sound = NULL;
-       const char *end_sound = NULL;
-       char *parse;    
-       long time_left_ms = 0;
-       struct timeval nexteventts = { 0, };
-       int to;
+       unsigned int calldurationlimit = 0;
+       long timelimit = 0;
+       long play_warning = 0;
+       long warning_freq = 0;
+       const char *warning_sound = NULL;
+       const char *end_sound = NULL;
+       char *parse;
+       long time_left_ms = 0;
+       struct timeval nexteventts = { 0, };
+       int to;
        int setusercount = 0;
        int confsilence = 0, totalsilence = 0;
        char *mailbox, *context;
@@ -2283,72 +2283,72 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                (opt_waitmarked_timeout > 0)) {
                timeout = time(NULL) + opt_waitmarked_timeout;
        }
-               
-       if (ast_test_flag64(confflags, CONFFLAG_DURATION_STOP) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_STOP])) {
-               calldurationlimit = atoi(optargs[OPT_ARG_DURATION_STOP]);
-               ast_verb(3, "Setting call duration limit to %d seconds.\n", calldurationlimit);
-       }
-       
-       if (ast_test_flag64(confflags, CONFFLAG_DURATION_LIMIT) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_LIMIT])) {
-               char *limit_str, *warning_str, *warnfreq_str;
+
+       if (ast_test_flag64(confflags, CONFFLAG_DURATION_STOP) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_STOP])) {
+               calldurationlimit = atoi(optargs[OPT_ARG_DURATION_STOP]);
+               ast_verb(3, "Setting call duration limit to %d seconds.\n", calldurationlimit);
+       }
+
+       if (ast_test_flag64(confflags, CONFFLAG_DURATION_LIMIT) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_LIMIT])) {
+               char *limit_str, *warning_str, *warnfreq_str;
                const char *var;
-               parse = optargs[OPT_ARG_DURATION_LIMIT];
-               limit_str = strsep(&parse, ":");
-               warning_str = strsep(&parse, ":");
-               warnfreq_str = parse;
-               timelimit = atol(limit_str);
-               if (warning_str)
-                       play_warning = atol(warning_str);
-               if (warnfreq_str)
-                       warning_freq = atol(warnfreq_str);
-               if (!timelimit) {
-                       timelimit = play_warning = warning_freq = 0;
-                       warning_sound = NULL;
-               } else if (play_warning > timelimit) {                  
-                       if (!warning_freq) {
-                               play_warning = 0;
-                       } else {
-                               while (play_warning > timelimit)
-                                       play_warning -= warning_freq;
-                               if (play_warning < 1)
-                                       play_warning = warning_freq = 0;
-                       }
-               }
-               
+
+               parse = optargs[OPT_ARG_DURATION_LIMIT];
+               limit_str = strsep(&parse, ":");
+               warning_str = strsep(&parse, ":");
+               warnfreq_str = parse;
+
+               timelimit = atol(limit_str);
+               if (warning_str)
+                       play_warning = atol(warning_str);
+               if (warnfreq_str)
+                       warning_freq = atol(warnfreq_str);
+
+               if (!timelimit) {
+                       timelimit = play_warning = warning_freq = 0;
+                       warning_sound = NULL;
+               } else if (play_warning > timelimit) {
+                       if (!warning_freq) {
+                               play_warning = 0;
+                       } else {
+                               while (play_warning > timelimit)
+                                       play_warning -= warning_freq;
+                               if (play_warning < 1)
+                                       play_warning = warning_freq = 0;
+                       }
+               }
+
                ast_channel_lock(chan);
                if ((var = pbx_builtin_getvar_helper(chan, "CONF_LIMIT_WARNING_FILE"))) {
                        var = ast_strdupa(var);
                }
                ast_channel_unlock(chan);
 
-               warning_sound = var ? var : "timeleft";
-               
+               warning_sound = var ? var : "timeleft";
+
                ast_channel_lock(chan);
                if ((var = pbx_builtin_getvar_helper(chan, "CONF_LIMIT_TIMEOUT_FILE"))) {
                        var = ast_strdupa(var);
                }
                ast_channel_unlock(chan);
-               
+
                end_sound = var ? var : NULL;
-                       
-               /* undo effect of S(x) in case they are both used */
-               calldurationlimit = 0;
-               /* more efficient do it like S(x) does since no advanced opts */
-               if (!play_warning && !end_sound && timelimit) { 
-                       calldurationlimit = timelimit / 1000;
-                       timelimit = play_warning = warning_freq = 0;
-               } else {
-                       ast_debug(2, "Limit Data for this call:\n");
+
+               /* undo effect of S(x) in case they are both used */
+               calldurationlimit = 0;
+               /* more efficient do it like S(x) does since no advanced opts */
+               if (!play_warning && !end_sound && timelimit) {
+                       calldurationlimit = timelimit / 1000;
+                       timelimit = play_warning = warning_freq = 0;
+               } else {
+                       ast_debug(2, "Limit Data for this call:\n");
                        ast_debug(2, "- timelimit     = %ld\n", timelimit);
-                       ast_debug(2, "- play_warning  = %ld\n", play_warning);
-                       ast_debug(2, "- warning_freq  = %ld\n", warning_freq);
-                       ast_debug(2, "- warning_sound = %s\n", warning_sound ? warning_sound : "UNDEF");
-                       ast_debug(2, "- end_sound     = %s\n", end_sound ? end_sound : "UNDEF");
-               }
-       }
+                       ast_debug(2, "- play_warning  = %ld\n", play_warning);
+                       ast_debug(2, "- warning_freq  = %ld\n", warning_freq);
+                       ast_debug(2, "- warning_sound = %s\n", warning_sound ? warning_sound : "UNDEF");
+                       ast_debug(2, "- end_sound     = %s\n", end_sound ? end_sound : "UNDEF");
+               }
+       }
 
        /* Get exit keys */
        if (ast_test_flag64(confflags, CONFFLAG_KEYEXIT)) {
@@ -2667,7 +2667,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
        memset(&dahdic, 0, sizeof(dahdic));
        memset(&dahdic_empty, 0, sizeof(dahdic_empty));
        /* Check to see if we're in a conference... */
-       dahdic.chan = 0;        
+       dahdic.chan = 0;
        if (ioctl(fd, DAHDI_GETCONF, &dahdic)) {
                ast_log(LOG_WARNING, "Error getting conference\n");
                close(fd);
@@ -2683,7 +2683,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
        }
        memset(&dahdic, 0, sizeof(dahdic));
        /* Add us to the conference */
-       dahdic.chan = 0;        
+       dahdic.chan = 0;
        dahdic.confno = conf->dahdiconf;
 
        if (!ast_test_flag64(confflags, CONFFLAG_QUIET) && (ast_test_flag64(confflags, CONFFLAG_INTROUSER) ||
@@ -2717,7 +2717,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                dahdic.confmode = DAHDI_CONF_CONFMON | DAHDI_CONF_LISTENER;
        else if (ast_test_flag64(confflags, CONFFLAG_TALKER))
                dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER;
-       else 
+       else
                dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
 
        if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
@@ -3595,7 +3595,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                } else if ((f->frametype == AST_FRAME_DTMF) && ast_test_flag64(confflags, CONFFLAG_KEYEXIT) &&
                                        (strchr(exitkeys, f->subclass.integer))) {
                                        pbx_builtin_setvar_helper(chan, "MEETME_EXIT_KEY", dtmfstr);
-                                               
+
                                        if (ast_test_flag64(confflags, CONFFLAG_PASS_DTMF)) {
                                                conf_queue_dtmf(conf, user, f);
                                        }
@@ -3623,12 +3623,12 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                                goto outrun;
                                                break;
                                        default:
-                                               ast_debug(1, 
+                                               ast_debug(1,
                                                        "Got ignored control frame on channel %s, f->frametype=%d,f->subclass=%d\n",
                                                        chan->name, f->frametype, f->subclass.integer);
                                        }
                                } else {
-                                       ast_debug(1, 
+                                       ast_debug(1,
                                                "Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d\n",
                                                chan->name, f->frametype, f->subclass.integer);
                                }
@@ -4046,7 +4046,7 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno,
        AST_LIST_LOCK(&confs);
        AST_LIST_TRAVERSE(&confs, cnf, list) {
                ast_debug(3, "Does conf %s match %s?\n", confno, cnf->confno);
-               if (!strcmp(confno, cnf->confno)) 
+               if (!strcmp(confno, cnf->confno))
                        break;
        }
        if (cnf) {
@@ -6280,7 +6280,7 @@ static int sla_station_exec(struct ast_channel *chan, const char *data)
        }
 
        snprintf(conf_name, sizeof(conf_name), "SLA_%s", trunk_ref->trunk->name);
-       ast_set_flag64(&conf_flags, 
+       ast_set_flag64(&conf_flags,
                CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_PASS_DTMF | CONFFLAG_SLA_STATION);
        ast_answer(chan);
        conf = build_conf(conf_name, "", "", 0, 0, 1, chan, NULL);
index 765f731..8899793 100644 (file)
@@ -1646,7 +1646,7 @@ static const char* dtmf_tones[] = {
                                ast_playtones_start(myrpt->txchannel, 0, dtmf_tones[15], 0);
                        else {
                                /* not handled */
-                               ast_log(LOG_DEBUG, "Unable to generate DTMF tone '%c' for '%s'\n", digit, myrpt->txchannel->name);
+                               ast_debug(1, "Unable to generate DTMF tone '%c' for '%s'\n", digit, myrpt->txchannel->name);
                        }
                        rpt_mutex_lock(&myrpt->lock);
                }
@@ -12525,7 +12525,7 @@ struct ast_format_cap *cap = NULL;
                                                        f->data.ptr,f->datalen / 2);
                                                if (n1 != l->wasvox)
                                                {
-                                                       if (debug)ast_log(LOG_DEBUG,"Link Node %s, vox %d\n",l->name,n1);
+                                                       ast_debug(1,"Link Node %s, vox %d\n",l->name,n1);
                                                        l->wasvox = n1;
                                                        l->voxtostate = 0;
                                                        if (n1) l->voxtotimer = myrpt->p.voxtimeout_ms;
@@ -12874,7 +12874,7 @@ struct ast_format_cap *cap = NULL;
                                n = dovox(&myrpt->vox,f->data.ptr,f->datalen / 2);
                                if (n != myrpt->wasvox)
                                {
-                                       if (debug) ast_log(LOG_DEBUG,"Node %s, vox %d\n",myrpt->name,n);
+                                       ast_debug(1,"Node %s, vox %d\n",myrpt->name,n);
                                        myrpt->wasvox = n;
                                        myrpt->voxtostate = 0;
                                        if (n) myrpt->voxtotimer = myrpt->p.voxtimeout_ms;
index f7882c2..7223d3d 100644 (file)
@@ -1212,7 +1212,7 @@ static int check_password(struct ast_vm_user *vmu, char *password)
        if (!ast_strlen_zero(ext_pass_check_cmd)) {
                char cmd[255], buf[255];
 
-               ast_log(AST_LOG_DEBUG, "Verify password policies for %s\n", password);
+               ast_debug(1, "Verify password policies for %s\n", password);
 
                snprintf(cmd, sizeof(cmd), "%s %s %s %s %s", ext_pass_check_cmd, vmu->mailbox, vmu->context, vmu->password, password);
                if (vm_check_password_shell(cmd, buf, sizeof(buf))) {
@@ -1754,8 +1754,7 @@ static void vm_imap_delete(char *file, int msgnum, struct ast_vm_user *vmu)
                ast_log(LOG_WARNING, "msgnum %d, mailbox message %lu is zero.\n", msgnum, messageNum);
                return;
        }
-       if (option_debug > 2)
-               ast_log(LOG_DEBUG, "deleting msgnum %d, which is mailbox message %lu\n", msgnum, messageNum);
+       ast_debug(3, "deleting msgnum %d, which is mailbox message %lu\n", msgnum, messageNum);
        /* delete message */
        snprintf (arg, sizeof(arg), "%lu", messageNum);
        ast_mutex_lock(&vms->lock);
@@ -1782,7 +1781,7 @@ static int imap_retrieve_greeting(const char *dir, const int msgnum, struct ast_
                if (file)
                        *file++ = '\0';
                else {
-                       ast_debug (1, "Failed to procure file name from directory passed.\n");
+                       ast_debug(1, "Failed to procure file name from directory passed.\n");
                        return -1;
                }
        }
@@ -1878,7 +1877,7 @@ static int imap_retrieve_file(const char *dir, const int msgnum, const char *mai
                res = -1;
                goto exit;
        }
-       
+
        make_file(vms->fn, sizeof(vms->fn), dir, msgnum);
        snprintf(vms->introfn, sizeof(vms->introfn), "%sintro", vms->fn);
 
@@ -1888,8 +1887,7 @@ static int imap_retrieve_file(const char *dir, const int msgnum, const char *mai
                goto exit;
        }
 
-       if (option_debug > 2)
-               ast_log(LOG_DEBUG, "Before mail_fetchheaders, curmsg is: %d, imap messages is %lu\n", msgnum, vms->msgArray[msgnum]);
+       ast_debug(3, "Before mail_fetchheaders, curmsg is: %d, imap messages is %lu\n", msgnum, vms->msgArray[msgnum]);
        if (vms->msgArray[msgnum] == 0) {
                ast_log(LOG_WARNING, "Trying to access unknown message\n");
                res = -1;
@@ -2029,7 +2027,7 @@ static int __messagecount(const char *context, const char *mailbox, const char *
                        return -1;
                }
        }
-       
+
        /* No IMAP account available */
        if (vmu->imapuser[0] == '\0') {
                ast_log(AST_LOG_WARNING, "IMAP user not set for mailbox %s\n", vmu->mailbox);
@@ -2126,7 +2124,7 @@ static int imap_check_limits(struct ast_channel *chan, struct vm_state *vms, str
                ast_play_and_wait(chan, "vm-mailboxfull");
                return -1;
        }
-       
+
        /* Check if we have exceeded maxmsg */
        ast_debug(3, "Checking message number quota: mailbox has %d messages, maximum is set to %d, current messages %d\n", msgnum, vmu->maxmsg, inprocess_count(vmu->mailbox, vmu->context, 0));
        if (msgnum >= vmu->maxmsg - inprocess_count(vmu->mailbox, vmu->context, +1)) {
@@ -2178,7 +2176,7 @@ static int imap_store_file(const char *dir, const char *mailboxuser, const char
     if (msgnum < 0 && !imapgreetings) {
         return 0;
     }
-       
+
        if (imap_check_limits(chan, vms, vmu, msgcount)) {
                return -1;
        }
@@ -2188,7 +2186,7 @@ static int imap_store_file(const char *dir, const char *mailboxuser, const char
                ast_debug(3, "Setting message flag \\\\FLAGGED.\n");
                imap_flags = "\\FLAGGED";
        }
-       
+
        /* Attach only the first format */
        fmt = ast_strdupa(fmt);
        stringp = fmt;
@@ -2206,7 +2204,7 @@ static int imap_store_file(const char *dir, const char *mailboxuser, const char
        if (ast_fileexists(introfn, NULL, NULL) <= 0) {
                *introfn = '\0';
        }
-       
+
        if (ast_strlen_zero(vmu->email)) {
                /* We need the vmu->email to be set when we call make_email_file, but
                 * if we keep it set, a duplicate e-mail will be created. So at the end
@@ -2278,7 +2276,7 @@ static int imap_store_file(const char *dir, const char *mailboxuser, const char
                return -1;
        }
        ast_debug(3, "%s stored\n", fn);
-       
+
        if (tempcopy)
                *(vmu->email) = '\0';
        inprocess_count(vmu->mailbox, vmu->context, -1);
@@ -2317,7 +2315,7 @@ static int inboxcount2(const char *mailbox_context, int *urgentmsgs, int *newmsg
        /* If no mailbox, return immediately */
        if (ast_strlen_zero(mailbox_context))
                return 0;
-       
+
        ast_copy_string(tmp, mailbox_context, sizeof(tmp));
        context = strchr(tmp, '@');
        if (strchr(mailbox_context, ',')) {
@@ -2499,16 +2497,14 @@ static int init_mailstream(struct vm_state *vms, int box)
        MAILSTREAM *stream = NIL;
        long debug;
        char tmp[256];
-       
+
        if (!vms) {
                ast_log(LOG_ERROR, "vm_state is NULL!\n");
                return -1;
        }
-       if (option_debug > 2)
-               ast_log(LOG_DEBUG, "vm_state user is:%s\n", vms->imapuser);
+       ast_debug(3, "vm_state user is:%s\n", vms->imapuser);
        if (vms->mailstream == NIL || !vms->mailstream) {
-               if (option_debug)
-                       ast_log(LOG_DEBUG, "mailstream not set.\n");
+               ast_debug(1, "mailstream not set.\n");
        } else {
                stream = vms->mailstream;
        }
@@ -2541,8 +2537,7 @@ static int init_mailstream(struct vm_state *vms, int box)
        }
        /* Now connect to the target folder */
        imap_mailbox_name(tmp, sizeof(tmp), vms, box, 1);
-       if (option_debug > 2)
-               ast_log(LOG_DEBUG, "Before mail_open, server: %s, box:%d\n", tmp, box);
+       ast_debug(3, "Before mail_open, server: %s, box:%d\n", tmp, box);
        ast_mutex_lock(&vms->lock);
        vms->mailstream = mail_open (stream, tmp, debug ? OP_DEBUG : NIL);
        ast_mutex_unlock(&vms->lock);
@@ -2574,9 +2569,9 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box)
                ast_log(AST_LOG_ERROR, "Could not initialize mailstream\n");
                return -1;
        }
-       
+
        create_dirpath(vms->curdir, sizeof(vms->curdir), vmu->context, vms->username, vms->curbox);
-       
+
        /* Check Quota */
        if  (box == 0)  {
                ast_debug(3, "Mailbox name set to: %s, about to check quotas\n", mbox(vmu, box));
@@ -2853,13 +2848,13 @@ static void mm_parsequota(MAILSTREAM *stream, unsigned char *msg, QUOTALIST *pqu
        char *mailbox = stream->mailbox, *user;
        char buf[1024] = "";
        unsigned long usage = 0, limit = 0;
-       
+
        while (pquota) {
                usage = pquota->usage;
                limit = pquota->limit;
                pquota = pquota->next;
        }
-       
+
        if (!(user = get_user_by_mailbox(mailbox, buf, sizeof(buf))) || (!(vms = get_vm_state_by_imapuser(user, 2)) && !(vms = get_vm_state_by_imapuser(user, 0)))) {
                ast_log(AST_LOG_ERROR, "No state found.\n");
                return;
@@ -2927,8 +2922,7 @@ static struct vm_state *create_vm_state_from_user(struct ast_vm_user *vmu)
        if ((vms_p = pthread_getspecific(ts_vmstate.key)) && !strcmp(vms_p->imapuser, vmu->imapuser) && !strcmp(vms_p->username, vmu->mailbox)) {
                return vms_p;
        }
-       if (option_debug > 4)
-               ast_log(AST_LOG_DEBUG, "Adding new vmstate for %s\n", vmu->imapuser);
+       ast_debug(5, "Adding new vmstate for %s\n", vmu->imapuser);
        if (!(vms_p = ast_calloc(1, sizeof(*vms_p))))
                return NULL;
        ast_copy_string(vms_p->imapuser, vmu->imapuser, sizeof(vms_p->imapuser));
@@ -2937,8 +2931,7 @@ static struct vm_state *create_vm_state_from_user(struct ast_vm_user *vmu)
        ast_copy_string(vms_p->context, vmu->context, sizeof(vms_p->context));
        vms_p->mailstream = NIL; /* save for access from interactive entry point */
        vms_p->imapversion = vmu->imapversion;
-       if (option_debug > 4)
-               ast_log(AST_LOG_DEBUG, "Copied %s to %s\n", vmu->imapuser, vms_p->imapuser);
+       ast_debug(5, "Copied %s to %s\n", vmu->imapuser, vms_p->imapuser);
        vms_p->updated = 1;
        /* set mailbox to INBOX! */
        ast_copy_string(vms_p->curbox, mbox(vmu, 0), sizeof(vms_p->curbox));
@@ -3012,7 +3005,7 @@ static struct vm_state *get_vm_state_by_mailbox(const char *mailbox, const char
                }
 
                ast_debug(3, "comparing mailbox %s@%s (i=%d) to vmstate mailbox %s@%s (i=%d)\n", mailbox, local_context, interactive, vlist->vms->username, vlist->vms->context, vlist->vms->interactive);
-               
+
                if (!strcmp(vlist->vms->username, mailbox) && !strcmp(vlist->vms->context, local_context) && vlist->vms->interactive == interactive) {
                        ast_debug(3, "Found it!\n");
                        AST_LIST_UNLOCK(&vmstates);
@@ -3026,7 +3019,7 @@ static struct vm_state *get_vm_state_by_mailbox(const char *mailbox, const char
        return NULL;
 }
 
-static void vmstate_insert(struct vm_state *vms) 
+static void vmstate_insert(struct vm_state *vms)
 {
        struct vmstate *v;
        struct vm_state *altvms;
@@ -3036,7 +3029,7 @@ static void vmstate_insert(struct vm_state *vms)
           We can compare the username to find the duplicate */
        if (vms->interactive == 1) {
                altvms = get_vm_state_by_mailbox(vms->username, vms->context, 0);
-               if (altvms) {   
+               if (altvms) {
                        ast_debug(3, "Duplicate mailbox %s, copying message info...\n", vms->username);
                        vms->newmessages = altvms->newmessages;
                        vms->oldmessages = altvms->oldmessages;
@@ -3057,7 +3050,7 @@ static void vmstate_insert(struct vm_state *vms)
 
        if (!(v = ast_calloc(1, sizeof(*v))))
                return;
-       
+
        v->vms = vms;
 
        ast_debug(3, "Inserting vm_state for user:%s, mailbox %s\n", vms->imapuser, vms->username);
@@ -3067,7 +3060,7 @@ static void vmstate_insert(struct vm_state *vms)
        AST_LIST_UNLOCK(&vmstates);
 }
 
-static void vmstate_delete(struct vm_state *vms) 
+static void vmstate_delete(struct vm_state *vms)
 {
        struct vmstate *vc = NULL;
        struct vm_state *altvms = NULL;
@@ -3084,9 +3077,9 @@ static void vmstate_delete(struct vm_state *vms)
                /* Interactive states are not stored within the persistent list */
                return;
        }
-       
+
        ast_debug(3, "Removing vm_state for user:%s, mailbox %s\n", vms->imapuser, vms->username);
-       
+
        AST_LIST_LOCK(&vmstates);
        AST_LIST_TRAVERSE_SAFE_BEGIN(&vmstates, vc, list) {
                if (vc->vms == vms) {
@@ -3105,7 +3098,7 @@ static void vmstate_delete(struct vm_state *vms)
                ast_log(AST_LOG_ERROR, "No vmstate found for user:%s, mailbox %s\n", vms->imapuser, vms->username);
 }
 
-static void set_update(MAILSTREAM * stream) 
+static void set_update(MAILSTREAM * stream)
 {
        struct vm_state *vms;
        char *mailbox = stream->mailbox, *user;
@@ -3122,7 +3115,7 @@ static void set_update(MAILSTREAM * stream)
        vms->updated = 1; /* Set updated flag since mailbox changed */
 }
 
-static void init_vm_state(struct vm_state *vms) 
+static void init_vm_state(struct vm_state *vms)
 {
        int x;
        vms->vmArrayIndex = 0;
@@ -3132,7 +3125,7 @@ static void init_vm_state(struct vm_state *vms)
        ast_mutex_init(&vms->lock);
 }
 
-static int save_body(BODY *body, struct vm_state *vms, char *section, char *format, int is_intro) 
+static int save_body(BODY *body, struct vm_state *vms, char *section, char *format, int is_intro)
 {
        char *body_content;
        char *body_decoded;
@@ -3140,7 +3133,7 @@ static int save_body(BODY *body, struct vm_state *vms, char *section, char *form
        unsigned long len;
        unsigned long newlen;
        char filename[256];
-       
+
        if (!body || body == NIL)
                return -1;
 
@@ -3149,9 +3142,9 @@ static int save_body(BODY *body, struct vm_state *vms, char *section, char *form
        ast_mutex_unlock(&vms->lock);
        if (body_content != NIL) {
                snprintf(filename, sizeof(filename), "%s.%s", fn, format);
-               /* ast_debug(1,body_content); */
+               /* ast_debug(1, body_content); */
                body_decoded = rfc822_base64((unsigned char *) body_content, len, &newlen);
-               /* If the body of the file is empty, return an error */
+               /* If the body of the file is empty, return an error */
                if (!newlen) {
                        return -1;
                }
@@ -4256,9 +4249,7 @@ static void prep_email_sub_vars(struct ast_channel *ast, struct ast_vm_user *vmu
                strcat(fromfile, ".txt");
        }
        if (!(msg_cfg = ast_config_load(fromfile, config_flags))) {
-               if (option_debug > 0) {
-                       ast_log(LOG_DEBUG, "Config load for message text file '%s' failed\n", fromfile);
-               }
+               ast_debug(1, "Config load for message text file '%s' failed\n", fromfile);
                return;
        }
 
@@ -4930,7 +4921,7 @@ static int get_date(char *s, int len)
 {
        struct ast_tm tm;
        struct timeval t = ast_tvnow();
-       
+
        ast_localtime(&t, &tm, "UTC");
 
        return ast_strftime(s, len, "%a %b %e %r UTC %Y", &tm);
@@ -5669,8 +5660,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
        }
        /* If maxmsg is zero, act as a "greetings only" voicemail: Exit successfully without recording */
        if (vmu->maxmsg == 0) {
-               if (option_debug > 2)
-                       ast_log(LOG_DEBUG, "Greetings only VM (maxmsg=0), Skipping voicemail recording\n");
+               ast_debug(3, "Greetings only VM (maxmsg=0), Skipping voicemail recording\n");
                pbx_builtin_setvar_helper(chan, "VMSTATUS", "SUCCESS");
                goto leave_vm_out;
        }
@@ -5762,7 +5752,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
                        }
                }
                vms->newmessages++;
-               
+
                /* here is a big difference! We add one to it later */
                msgnum = newmsgs + oldmsgs;
                ast_debug(3, "Messagecount set to %d\n", msgnum);
@@ -6077,7 +6067,7 @@ static int save_to_folder(struct ast_vm_user *vmu, struct vm_state *vms, int msg
 
        /* get the real IMAP message number for this message */
        snprintf(sequence, sizeof(sequence), "%ld", vms->msgArray[msg]);
-       
+
        ast_debug(3, "Copying sequence %s to mailbox %s\n", sequence, mbox(vmu, box));
        ast_mutex_lock(&vms->lock);
        /* if save to Old folder, put in INBOX as read */
@@ -6095,7 +6085,7 @@ static int save_to_folder(struct ast_vm_user *vmu, struct vm_state *vms, int msg
        /* Create the folder if it don't exist */
        imap_mailbox_name(mailbox, sizeof(mailbox), vms, box, 1); /* Get the full mailbox name */
        ast_debug(5, "Checking if folder exists: %s\n", mailbox);
-       if (mail_create(vms->mailstream, mailbox) == NIL) 
+       if (mail_create(vms->mailstream, mailbox) == NIL)
                ast_debug(5, "Folder exists.\n");
        else
                ast_log(AST_LOG_NOTICE, "Folder %s created!\n", mbox(vmu, box));
@@ -7407,7 +7397,6 @@ static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms,
        int i;
        char *callerid, *name;
        char prefile[PATH_MAX] = "";
-       
 
        /* If voicemail cid is not enabled, or we didn't get cid or context from
         * the attribute file, leave now.
@@ -9092,7 +9081,7 @@ static int vm_newuser(struct ast_channel *chan, struct ast_vm_user *vmu, struct
        ast_debug(1, "User %s set password to %s of length %d\n", vms->username, newpassword, (int) strlen(newpassword));
        cmd = ast_play_and_wait(chan, vm_passchanged);
 
-       /* If forcename is set, have the user record their name */      
+       /* If forcename is set, have the user record their name */
        if (ast_test_flag(vmu, VM_FORCENAME)) {
                snprintf(prefile, sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, vmu->context, vms->username);
                if (ast_fileexists(prefile, NULL, NULL) < 1) {
@@ -9214,10 +9203,10 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct
                                vms->username, newpassword, (int) strlen(newpassword));
                        cmd = ast_play_and_wait(chan, vm_passchanged);
                        break;
-               case '*': 
+               case '*':
                        cmd = 't';
                        break;
-               default: 
+               default:
                        cmd = 0;
                        snprintf(prefile, sizeof(prefile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vms->username);
                        RETRIEVE(prefile, -1, vmu->mailbox, vmu->context);
@@ -9845,7 +9834,7 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
                cmd = ast_play_and_wait(chan, "an-error-has-occured");
                return -1;
        }
-       
+
        /* Set language from config to override channel language */
        if (!ast_strlen_zero(vmu->language))
                ast_string_field_set(chan, language, vmu->language);
@@ -10209,7 +10198,7 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
                        deleted = 1;
 #endif
                        break;
-       
+
                case '8': /* Forward the current messgae */
                        if (vms.lastmsg > -1) {
                                cmd = forward_message(chan, context, &vms, vmu, vmfmts, 0, record_gain, in_urgent);
@@ -10382,7 +10371,7 @@ out:
 #ifdef HAVE_IMAP_TK2006
                if (LEVELUIDPLUS (vms.mailstream)) {
                        mail_expunge_full(vms.mailstream, NIL, EX_UID);
-               } else 
+               } else
 #endif
                        mail_expunge(vms.mailstream);
                ast_mutex_unlock(&vms.lock);
@@ -11682,11 +11671,11 @@ static int load_config(int reload)
                        ast_copy_string(ext_pass_cmd, val, sizeof(ext_pass_cmd));
                        pwdchange = PWDCHANGE_EXTERNAL | PWDCHANGE_INTERNAL;
                }
+
                /* External password validation command */
                if ((val = ast_variable_retrieve(cfg, "general", "externpasscheck"))) {
                        ast_copy_string(ext_pass_check_cmd, val, sizeof(ext_pass_check_cmd));
-                       ast_log(AST_LOG_DEBUG, "found externpasscheck: %s\n", ext_pass_check_cmd);
+                       ast_debug(1, "found externpasscheck: %s\n", ext_pass_check_cmd);
                }
 
 #ifdef IMAP_STORAGE
@@ -11796,18 +11785,18 @@ static int load_config(int reload)
                        }
                        if (!smdi_iface) {
                                ast_log(AST_LOG_ERROR, "No valid SMDI interface specfied, disabling SMDI voicemail notification\n");
-                       } 
+                       }
                }
 
                /* Silence treshold */
                silencethreshold = ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE);
                if ((val = ast_variable_retrieve(cfg, "general", "silencethreshold")))
                        silencethreshold = atoi(val);
-               
-               if (!(val = ast_variable_retrieve(cfg, "general", "serveremail"))) 
+
+               if (!(val = ast_variable_retrieve(cfg, "general", "serveremail")))
                        val = ASTERISK_USERNAME;
                ast_copy_string(serveremail, val, sizeof(serveremail));
-               
+
                vmmaxsecs = 0;
                if ((val = ast_variable_retrieve(cfg, "general", "maxsecs"))) {
                        if (sscanf(val, "%30d", &x) == 1) {
@@ -11903,12 +11892,12 @@ static int load_config(int reload)
                }
 
                /* Force new user to record name ? */
-               if (!(val = ast_variable_retrieve(cfg, "general", "forcename"))) 
+               if (!(val = ast_variable_retrieve(cfg, "general", "forcename")))
                        val = "no";
                ast_set2_flag((&globalflags), ast_true(val), VM_FORCENAME);
 
                /* Force new user to record greetings ? */
-               if (!(val = ast_variable_retrieve(cfg, "general", "forcegreetings"))) 
+               if (!(val = ast_variable_retrieve(cfg, "general", "forcegreetings")))
                        val = "no";
                ast_set2_flag((&globalflags), ast_true(val), VM_FORCEGREET);
 
@@ -11931,7 +11920,7 @@ static int load_config(int reload)
                        ast_debug(1, "VM Review Option disabled globally\n");
                        val = "no";
                }
-               ast_set2_flag((&globalflags), ast_true(val), VM_REVIEW);        
+               ast_set2_flag((&globalflags), ast_true(val), VM_REVIEW);
 
                /* Temporary greeting reminder */
                if (!(val = ast_variable_retrieve(cfg, "general", "tempgreetwarn"))) {
@@ -11945,49 +11934,49 @@ static int load_config(int reload)
                        ast_debug(1, "VM next message wrap disabled globally\n");
                        val = "no";
                }
-               ast_set2_flag((&globalflags), ast_true(val), VM_MESSAGEWRAP);   
+               ast_set2_flag((&globalflags), ast_true(val), VM_MESSAGEWRAP);
 
                if (!(val = ast_variable_retrieve(cfg, "general", "operator"))){
                        ast_debug(1, "VM Operator break disabled globally\n");
                        val = "no";
                }
-               ast_set2_flag((&globalflags), ast_true(val), VM_OPERATOR);      
+               ast_set2_flag((&globalflags), ast_true(val), VM_OPERATOR);
 
                if (!(val = ast_variable_retrieve(cfg, "general", "saycid"))) {
                        ast_debug(1, "VM CID Info before msg disabled globally\n");
                        val = "no";
-               } 
-               ast_set2_flag((&globalflags), ast_true(val), VM_SAYCID);        
+               }
+               ast_set2_flag((&globalflags), ast_true(val), VM_SAYCID);
 
                if (!(val = ast_variable_retrieve(cfg, "general", "sendvoicemail"))){
                        ast_debug(1, "Send Voicemail msg disabled globally\n");
                        val = "no";
                }
                ast_set2_flag((&globalflags), ast_true(val), VM_SVMAIL);
-       
+
                if (!(val = ast_variable_retrieve(cfg, "general", "envelope"))) {
                        ast_debug(1, "ENVELOPE before msg enabled globally\n");
                        val = "yes";
                }
-               ast_set2_flag((&globalflags), ast_true(val), VM_ENVELOPE);      
+               ast_set2_flag((&globalflags), ast_true(val), VM_ENVELOPE);
 
                if (!(val = ast_variable_retrieve(cfg, "general", "moveheard"))) {
                        ast_debug(1, "Move Heard enabled globally\n");
                        val = "yes";
                }
-               ast_set2_flag((&globalflags), ast_true(val), VM_MOVEHEARD);     
+               ast_set2_flag((&globalflags), ast_true(val), VM_MOVEHEARD);
 
                if (!(val = ast_variable_retrieve(cfg, "general", "forward_urgent_auto"))) {
                        ast_debug(1, "Autoset of Urgent flag on forwarded Urgent messages disabled globally\n");
                        val = "no";
                }
-               ast_set2_flag((&globalflags), ast_true(val), VM_FWDURGAUTO);    
+               ast_set2_flag((&globalflags), ast_true(val), VM_FWDURGAUTO);
 
                if (!(val = ast_variable_retrieve(cfg, "general", "sayduration"))) {
                        ast_debug(1, "Duration info before msg enabled globally\n");
                        val = "yes";
                }
-               ast_set2_flag((&globalflags), ast_true(val), VM_SAYDURATION);   
+               ast_set2_flag((&globalflags), ast_true(val), VM_SAYDURATION);
 
                saydurationminfo = 2;
                if ((val = ast_variable_retrieve(cfg, "general", "saydurationm"))) {
@@ -12008,9 +11997,9 @@ static int load_config(int reload)
                        ast_copy_string(dialcontext, val, sizeof(dialcontext));
                        ast_debug(1, "found dialout context: %s\n", dialcontext);
                } else {
-                       dialcontext[0] = '\0';  
+                       dialcontext[0] = '\0';
                }
-               
+
                if ((val = ast_variable_retrieve(cfg, "general", "callback"))) {
                        ast_copy_string(callcontext, val, sizeof(callcontext));
                        ast_debug(1, "found callback context: %s\n", callcontext);
@@ -12024,7 +12013,7 @@ static int load_config(int reload)
                } else {
                        exitcontext[0] = '\0';
                }
-               
+
                /* load password sounds configuration */
                if ((val = ast_variable_retrieve(cfg, "general", "vm-password")))
                        ast_copy_string(vm_password, val, sizeof(vm_password));
index 0e20571..6ffd9fe 100644 (file)
@@ -186,9 +186,7 @@ static void radius_log(const struct ast_event *event, void *userdata)
        }
 
        if (build_radius_record(&send, &record)) {
-               if (option_debug) {
-                       ast_log(LOG_DEBUG, "Unable to create RADIUS record. CEL not recorded!\n");
-               }
+               ast_debug(1, "Unable to create RADIUS record. CEL not recorded!\n");
                goto return_cleanup;
        }
 
index b5f398f..6ebe7ff 100644 (file)
@@ -1734,7 +1734,7 @@ static int my_get_callerid(void *pvt, char *namebuf, char *numbuf, enum analog_e
                        if (num)
                                ast_copy_string(numbuf, num, ANALOG_MAX_CID);
 
-                       ast_log(LOG_DEBUG, "CallerID number: %s, name: %s, flags=%d\n", num, name, flags);
+                       ast_debug(1, "CallerID number: %s, name: %s, flags=%d\n", num, name, flags);
                        return 0;
                }
        }
@@ -2236,7 +2236,7 @@ static void my_set_waitingfordt(void *pvt, struct ast_channel *ast)
        struct dahdi_pvt *p = pvt;
 
        if (p->waitfordialtone && CANPROGRESSDETECT(p) && p->dsp) {
-               ast_log(LOG_DEBUG, "Defer dialing for %dms or dialtone\n", p->waitfordialtone);
+               ast_debug(1, "Defer dialing for %dms or dialtone\n", p->waitfordialtone);
                gettimeofday(&p->waitingfordt, NULL);
                ast_setstate(ast, AST_STATE_OFFHOOK);
        }
@@ -2899,7 +2899,7 @@ static int my_dial_digits(void *pvt, enum analog_sub sub, struct analog_dialoper
        res = ioctl(p->subs[index].dfd, DAHDI_DIAL, &ddop);
 
        if (res == -1)
-               ast_log(LOG_DEBUG, "DAHDI_DIAL ioctl failed on %s: %s\n", p->owner->name, strerror(errno));
+               ast_debug(1, "DAHDI_DIAL ioctl failed on %s: %s\n", p->owner->name, strerror(errno));
 
        return res;
 }
@@ -2924,7 +2924,7 @@ static int my_is_dialing(void *pvt, enum analog_sub sub)
        index = analogsub_to_dahdisub(sub);
 
        if (ioctl(p->subs[index].dfd, DAHDI_DIALING, &x)) {
-               ast_log(LOG_DEBUG, "DAHDI_DIALING ioctl failed!\n");
+               ast_debug(1, "DAHDI_DIALING ioctl failed!\n");
                return -1;
        }
 
@@ -3829,13 +3829,13 @@ static void dahdi_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, con
        p->mfcr2_recvd_category = category;
        /* if we're not supposed to use CID, clear whatever we have */
        if (!p->use_callerid) {
-               ast_log(LOG_DEBUG, "No CID allowed in configuration, CID is being cleared!\n");
+               ast_debug(1, "No CID allowed in configuration, CID is being cleared!\n");
                p->cid_num[0] = 0;
                p->cid_name[0] = 0;
        }
        /* if we're supposed to answer immediately, clear DNIS and set 's' exten */
        if (p->immediate || !openr2_context_get_max_dnis(openr2_chan_get_context(r2chan))) {
-               ast_log(LOG_DEBUG, "Setting exten => s because of immediate or 0 DNIS configured\n");
+               ast_debug(1, "Setting exten => s because of immediate or 0 DNIS configured\n");
                p->exten[0] = 's';
                p->exten[1] = 0;
        }
@@ -3858,10 +3858,10 @@ static void dahdi_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, con
                ast_log(LOG_WARNING, "Unable to create PBX channel in DAHDI channel %d\n", p->channel);
                dahdi_r2_disconnect_call(p, OR2_CAUSE_OUT_OF_ORDER);
        } else if (p->mfcr2_charge_calls) {
-               ast_log(LOG_DEBUG, "Accepting MFC/R2 call with charge on chan %d\n", p->channel);
+               ast_debug(1, "Accepting MFC/R2 call with charge on chan %d\n", p->channel);
                openr2_chan_accept_call(r2chan, OR2_CALL_WITH_CHARGE);
        } else {
-               ast_log(LOG_DEBUG, "Accepting MFC/R2 call with no charge on chan %d\n", p->channel);
+               ast_debug(1, "Accepting MFC/R2 call with no charge on chan %d\n", p->channel);
                openr2_chan_accept_call(r2chan, OR2_CALL_NO_CHARGE);
        }
 }
@@ -3893,7 +3893,7 @@ static void dahdi_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t
                if (!p->mfcr2_accept_on_offer) {
                        openr2_chan_disable_read(r2chan);
                        if (p->mfcr2_answer_pending) {
-                               ast_log(LOG_DEBUG, "Answering MFC/R2 call after accepting it on chan %d\n", openr2_chan_get_number(r2chan));
+                               ast_debug(1, "Answering MFC/R2 call after accepting it on chan %d\n", openr2_chan_get_number(r2chan));
                                dahdi_r2_answer(p);
                        }
                        return;
@@ -3927,7 +3927,7 @@ static void dahdi_r2_on_call_answered(openr2_chan_t *r2chan)
 
 static void dahdi_r2_on_call_read(openr2_chan_t *r2chan, const unsigned char *buf, int buflen)
 {
-       /*ast_log(LOG_DEBUG, "Read data from dahdi channel %d\n", openr2_chan_get_number(r2chan));*/
+       /*ast_debug(1, "Read data from dahdi channel %d\n", openr2_chan_get_number(r2chan));*/
 }
 
 static int dahdi_r2_cause_to_ast_cause(openr2_call_disconnect_cause_t cause)
@@ -4010,11 +4010,11 @@ static void dahdi_r2_write_log(openr2_log_level_t level, char *logmessage)
        case OR2_LOG_CAS_TRACE:
        case OR2_LOG_DEBUG:
        case OR2_LOG_EX_DEBUG:
-               ast_log(LOG_DEBUG, "%s", logmessage);
+               ast_debug(1, "%s", logmessage);
                break;
        default:
                ast_log(LOG_WARNING, "We should handle logging level %d here.\n", level);
-               ast_log(LOG_DEBUG, "%s", logmessage);
+               ast_debug(1, "%s", logmessage);
                break;
        }
 }
@@ -5819,23 +5819,23 @@ static int dahdi_send_callrerouting_facility_exec(struct ast_channel *chan, cons
        );
 
        if (ast_strlen_zero(data)) {
-               ast_log(LOG_DEBUG, "No data sent to application!\n");
+               ast_debug(1, "No data sent to application!\n");
                return -1;
        }
        if (chan->tech != &dahdi_tech) {
-               ast_log(LOG_DEBUG, "Only DAHDI technology accepted!\n");
+               ast_debug(1, "Only DAHDI technology accepted!\n");
                return -1;
        }
        pvt = (struct dahdi_pvt *) chan->tech_pvt;
        if (!pvt) {
-               ast_log(LOG_DEBUG, "Unable to find technology private\n");
+               ast_debug(1, "Unable to find technology private\n");
                return -1;
        }
        switch (pvt->sig) {
        case SIG_PRI_LIB_HANDLE_CASES:
                break;
        default:
-               ast_log(LOG_DEBUG, "callrerouting attempted on non-ISDN channel %s\n",
+               ast_debug(1, "callrerouting attempted on non-ISDN channel %s\n",
                        chan->name);
                return -1;
        }
@@ -5882,18 +5882,18 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data)
        );
 
        if (ast_strlen_zero(data)) {
-               ast_log(LOG_DEBUG, "No data sent to application!\n");
+               ast_debug(1, "No data sent to application!\n");
                return -1;
        }
 
        if (chan->tech != &dahdi_tech) {
-               ast_log(LOG_DEBUG, "Only DAHDI technology accepted!\n");
+               ast_debug(1, "Only DAHDI technology accepted!\n");
                return -1;
        }
 
        p = (struct dahdi_pvt *)chan->tech_pvt;
        if (!p) {
-               ast_log(LOG_DEBUG, "Unable to find technology private!\n");
+               ast_debug(1, "Unable to find technology private!\n");
                return -1;
        }
 
@@ -5908,13 +5908,13 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data)
        ast_mutex_lock(&p->lock);
        if (!p->mfcr2 || !p->mfcr2call) {
                ast_mutex_unlock(&p->lock);
-               ast_log(LOG_DEBUG, "Channel %s does not seems to be an R2 active channel!\n", chan->name);
+               ast_debug(1, "Channel %s does not seems to be an R2 active channel!\n", chan->name);
                return -1;
        }
 
        if (p->mfcr2_call_accepted) {
                ast_mutex_unlock(&p->lock);
-               ast_log(LOG_DEBUG, "MFC/R2 call already accepted on channel %s!\n", chan->name);
+               ast_debug(1, "MFC/R2 call already accepted on channel %s!\n", chan->name);
                return 0;
        }
        accept_mode = ast_true(args.charge) ? OR2_CALL_WITH_CHARGE : OR2_CALL_NO_CHARGE;
@@ -5936,7 +5936,7 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data)
                }
                res = ast_waitfor(chan, timeout);
                if (res < 0) {
-                       ast_log(LOG_DEBUG, "ast_waitfor failed on channel %s, going out ...\n", chan->name);
+                       ast_debug(1, "ast_waitfor failed on channel %s, going out ...\n", chan->name);
                        res = -1;
                        break;
                }
@@ -5945,12 +5945,12 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data)
                }
                f = ast_read(chan);
                if (!f) {
-                       ast_log(LOG_DEBUG, "No frame read on channel %s, going out ...\n", chan->name);
+                       ast_debug(1, "No frame read on channel %s, going out ...\n", chan->name);
                        res = -1;
                        break;
                }
                if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_HANGUP) {
-                       ast_log(LOG_DEBUG, "Got HANGUP frame on channel %s, going out ...\n", chan->name);
+                       ast_debug(1, "Got HANGUP frame on channel %s, going out ...\n", chan->name);
                        ast_frfree(f);
                        res = -1;
                        break;
@@ -5959,7 +5959,7 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data)
                ast_mutex_lock(&p->lock);
                if (p->mfcr2_call_accepted) {
                        ast_mutex_unlock(&p->lock);
-                       ast_log(LOG_DEBUG, "Accepted MFC/R2 call!\n");
+                       ast_debug(1, "Accepted MFC/R2 call!\n");
                        break;
                }
                ast_mutex_unlock(&p->lock);
@@ -6003,7 +6003,7 @@ static openr2_call_disconnect_cause_t dahdi_ast_cause_to_r2_cause(int cause)
                r2cause = OR2_CAUSE_NORMAL_CLEARING;
                break;
        }
-       ast_log(LOG_DEBUG, "ast cause %d resulted in openr2 cause %d/%s\n",
+       ast_debug(1, "ast cause %d resulted in openr2 cause %d/%s\n",
                        cause, r2cause, openr2_proto_get_disconnect_string(r2cause));
        return r2cause;
 }
@@ -6305,7 +6305,7 @@ static int dahdi_hangup(struct ast_channel *ast)
                /* Perform low level hangup if no owner left */
 #ifdef HAVE_OPENR2
                if (p->mfcr2 && p->mfcr2call && openr2_chan_get_direction(p->r2chan) != OR2_DIR_STOPPED) {
-                       ast_log(LOG_DEBUG, "disconnecting MFC/R2 call on chan %d\n", p->channel);
+                       ast_debug(1, "disconnecting MFC/R2 call on chan %d\n", p->channel);
                        /* If it's an incoming call, check the mfcr2_forced_release setting */
                        if (openr2_chan_get_direction(p->r2chan) == OR2_DIR_BACKWARD && p->mfcr2_forced_release) {
                                dahdi_r2_disconnect_call(p, OR2_CAUSE_FORCED_RELEASE);
@@ -6317,7 +6317,7 @@ static int dahdi_hangup(struct ast_channel *ast)
                                dahdi_r2_disconnect_call(p, r2cause);
                        }
                } else if (p->mfcr2call) {
-                       ast_log(LOG_DEBUG, "Clearing call request on channel %d\n", p->channel);
+                       ast_debug(1, "Clearing call request on channel %d\n", p->channel);
                        /* since ast_request() was called but not ast_call() we have not yet dialed
                        and the openr2 stack will not call on_call_end callback, we need to unset
                        the mfcr2call flag and bump the monitor count so the monitor thread can take
@@ -6464,14 +6464,14 @@ static int dahdi_answer(struct ast_channel *ast)
                           openr2_chan_answer_call will be called when the callback on_call_accepted is executed */
                        p->mfcr2_answer_pending = 1;
                        if (p->mfcr2_charge_calls) {
-                               ast_log(LOG_DEBUG, "Accepting MFC/R2 call with charge before answering on chan %d\n", p->channel);
+                               ast_debug(1, "Accepting MFC/R2 call with charge before answering on chan %d\n", p->channel);
                                openr2_chan_accept_call(p->r2chan, OR2_CALL_WITH_CHARGE);
                        } else {
-                               ast_log(LOG_DEBUG, "Accepting MFC/R2 call with no charge before answering on chan %d\n", p->channel);
+                               ast_debug(1, "Accepting MFC/R2 call with no charge before answering on chan %d\n", p->channel);
                                openr2_chan_accept_call(p->r2chan, OR2_CALL_NO_CHARGE);
                        }
                } else {
-                       ast_log(LOG_DEBUG, "Answering MFC/R2 call on chan %d\n", p->channel);
+                       ast_debug(1, "Answering MFC/R2 call on chan %d\n", p->channel);
                        dahdi_r2_answer(p);
                }
                break;
@@ -7771,7 +7771,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
                if (p->sig != SIG_MFCR2) {
                        ast_log(LOG_WARNING, "Received bits changed on %s signalling?\n", sig2str(p->sig));
                } else {
-                       ast_log(LOG_DEBUG, "bits changed in chan %d\n", p->channel);
+                       ast_debug(1, "bits changed in chan %d\n", p->channel);
                        openr2_chan_handle_cas(p->r2chan);
                }
 #else
@@ -7793,7 +7793,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
                if (p->inalarm) break;
                if ((p->radio || (p->oprmode < 0))) break;
                if (ioctl(p->subs[idx].dfd,DAHDI_DIALING,&x) == -1) {
-                       ast_log(LOG_DEBUG, "DAHDI_DIALING ioctl failed on %s: %s\n",ast->name, strerror(errno));
+                       ast_debug(1, "DAHDI_DIALING ioctl failed on %s: %s\n",ast->name, strerror(errno));
                        return NULL;
                }
                if (!x) { /* if not still dialing in driver */
@@ -8744,7 +8744,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
                        if (p->mfcr2_call_accepted &&
                                !p->mfcr2_progress_sent && 
                                ast->_state == AST_STATE_RINGING) {
-                               ast_log(LOG_DEBUG, "Enqueuing progress frame after R2 accept in chan %d\n", p->channel);
+                               ast_debug(1, "Enqueuing progress frame after R2 accept in chan %d\n", p->channel);
                                ast_queue_frame(p->owner, &fr);
                                p->mfcr2_progress_sent = 1;
                        }
@@ -9009,7 +9009,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
                                                p->waitingfordt.tv_sec = 0;
                                                p->dsp_features &= ~DSP_FEATURE_WAITDIALTONE;
                                                ast_dsp_set_features(p->dsp, p->dsp_features);
-                                               ast_log(LOG_DEBUG, "Got 10 samples of dialtone!\n");
+                                               ast_debug(1, "Got 10 samples of dialtone!\n");
                                                if (!ast_strlen_zero(p->dop.dialstr)) { /* Dial deferred digits */
                                                        res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_DIAL, &p->dop);
                                                        if (res < 0) {
@@ -9018,7 +9018,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
                                                                ast_mutex_unlock(&p->lock);
                                                                return NULL;
                                                        } else {
-                                                               ast_log(LOG_DEBUG, "Sent deferred digit string: %s\n", p->dop.dialstr);
+                                                               ast_debug(1, "Sent deferred digit string: %s\n", p->dop.dialstr);
                                                                p->dialing = 1;
                                                                p->dop.dialstr[0] = '\0';
                                                                p->dop.op = DAHDI_DIAL_OP_REPLACE;
@@ -10462,7 +10462,7 @@ static void *analog_ss_thread(void *data)
                                        f = ast_read(chan);
                                        if (f->frametype == AST_FRAME_DTMF) {
                                                dtmfbuf[k++] = f->subclass.integer;
-                                               ast_log(LOG_DEBUG, "CID got digit '%c'\n", f->subclass.integer);
+                                               ast_debug(1, "CID got digit '%c'\n", f->subclass.integer);
                                                res = 2000;
                                        }
                                        ast_frfree(f);
@@ -10474,7 +10474,7 @@ static void *analog_ss_thread(void *data)
                                dahdi_setlinear(p->subs[idx].dfd, p->subs[idx].linear);
                                /* Got cid and ring. */
                                callerid_get_dtmf(dtmfbuf, dtmfcid, &flags);
-                               ast_log(LOG_DEBUG, "CID is '%s', flags %d\n",
+                               ast_debug(1, "CID is '%s', flags %d\n",
                                        dtmfcid, flags);
                                /* If first byte is NULL, we have no cid */
                                if (!ast_strlen_zero(dtmfcid))
@@ -10522,7 +10522,7 @@ static void *analog_ss_thread(void *data)
                                                        }
                                                        /* If we get a PR event, they hung up while processing calerid */
                                                        if ( res == DAHDI_EVENT_POLARITY && p->hanguponpolarityswitch && p->polarity == POLARITY_REV) {
-                                                               ast_log(LOG_DEBUG, "Hanging up due to polarity reversal on channel %d while detecting callerid\n", p->channel);
+                                                               ast_debug(1, "Hanging up due to polarity reversal on channel %d while detecting callerid\n", p->channel);
                                                                p->polarity = POLARITY_IDLE;
                                                                callerid_free(cs);
                                                                ast_hangup(chan);
@@ -11537,7 +11537,7 @@ static void *do_monitor(void *data)
                                                                pthread_attr_init(&attr);
                                                                pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 
-                                                               ast_log(LOG_DEBUG, "Maybe some MWI on port %d!\n", i->channel);
+                                                               ast_debug(1, "Maybe some MWI on port %d!\n", i->channel);
                                                                if ((mtd = ast_calloc(1, sizeof(*mtd)))) {
                                                                        mtd->pvt = i;
                                                                        memcpy(mtd->buf, buf, res);
@@ -11844,7 +11844,7 @@ static struct dahdi_mfcr2 *dahdi_r2_get_link(void)
                new_r2link->r2master = AST_PTHREADT_NULL;
                r2links[r2links_count] = new_r2link;
                r2links_count++;
-               ast_log(LOG_DEBUG, "Created new R2 link!\n");
+               ast_debug(1, "Created new R2 link!\n");
        }
        return r2links[r2links_count - 1];
 }
@@ -11942,7 +11942,7 @@ static int device2chan(const char *subdir, int channel, char *path, int pathlen)
                return -EINVAL;
        }
        num = minor(stbuf.st_rdev);
-       ast_log(LOG_DEBUG, "%s -> %d\n", path, num);
+       ast_debug(1, "%s -> %d\n", path, num);
        return num;
 
 }
@@ -13339,7 +13339,7 @@ static struct ast_channel *dahdi_request(const char *type, struct ast_format_cap
                                ast_mutex_lock(&p->lock);
                                if (p->mfcr2call) {
                                        ast_mutex_unlock(&p->lock);
-                                       ast_log(LOG_DEBUG, "Yay!, someone just beat us in the race for channel %d.\n", p->channel);
+                                       ast_debug(1, "Yay!, someone just beat us in the race for channel %d.\n", p->channel);
                                        goto next;
                                }
                                p->mfcr2call = 1;
@@ -13676,7 +13676,7 @@ static void *mfcr2_monitor(void *data)
                                continue;
                        }
                        if (!mfcr2->pvts[i]->r2chan) {
-                               ast_log(LOG_DEBUG, "Wow, no r2chan on channel %d\n", mfcr2->pvts[i]->channel);
+                               ast_debug(1, "Wow, no r2chan on channel %d\n", mfcr2->pvts[i]->channel);
                                quit_loop = 1;
                                break;
                        }
@@ -13690,7 +13690,7 @@ static void *mfcr2_monitor(void *data)
                }
                if (pollsize == 0) {
                        if (!was_idle) {
-                               ast_log(LOG_DEBUG, "Monitor thread going idle since everybody has an owner\n");
+                               ast_debug(1, "Monitor thread going idle since everybody has an owner\n");
                                was_idle = 1;
                        }
                        poll(NULL, 0, maxsleep);
@@ -16485,19 +16485,19 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
 
                /* Create the interface list */
                if (!strcasecmp(v->name, "channel") || !strcasecmp(v->name, "channels")) {
-                       if (options & PROC_DAHDI_OPT_NOCHAN) {
+                       if (options & PROC_DAHDI_OPT_NOCHAN) {
                                ast_log(LOG_WARNING, "Channel '%s' ignored.\n", v->value);
-                               continue;
+                               continue;
                        }
                        if (build_channels(confp, v->value, reload, v->lineno, &found_pseudo)) {
                                if (confp->ignore_failed_channels) {
                                        ast_log(LOG_WARNING, "Channel '%s' failure ignored: ignore_failed_channels.\n", v->value);
                                        continue;
                                } else {
-                                       return -1;
+                                       return -1;
                                }
                        }
-                       ast_log(LOG_DEBUG, "Channel '%s' configured.\n", v->value);
+                       ast_debug(1, "Channel '%s' configured.\n", v->value);
                } else if (!strcasecmp(v->name, "ignore_failed_channels")) {
                        confp->ignore_failed_channels = ast_true(v->value);
                } else if (!strcasecmp(v->name, "buffers")) {
@@ -16510,8 +16510,8 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
                        if (!parse_buffers_policy(v->value, &confp->chan.faxbuf_no, &confp->chan.faxbuf_policy)) {
                                confp->chan.usefaxbuffers = 1;
                        }
-               } else if (!strcasecmp(v->name, "dahdichan")) {
-                       ast_copy_string(dahdichan, v->value, sizeof(dahdichan));
+               } else if (!strcasecmp(v->name, "dahdichan")) {
+                       ast_copy_string(dahdichan, v->value, sizeof(dahdichan));
                } else if (!strcasecmp(v->name, "usedistinctiveringdetection")) {
                        usedistinctiveringdetection = ast_true(v->value);
                } else if (!strcasecmp(v->name, "distinctiveringaftercid")) {
index 3bbf161..a284520 100644 (file)
@@ -498,7 +498,7 @@ static int gtalk_ringing_ack(void *data, ikspak *pak)
                                (redirect = iks_find_cdata(traversenodes, "redirect")) &&
                                (redirect = strstr(redirect, "xmpp:"))) {
                                redirect += 5;
-                               ast_log(LOG_DEBUG, "redirect %s\n", redirect);
+                               ast_debug(1, "redirect %s\n", redirect);
                                ast_copy_string(p->them, redirect, sizeof(p->them));
 
                                gtalk_invite(p, p->them, p->us, p->sid, 1);
@@ -626,7 +626,7 @@ static int gtalk_is_answered(struct gtalk *client, ikspak *pak)
        char s1[BUFSIZ], s2[BUFSIZ], s3[BUFSIZ];
        int peernoncodeccapability;
 
-       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 does exist */
        for (tmp = client->p; tmp; tmp = tmp->next) {
@@ -701,7 +701,7 @@ static int gtalk_is_accepted(struct gtalk *client, ikspak *pak)
        struct gtalk_pvt *tmp;
        char *from;
 
-       ast_log(LOG_DEBUG, "The client is %s\n", client->name);
+       ast_debug(1, "The client is %s\n", client->name);
        /* find corresponding call */
        for (tmp = client->p; tmp; tmp = tmp->next) {
                if (iks_find_with_attrib(pak->x, "session", "id", tmp->sid)) {
index 49434d6..6087a82 100644 (file)
@@ -1320,7 +1320,7 @@ static void network_change_event_cb(const struct ast_event *event, void *userdat
 
 /*! \brief Send manager event at call setup to link between Asterisk channel name
        and IAX2 call identifiers */
-static void iax2_ami_channelupdate(struct chan_iax2_pvt *pvt) 
+static void iax2_ami_channelupdate(struct chan_iax2_pvt *pvt)
 {
        manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate",
                "Channel: %s\r\nChanneltype: IAX2\r\nIAX2-callno-local: %d\r\nIAX2-callno-remote: %d\r\nIAX2-peer: %s\r\n",
@@ -1477,7 +1477,7 @@ static int __schedule_action(void (*func)(const void *data), const void *data, c
                return 0;
        }
        time(&t);
-       if (t != lasterror) 
+       if (t != lasterror)
                ast_debug(1, "Out of idle IAX2 threads for scheduling!\n");
        lasterror = t;
 
@@ -1890,9 +1890,7 @@ static int scheduled_destroy(const void *vid)
        unsigned short callno = PTR_TO_CALLNO(vid);
        ast_mutex_lock(&iaxsl[callno]);
        if (iaxs[callno]) {
-               if (option_debug) {
-                       ast_log(LOG_DEBUG, "Really destroying %d now...\n", callno);
-               }
+               ast_debug(1, "Really destroying %d now...\n", callno);
                iax2_destroy(callno);
        }
        ast_mutex_unlock(&iaxsl[callno]);
@@ -3399,11 +3397,11 @@ static int send_packet(struct iax_frame *f)
        /* Don't send if there was an error, but return error instead */
        if (!callno || !iaxs[callno] || iaxs[callno]->error)
            return -1;
-       
+
        /* Called with iaxsl held */
        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));
@@ -4106,21 +4104,21 @@ static int get_from_jb(const void *p);
 static void update_jbsched(struct chan_iax2_pvt *pvt)
 {
        int when;
-       
+
        when = ast_tvdiff_ms(ast_tvnow(), pvt->rxcore);
-       
+
        when = jb_next(pvt->jb) - when;
 
        if (when <= 0) {
                /* XXX should really just empty until when > 0.. */
                when = 1;
        }
-       
-       pvt->jbid = iax2_sched_replace(pvt->jbid, sched, when, get_from_jb, 
+
+       pvt->jbid = iax2_sched_replace(pvt->jbid, sched, when, get_from_jb,
                CALLNO_TO_PTR(pvt->callno));
 }
 
-static void __get_from_jb(const void *p) 
+static void __get_from_jb(const void *p)
 {
        int callno = PTR_TO_CALLNO(p);
        struct chan_iax2_pvt *pvt = NULL;
@@ -4220,7 +4218,7 @@ static int schedule_delivery(struct iax_frame *fr, int updatehistory, int fromtr
        int needfree = 0;
        struct ast_channel *owner = NULL;
        struct ast_channel *bridge = NULL;
-       
+
        /* Attempt to recover wrapped timestamps */
        unwrap_timestamp(fr);
 
@@ -5286,20 +5284,20 @@ static int iax2_call(struct ast_channel *c, char *dest, int timeout)
        return 0;
 }
 
-static int iax2_hangup(struct ast_channel *c) 
+static int iax2_hangup(struct ast_channel *c)
 {
        unsigned short callno = PTR_TO_CALLNO(c->tech_pvt);
-       struct iax_ie_data ied;
+       struct iax_ie_data ied;
        int alreadygone;
-       memset(&ied, 0, sizeof(ied));
+       memset(&ied, 0, sizeof(ied));
        ast_mutex_lock(&iaxsl[callno]);
        if (callno && iaxs[callno]) {
                ast_debug(1, "We're hanging up %s now...\n", c->name);
                alreadygone = ast_test_flag64(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);
+               iax_ie_append_byte(&ied, IAX_IE_CAUSECODE, (unsigned char)c->hangupcause);
                if (!iaxs[callno]->error && !alreadygone) {
-                       if (send_command_final(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_HANGUP, 0, ied.buf, ied.pos, -1)) {
+                       if (send_command_final(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_HANGUP, 0, ied.buf, ied.pos, -1)) {
                                ast_log(LOG_WARNING, "No final packet could be sent for callno %d\n", callno);
                        }
                        if (!iaxs[callno]) {
@@ -5493,7 +5491,7 @@ static int iax2_start_transfer(unsigned short callno0, unsigned short callno1, i
        iax_ie_append_addr(&ied1, IAX_IE_APPARENT_ADDR, &iaxs[callno0]->addr);
        iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[callno0]->peercallno);
        iax_ie_append_int(&ied1, IAX_IE_TRANSFERID, transferid);
-       
+
        res = send_command(iaxs[callno0], AST_FRAME_IAX, IAX_COMMAND_TXREQ, 0, ied0.buf, ied0.pos, -1);
        if (res)
                return -1;
@@ -5728,7 +5726,7 @@ done:
 
        return res;
 }
-       
+
 static int iax2_transfer(struct ast_channel *c, const char *dest)
 {
        unsigned short callno = PTR_TO_CALLNO(c->tech_pvt);
@@ -5748,7 +5746,7 @@ static int iax2_transfer(struct ast_channel *c, const char *dest)
        ast_queue_control_data(c, AST_CONTROL_TRANSFER, &message, sizeof(message));
        return send_command_locked(callno, AST_FRAME_IAX, IAX_COMMAND_TRANSFER, 0, ied.buf, ied.pos, -1);
 }
-       
+
 static int iax2_getpeertrunk(struct sockaddr_in sin)
 {
        struct iax2_peer *peer;
@@ -5970,7 +5968,7 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str
                } else if (f->frametype == AST_FRAME_IAX) {
                        genuine = 1;
                } else if (f->frametype == AST_FRAME_CNG) {
-                       p->notsilenttx = 0;     
+                       p->notsilenttx = 0;
                }
        }
        if (ast_tvzero(p->offset)) {
@@ -6161,7 +6159,7 @@ static int iax2_trunk_queue(struct chan_iax2_pvt *pvt, struct iax_frame *fr)
        struct iax2_trunk_peer *tpeer;
        void *tmp, *ptr;
        struct timeval now;
-       int res; 
+       int res;
        struct ast_iax2_meta_trunk_entry *met;
        struct ast_iax2_meta_trunk_mini *mtm;
 
@@ -6175,7 +6173,7 @@ static int iax2_trunk_queue(struct chan_iax2_pvt *pvt, struct iax_frame *fr)
                                        ast_mutex_unlock(&tpeer->lock);
                                        return -1;
                                }
-                               
+
                                tpeer->trunkdataalloc += DEFAULT_TRUNKDATA;
                                tpeer->trunkdata = tmp;
                                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);
@@ -7531,7 +7529,7 @@ static int iax2_write(struct ast_channel *c, struct ast_frame *f)
        return res;
 }
 
-static int __send_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const unsigned char *data, int datalen, int seqno, 
+static int __send_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const unsigned char *data, int datalen, int seqno,
                int now, int transfer, int final)
 {
        struct ast_frame f = { 0, };
@@ -7838,11 +7836,8 @@ static int raw_hangup(struct sockaddr_in *sin, unsigned short src, unsigned shor
        fh.type = AST_FRAME_IAX;
        fh.csub = compress_subclass(IAX_COMMAND_INVAL);
        iax_outputframe(NULL, &fh, 0, sin, 0);
-#if 0
-       if (option_debug)
-#endif 
-               ast_debug(1, "Raw Hangup %s:%d, src=%d, dst=%d\n",
-                       ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port), src, dst);
+       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));
 }
 
@@ -9192,7 +9187,7 @@ static int send_trunk(struct iax2_trunk_peer *tpeer, struct timeval *now)
                calls = tpeer->calls;
 #if 0
                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         
+#endif
                /* Reset transmit trunk side data */
                tpeer->trunkdatalen = 0;
                tpeer->calls = 0;
@@ -9238,11 +9233,11 @@ static int timing_read(int *id, int fd, short events, void *cbdata)
                        drop = tpeer;
                } else {
                        res = send_trunk(tpeer, &now);
-                       trunk_timed++; 
+                       trunk_timed++;
                        if (iaxtrunkdebug)
                                ast_verbose(" - Trunk peer (%s:%d) has %d call chunk%s in transit, %d bytes backloged and has hit a high water mark of %d bytes\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), res, (res != 1) ? "s" : "", tpeer->trunkdatalen, tpeer->trunkdataalloc);
-               }               
-               totalcalls += res;      
+               }
+               totalcalls += res;
                res = 0;
                ast_mutex_unlock(&tpeer->lock);
        }
@@ -9261,7 +9256,6 @@ static int timing_read(int *id, int fd, short events, void *cbdata)
                ast_mutex_unlock(&drop->lock);
                ast_mutex_destroy(&drop->lock);
                ast_free(drop);
-               
        }
 
        if (iaxtrunkdebug)
@@ -9424,16 +9418,16 @@ static int check_provisioning(struct sockaddr_in *sin, int sockfd, char *si, uns
        if (iax_provision_version(&ourver, rsi, 1))
                return 0;
        ast_debug(1, "Service identifier '%s', we think '%08x', they think '%08x'\n", si, ourver, ver);
-       if (ourver != ver) 
+       if (ourver != ver)
                iax2_provision(sin, sockfd, NULL, rsi, 1);
        return 0;
 }
 
-static void construct_rr(struct chan_iax2_pvt *pvt, struct iax_ie_data *iep) 
+static void construct_rr(struct chan_iax2_pvt *pvt, struct iax_ie_data *iep)
 {
        jb_info stats;
        jb_getinfo(pvt->jb, &stats);
-       
+
        memset(iep, 0, sizeof(*iep));
 
        iax_ie_append_int(iep,IAX_IE_RR_JITTER, stats.jitter);
@@ -9600,7 +9594,7 @@ static void defer_full_frame(struct iax2_thread *from_here, struct iax2_thread *
 
        if (!cur_pkt_buf)
                AST_LIST_INSERT_TAIL(&to_here->full_frames, pkt_buf, entry);
-       
+
        ast_mutex_unlock(&to_here->lock);
 }
 
@@ -10121,7 +10115,7 @@ static int socket_process(struct iax2_thread *thread)
                f.subclass.integer != IAX_COMMAND_TXCNT &&              /* for attended transfer */
                f.subclass.integer != IAX_COMMAND_TXACC) {              /* for attended transfer */
                unsigned short new_peercallno;
-               
+
                new_peercallno = (unsigned short) (ntohs(mh->callno) & ~IAX_FLAG_FULL);
                if (new_peercallno && new_peercallno != iaxs[fr->callno]->peercallno) {
                        if (iaxs[fr->callno]->peercallno) {
@@ -10172,14 +10166,14 @@ static int socket_process(struct iax2_thread *thread)
                          (f.subclass.integer != IAX_COMMAND_TXACC) &&
                          (f.subclass.integer != IAX_COMMAND_VNAK)) ||
                          (f.frametype != AST_FRAME_IAX)) {
-                               /* If it's not an ACK packet, it's out of order. */
-                               ast_debug(1, "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n", 
+                               /* If it's not an ACK packet, it's out of order. */
+                               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.integer);
                                /* Check to see if we need to request retransmission,
                                 * and take sequence number wraparound into account */
                                if ((unsigned char) (iaxs[fr->callno]->iseqno - fr->oseqno) < 128) {
                                        /* If we've already seen it, ack it XXX There's a border condition here XXX */
-                                       if ((f.frametype != AST_FRAME_IAX) || 
+                                       if ((f.frametype != AST_FRAME_IAX) ||
                                                        ((f.subclass.integer != IAX_COMMAND_ACK) && (f.subclass.integer != IAX_COMMAND_INVAL))) {
                                                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
@@ -10214,7 +10208,7 @@ static int socket_process(struct iax2_thread *thread)
 
                /* Handle implicit ACKing unless this is an INVAL, and only if this is 
                   from the real peer, not the transfer peer */
-               if (!inaddrcmp(&sin, &iaxs[fr->callno]->addr) && 
+               if (!inaddrcmp(&sin, &iaxs[fr->callno]->addr) &&
                    ((f.subclass.integer != IAX_COMMAND_INVAL) ||
                     (f.frametype != AST_FRAME_IAX))) {
                        unsigned char x;
@@ -10222,7 +10216,7 @@ static int socket_process(struct iax2_thread *thread)
                        /* First we have to qualify that the ACKed value is within our window */
                        if (iaxs[fr->callno]->rseqno >= iaxs[fr->callno]->oseqno || (fr->iseqno >= iaxs[fr->callno]->rseqno && fr->iseqno < iaxs[fr->callno]->oseqno))
                                x = fr->iseqno;
-                       else 
+                       else
                                x = iaxs[fr->callno]->oseqno;
                        if ((x != iaxs[fr->callno]->oseqno) || (iaxs[fr->callno]->oseqno == fr->iseqno)) {
                                /* The acknowledgement is within our window.  Time to acknowledge everything
@@ -10262,8 +10256,8 @@ static int socket_process(struct iax2_thread *thread)
                                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) && 
-                       ((f.frametype != AST_FRAME_IAX) || 
+               if (inaddrcmp(&sin, &iaxs[fr->callno]->addr) &&
+                       ((f.frametype != AST_FRAME_IAX) ||
                         ((f.subclass.integer != IAX_COMMAND_TXACC) &&
                          (f.subclass.integer != IAX_COMMAND_TXCNT)))) {
                        /* Only messages we accept from a transfer host are TXACC and TXCNT */
@@ -10942,7 +10936,7 @@ static int socket_process(struct iax2_thread *thread)
                                                }
                                        }
                                        /* Schedule the next cycle */
-                                       if ((peer->lastms < 0)  || (peer->historicms > peer->maxms)) 
+                                       if ((peer->lastms < 0)  || (peer->historicms > peer->maxms))
                                                peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqnotok, iax2_poke_peer_s, peer_ref(peer));
                                        else
                                                peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqok, iax2_poke_peer_s, peer_ref(peer));
@@ -11498,12 +11492,12 @@ immediatedial:
                        }
 
                        /* Don't actually pass these frames along */
-                       if ((f.subclass.integer != IAX_COMMAND_ACK) && 
-                         (f.subclass.integer != IAX_COMMAND_TXCNT) && 
-                         (f.subclass.integer != IAX_COMMAND_TXACC) && 
+                       if ((f.subclass.integer != IAX_COMMAND_ACK) &&
+                         (f.subclass.integer != IAX_COMMAND_TXCNT) &&
+                         (f.subclass.integer != IAX_COMMAND_TXACC) &&
                          (f.subclass.integer != IAX_COMMAND_INVAL) &&
-                         (f.subclass.integer != IAX_COMMAND_VNAK)) { 
-                               if (iaxs[fr->callno] && iaxs[fr->callno]->aseqno != iaxs[fr->callno]->iseqno)
+                         (f.subclass.integer != IAX_COMMAND_VNAK)) {
+                               if (iaxs[fr->callno] && iaxs[fr->callno]->aseqno != iaxs[fr->callno]->iseqno)
                                        send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr->ts, NULL, 0,fr->iseqno);
                        }
                        ast_mutex_unlock(&iaxsl[fr->callno]);
@@ -11804,12 +11798,12 @@ static int iax2_do_register(struct iax2_registry *reg)
        if (iaxdebug)
                ast_debug(1, "Sending registration request for '%s'\n", reg->username);
 
-       if (reg->dnsmgr && 
+       if (reg->dnsmgr &&
            ((reg->regstate == REG_STATE_TIMEOUT) || !ast_sockaddr_ipv4(&reg->addr))) {
                /* Maybe the IP has changed, force DNS refresh */
                ast_dnsmgr_refresh(reg->dnsmgr);
        }
-       
+
        /*
         * if IP has Changed, free allocated call to create a new one with new IP
         * call has the pointer to IP and must be updated to the new one
@@ -11825,7 +11819,7 @@ static int iax2_do_register(struct iax2_registry *reg)
                if (iaxdebug)
                        ast_debug(1, "Unable to send registration request for '%s' without IP address\n", reg->username);
                /* Setup the next registration attempt */
-               reg->expire = iax2_sched_replace(reg->expire, sched, 
+               reg->expire = iax2_sched_replace(reg->expire, sched,
                        (5 * reg->refresh / 6) * 1000, iax2_do_register_s, reg);
                return -1;
        }
@@ -11847,7 +11841,7 @@ static int iax2_do_register(struct iax2_registry *reg)
                ast_mutex_unlock(&iaxsl[reg->callno]);
        }
        /* Setup the next registration a little early */
-       reg->expire = iax2_sched_replace(reg->expire, sched, 
+       reg->expire = iax2_sched_replace(reg->expire, sched,
                (5 * reg->refresh / 6) * 1000, iax2_do_register_s, reg);
        /* Send the request */
        memset(&ied, 0, sizeof(ied));
@@ -12266,7 +12260,7 @@ static int check_srcaddr(struct sockaddr *sa, socklen_t salen)
 {
        int sd;
        int res;
-       
+
        sd = socket(AF_INET, SOCK_DGRAM, 0);
        if (sd < 0) {
                ast_log(LOG_ERROR, "Socket: %s\n", strerror(errno));
@@ -12344,7 +12338,7 @@ static int peer_set_srcaddr(struct iax2_peer *peer, const char *srcaddr)
                        }
                }
        }
-               
+
        peer->sockfd = sockfd;
 
        if (nonlocal == 1) {
@@ -13991,7 +13985,7 @@ static int acf_channel_read(struct ast_channel *chan, const char *funcname, char
 }
 
 /*! \brief Part of the device state notification system ---*/
-static int iax2_devicestate(void *data) 
+static int iax2_devicestate(void *data)
 {
        struct parsed_dial_string pds;
        char *tmp = ast_strdupa(data);
@@ -14005,7 +13999,7 @@ static int iax2_devicestate(void *data)
                ast_log(LOG_WARNING, "No peer provided in the IAX2 dial string '%s'\n", (char *) data);
                return res;
        }
-       
+
        ast_debug(3, "Checking device state for device %s\n", pds.peer);
 
        /* SLD: FIXME: second call to find_peer during registration */
@@ -14015,14 +14009,14 @@ static int iax2_devicestate(void *data)
        res = AST_DEVICE_UNAVAILABLE;
        ast_debug(3, "iax2_devicestate: Found peer. What's device state of %s? addr=%d, defaddr=%d maxms=%d, lastms=%d\n",
                pds.peer, ast_sockaddr_ipv4(&p->addr), p->defaddr.sin_addr.s_addr, p->maxms, p->lastms);
-       
+
        if ((ast_sockaddr_ipv4(&p->addr) || p->defaddr.sin_addr.s_addr) &&
            (!p->maxms || ((p->lastms > -1) && (p->historicms <= p->maxms)))) {
                /* Peer is registered, or have default IP address
                   and a valid registration */
                if (p->historicms == 0 || p->historicms <= p->maxms)
                        /* let the core figure out whether it is in use or not */
-                       res = AST_DEVICE_UNKNOWN;       
+                       res = AST_DEVICE_UNKNOWN;
        }
 
        peer_unref(p);
@@ -14030,7 +14024,7 @@ static int iax2_devicestate(void *data)
        return res;
 }
 
-static struct ast_switch iax2_switch = 
+static struct ast_switch iax2_switch =
 {
        name:        "IAX2",
        description: "IAX Remote Dialplan Switch",
index 91bcf87..91ee823 100644 (file)
@@ -7233,9 +7233,9 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame
 {
        struct ast_frame *f;
 
-       if (tmp->dsp) {
-               f = ast_dsp_process(tmp->ast, tmp->dsp, frame);
-       } else {
+       if (tmp->dsp) {
+               f = ast_dsp_process(tmp->ast, tmp->dsp, frame);
+       } else {
                chan_misdn_log(0, tmp->bc->port, "No DSP-Path found\n");
                return NULL;
        }
@@ -7246,59 +7246,59 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame
 
        ast_debug(1, "Detected inband DTMF digit: %c\n", f->subclass.integer);
 
-       if (tmp->faxdetect && (f->subclass.integer == 'f')) {
-               /* Fax tone -- Handle and return NULL */
-               if (!tmp->faxhandled) {
-                       struct ast_channel *ast = tmp->ast;
-                       tmp->faxhandled++;
-                       chan_misdn_log(0, tmp->bc->port, "Fax detected, preparing %s for fax transfer.\n", ast->name);
-                       tmp->bc->rxgain = 0;
-                       isdn_lib_update_rxgain(tmp->bc);
-                       tmp->bc->txgain = 0;
-                       isdn_lib_update_txgain(tmp->bc);
+       if (tmp->faxdetect && (f->subclass.integer == 'f')) {
+               /* Fax tone -- Handle and return NULL */
+               if (!tmp->faxhandled) {
+                       struct ast_channel *ast = tmp->ast;
+                       tmp->faxhandled++;
+                       chan_misdn_log(0, tmp->bc->port, "Fax detected, preparing %s for fax transfer.\n", ast->name);
+                       tmp->bc->rxgain = 0;
+                       isdn_lib_update_rxgain(tmp->bc);
+                       tmp->bc->txgain = 0;
+                       isdn_lib_update_txgain(tmp->bc);
 #ifdef MISDN_1_2
                        *tmp->bc->pipeline = 0;
 #else
-                       tmp->bc->ec_enable = 0;
+                       tmp->bc->ec_enable = 0;
 #endif
-                       isdn_lib_update_ec(tmp->bc);
-                       isdn_lib_stop_dtmf(tmp->bc);
-                       switch (tmp->faxdetect) {
-                       case 1:
-                               if (strcmp(ast->exten, "fax")) {
-                                       char *context;
-                                       char context_tmp[BUFFERSIZE];
-                                       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;
+                       isdn_lib_update_ec(tmp->bc);
+                       isdn_lib_stop_dtmf(tmp->bc);
+                       switch (tmp->faxdetect) {
+                       case 1:
+                               if (strcmp(ast->exten, "fax")) {
+                                       char *context;
+                                       char context_tmp[BUFFERSIZE];
+                                       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,
                                                S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) {
-                                               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)) {
-                                                       ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%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)) {
+                                                       ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast->name, context);
                                                }
-                                       } else {
-                                               ast_log(LOG_NOTICE, "Fax detected but no fax extension, context:%s exten:%s\n", context, ast->exten);
+                                       } else {
+                                               ast_log(LOG_NOTICE, "Fax detected but no fax extension, context:%s exten:%s\n", context, ast->exten);
                                        }
-                               } else {
+                               } else {
                                        ast_debug(1, "Already in a fax extension, not redirecting\n");
                                }
-                               break;
-                       case 2:
-                               ast_verb(3, "Not redirecting %s to fax extension, nojump is set.\n", ast->name);
-                               break;
+                               break;
+                       case 2:
+                               ast_verb(3, "Not redirecting %s to fax extension, nojump is set.\n", ast->name);
+                               break;
                        default:
                                break;
-                       }
-               } else {
+                       }
+               } else {
                        ast_debug(1, "Fax already handled\n");
                }
-       }
+       }
 
-       if (tmp->ast_dsp && (f->subclass.integer != 'f')) {
-               chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n", f->subclass.integer);
-       }
+       if (tmp->ast_dsp && (f->subclass.integer != 'f')) {
+               chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n", f->subclass.integer);
+       }
 
        return f;
 }
@@ -11988,7 +11988,7 @@ static int misdn_command_exec(struct ast_channel *chan, const char *data)
                return -1;
        }
 
-       ast_log(LOG_DEBUG, "%s(%s)\n", misdn_command_name, (char *) data);
+       ast_debug(1, "%s(%s)\n", misdn_command_name, (char *) data);
 
        parse = ast_strdupa(data);
        AST_STANDARD_APP_ARGS(subcommand, parse);
index d9304b6..f9cd26a 100644 (file)
@@ -3136,9 +3136,9 @@ static int __sip_xmit(struct sip_pvt *p, struct ast_str *data, int len)
 
        if (res == -1) {
                switch (errno) {
-               case EBADF:             /* Bad file descriptor - seems like this is generated when the host exist, but doesn't accept the UDP packet */
-               case EHOSTUNREACH:      /* Host can't be reached */
-               case ENETDOWN:          /* Interface down */
+               case EBADF:             /* Bad file descriptor - seems like this is generated when the host exist, but doesn't accept the UDP packet */
+               case EHOSTUNREACH:      /* Host can't be reached */
+               case ENETDOWN:          /* Interface down */
                case ENETUNREACH:       /* Network failure */
                case ECONNREFUSED:      /* ICMP port unreachable */
                        res = XMIT_ERROR;       /* Don't bother with trying to transmit again */
@@ -4182,8 +4182,8 @@ static int sip_sendhtml(struct ast_channel *chan, int subclass, const char *data
                if (!p->pendinginvite) {                /* We are up, and have no outstanding invite */
                        transmit_reinvite_with_sdp(p, FALSE, FALSE);
                } else if (!ast_test_flag(&p->flags[0], SIP_PENDINGBYE)) {
-                       ast_set_flag(&p->flags[0], SIP_NEEDREINVITE);   
-               }       
+                       ast_set_flag(&p->flags[0], SIP_NEEDREINVITE);
+               }
                break;
        default:
                ast_log(LOG_WARNING, "Don't know how to send URI when state is %d!\n", chan->_state);
@@ -4218,7 +4218,7 @@ static int sip_sendtext(struct ast_channel *ast, const char *text)
        if (debug)
                ast_verbose("Sending text %s on %s\n", text, ast->name);
        transmit_message_with_text(dialog, text);
-       return 0;       
+       return 0;
 }
 
 /*! \brief Update peer object in realtime storage
@@ -4348,18 +4348,17 @@ static void sip_destroy_peer(struct sip_peer *peer)
                dialog_unlink_all(peer->call, TRUE, TRUE);
                peer->call = dialog_unref(peer->call, "peer->call is being unset");
        }
-       
 
        if (peer->mwipvt) {     /* We have an active subscription, delete it */
                dialog_unlink_all(peer->mwipvt, TRUE, TRUE);
                peer->mwipvt = dialog_unref(peer->mwipvt, "unreffing peer->mwipvt");
        }
-       
+
        if (peer->chanvars) {
                ast_variables_destroy(peer->chanvars);
                peer->chanvars = NULL;
        }
-       
+
        register_peer_exten(peer, FALSE);
        ast_free_ha(peer->ha);
        ast_free_ha(peer->directmediaha);
@@ -5296,9 +5295,9 @@ static void sip_registry_destroy(struct sip_registry *reg)
                reg->call = dialog_unref(reg->call, "unref reg->call");
                /* reg->call = sip_destroy(reg->call); */
        }
-       AST_SCHED_DEL(sched, reg->expire);      
+       AST_SCHED_DEL(sched, reg->expire);
        AST_SCHED_DEL(sched, reg->timeout);
-       
+
        ast_string_field_free_memory(reg);
        ast_atomic_fetchadd_int(&regobjs, -1);
        ast_dnsmgr_release(reg->dnsmgr);
@@ -5806,7 +5805,7 @@ const char *hangup_cause2sip(int cause)
                        return "488 Not Acceptable Here";
                case AST_CAUSE_INTERWORKING:    /* Unspecified Interworking issues */
                        return "500 Network error";
-                       
+
                case AST_CAUSE_NOTDEFINED:
                default:
                        ast_debug(1, "AST hangup cause %d (no match found in SIP)\n", cause);
@@ -6055,7 +6054,7 @@ static void try_suggested_sip_codec(struct sip_pvt *p)
                        ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because it is not shared by both ends.\n");
        } else
                ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because of unrecognized/not configured codec (check allow/disallow in sip.conf): %s\n", codec);
-       return; 
+       return;
 }
 
 /*! \brief  sip_answer: Answer SIP call , send 200 OK on Invite
@@ -6067,7 +6066,7 @@ static int sip_answer(struct ast_channel *ast)
 
        sip_pvt_lock(p);
        if (ast->_state != AST_STATE_UP) {
-               try_suggested_sip_codec(p);     
+               try_suggested_sip_codec(p);
 
                ast_setstate(ast, AST_STATE_UP);
                ast_debug(1, "SIP answering channel: %s\n", ast->name);
@@ -6613,14 +6612,14 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
                        needvideo = 1;
                else if (!ast_format_cap_is_empty(i->prefcaps))
                        needvideo = ast_format_cap_has_type(i->prefcaps, AST_FORMAT_TYPE_VIDEO);        /* Outbound call */
-               else
+               else
                        needvideo = ast_format_cap_has_type(i->jointcaps, AST_FORMAT_TYPE_VIDEO);       /* Inbound call */
        }
 
        if (i->trtp) {
                if (!ast_format_cap_is_empty(i->prefcaps))
                        needtext = ast_format_cap_has_type(i->prefcaps, AST_FORMAT_TYPE_TEXT);  /* Outbound call */
-               else
+               else
                        needtext = ast_format_cap_has_type(i->jointcaps, AST_FORMAT_TYPE_TEXT); /* Inbound call */
        }
 
@@ -7010,7 +7009,7 @@ static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p
                        }
                }
        }
-       
+
        return f;
 }
 
@@ -7292,7 +7291,7 @@ struct sip_pvt *sip_alloc(ast_string_field callid, struct ast_sockaddr *addr,
        /* Add to active dialog list */
 
        ao2_t_link(dialogs, p, "link pvt into dialogs table");
-       
+
        ast_debug(1, "Allocating new SIP dialog for %s - %s (%s)\n", callid ? callid : p->callid, sip_methods[intended_method].text, p->rtp ? "With RTP" : "No RTP");
        return p;
 }
@@ -8426,7 +8425,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
                }
 
                ast_debug(3, "Processing session-level SDP %c=%s... %s\n", type, value, (processed == TRUE)? "OK." : "UNSUPPORTED.");
-       }
+       }
 
 
 
@@ -8888,7 +8887,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
                ast_set_read_format(p->owner, &p->owner->readformat);
                ast_set_write_format(p->owner, &p->owner->writeformat);
        }
-       
+
        if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD) && (!ast_sockaddr_isnull(sa) || !ast_sockaddr_isnull(vsa) || !ast_sockaddr_isnull(tsa) || !ast_sockaddr_isnull(isa)) && (!sendonly || sendonly == -1)) {
                ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
                /* Activate a re-invite */
@@ -9821,14 +9820,14 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in
        int is_outbound = ast_test_flag(&p->flags[0], SIP_OUTGOING);    /* Session direction */
 
        memset(req, 0, sizeof(struct sip_request));
-       
+
        snprintf(p->lastmsg, sizeof(p->lastmsg), "Tx: %s", sip_methods[sipmethod].text);
-       
+
        if (!seqno) {
                p->ocseq++;
                seqno = p->ocseq;
        }
-       
+
        /* A CANCEL must have the same branch as the INVITE that it is canceling. */
        if (sipmethod == SIP_CANCEL) {
                p->branch = p->invite_branch;
@@ -9848,7 +9847,7 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in
                if (sipdebug)
                        ast_debug(1, "Strict routing enforced for session %s\n", p->callid);
        }
-       
+
        if (sipmethod == SIP_CANCEL)
                c = REQ_OFFSET_TO_STR(&p->initreq, rlPart2);    /* Use original URI */
        else if (sipmethod == SIP_ACK) {
@@ -9856,8 +9855,8 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in
                (we only have the contacturi on INVITEs) */
                if (!ast_strlen_zero(p->okcontacturi))
                        c = is_strict ? p->route->hop : p->okcontacturi;
-               else
-                       c = REQ_OFFSET_TO_STR(&p->initreq, rlPart2);
+               else
+                       c = REQ_OFFSET_TO_STR(&p->initreq, rlPart2);
        } else if (!ast_strlen_zero(p->okcontacturi))
                c = is_strict ? p->route->hop : p->okcontacturi; /* Use for BYE or REINVITE */
        else if (!ast_strlen_zero(p->uri))
@@ -11124,7 +11123,7 @@ static int transmit_response_with_t38_sdp(struct sip_pvt *p, char *msg, struct s
 {
        struct sip_request resp;
        int seqno;
-       
+
        if (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1) {
                ast_log(LOG_WARNING, "Unable to get seqno from '%s'\n", get_header(req, "CSeq"));
                return -1;
@@ -11723,17 +11722,17 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init,
 
                                        /* Strip of the starting " (if it's there) */
                                        if (*headdup == '"') {
-                                               headdup++;
+                                               headdup++;
                                        }
                                        if ((content = strchr(headdup, ':'))) {
                                                *content++ = '\0';
                                                content = ast_skip_blanks(content); /* Skip white space */
                                                /* Strip the ending " (if it's there) */
-                                               end = content + strlen(content) -1;     
+                                               end = content + strlen(content) -1;
                                                if (*end == '"') {
                                                        *end = '\0';
                                                }
-                                       
+
                                                add_header(&req, headdup, content);
                                                if (sipdebug) {
                                                        ast_debug(1, "Adding SIP Header \"%s\" with content :%s: \n", headdup, content);
@@ -12725,7 +12724,7 @@ static int transmit_register(struct sip_registry *r, int sipmethod, const char *
        if (!ast_strlen_zero(global_useragent))
                add_header(&req, "User-Agent", global_useragent);
 
-       if (auth) {     /* Add auth header */
+       if (auth) {     /* Add auth header */
                add_header(&req, authheader, auth);
        } else if (!ast_strlen_zero(r->nonce)) {
                char digest[1024];
@@ -12804,7 +12803,7 @@ static int sip_notify_allocate(struct sip_pvt *p)
 static int transmit_refer(struct sip_pvt *p, const char *dest)
 {
        struct sip_request req = {
-               .headers = 0,   
+               .headers = 0,
        };
        char from[256];
        const char *of;
@@ -13533,7 +13532,7 @@ static void build_route(struct sip_pvt *p, struct sip_request *req, int backward
 
        /* We only want to create the route set the first time this is called */
        p->route_persistent = 1;
-       
+
        /* Build a tailq, then assign it to p->route when done.
         * If backwards, we add entries from the head so they end up
         * in reverse order. However, we do need to maintain a correct
@@ -14770,7 +14769,7 @@ static struct sip_pvt *get_sip_pvt_byid_locked(const char *callid, const char *t
        }
 
        /* Search dialogs and find the match */
-       
+
        sip_pvt_ptr = ao2_t_find(dialogs, &tmp_dialog, OBJ_POINTER, "ao2_find of dialog in dialogs table");
        if (sip_pvt_ptr) {
                /* Go ahead and lock it (and its owner) before returning */
@@ -14823,7 +14822,7 @@ static struct sip_pvt *get_sip_pvt_byid_locked(const char *callid, const char *t
                                return NULL;
                        }
                }
-               
+
                if (totag)
                        ast_debug(4, "Matched %s call - their tag is %s Our tag is %s\n",
                                          sip_pvt_ptr->outgoing_call == TRUE ? "OUTGOING": "INCOMING",
@@ -14948,7 +14947,7 @@ static int get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoi
                        }
                        ast_copy_string(referdata->replaces_callid_totag, ptr, sizeof(referdata->replaces_callid_totag));
                }
-               
+
                if (from) {
                        ptr = from + 9;
                        if ((to = strchr(ptr, '&'))) {
@@ -14959,14 +14958,14 @@ static int get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoi
                        }
                        ast_copy_string(referdata->replaces_callid_fromtag, ptr, sizeof(referdata->replaces_callid_fromtag));
                }
-               
+
                if (!sip_cfg.pedanticsipchecking) {
                        ast_debug(2, "Attended transfer: Will use Replace-Call-ID : %s (No check of from/to tags)\n", referdata->replaces_callid );
                } else {
                        ast_debug(2, "Attended transfer: Will use Replace-Call-ID : %s F-tag: %s T-tag: %s\n", referdata->replaces_callid, referdata->replaces_callid_fromtag ? referdata->replaces_callid_fromtag : "<none>", referdata->replaces_callid_totag ? referdata->replaces_callid_totag : "<none>" );
                }
        }
-       
+
        if ((ptr = strchr(refer_to, '@'))) {    /* Separate domain */
                char *urioption = NULL, *domain;
                int bracket = 0;
@@ -16274,7 +16273,7 @@ static int dialog_needdestroy(void *dialogobj, void *arg, int flags)
                        sip_pvt_unlock(dialog);
                        return 0;
                }
-               
+
                if (dialog->vrtp && ast_rtp_instance_get_bridged(dialog->vrtp)) {
                        ast_debug(2, "Bridge still active.  Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
                        sip_pvt_unlock(dialog);
@@ -18326,16 +18325,16 @@ static int do_register_auth(struct sip_pvt *p, struct sip_request *req, enum sip
        memset(digest, 0, sizeof(digest));
        if (reply_digest(p, req, header, SIP_REGISTER, digest, sizeof(digest))) {
                /* There's nothing to use for authentication */
-               /* No digest challenge in request */
-               if (sip_debug_test_pvt(p) && p->registry)
-                       ast_verbose("No authentication challenge, sending blank registration to domain/host name %s\n", p->registry->hostname);
-                       /* No old challenge */
+               /* No digest challenge in request */
+               if (sip_debug_test_pvt(p) && p->registry)
+                       ast_verbose("No authentication challenge, sending blank registration to domain/host name %s\n", p->registry->hostname);
+                       /* No old challenge */
                return -1;
        }
        if (p->do_history)
                append_history(p, "RegistryAuth", "Try: %d", p->authtries);
-       if (sip_debug_test_pvt(p) && p->registry)
-               ast_verbose("Responding to challenge, registration to domain/host name %s\n", p->registry->hostname);
+       if (sip_debug_test_pvt(p) && p->registry)
+               ast_verbose("Responding to challenge, registration to domain/host name %s\n", p->registry->hostname);
        return transmit_register(p->registry, SIP_REGISTER, digest, respheader);
 }
 
@@ -18465,28 +18464,28 @@ static int build_reply_digest(struct sip_pvt *p, int method, char* digest, int d
 
        snprintf(cnonce, sizeof(cnonce), "%08lx", ast_random());
 
-       /* Check if we have separate auth credentials */
-       if(!(auth = find_realm_authentication(p->peerauth, p->realm)))  /* Start with peer list */
-               auth = find_realm_authentication(authl, p->realm);      /* If not, global list */
+       /* Check if we have separate auth credentials */
+       if(!(auth = find_realm_authentication(p->peerauth, p->realm)))  /* Start with peer list */
+               auth = find_realm_authentication(authl, p->realm);      /* If not, global list */
 
-       if (auth) {
+       if (auth) {
                ast_debug(3, "use realm [%s] from peer [%s][%s]\n", auth->username, p->peername, p->username);
-               username = auth->username;
-               secret = auth->secret;
-               md5secret = auth->md5secret;
+               username = auth->username;
+               secret = auth->secret;
+               md5secret = auth->md5secret;
                if (sipdebug)
-                       ast_debug(1, "Using realm %s authentication for call %s\n", p->realm, p->callid);
-       } else {
-               /* No authentication, use peer or register= config */
-               username = p->authname;
-               secret =  p->peersecret;
-               md5secret = p->peermd5secret;
-       }
+                       ast_debug(1, "Using realm %s authentication for call %s\n", p->realm, p->callid);
+       } else {
+               /* No authentication, use peer or register= config */
+               username = p->authname;
+               secret =  p->peersecret;
+               md5secret = p->peermd5secret;
+       }
        if (ast_strlen_zero(username))  /* We have no authentication */
                return -1;
 
-       /* Calculate SIP digest response */
-       snprintf(a1, sizeof(a1), "%s:%s:%s", username, p->realm, secret);
+       /* Calculate SIP digest response */
+       snprintf(a1, sizeof(a1), "%s:%s:%s", username, p->realm, secret);
        snprintf(a2, sizeof(a2), "%s:%s", sip_methods[method].text, uri);
        if (!ast_strlen_zero(md5secret))
                ast_copy_string(a1_hash, md5secret, sizeof(a1_hash));
@@ -18970,7 +18969,7 @@ static void check_pendings(struct sip_pvt *p)
                        /* Perhaps there is an SD change INVITE outstanding */
                        transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, TRUE);
                }
-               ast_clear_flag(&p->flags[0], SIP_PENDINGBYE);   
+               ast_clear_flag(&p->flags[0], SIP_PENDINGBYE);
                sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
        } else if (ast_test_flag(&p->flags[0], SIP_NEEDREINVITE)) {
                /* if we can't REINVITE, hold it for later */
@@ -18980,7 +18979,7 @@ static void check_pendings(struct sip_pvt *p)
                        ast_debug(2, "Sending pending reinvite on '%s'\n", p->callid);
                        /* Didn't get to reinvite yet, so do it now */
                        transmit_reinvite_with_sdp(p, (p->t38.state == T38_LOCAL_REINVITE ? TRUE : FALSE), FALSE);
-                       ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE); 
+                       ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE);
                }
        }
 }
@@ -19834,7 +19833,7 @@ static int handle_response_register(struct sip_pvt *p, int resp, const char *res
                        pvt_set_needdestroy(p, "received erroneous 200 response");
                        return 0;
                }
-               
+
                r->regstate = REG_STATE_REGISTERED;
                r->regtime = ast_tvnow();               /* Reset time of last successful registration */
                manager_event(EVENT_FLAG_SYSTEM, "Registry", "ChannelType: SIP\r\nDomain: %s\r\nStatus: %s\r\n", r->hostname, regstate2str(r->regstate));
@@ -19850,7 +19849,7 @@ static int handle_response_register(struct sip_pvt *p, int resp, const char *res
                /* Let this one hang around until we have all the responses */
                sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
                /* p->needdestroy = 1; */
-               
+
                /* set us up for re-registering
                 * figure out how long we got registered for
                 * according to section 6.13 of RFC, contact headers override
@@ -20408,7 +20407,7 @@ static void handle_response(struct sip_pvt *p, int resp, const char *rest, struc
                        break;
                default:        /* Errors without handlers */
                        if ((resp >= 100) && (resp < 200)) {
-                               if (sipmethod == SIP_INVITE) {  /* re-invite */
+                               if (sipmethod == SIP_INVITE) {  /* re-invite */
                                        if (!req->ignore && sip_cancel_destroy(p))
                                                ast_log(LOG_WARNING, "Unable to cancel SIP destruction.  Expect bad things.\n");
                                }
@@ -20475,7 +20474,6 @@ static void *sip_park_thread(void *stuff)
        }
 
        res = ast_park_call(transferee, transferer, 0, d->parkexten, &ext);
-       
 
 #ifdef WHEN_WE_KNOW_THAT_THE_CLIENT_SUPPORTS_MESSAGE
        if (!res) {
@@ -20622,14 +20620,14 @@ static void ast_quiet_chan(struct ast_channel *chan)
 static int attempt_transfer(struct sip_dual *transferer, struct sip_dual *target)
 {
        int res = 0;
-       struct ast_channel *peera = NULL,       
+       struct ast_channel *peera = NULL,
                *peerb = NULL,
                *peerc = NULL,
                *peerd = NULL;
 
 
        /* We will try to connect the transferee with the target and hangup
-          all channels to the transferer */    
+          all channels to the transferer */
        ast_debug(4, "Sip transfer:--------------------\n");
        if (transferer->chan1)
                ast_debug(4, "-- Transferer to PBX channel: %s State %s\n", transferer->chan1->name, ast_state2str(transferer->chan1->_state));
@@ -20664,7 +20662,7 @@ static int attempt_transfer(struct sip_dual *transferer, struct sip_dual *target
 
        if (peera && peerb && peerc && (peerb != peerc)) {
                ast_quiet_chan(peera);          /* Stop generators */
-               ast_quiet_chan(peerb);  
+               ast_quiet_chan(peerb);
                ast_quiet_chan(peerc);
                if (peerd)
                        ast_quiet_chan(peerd);
@@ -20783,7 +20781,7 @@ static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, str
                *sep++ = '\0';
                eventid = sep;
        }
-       
+
        if (sipdebug)
                ast_debug(2, "Got NOTIFY Event: %s\n", event);
 
@@ -20803,7 +20801,7 @@ static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, str
                 We are getting notifications on a call that we transfered
                 We should hangup when we are getting a 200 OK in a sipfrag
                 Check if we have an owner of this event */
-               
+
                /* Check the content type */
                if (strncasecmp(get_header(req, "Content-Type"), "message/sipfrag", strlen("message/sipfrag"))) {
                        /* We need a sipfrag */
@@ -22427,7 +22425,7 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int
                        transmit_response(p, "202 Accepted", req);
                        append_history(p, "Xfer", "Refer failed. Bad extension.");
                        transmit_notify_with_sipfrag(p, seqno, "404 Not found", TRUE);
-                       ast_clear_flag(&p->flags[0], SIP_GOTREFER);     
+                       ast_clear_flag(&p->flags[0], SIP_GOTREFER);
                        if (req->debug)
                                ast_debug(1, "SIP transfer to bad extension: %s\n", p->refer->refer_to);
                        break;
@@ -22665,7 +22663,7 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int
                if (p->owner)
                        p->owner->hangupcause = AST_CAUSE_NORMAL_CLEARING;
                append_history(p, "Xfer", "Refer succeeded.");
-               ast_clear_flag(&p->flags[0], SIP_GOTREFER);     
+               ast_clear_flag(&p->flags[0], SIP_GOTREFER);
                /* Do not hangup call, the other side do that when we say 200 OK */
                /* We could possibly implement a timer here, auto congestion */
                res = 0;
@@ -22676,7 +22674,7 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int
                /* Failure of some kind */
                p->refer->status = REFER_FAILED;
                transmit_notify_with_sipfrag(p, seqno, "503 Service Unavailable", TRUE);
-               ast_clear_flag(&p->flags[0], SIP_GOTREFER);     
+               ast_clear_flag(&p->flags[0], SIP_GOTREFER);
                res = -1;
        }
 
@@ -23481,12 +23479,12 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
        int resubscribe = (p->subscribed != NONE) && !req->ignore;
        char *temp, *event;
 
-       if (p->initreq.headers) {       
+       if (p->initreq.headers) {
                /* We already have a dialog */
                if (p->initreq.method != SIP_SUBSCRIBE) {
                        /* This is a SUBSCRIBE within another SIP dialog, which we do not support */
                        /* For transfers, this could happen, but since we haven't seen it happening, let us just refuse this */
-                       transmit_response(p, "403 Forbidden (within dialog)", req);
+                       transmit_response(p, "403 Forbidden (within dialog)", req);
                        /* Do not destroy session, since we will break the call if we do */
                        ast_debug(1, "Got a subscription within the context of another call, can't handle that - %s (Method %s)\n", p->callid, sip_methods[p->initreq.method].text);
                        return 0;
@@ -23502,7 +23500,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
                if so, we don't have to check peer settings after auth, which saves a lot of processing
        */
        if (!sip_cfg.allowsubscribe) {
-               transmit_response(p, "403 Forbidden (policy)", req);
+               transmit_response(p, "403 Forbidden (policy)", req);
                pvt_set_needdestroy(p, "forbidden");
                return 0;
        }
@@ -23543,7 +23541,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
 
        if ( (strchr(eventheader, ';'))) {
                event = ast_strdupa(eventheader);       /* Since eventheader is a const, we can't change it */
-               temp = strchr(event, ';');              
+               temp = strchr(event, ';');
                *temp = '\0';                           /* Remove any options for now */
                                                        /* We might need to use them later :-) */
        } else
@@ -23695,7 +23693,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
                while (!found_supported && !ast_strlen_zero(acceptheader)) {
                        found_supported = strcmp(acceptheader, "application/simple-message-summary") ? 0 : 1;
                        if (!found_supported && (option_debug > 2)) {
-                               ast_log(LOG_DEBUG, "Received SIP mailbox subscription for unknown format: %s\n", acceptheader);
+                               ast_debug(1, "Received SIP mailbox subscription for unknown format: %s\n", acceptheader);
                        }
                        acceptheader = __get_header(req, "Accept", &start);
                }
@@ -24006,8 +24004,7 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct as
 
        /* New SIP request coming in
           (could be new request in existing SIP dialog as well...)
-        */                     
-       
+        */
        p->method = req->method;        /* Find out which SIP method they are using */
        ast_debug(4, "**** Received %s (%d) - Command in SIP %s\n", sip_methods[p->method].text, sip_methods[p->method].id, cmd);
 
@@ -24402,7 +24399,7 @@ static int handle_request_do(struct sip_request *req, struct ast_sockaddr *addr)
                /* Request failed */
                ast_debug(1, "SIP message could not be handled, bad request: %-70.70s\n", p->callid[0] ? p->callid : "<no callid>");
        }
-               
+
        if (recount)
                ast_update_use_count();
 
@@ -25352,7 +25349,7 @@ static int sip_devicestate(void *data)
        if ((p = find_peer(host, NULL, FALSE, FINDALLDEVICES, TRUE, 0))) {
                if (!(ast_sockaddr_isnull(&p->addr) && ast_sockaddr_isnull(&p->defaddr))) {
                        /* we have an address for the peer */
-               
+
                        /* Check status in this order
                                - Hold
                                - Ringing
@@ -25565,7 +25562,7 @@ static struct ast_channel *sip_request_call(const char *type, struct ast_format_
        ao2_t_unlink(dialogs, p, "About to change the callid -- remove the old name");
        build_callid_pvt(p);
        ao2_t_link(dialogs, p, "Linking in under new name");
-       
+
        /* We have an extension to call, don't use the full contact here */
        /* This to enable dialing registered peers with extension dialling,
           like SIP/peername/extension  
@@ -25850,7 +25847,7 @@ static int add_sip_domain(const char *domain, const enum domain_mode mode, const
        AST_LIST_INSERT_TAIL(&domain_list, d, list);
        AST_LIST_UNLOCK(&domain_list);
 
-       if (sipdebug)   
+       if (sipdebug)
                ast_debug(1, "Added local SIP domain '%s'\n", domain);
 
        return 1;
@@ -25869,7 +25866,7 @@ static int check_sip_domain(const char *domain, char *context, size_t len)
 
                if (len && !ast_strlen_zero(d->context))
                        ast_copy_string(context, d->context, len);
-               
+
                result = 1;
                break;
        }
@@ -27093,7 +27090,7 @@ static int reload_config(enum channelreloadreason reason)
                        sip_cfg.allowguest = ast_true(v->value) ? 1 : 0;
                } else if (!strcasecmp(v->name, "realm")) {
                        ast_copy_string(sip_cfg.realm, v->value, sizeof(sip_cfg.realm));
-               } else if (!strcasecmp(v->name, "domainsasrealm")) {
+               } else if (!strcasecmp(v->name, "domainsasrealm")) {
                        sip_cfg.domainsasrealm = ast_true(v->value);
                } else if (!strcasecmp(v->name, "useragent")) {
                        ast_copy_string(global_useragent, v->value, sizeof(global_useragent));
@@ -27685,7 +27682,7 @@ static int reload_config(enum channelreloadreason reason)
                                              STANDARD_TLS_PORT);
                }
                ast_tcptls_server_start(&sip_tls_desc);
-               if (default_tls_cfg.enabled && sip_tls_desc.accept_fd == -1) {
+               if (default_tls_cfg.enabled && sip_tls_desc.accept_fd == -1) {
                        ast_log(LOG_ERROR, "TLS Server start failed. Not listening on TLS socket.\n");
                        sip_tls_desc.tls_cfg = NULL;
                }
@@ -27911,7 +27908,7 @@ static struct ast_udptl *sip_get_udptl_peer(struct ast_channel *chan)
 static int sip_set_udptl_peer(struct ast_channel *chan, struct ast_udptl *udptl)
 {
        struct sip_pvt *p;
-       
+
        p = chan->tech_pvt;
        if (!p) {
                return -1;
@@ -28231,7 +28228,7 @@ static int sip_removeheader(struct ast_channel *chan, const char *data)
 {
        struct ast_var_t *newvariable;
        struct varshead *headp;
-       int removeall = 0;
+       int removeall = 0;
        char *inbuf = (char *) data;
 
        if (ast_strlen_zero(inbuf)) {
@@ -28450,7 +28447,7 @@ static int process_crypto(struct sip_pvt *p, struct ast_rtp_instance *rtp, struc
 static int sip_do_reload(enum channelreloadreason reason)
 {
        time_t start_poke, end_poke;
-       
+
        reload_config(reason);
        ast_sched_dump(sched);
 
@@ -28469,7 +28466,7 @@ static int sip_do_reload(enum channelreloadreason reason)
        sip_send_all_mwi_subscriptions();
 
        end_poke = time(0);
-       
+
        ast_debug(4, "do_reload finished. peer poke/prune reg contact time = %d sec.\n", (int)(end_poke-start_poke));
 
        ast_debug(4, "--------------- SIP reload done\n");
@@ -28480,7 +28477,7 @@ static int sip_do_reload(enum channelreloadreason reason)
 /*! \brief Force reload of module from cli */
 static char *sip_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-       
+
        switch (cmd) {
        case CLI_INIT:
                e->command = "sip reload";
index 3eb7682..3d485ff 100644 (file)
@@ -4454,7 +4454,7 @@ static int skinny_transfer(struct skinny_subchannel *sub)
        struct skinny_subchannel *xferor; /* the sub doing the transferring */
        struct skinny_subchannel *xferee; /* the sub being transferred */
        struct ast_tone_zone_sound *ts = NULL;
-               
+
        if (ast_bridged_channel(sub->owner) || ast_bridged_channel(sub->related->owner)) {
                if (sub->xferor) {
                        xferor = sub;
@@ -4463,7 +4463,7 @@ static int skinny_transfer(struct skinny_subchannel *sub)
                        xferor = sub;
                        xferee = sub->related;
                }
-               
+
                if (skinnydebug) {
                        ast_debug(1, "Transferee channels (local/remote): %s and %s\n",
                                xferee->owner->name, ast_bridged_channel(xferee->owner)?ast_bridged_channel(xferee->owner)->name:"");
@@ -4508,9 +4508,8 @@ static int skinny_transfer(struct skinny_subchannel *sub)
                        }
                        return 0;
                } else {
-                       if (option_debug)
-                               ast_log(LOG_DEBUG, "Neither %s nor %s are in a bridge, nothing to transfer\n",
-                                       xferor->owner->name, xferee->owner->name);
+                       ast_debug(1, "Neither %s nor %s are in a bridge, nothing to transfer\n",
+                               xferor->owner->name, xferee->owner->name);
                }
        }
        return 0;
@@ -5410,7 +5409,7 @@ static int handle_offhook_message(struct skinny_req *req, struct skinnysession *
        } else {
                /* Not ideal, but let's send updated time at onhook and offhook, as it clears the display */
                transmit_definetimedate(d);
-               
+
                if (sub && sub->owner) {
                        ast_debug(1, "Current sub [%s] already has owner\n", sub->owner->name);
                } else {
@@ -6402,7 +6401,7 @@ static int get_input(struct skinnysession *s)
                } else if (res != 4) {
                        ast_log(LOG_WARNING, "Skinny Client sent less data than expected.  Expected 4 but got %d.\n", res);
                        ast_mutex_unlock(&s->lock);
-                       
+
                        if (res == 0) {
                                if (skinnydebug)
                                        ast_verb(1, "Skinny Client was lost, unregistering\n");
@@ -6492,9 +6491,9 @@ static void *skinny_session(void *data)
        }
        ast_debug(3, "Skinny Session returned: %s\n", strerror(errno));
 
-       if (s) 
+       if (s)
                destroy_session(s);
-       
+
        return 0;
 }
 
index cc3214a..e66068b 100644 (file)
@@ -913,7 +913,7 @@ struct ast_channel *sig_pri_request(struct sig_pri_chan *p, enum sig_pri_law law
 {
        struct ast_channel *ast;
 
-       ast_log(LOG_DEBUG, "%s %d\n", __FUNCTION__, p->channel);
+       ast_debug(1, "%s %d\n", __FUNCTION__, p->channel);
 
        p->outgoing = 1;
        ast = sig_pri_new_ast_channel(p, AST_STATE_RESERVED, law, transfercapability, p->exten, requestor);
@@ -1594,7 +1594,7 @@ static void *pri_ss_thread(void *data)
                        timeout = pri_gendigittimeout;
                res = ast_waitfordigit(chan, timeout);
                if (res < 0) {
-                       ast_log(LOG_DEBUG, "waitfordigit returned < 0...\n");
+                       ast_debug(1, "waitfordigit returned < 0...\n");
                        ast_hangup(chan);
                        return NULL;
                } else if (res) {
@@ -1666,7 +1666,7 @@ static void *pri_ss_thread(void *data)
                        ast_log(LOG_WARNING, "PBX exited non-zero!\n");
                }
        } else {
-               ast_log(LOG_DEBUG, "No such possible extension '%s' in context '%s'\n", exten, chan->context);
+               ast_debug(1, "No such possible extension '%s' in context '%s'\n", exten, chan->context);
                chan->hangupcause = AST_CAUSE_UNALLOCATED;
                ast_hangup(chan);
                p->exten[0] = '\0';
@@ -3471,7 +3471,7 @@ static void sig_pri_send_aoce_termination_request(struct sig_pri_span *pri, int
 
        pvt->waiting_for_aoce = 1;
        ast_channel_setwhentohangup_tv(pvt->owner, whentohangup);
-       ast_log(LOG_DEBUG, "Delaying hangup on %s for aoc-e msg\n", pvt->owner->name);
+       ast_debug(1, "Delaying hangup on %s for aoc-e msg\n", pvt->owner->name);
 
 cleanup_termination_request:
        ast_channel_unlock(pvt->owner);
@@ -6776,7 +6776,7 @@ int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast)
        const char *useruser = pbx_builtin_getvar_helper(ast, "USERUSERINFO");
 #endif
 
-       ast_log(LOG_DEBUG, "%s %d\n", __FUNCTION__, p->channel);
+       ast_debug(1, "%s %d\n", __FUNCTION__, p->channel);
        if (!ast->tech_pvt) {
                ast_log(LOG_WARNING, "Asked to hangup channel not connected\n");
                return 0;
@@ -6805,7 +6805,7 @@ int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast)
                sig_pri_moh_fsm_event(ast, p, SIG_PRI_MOH_EVENT_RESET);
                if (p->call) {
                        if (p->alreadyhungup) {
-                               ast_log(LOG_DEBUG, "Already hungup...  Calling hangup once, and clearing call\n");
+                               ast_debug(1, "Already hungup...  Calling hangup once, and clearing call\n");
 
 #ifdef SUPPORT_USERUSER
                                pri_call_set_useruser(p->call, useruser);
@@ -6821,7 +6821,7 @@ int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast)
                        } else {
                                const char *cause = pbx_builtin_getvar_helper(ast,"PRI_CAUSE");
                                int icause = ast->hangupcause ? ast->hangupcause : -1;
-                               ast_log(LOG_DEBUG, "Not yet hungup...  Calling hangup once with icause, and clearing call\n");
+                               ast_debug(1, "Not yet hungup...  Calling hangup once with icause, and clearing call\n");
 
 #ifdef SUPPORT_USERUSER
                                pri_call_set_useruser(p->call, useruser);
@@ -6976,7 +6976,7 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, i
        struct ast_flags opts;
        char *opt_args[OPT_ARG_ARRAY_SIZE];
 
-       ast_log(LOG_DEBUG, "CALLER NAME: %s NUM: %s\n",
+       ast_debug(1, "CALLER NAME: %s NUM: %s\n",
                S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""),
                S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, ""));
 
@@ -7438,7 +7438,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi
                }
                break;
        case AST_CONTROL_PROCEEDING:
-               ast_debug(1,"Received AST_CONTROL_PROCEEDING on %s\n",chan->name);
+               ast_debug(1, "Received AST_CONTROL_PROCEEDING on %s\n",chan->name);
                if (p->call_level < SIG_PRI_CALL_LEVEL_PROCEEDING && !p->outgoing) {
                        p->call_level = SIG_PRI_CALL_LEVEL_PROCEEDING;
                        if (p->pri && p->pri->pri) {
@@ -7458,7 +7458,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi
                res = 0;
                break;
        case AST_CONTROL_PROGRESS:
-               ast_debug(1,"Received AST_CONTROL_PROGRESS on %s\n",chan->name);
+               ast_debug(1, "Received AST_CONTROL_PROGRESS on %s\n",chan->name);
                sig_pri_set_digital(p, 0);      /* Digital-only calls isn't allowing any inband progress messages */
                if (!p->progress && p->call_level < SIG_PRI_CALL_LEVEL_ALERTING && !p->outgoing
                        && !p->no_b_channel) {
@@ -7640,7 +7640,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi
                                         * and initiate the softhangup since the delay is no longer necessary */
                                        if (p->waiting_for_aoce) {
                                                p->waiting_for_aoce = 0;
-                                               ast_log(LOG_DEBUG,
+                                               ast_debug(1,
                                                        "Received final AOC-E msg, continue with hangup on %s\n",
                                                        chan->name);
                                                ast_softhangup_nolock(chan, AST_SOFTHANGUP_DEV);
@@ -8349,7 +8349,7 @@ int pri_send_callrerouting_facility_exec(struct sig_pri_chan *p, enum ast_channe
        sig_pri_lock_private(p);
 
        if (!p->pri || !p->call) {
-               ast_log(LOG_DEBUG, "Unable to find pri or call on channel!\n");
+               ast_debug(1, "Unable to find pri or call on channel!\n");
                sig_pri_unlock_private(p);
                return -1;
        }
@@ -8358,7 +8358,7 @@ int pri_send_callrerouting_facility_exec(struct sig_pri_chan *p, enum ast_channe
                res = pri_callrerouting_facility(p->pri->pri, p->call, destination, original, reason);
                pri_rel(p->pri);
        } else {
-               ast_log(LOG_DEBUG, "Unable to grab pri to send callrerouting facility on span %d!\n", p->pri->span);
+               ast_debug(1, "Unable to grab pri to send callrerouting facility on span %d!\n", p->pri->span);
        }
 
        sig_pri_unlock_private(p);
index cc5e499..7229b43 100644 (file)
@@ -89,7 +89,7 @@ static int ilbctolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
        float tmpf[ILBC_SAMPLES];
 
        if (!f->data.ptr && f->datalen) {
-               ast_log(LOG_DEBUG, "issue 16070, ILIB ERROR. data = NULL datalen = %d src = %s\n", f->datalen, f->src ? f->src : "no src set");
+               ast_debug(1, "issue 16070, ILIB ERROR. data = NULL datalen = %d src = %s\n", f->datalen, f->src ? f->src : "no src set");
                f->datalen = 0;
        }
 
@@ -104,12 +104,12 @@ static int ilbctolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
                ast_log(LOG_WARNING, "Huh?  An ilbc frame that isn't a multiple of 50 bytes long from %s (%d)?\n", f->src, f->datalen);
                return -1;
        }
-       
+
        for (x=0; x < f->datalen ; x += ILBC_FRAME_LEN) {
-               if (pvt->samples + ILBC_SAMPLES > BUFFER_SAMPLES) {     
+               if (pvt->samples + ILBC_SAMPLES > BUFFER_SAMPLES) {
                        ast_log(LOG_WARNING, "Out of buffer space\n");
                        return -1;
-               }               
+               }
                iLBC_decode(tmpf, plc_mode ? f->data.ptr + x : NULL, &tmp->dec, plc_mode);
                for ( i=0; i < ILBC_SAMPLES; i++)
                        dst[pvt->samples + i] = tmpf[i];
index f58ffc7..ec0049e 100644 (file)
@@ -2389,8 +2389,7 @@ static inline enum ast_t38_state ast_channel_get_t38_state(struct ast_channel *c
 
 #define CHECK_BLOCKING(c) do {          \
        if (ast_test_flag(c, AST_FLAG_BLOCKING)) {\
-               if (option_debug) \
-                       ast_log(LOG_DEBUG, "Thread %ld Blocking '%s', already blocked by thread %ld in procedure %s\n", (long) pthread_self(), (c)->name, (long) (c)->blocker, (c)->blockproc); \
+               ast_debug(1, "Thread %ld Blocking '%s', already blocked by thread %ld in procedure %s\n", (long) pthread_self(), (c)->name, (long) (c)->blocker, (c)->blockproc); \
        } else { \
                (c)->blocker = pthread_self(); \
                (c)->blockproc = __PRETTY_FUNCTION__; \
index c5581fb..b16421a 100644 (file)
@@ -49,8 +49,8 @@ extern "C" {
                int _sched_res = -1; \
                while (id > -1 && (_sched_res = ast_sched_del(sched, id)) && ++_count < 10) \
                        usleep(1); \
-               if (_count == 10 && option_debug > 2) { \
-                       ast_log(LOG_DEBUG, "Unable to cancel schedule ID %d.\n", id); \
+               if (_count == 10) { \
+                       ast_debug(3, "Unable to cancel schedule ID %d.\n", id); \
                } \
                id = -1; \
                (_sched_res); \
@@ -87,8 +87,8 @@ extern "C" {
                        usleep(1); \
                        ast_mutex_lock(lock); \
                } \
-               if (_count == 10 && option_debug > 2) { \
-                       ast_log(LOG_DEBUG, "Unable to cancel schedule ID %d.\n", id); \
+               if (_count == 10) { \
+                       ast_debug(3, "Unable to cancel schedule ID %d.\n", id); \
                } \
                id = -1; \
                (_sched_res); \
index 27858a2..b9be317 100644 (file)
@@ -1481,9 +1481,9 @@ static int ast_unlock_path_flock(const char *path)
                snprintf(s, strlen(path) + 19, "%s/lock", path);
                unlink(s);
                path_lock_destroy(p);
-               ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path);
+               ast_debug(1, "Unlocked path '%s'\n", path);
        } else {
-               ast_log(LOG_DEBUG, "Failed to unlock path '%s': "
+               ast_debug(1, "Failed to unlock path '%s': "
                                "lock not found\n", path);
        }
 
index 23650a7..6b2df64 100644 (file)
@@ -138,16 +138,13 @@ int ast_audiohook_write_frame(struct ast_audiohook *audiohook, enum ast_audiohoo
        other_factory_ms = other_factory_samples / 8;
 
        if (ast_test_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC) && other_factory_samples && (our_factory_ms - other_factory_ms > AST_AUDIOHOOK_SYNC_TOLERANCE)) {
-               if (option_debug)
-                       ast_log(LOG_DEBUG, "Flushing audiohook %p so it remains in sync\n", audiohook);
+               ast_debug(1, "Flushing audiohook %p so it remains in sync\n", audiohook);
                ast_slinfactory_flush(factory);
                ast_slinfactory_flush(other_factory);
        }
 
        if (ast_test_flag(audiohook, AST_AUDIOHOOK_SMALL_QUEUE) && (our_factory_samples > 640 || other_factory_samples > 640)) {
-               if (option_debug) {
-                       ast_log(LOG_DEBUG, "Audiohook %p has stale audio in its factories. Flushing them both\n", audiohook);
-               }
+               ast_debug(1, "Audiohook %p has stale audio in its factories. Flushing them both\n", audiohook);
                ast_slinfactory_flush(factory);
                ast_slinfactory_flush(other_factory);
        }
@@ -256,8 +253,8 @@ static struct ast_frame *audiohook_read_frame_both(struct ast_audiohook *audioho
                                }
                        }
                }
-       } else if (option_debug)
-               ast_log(LOG_DEBUG, "Failed to get %d samples from read factory %p\n", (int)samples, &audiohook->read_factory);
+       }
+       ast_debug(1, "Failed to get %d samples from read factory %p\n", (int)samples, &audiohook->read_factory);
 
        /* Move on to the write factory... if there are enough samples, read them in */
        if (usable_write) {
@@ -275,8 +272,8 @@ static struct ast_frame *audiohook_read_frame_both(struct ast_audiohook *audioho
                                }
                        }
                }
-       } else if (option_debug)
-               ast_log(LOG_DEBUG, "Failed to get %d samples from write factory %p\n", (int)samples, &audiohook->write_factory);
+       }
+       ast_debug(1, "Failed to get %d samples from write factory %p\n", (int)samples, &audiohook->write_factory);
 
        /* Basically we figure out which buffer to use... and if mixing can be done here */
        if (!read_buf && !write_buf)
@@ -818,7 +815,7 @@ int ast_channel_audiohook_count_by_source(struct ast_channel *chan, const char *
                        AST_LIST_TRAVERSE_SAFE_END;
                        break;
                default:
-                       ast_log(LOG_DEBUG, "Invalid audiohook type supplied, (%d)\n", type);
+                       ast_debug(1, "Invalid audiohook type supplied, (%d)\n", type);
                        return -1;
        }
 
@@ -856,7 +853,7 @@ int ast_channel_audiohook_count_by_source_running(struct ast_channel *chan, cons
                        AST_LIST_TRAVERSE_SAFE_END;
                        break;
                default:
-                       ast_log(LOG_DEBUG, "Invalid audiohook type supplied, (%d)\n", type);
+                       ast_debug(1, "Invalid audiohook type supplied, (%d)\n", type);
                        return -1;
        }
        return count;
index 796dc8b..ae61b77 100644 (file)
@@ -675,16 +675,16 @@ static int ast_channel_trace_data_update(struct ast_channel *chan, struct ast_ch
                return 0;
        /* If the last saved context does not match the current one
           OR we have not saved any context so far, then save the current context */
-       if ((!AST_LIST_EMPTY(&traced->trace) && strcasecmp(AST_LIST_FIRST(&traced->trace)->context, chan->context)) || 
+       if ((!AST_LIST_EMPTY(&traced->trace) && strcasecmp(AST_LIST_FIRST(&traced->trace)->context, chan->context)) ||
            (AST_LIST_EMPTY(&traced->trace))) {
                /* Just do some debug logging */
                if (AST_LIST_EMPTY(&traced->trace))
-                       ast_log(LOG_DEBUG, "Setting initial trace context to %s\n", chan->context);
+                       ast_debug(1, "Setting initial trace context to %s\n", chan->context);
                else
-                       ast_log(LOG_DEBUG, "Changing trace context from %s to %s\n", AST_LIST_FIRST(&traced->trace)->context, chan->context);
+                       ast_debug(1, "Changing trace context from %s to %s\n", AST_LIST_FIRST(&traced->trace)->context, chan->context);
                /* alloc or bail out */
                trace = ast_malloc(sizeof(*trace));
-               if (!trace) 
+               if (!trace)
                        return -1;
                /* save the current location and store it in the trace list */
                ast_copy_string(trace->context, chan->context, sizeof(trace->context));
@@ -745,7 +745,7 @@ int ast_check_hangup(struct ast_channel *chan)
                return 1;
        if (ast_tvzero(chan->whentohangup))     /* no if no hangup scheduled */
                return 0;
-       if (ast_tvdiff_ms(chan->whentohangup, ast_tvnow()) > 0)         /* no if hangup time has not come yet. */
+       if (ast_tvdiff_ms(chan->whentohangup, ast_tvnow()) > 0)         /* no if hangup time has not come yet. */
                return 0;
        ast_debug(4, "Hangup time has come: %" PRIi64 "\n", ast_tvdiff_ms(chan->whentohangup, ast_tvnow()));
        chan->_softhangup |= AST_SOFTHANGUP_TIMEOUT;    /* record event */
@@ -847,7 +847,7 @@ int ast_channel_register(const struct ast_channel_tech *tech)
                        return -1;
                }
        }
-       
+
        if (!(chan = ast_calloc(1, sizeof(*chan)))) {
                AST_RWLIST_UNLOCK(&backends);
                return -1;
@@ -2775,7 +2775,7 @@ int ast_hangup(struct ast_channel *chan)
        } else {
                ast_debug(1, "Hanging up zombie '%s'\n", chan->name);
        }
-                       
+
        ast_channel_unlock(chan);
        ast_cc_offer(chan);
        ast_manager_event(chan, EVENT_FLAG_CALL, "Hangup",
@@ -3568,7 +3568,7 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
                } else {
                        samples = f->samples;
                }
-               
+
                /* This unlock is here based on two assumptions that hold true at this point in the
                 * code. 1) this function is only called from within __ast_read() and 2) all generators
                 * call ast_write() in their generate callback.
@@ -4548,7 +4548,7 @@ int ast_senddigit_end(struct ast_channel *chan, char digit, unsigned int duratio
 
        if (res && chan->generator)
                ast_playtones_stop(chan);
-       
+
        return 0;
 }
 
@@ -4558,7 +4558,7 @@ int ast_senddigit(struct ast_channel *chan, char digit, unsigned int duration)
                ast_senddigit_begin(chan, digit);
                ast_safe_sleep(chan, (duration >= AST_DEFAULT_EMULATE_DTMF_DURATION ? duration : AST_DEFAULT_EMULATE_DTMF_DURATION));
        }
-       
+
        return ast_senddigit_end(chan, digit, (duration >= AST_DEFAULT_EMULATE_DTMF_DURATION ? duration : AST_DEFAULT_EMULATE_DTMF_DURATION));
 }
 
@@ -6222,32 +6222,32 @@ static void ast_set_owners_and_peers(struct ast_channel *chan1,
                                                                         struct ast_channel *chan2)
 {
        if (!ast_strlen_zero(chan1->accountcode) && ast_strlen_zero(chan2->peeraccount)) {
-               ast_log(LOG_DEBUG, "setting peeraccount to %s for %s from data on channel %s\n",
+               ast_debug(1, "setting peeraccount to %s for %s from data on channel %s\n",
                                chan1->accountcode, chan2->name, chan1->name);
                ast_string_field_set(chan2, peeraccount, chan1->accountcode);
        }
        if (!ast_strlen_zero(chan2->accountcode) && ast_strlen_zero(chan1->peeraccount)) {
-               ast_log(LOG_DEBUG, "setting peeraccount to %s for %s from data on channel %s\n",
+               ast_debug(1, "setting peeraccount to %s for %s from data on channel %s\n",
                                chan2->accountcode, chan1->name, chan2->name);
                ast_string_field_set(chan1, peeraccount, chan2->accountcode);
        }
        if (!ast_strlen_zero(chan1->peeraccount) && ast_strlen_zero(chan2->accountcode)) {
-               ast_log(LOG_DEBUG, "setting accountcode to %s for %s from data on channel %s\n",
+               ast_debug(1, "setting accountcode to %s for %s from data on channel %s\n",
                                chan1->peeraccount, chan2->name, chan1->name);
                ast_string_field_set(chan2, accountcode, chan1->peeraccount);
        }
        if (!ast_strlen_zero(chan2->peeraccount) && ast_strlen_zero(chan1->accountcode)) {
-               ast_log(LOG_DEBUG, "setting accountcode to %s for %s from data on channel %s\n",
+               ast_debug(1, "setting accountcode to %s for %s from data on channel %s\n",
                                chan2->peeraccount, chan1->name, chan2->name);
                ast_string_field_set(chan1, accountcode, chan2->peeraccount);
        }
        if (0 != strcmp(chan1->accountcode, chan2->peeraccount)) {
-               ast_log(LOG_DEBUG, "changing peeraccount from %s to %s on %s to match channel %s\n",
+               ast_debug(1, "changing peeraccount from %s to %s on %s to match channel %s\n",
                                chan2->peeraccount, chan1->peeraccount, chan2->name, chan1->name);
                ast_string_field_set(chan2, peeraccount, chan1->accountcode);
        }
        if (0 != strcmp(chan2->accountcode, chan1->peeraccount)) {
-               ast_log(LOG_DEBUG, "changing peeraccount from %s to %s on %s to match channel %s\n",
+               ast_debug(1, "changing peeraccount from %s to %s on %s to match channel %s\n",
                                chan1->peeraccount, chan2->peeraccount, chan1->name, chan2->name);
                ast_string_field_set(chan1, peeraccount, chan2->accountcode);
        }
@@ -6999,7 +6999,7 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct
                if (!f) {
                        *fo = NULL;
                        *rc = who;
-                       ast_debug(1, "Didn't get a frame from channel: %s\n",who->name);
+                       ast_debug(1, "Didn't get a frame from channel: %s\n", who->name);
                        break;
                }
 
@@ -7062,7 +7062,7 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct
                                f->frametype == AST_FRAME_DTMF_BEGIN)) {
                                *fo = f;
                                *rc = who;
-                               ast_debug(1, "Got DTMF %s on channel (%s)\n", 
+                               ast_debug(1, "Got DTMF %s on channel (%s)\n",
                                        f->frametype == AST_FRAME_DTMF_END ? "end" : "begin",
                                        who->name);
 
@@ -8686,7 +8686,7 @@ int ast_connected_line_parse_data(const unsigned char *data, size_t datalen, str
                        break;
 /* Connected line party unknown element */
                default:
-                       ast_log(LOG_DEBUG, "Unknown connected line element: %u (%u)\n",
+                       ast_debug(1, "Unknown connected line element: %u (%u)\n",
                                (unsigned) ie_id, (unsigned) ie_len);
                        break;
                }
@@ -8714,7 +8714,7 @@ int ast_connected_line_parse_data(const unsigned char *data, size_t datalen, str
                 * The other end is newer than we are.
                 * We need to assume that they are compatible with us.
                 */
-               ast_log(LOG_DEBUG, "Connected line frame has newer version: %u\n",
+               ast_debug(1, "Connected line frame has newer version: %u\n",
                        (unsigned) frame_version);
                break;
        }
@@ -9185,7 +9185,7 @@ int ast_redirecting_parse_data(const unsigned char *data, size_t datalen, struct
                        break;
 /* Redirecting unknown element */
                default:
-                       ast_log(LOG_DEBUG, "Unknown redirecting element: %u (%u)\n",
+                       ast_debug(1, "Unknown redirecting element: %u (%u)\n",
                                (unsigned) ie_id, (unsigned) ie_len);
                        break;
                }
@@ -9221,7 +9221,7 @@ int ast_redirecting_parse_data(const unsigned char *data, size_t datalen, struct
                 * The other end is newer than we are.
                 * We need to assume that they are compatible with us.
                 */
-               ast_log(LOG_DEBUG, "Redirecting frame has newer version: %u\n",
+               ast_debug(1, "Redirecting frame has newer version: %u\n",
                        (unsigned) frame_version);
                break;
        }
index 44f0eb8..23e8d57 100644 (file)
@@ -854,7 +854,7 @@ static const char *findparkinglotname(struct ast_channel *chan)
 /*! \brief Notify metermaids that we've changed an extension */
 static void notify_metermaids(const char *exten, char *context, enum ast_device_state state)
 {
-       ast_debug(4, "Notification of state change to metermaids %s@%s\n to state '%s'", 
+       ast_debug(4, "Notification of state change to metermaids %s@%s\n to state '%s'",
                exten, context, ast_devstate2str(state));
 
        ast_devstate_changed(state, "park:%s@%s", exten, context);
@@ -871,7 +871,7 @@ static enum ast_device_state metermaidstate(const char *data)
        exten = strsep(&context, "@");
        if (!context)
                return AST_DEVICE_INVALID;
-       
+
        ast_debug(4, "Checking state of exten %s in context %s\n", exten, context);
 
        if (!ast_exists_extension(NULL, context, exten, 1, NULL))
@@ -1923,12 +1923,12 @@ static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *p
                }
                if (transferer->cdr) {
                        struct ast_cdr *swap = transferer->cdr;
-                       ast_log(LOG_DEBUG,"transferer=%s; transferee=%s; lastapp=%s; lastdata=%s; chan=%s; dstchan=%s\n",
+                       ast_debug(1, "transferer=%s; transferee=%s; lastapp=%s; lastdata=%s; chan=%s; dstchan=%s\n",
                                        transferer->name, transferee->name, transferer->cdr->lastapp, transferer->cdr->lastdata, 
                                        transferer->cdr->channel, transferer->cdr->dstchannel);
-                       ast_log(LOG_DEBUG,"TRANSFEREE; lastapp=%s; lastdata=%s, chan=%s; dstchan=%s\n",
+                       ast_debug(1, "TRANSFEREE; lastapp=%s; lastdata=%s, chan=%s; dstchan=%s\n",
                                        transferee->cdr->lastapp, transferee->cdr->lastdata, transferee->cdr->channel, transferee->cdr->dstchannel);
-                       ast_log(LOG_DEBUG,"transferer_real_context=%s; xferto=%s\n", transferer_real_context, xferto);
+                       ast_debug(1, "transferer_real_context=%s; xferto=%s\n", transferer_real_context, xferto);
                        /* swap cdrs-- it will save us some time & work */
                        transferer->cdr = transferee->cdr;
                        transferee->cdr = swap;
@@ -1942,7 +1942,7 @@ static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *p
                } else {
                        /* Set the channel's new extension, since it exists, using transferer context */
                        ast_set_flag(transferee, AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
-                       ast_log(LOG_DEBUG,"ABOUT TO AST_ASYNC_GOTO, have a pbx... set HANGUP_DONT on chan=%s\n", transferee->name);
+                       ast_debug(1, "ABOUT TO AST_ASYNC_GOTO, have a pbx... set HANGUP_DONT on chan=%s\n", transferee->name);
                        if (ast_channel_connected_line_macro(transferee, transferer, &transferer->connected, 1, 0)) {
                                ast_channel_update_connected_line(transferer, &transferer->connected, NULL);
                        }
@@ -3534,7 +3534,7 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
                                ast_cdr_start(bridge_cdr);
                        }
                }
-               ast_debug(4,"bridge answer set, chan answer set\n");
+               ast_debug(4, "bridge answer set, chan answer set\n");
                /* peer_cdr->answer will be set when a macro runs on the peer;
                   in that case, the bridge answer will be delayed while the
                   macro plays on the peer channel. The peer answered the call
@@ -4665,7 +4665,7 @@ static struct ast_parkinglot *build_parkinglot(char *name, struct ast_variable *
                } else if (!strcasecmp(confvar->name, "findslot")) {
                        parkinglot->parkfindnext = (!strcasecmp(confvar->value, "next"));
                } else if (!strcasecmp(confvar->name, "parkedcalltransfers")) {
-                       ast_log(LOG_DEBUG, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
+                       ast_debug(1, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
                        if (!strcasecmp(confvar->value, "both")) {
                                parkinglot->parkedcalltransfers = AST_FEATURE_FLAG_BYBOTH;
                        } else if (!strcasecmp(confvar->value, "caller")) {
@@ -4674,7 +4674,7 @@ static struct ast_parkinglot *build_parkinglot(char *name, struct ast_variable *
                                parkinglot->parkedcalltransfers = AST_FEATURE_FLAG_BYCALLEE;
                        }
                } else if (!strcasecmp(confvar->name, "parkedcallreparking")) {
-                       ast_log(LOG_DEBUG, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
+                       ast_debug(1, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
                        if (!strcasecmp(confvar->value, "both")) {
                                parkinglot->parkedcallreparking = AST_FEATURE_FLAG_BYBOTH;
                        } else if (!strcasecmp(confvar->value, "caller")) {
@@ -4683,16 +4683,16 @@ static struct ast_parkinglot *build_parkinglot(char *name, struct ast_variable *
                                parkinglot->parkedcallreparking = AST_FEATURE_FLAG_BYCALLEE;
                        }
                } else if (!strcasecmp(confvar->name, "parkedcallhangup")) {
-                       ast_log(LOG_DEBUG, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
+                       ast_debug(1, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
                        if (!strcasecmp(confvar->value, "both")) {
                                parkinglot->parkedcallhangup = AST_FEATURE_FLAG_BYBOTH;
                        } else if (!strcasecmp(confvar->value, "caller")) {
-                               parkinglot->parkedcallhangup = AST_FEATURE_FLAG_BYCALLER; 
+                               parkinglot->parkedcallhangup = AST_FEATURE_FLAG_BYCALLER;
                        } else if (!strcasecmp(confvar->value, "callee")) {
                                parkinglot->parkedcallhangup = AST_FEATURE_FLAG_BYCALLEE;
                        }
                } else if (!strcasecmp(confvar->name, "parkedcallrecording")) {
-                       ast_log(LOG_DEBUG, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
+                       ast_debug(1, "Setting parking lot %s %s to %s\n", name, confvar->name, confvar->value);
                        if (!strcasecmp(confvar->value, "both")) {
                                parkinglot->parkedcallrecording = AST_FEATURE_FLAG_BYBOTH;
                        } else if (!strcasecmp(confvar->value, "caller")) {
@@ -4762,7 +4762,7 @@ static struct ast_parkinglot *build_parkinglot(char *name, struct ast_variable *
        return parkinglot;
 }
 
-static int load_config(void) 
+static int load_config(void)
 {
        int start = 0, end = 0;
        int res;
@@ -4793,7 +4793,7 @@ static int load_config(void)
                default_parkinglot->parkingtime = DEFAULT_PARK_TIME;
                ao2_unlock(default_parkinglot);
        }
-       
+
        if (default_parkinglot) {
                ast_debug(1, "Configuration of default parkinglot done.\n");
        } else {
@@ -5053,7 +5053,7 @@ static int load_config(void)
                                ast_log(LOG_ERROR, "Could not build parking lot %s. Configuration error.\n", ctg);
                        else
                                ast_debug(1, "Configured parking context %s\n", ctg);
-                       continue;       
+                       continue;
                }
                /* No, check if it's a group */
                for (i = 0; i < ARRAY_LEN(categories); i++) {
@@ -5061,7 +5061,7 @@ static int load_config(void)
                                break;
                }
 
-               if (i < ARRAY_LEN(categories)) 
+               if (i < ARRAY_LEN(categories))
                        continue;
 
                if (!(fg = register_group(ctg)))
@@ -5937,7 +5937,7 @@ static int bridge_exec(struct ast_channel *chan, const char *data)
                ast_set_flag(&(bconfig.features_caller), AST_FEATURE_DISCONNECT);
        if (ast_test_flag(&opts, OPT_CALLEE_MONITOR))
                ast_set_flag(&(bconfig.features_callee), AST_FEATURE_AUTOMON);
-       if (ast_test_flag(&opts, OPT_CALLER_MONITOR)) 
+       if (ast_test_flag(&opts, OPT_CALLER_MONITOR))
                ast_set_flag(&(bconfig.features_caller), AST_FEATURE_AUTOMON);
        if (ast_test_flag(&opts, OPT_CALLEE_PARK))
                ast_set_flag(&(bconfig.features_callee), AST_FEATURE_PARKCALL);
@@ -5949,8 +5949,8 @@ static int bridge_exec(struct ast_channel *chan, const char *data)
        /* the bridge has ended, set BRIDGERESULT to SUCCESS. If the other channel has not been hung up, return it to the PBX */
        pbx_builtin_setvar_helper(chan, "BRIDGERESULT", "SUCCESS");
        if (!ast_check_hangup(final_dest_chan) && !ast_test_flag(&opts, OPT_CALLEE_KILL)) {
-               ast_debug(1, "starting new PBX in %s,%s,%d for chan %s\n", 
-                       final_dest_chan->context, final_dest_chan->exten, 
+               ast_debug(1, "starting new PBX in %s,%s,%d for chan %s\n",
+                       final_dest_chan->context, final_dest_chan->exten,
                        final_dest_chan->priority, final_dest_chan->name);
 
                if (ast_pbx_start(final_dest_chan) != AST_PBX_SUCCESS) {
index 677e8c2..e288588 100644 (file)
@@ -787,7 +787,7 @@ static struct ast_variable *parse_cookies(char *cookies)
                }
 
                if (option_debug) {
-                       ast_log(LOG_DEBUG, "mmm ... cookie!  Name: '%s'  Value: '%s'\n", name, val);
+                       ast_debug(1, "mmm ... cookie!  Name: '%s'  Value: '%s'\n", name, val);
                }
 
                var = ast_variable_new(name, val, __FILE__);
index db9ec9b..f903295 100644 (file)
@@ -1258,7 +1258,7 @@ char **ast_bt_get_symbols(void **addresses, size_t num_frames)
                        char asteriskpath[256];
                        if (!(dli.dli_fname = ast_utils_which("asterisk", asteriskpath, sizeof(asteriskpath)))) {
                                /* This will fail to find symbols */
-                               ast_log(LOG_DEBUG, "Failed to find asterisk binary for debug symbols.\n");
+                               ast_debug(1, "Failed to find asterisk binary for debug symbols.\n");
                                dli.dli_fname = "asterisk";
                        }
                }
@@ -1378,7 +1378,7 @@ void ast_backtrace(void)
        if ((strings = ast_bt_get_symbols(bt->addresses, bt->num_frames))) {
                ast_debug(1, "Got %d backtrace record%c\n", bt->num_frames, bt->num_frames != 1 ? 's' : ' ');
                for (i = 3; i < bt->num_frames - 2; i++) {
-                       ast_log(LOG_DEBUG, "#%d: [%p] %s\n", i - 3, bt->addresses[i], strings[i]);
+                       ast_debug(1, "#%d: [%p] %s\n", i - 3, bt->addresses[i], strings[i]);
                }
 
                /* MALLOC_DEBUG will erroneously report an error here, unless we undef the macro. */
index 27fa6d8..8efc11d 100644 (file)
@@ -1214,7 +1214,7 @@ static struct mansession_session *unref_mansession(struct mansession_session *s)
 {
        int refcount = ao2_ref(s, -1);
         if (manager_debug) {
-               ast_log(LOG_DEBUG, "Mansession: %p refcount now %d\n", s, refcount - 1);
+               ast_debug(1, "Mansession: %p refcount now %d\n", s, refcount - 1);
        }
        return s;
 }
@@ -4344,14 +4344,14 @@ static int manager_modulecheck(struct mansession *s, const struct message *m)
                cut = filename + strlen(filename);
        }
        snprintf(cut, (sizeof(filename) - strlen(filename)) - 1, ".so");
-       ast_log(LOG_DEBUG, "**** ModuleCheck .so file %s\n", filename);
+       ast_debug(1, "**** ModuleCheck .so file %s\n", filename);
        res = ast_module_check(filename);
        if (!res) {
                astman_send_error(s, m, "Module not loaded");
                return 0;
        }
        snprintf(cut, (sizeof(filename) - strlen(filename)) - 1, ".c");
-       ast_log(LOG_DEBUG, "**** ModuleCheck .c file %s\n", filename);
+       ast_debug(1, "**** ModuleCheck .c file %s\n", filename);
 #if !defined(LOW_MEMORY)
        version = ast_file_version_find(filename);
 #endif
index 1d8324e..fe52ea2 100644 (file)
@@ -1811,10 +1811,10 @@ static void new_find_extension(const char *str, struct scoreboard *score, struct
                                                        }                                                                                                            \
                                                }                                                                                                                \
                                        }
-                                       
+
 #define        NEW_MATCHER_RECURSE                \
                                        if (p->next_char && (*(str + 1) || (p->next_char->x[0] == '/' && p->next_char->x[1] == 0)                 \
-                                                      || p->next_char->x[0] == '!')) {                                          \
+                                                      || p->next_char->x[0] == '!')) {                                          \
                                                if (*(str + 1) || p->next_char->x[0] == '!') {                                                         \
                                                        new_find_extension(str + 1, score, p->next_char, length + 1, spec + p->specificity, callerid, label, action); \
                                                        if (score->exten)  {                                                                             \
@@ -1825,7 +1825,7 @@ static void new_find_extension(const char *str, struct scoreboard *score, struct
                                                        new_find_extension("/", score, p->next_char, length + 1, spec + p->specificity, callerid, label, action);        \
                                                        if (score->exten || ((action == E_CANMATCH || action == E_MATCHMORE) && score->canmatch)) {      \
                                                        ast_debug(4,"returning a (can/more) match--- %s\n", score->exten ? score->exten->exten :     \
-                                              "NULL");                                                                        \
+                                              "NULL");                                                                        \
                                                                return; /* the first match is all we need */                                                 \
                                                        }                                                                                                                                                \
                                                }                                                                                                    \
@@ -1837,7 +1837,7 @@ static void new_find_extension(const char *str, struct scoreboard *score, struct
                                                        return;                                                                                          \
                                                }                                                                                                                                                    \
                                        }
-                                       
+
                                        NEW_MATCHER_CHK_MATCH;
                                        NEW_MATCHER_RECURSE;
                                }
@@ -1846,7 +1846,7 @@ static void new_find_extension(const char *str, struct scoreboard *score, struct
                                        NEW_MATCHER_CHK_MATCH;
                                        NEW_MATCHER_RECURSE;
                                }
-                       } else if (p->x[0] == 'X') { 
+                       } else if (p->x[0] == 'X') {
                                if (p->x[1] == 0 && *str >= '0' && *str <= '9' ) {
                                        NEW_MATCHER_CHK_MATCH;
                                        NEW_MATCHER_RECURSE;
@@ -2054,7 +2054,7 @@ static struct match_char *add_exten_to_pattern_tree(struct ast_context *con, str
                return 0;
        }
 #ifdef NEED_DEBUG
-       ast_log(LOG_DEBUG, "Adding exten %s%c%s to tree\n", s1, e1->matchcid ? '/' : ' ', e1->matchcid ? e1->cidmatch : "");
+       ast_debug(1, "Adding exten %s%c%s to tree\n", s1, e1->matchcid ? '/' : ' ', e1->matchcid ? e1->cidmatch : "");
 #endif
        m1 = con->pattern_tree; /* each pattern starts over at the root of the pattern tree */
        m0 = &con->pattern_tree;
@@ -2180,9 +2180,9 @@ static void create_match_char_tree(struct ast_context *con)
 #ifdef NEED_DEBUG
        int biggest_bucket, resizes, numobjs, numbucks;
 
-       ast_log(LOG_DEBUG,"Creating Extension Trie for context %s(%p)\n", con->name, con);
+       ast_debug(1, "Creating Extension Trie for context %s(%p)\n", con->name, con);
        ast_hashtab_get_stats(con->root_table, &biggest_bucket, &resizes, &numobjs, &numbucks);
-       ast_log(LOG_DEBUG,"This tree has %d objects in %d bucket lists, longest list=%d objects, and has resized %d times\n",
+       ast_debug(1, "This tree has %d objects in %d bucket lists, longest list=%d objects, and has resized %d times\n",
                        numobjs, numbucks, biggest_bucket, resizes);
 #endif
        t1 = ast_hashtab_start_traversal(con->root_table);
@@ -2701,7 +2701,7 @@ struct ast_exten *pbx_find_extension(struct ast_channel *chan,
        if (!tmp->pattern_tree && tmp->root_table) {
                create_match_char_tree(tmp);
 #ifdef NEED_DEBUG
-               ast_log(LOG_DEBUG, "Tree Created in context %s:\n", context);
+               ast_debug(1, "Tree Created in context %s:\n", context);
                log_match_char_tree(tmp->pattern_tree," ");
 #endif
        }
@@ -6623,7 +6623,7 @@ static int manager_show_dialplan_helper(struct mansession *s, const struct messa
                                if (!dpc->total_items++)
                                        manager_dpsendack(s, m);
                                astman_append(s, "Event: ListDialplan\r\n%s", actionidtext);
-                               astman_append(s, "Context: %s\r\nSwitch: %s/%s\r\nRegistrar: %s\r\n", ast_get_context_name(c), ast_get_switch_name(sw), ast_get_switch_data(sw), ast_get_switch_registrar(sw)); 
+                               astman_append(s, "Context: %s\r\nSwitch: %s/%s\r\nRegistrar: %s\r\n", ast_get_context_name(c), ast_get_switch_name(sw), ast_get_switch_data(sw), ast_get_switch_registrar(sw));
                                astman_append(s, "\r\n");
                                ast_debug(3, "manager_show_dialplan: Found Switch : %s \n", ast_get_switch_name(sw));
                        }
index 3faf01b..d16424d 100644 (file)
@@ -794,9 +794,9 @@ static int ast_say_number_full_da(struct ast_channel *chan, int num, const char
                }
                if (!res) {
                        if (!ast_streamfile(chan, fn, language)) {
-                               if ((audiofd > -1) && (ctrlfd > -1)) 
+                               if ((audiofd > -1) && (ctrlfd > -1))
                                        res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
-                               else  
+                               else
                                        res = ast_waitstream(chan, ints);
                        }
                        ast_stopstream(chan);
@@ -925,9 +925,9 @@ static int ast_say_number_full_de(struct ast_channel *chan, int num, const char
                }
                if (!res) {
                        if (!ast_streamfile(chan, fn, language)) {
-                               if ((audiofd > -1) && (ctrlfd > -1)) 
+                               if ((audiofd > -1) && (ctrlfd > -1))
                                        res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
-                               else  
+                               else
                                        res = ast_waitstream(chan, ints);
                        }
                        ast_stopstream(chan);
@@ -987,7 +987,7 @@ static int ast_say_number_full_en_GB(struct ast_channel *chan, int num, const ch
                        num -= 100 * hundreds;
                        if (num)
                                playa++;
-               } else  if (num < 1000000) {
+               } else if (num < 1000000) {
                        res = ast_say_number_full_en_GB(chan, num / 1000, ints, language, audiofd, ctrlfd);
                        if (res)
                                return res;
@@ -995,7 +995,7 @@ static int ast_say_number_full_en_GB(struct ast_channel *chan, int num, const ch
                        num %= 1000;
                        if (num && num < 100)
                                playa++;
-               } else  if (num < 1000000000) {
+               } else if (num < 1000000000) {
                                int millions = num / 1000000;
                                res = ast_say_number_full_en_GB(chan, millions, ints, language, audiofd, ctrlfd);
                                if (res)
@@ -1008,12 +1008,12 @@ static int ast_say_number_full_en_GB(struct ast_channel *chan, int num, const ch
                                ast_debug(1, "Number '%d' is too big for me\n", num);
                                res = -1;
                }
-               
+
                if (!res) {
                        if (!ast_streamfile(chan, fn, language)) {
-                               if ((audiofd > -1) && (ctrlfd > -1)) 
+                               if ((audiofd > -1) && (ctrlfd > -1))
                                        res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
-                               else  
+                               else
                                        res = ast_waitstream(chan, ints);
                        }
                        ast_stopstream(chan);
@@ -1124,7 +1124,7 @@ static int ast_say_number_full_es(struct ast_channel *chan, int num, const char
                        ast_stopstream(chan);
 
                }
-                       
+
        }
        return res;
 }
@@ -1774,7 +1774,7 @@ static int ast_say_number_full_no(struct ast_channel *chan, int num, const char
                        num -= 100 * hundreds;
                        if (num)
                                playa++;
-               } else  if (num < 1000000) {
+               } else if (num < 1000000) {
                        res = ast_say_number_full_no(chan, num / 1000, ints, language, "n", audiofd, ctrlfd);
                        if (res)
                                return res;
@@ -1782,7 +1782,7 @@ static int ast_say_number_full_no(struct ast_channel *chan, int num, const char
                        num %= 1000;
                        if (num && num < 100)
                                playa++;
-               } else  if (num < 1000000000) {
+               } else if (num < 1000000000) {
                                int millions = num / 1000000;
                                res = ast_say_number_full_no(chan, millions, ints, language, "c", audiofd, ctrlfd);
                                if (res)
@@ -1795,12 +1795,12 @@ static int ast_say_number_full_no(struct ast_channel *chan, int num, const char
                                ast_debug(1, "Number '%d' is too big for me\n", num);
                                res = -1;
                }
-               
+
                if (!res) {
                        if (!ast_streamfile(chan, fn, language)) {
-                               if ((audiofd > -1) && (ctrlfd > -1)) 
+                               if ((audiofd > -1) && (ctrlfd > -1))
                                        res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
-                               else  
+                               else
                                        res = ast_waitstream(chan, ints);
                        }
                        ast_stopstream(chan);
@@ -1835,12 +1835,12 @@ static char *pl_rzad_na_tekst(odmiana *odm, int i, int rzad)
 static char* pl_append(char* buffer, char* str)
 {
        strcpy(buffer, str);
-       buffer += strlen(str); 
+       buffer += strlen(str);
        return buffer;
 }
 
 static void pl_odtworz_plik(struct ast_channel *chan, const char *language, int audiofd, int ctrlfd, const char *ints, char *fn)
-{    
+{
        char file_name[255] = "digits/";
        strcat(file_name, fn);
        ast_debug(1, "Trying to play: %s\n", file_name);
@@ -2269,7 +2269,7 @@ static int ast_say_number_full_se(struct ast_channel *chan, int num, const char
                        num %= 1000000;
                        ast_copy_string(fn, "digits/million", sizeof(fn));
                } else {        /* Miljarder - Billions */
-                       ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+                       ast_debug(1, "Number '%d' is too big for me\n", num);
                        return -1;
                }
 
@@ -2350,7 +2350,7 @@ static int ast_say_number_full_zh(struct ast_channel *chan, int num, const char
                                        snprintf(fn, sizeof(fn), "digits/%d", (num / 100));
                                        playh++;
                                        snprintf(buf, 10, "%d", num);
-                                       ast_log(LOG_DEBUG, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
+                                       ast_debug(1, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
                                        last_length = strlen(buf);
                                        num -= ((num / 100) * 100);
                                } else if (num < 10000){
@@ -2358,7 +2358,7 @@ static int ast_say_number_full_zh(struct ast_channel *chan, int num, const char
                                        snprintf(fn, sizeof(fn), "digits/%d", (num / 1000));
                                        playt++;
                                        snprintf(buf, 10, "%d", num);
-                                       ast_log(LOG_DEBUG, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
+                                       ast_debug(1, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
                                        last_length = strlen(buf);
                                        num -= ((num / 1000) * 1000);
                                } else if (num < 100000000) { /* 100,000,000 */
@@ -2366,7 +2366,7 @@ static int ast_say_number_full_zh(struct ast_channel *chan, int num, const char
                                                if (res)
                                                        return res;
                                                snprintf(buf, 10, "%d", num);
-                                               ast_log(LOG_DEBUG, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
+                                               ast_debug(1, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
                                                num -= ((num / 10000) * 10000);
                                                last_length = strlen(buf);
                                                snprintf(fn, sizeof(fn), "digits/wan");
@@ -2376,7 +2376,7 @@ static int ast_say_number_full_zh(struct ast_channel *chan, int num, const char
                                                if (res)
                                                        return res;
                                                snprintf(buf, 10, "%d", num);
-                                               ast_log(LOG_DEBUG, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
+                                               ast_debug(1, "Number '%d' %d %d\n", num, (int)strlen(buf), last_length);
                                                last_length = strlen(buf);
                                                num -= ((num / 100000000) * 100000000);
                                                snprintf(fn, sizeof(fn), "digits/yi");
@@ -2443,7 +2443,7 @@ static int ast_say_number_full_ur(struct ast_channel *chan, int num, const char
                        num = num % 10000000;
                        snprintf(fn, sizeof(fn), "digits/crore");
                } else {
-                       ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+                       ast_debug(1, "Number '%d' is too big for me\n", num);
                        res = -1;
                }
 
@@ -2536,7 +2536,7 @@ static int ast_say_number_full_ru(struct ast_channel *chan, int num, const char
                                ast_copy_string(fn, "digits/thousands", sizeof(fn));
                        }
                        num %= 1000;
-               } else  if (num < 1000000000) { /* 1,000,000,000 */
+               } else if (num < 1000000000) {  /* 1,000,000,000 */
                        lastdigits = get_lastdigits_ru(num / 1000000);
                        /* say millions */
                        res = ast_say_number_full_ru(chan, num / 1000000, ints, language, NULL, audiofd, ctrlfd);
@@ -2824,7 +2824,7 @@ static int ast_say_enumeration_full_en(struct ast_channel *chan, int num, const
                        res = ast_say_number_full_en(chan, billions, ints, language, audiofd, ctrlfd);
                        if (res)
                                return res;
-                       if (num) {                                      
+                       if (num) {
                                ast_copy_string(fn, "digits/billion", sizeof(fn));
                        } else {
                                ast_copy_string(fn, "digits/h-billion", sizeof(fn));
@@ -2994,7 +2994,7 @@ static int ast_say_enumeration_full_da(struct ast_channel *chan, int num, const
                                res = ast_say_number_full_de(chan, billions, ints, language, options, audiofd, ctrlfd);
                                if (res)
                                        return res;
-                               if (num) {                                      
+                               if (num) {
                                        ast_copy_string(fn, "digits/milliards", sizeof(fna));
                                } else {
                                        snprintf(fn, sizeof(fna), "digits/h-milliard%s", gender);
@@ -3011,9 +3011,9 @@ static int ast_say_enumeration_full_da(struct ast_channel *chan, int num, const
 
                if (!res) {
                        if (!ast_streamfile(chan, fn, language)) {
-                               if ((audiofd > -1) && (ctrlfd > -1)) 
+                               if ((audiofd > -1) && (ctrlfd > -1))
                                        res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
-                               else  
+                               else
                                        res = ast_waitstream(chan, ints);
                        }
                        ast_stopstream(chan);
@@ -3157,7 +3157,7 @@ static int ast_say_enumeration_full_de(struct ast_channel *chan, int num, const
                                res = ast_say_number_full_de(chan, billions, ints, language, options, audiofd, ctrlfd);
                                if (res)
                                        return res;
-                               if (num) {                                      
+                               if (num) {
                                        ast_copy_string(fn, "digits/milliards", sizeof(fna));
                                } else {
                                        snprintf(fn, sizeof(fna), "digits/h-milliard%s", gender);
@@ -3174,9 +3174,9 @@ static int ast_say_enumeration_full_de(struct ast_channel *chan, int num, const
 
                if (!res) {
                        if (!ast_streamfile(chan, fn, language)) {
-                               if ((audiofd > -1) && (ctrlfd > -1)) 
+                               if ((audiofd > -1) && (ctrlfd > -1))
                                        res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
-                               else  
+                               else
                                        res = ast_waitstream(chan, ints);
                        }
                        ast_stopstream(chan);
@@ -3267,7 +3267,7 @@ static int ast_say_enumeration_full_he(struct ast_channel *chan, int num, const
                        snprintf(fn, sizeof(fn), "digits/1m");
                        num = num % 1000000;
                } else {
-                       ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
+                       ast_debug(1, "Number '%d' is too big for me\n", num);
                        res = -1;
                }
                if (!res) {
@@ -4349,7 +4349,7 @@ int ast_say_date_with_format_th(struct ast_channel *chan, time_t t, const char *
        ast_localtime(&when, &tm, tzone);
 
        for (offset=0 ; format[offset] != '\0' ; offset++) {
-               ast_log(LOG_DEBUG, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
+               ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
                switch (format[offset]) {
                        /* NOTE:  if you add more options here, please try to be consistent with strftime(3) */
                        case '\'':
@@ -7250,7 +7250,7 @@ static int gr_say_number_female(int num, struct ast_channel *chan, const char *i
                res = wait_file(chan, ints, fn, lang);
        } else if (num < 13) {
                res = ast_say_number(chan, num, ints, lang, (char *) NULL);
-       } else if (num <100 ) { 
+       } else if (num <100 ) {
                tmp = (num/10) * 10;
                left = num - tmp;
                snprintf(fn, sizeof(fn), "digits/%d", tmp);
@@ -7259,7 +7259,7 @@ static int gr_say_number_female(int num, struct ast_channel *chan, const char *i
                        res = ast_waitstream(chan, ints);
                if (left)
                        gr_say_number_female(left, chan, ints, lang);
-                       
+
        } else {
                return -1;
        }
@@ -7318,7 +7318,7 @@ static int ast_say_number_full_gr(struct ast_channel *chan, int num, const char
                        snprintf(fn, sizeof(fn), "digits/xilia");
                        num %= 1000;
                } else {
-                       /* num >  1000 */ 
+                       /* num >  1000 */
                        if (num < 1000000) {
                                res = ast_say_number_full_gr(chan, (num / 1000), ints, chan->language, audiofd, ctrlfd);
                                if (res)
@@ -7337,7 +7337,7 @@ static int ast_say_number_full_gr(struct ast_channel *chan, int num, const char
                                        res = -1;
                                }
                        }
-               } 
+               }
                if (!res) {
                        if (!ast_streamfile(chan, fn, language)) {
                                if ((audiofd > -1) && (ctrlfd > -1))
@@ -7501,7 +7501,7 @@ static int ast_say_date_with_format_gr(struct ast_channel *chan, time_t t, const
                format = "AdBY 'digits/at' IMp";
 
        ast_localtime(&when, &tm, tzone);
-       
+
        for (offset=0 ; format[offset] != '\0' ; offset++) {
                ast_debug(1, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);
                switch (format[offset]) {
index e09944b..e0d7e5b 100644 (file)
@@ -346,13 +346,13 @@ static int tps_cmp_cb(void *obj, void *arg, int flags)
 static void tps_taskprocessor_destroy(void *tps)
 {
        struct ast_taskprocessor *t = tps;
-       
+
        if (!tps) {
                ast_log(LOG_ERROR, "missing taskprocessor\n");
                return;
        }
-       ast_log(LOG_DEBUG, "destroying taskprocessor '%s'\n", t->name);
-       /* kill it */   
+       ast_debug(1, "destroying taskprocessor '%s'\n", t->name);
+       /* kill it */
        ast_mutex_lock(&t->taskprocessor_lock);
        t->poll_thread_run = 0;
        ast_cond_signal(&t->poll_cond);
index d359705..bbbb590 100644 (file)
@@ -1793,7 +1793,7 @@ static char *xmldoc_build_field(const char *type, const char *name, const char *
        node = ast_xml_find_element(ast_xml_node_get_children(node), var, NULL, NULL);
 
        if (!node || !ast_xml_node_get_children(node)) {
-               ast_log(LOG_DEBUG, "Cannot find variable '%s' in tree '%s'\n", var, name);
+               ast_debug(1, "Cannot find variable '%s' in tree '%s'\n", var, name);
                return ret;
        }
 
index 9ab1463..e283127 100644 (file)
@@ -76,7 +76,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
        char *newpattern=NULL; \
        loopback_subst(buf, sizeof(buf), exten, context, priority, data); \
        loopback_parse(&newexten, &newcontext, &newpriority, &newpattern, buf); \
-       ast_log(LOG_DEBUG, "Parsed into %s @ %s priority %d\n", newexten, newcontext, newpriority); \
+       ast_debug(1, "Parsed into %s @ %s priority %d\n", newexten, newcontext, newpriority); \
        if (!strcasecmp(newcontext, context)) return -1
 
 static char *loopback_subst(char *buf, int buflen, const char *exten, const char *context, int priority, const char *data)
index bc83230..b908663 100644 (file)
@@ -432,7 +432,7 @@ static int scan_service(const char *fn, time_t now)
                now += o->retrytime;
                if (o->callingpid && (o->callingpid == ast_mainpid)) {
                        safe_append(o, time(NULL), "DelayedRetry");
-                       ast_log(LOG_DEBUG, "Delaying retry since we're currently running '%s'\n", o->fn);
+                       ast_debug(1, "Delaying retry since we're currently running '%s'\n", o->fn);
                        free_outgoing(o);
                } else {
                        /* Increment retries */
index 9438d77..88b8a6f 100644 (file)
@@ -182,18 +182,18 @@ static void ast_event_cb(const struct ast_event *ast_event, void *data)
        const char *filter_str;
        SaEvtEventIdT event_id;
 
-       ast_log(LOG_DEBUG, "Got an event to forward\n");
+       ast_debug(1, "Got an event to forward\n");
 
        if (ast_eid_cmp(&ast_eid_default, ast_event_get_ie_raw(ast_event, AST_EVENT_IE_EID))) {
                /* If the event didn't originate from this server, don't send it back out. */
-               ast_log(LOG_DEBUG, "Returning here\n");
+               ast_debug(1, "Returning here\n");
                return;
        }
 
        ais_res = saEvtEventAllocate(event_channel->handle, &event_handle);
        if (ais_res != SA_AIS_OK) {
                ast_log(LOG_ERROR, "Error allocating event: %s\n", ais_err2str(ais_res));
-               ast_log(LOG_DEBUG, "Returning here\n");
+               ast_debug(1, "Returning here\n");
                return;
        }
 
@@ -237,7 +237,7 @@ return_event_free:
        if (ais_res != SA_AIS_OK) {
                ast_log(LOG_ERROR, "Error freeing allocated event: %s\n", ais_err2str(ais_res));
        }
-       ast_log(LOG_DEBUG, "Returning here (event_free)\n");
+       ast_debug(1, "Returning here (event_free)\n");
 }
 
 static char *ais_evt_show_event_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@@ -325,7 +325,7 @@ static void add_publish_event(struct event_channel *event_channel, const char *e
        }
 
        publish_event->type = type;
-       ast_log(LOG_DEBUG, "Subscribing to event type %d\n", type);
+       ast_debug(1, "Subscribing to event type %d\n", type);
        publish_event->sub = ast_event_subscribe(type, ast_event_cb, "AIS", event_channel,
                AST_EVENT_IE_END);
        ast_event_dump_cache(publish_event->sub);
index 09cdc39..0c25c99 100644 (file)
@@ -1122,7 +1122,7 @@ static char *handle_cli_agi_add_cmd(struct ast_cli_entry *e, int cmd, struct ast
                return CLI_FAILURE;
        }
 
-       ast_log(LOG_DEBUG, "Added AGI command to channel %s queue\n", chan->name);
+       ast_debug(1, "Added AGI command to channel %s queue\n", chan->name);
 
        ast_channel_unlock(chan);
        chan = ast_channel_unref(chan);
@@ -1259,7 +1259,7 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i
        while (1) {
                /* bail out if we need to hangup */
                if (ast_check_hangup(chan)) {
-                       ast_log(LOG_DEBUG, "ast_check_hangup returned true on chan %s\n", chan->name);
+                       ast_debug(1, "ast_check_hangup returned true on chan %s\n", chan->name);
                        break;
                }
                /* retrieve a command
@@ -1296,21 +1296,21 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i
                        /* no command so far, wait a bit for a frame to read */
                        res = ast_waitfor(chan, timeout);
                        if (res < 0) {
-                               ast_log(LOG_DEBUG, "ast_waitfor returned <= 0 on chan %s\n", chan->name);
+                               ast_debug(1, "ast_waitfor returned <= 0 on chan %s\n", chan->name);
                                break;
                        }
                        if (res == 0)
                                continue;
                        f = ast_read(chan);
                        if (!f) {
-                               ast_log(LOG_DEBUG, "No frame read on channel %s, going out ...\n", chan->name);
+                               ast_debug(1, "No frame read on channel %s, going out ...\n", chan->name);
                                returnstatus = AGI_RESULT_HANGUP;
                                break;
                        }
                        /* is there any other frame we should care about
                           besides AST_CONTROL_HANGUP? */
                        if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_HANGUP) {
-                               ast_log(LOG_DEBUG, "Got HANGUP frame on channel %s, going out ...\n", chan->name);
+                               ast_debug(1, "Got HANGUP frame on channel %s, going out ...\n", chan->name);
                                ast_frfree(f);
                                break;
                        }
index 1907583..adfdacb 100644 (file)
@@ -159,7 +159,7 @@ static int semicolon_count_str(const char *somestr)
        }
 
        return count;
-} 
+}
 
 /* takes a linked list of \a ast_variable variables, finds the one with the name variable_value
  * and returns the number of semicolons in the value for that \a ast_variable
@@ -399,19 +399,18 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
        i = 0;
 
        /* For each static realtime variable we may create several entries in the \a vars array if it's delimited */
-       for (entry_index = 0; ldap_entry; ) { 
+       for (entry_index = 0; ldap_entry; ) {
                int pos = 0;
                delim_value = NULL;
                delim_tot_count = 0;
                delim_count = 0;
-               
+
                do { /* while delim_count */
 
                        /* Starting new static var */
                        char *ldap_attribute_name = ldap_first_attribute(ldapConn, ldap_entry, &ber);
                        struct berval *value;
                        while (ldap_attribute_name) {
-                       
                                const char *attribute_name = convert_attribute_name_from_ldap(table_config, ldap_attribute_name);
                                int is_realmed_password_attribute = strcasecmp(attribute_name, "md5secret") == 0;
                                struct berval **values = NULL;
@@ -431,7 +430,7 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
                                                        ast_debug(2, "md5: %s\n", valptr);
                                                }
                                                if (valptr) {
-                                                       if (delim_value == NULL && !is_realmed_password_attribute 
+                                                       if (delim_value == NULL && !is_realmed_password_attribute
                                                                && (static_table_config != table_config || strcmp(attribute_name, "variable_value") == 0)) {
 
                                                                delim_value = ast_strdup(valptr);
@@ -442,7 +441,7 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
                                                                }
                                                        }
 
-                                                       if (is_delimited != 0 && !is_realmed_password_attribute 
+                                                       if (is_delimited != 0 && !is_realmed_password_attribute
                                                                && (static_table_config != table_config || strcmp(attribute_name, "variable_value") == 0) ) {
                                                                /* for non-Static RealTime, first */
 
@@ -452,7 +451,7 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
                                                                                delim_value[i] = '\0';
 
                                                                                ast_debug(2, "LINE(%d) DELIM - attribute_name: %s value: %s pos: %d\n", __LINE__, attribute_name, &delim_value[pos], pos);
-                                                       
+
                                                                                if (prev) {
                                                                                        prev->next = ast_variable_new(attribute_name, &delim_value[pos], table_config->table_name);
                                                                                        if (prev->next) {
@@ -486,7 +485,7 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
                                                                }
                                                                free(delim_value);
                                                                delim_value = NULL;
-                                                               
+
                                                                ast_debug(4, "LINE(%d) DELIM pos: %d i: %d\n", __LINE__, pos, i);
                                                        } else {
                                                                /* not delimited */
@@ -530,7 +529,7 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
 
                if (static_table_config != table_config) {
                        ast_debug(3, "LINE(%d) Added to vars - non static\n", __LINE__);
-                               
+
                        vars[entry_index++] = var;
                        prev = NULL;
                }
@@ -805,7 +804,7 @@ static struct ast_variable **realtime_ldap_base_ap(unsigned int *entries_count_p
                                  LDAP_SCOPE_SUBTREE, ast_str_buffer(filter), NULL, 0, NULL, NULL, NULL, LDAP_NO_LIMIT,
                                  &ldap_result_msg);
                if (result != LDAP_SUCCESS && is_ldap_connect_error(result)) {
-                       ast_log(LOG_DEBUG, "Failed to query directory. Try %d/10\n", tries + 1);
+                       ast_debug(1, "Failed to query directory. Try %d/10\n", tries + 1);
                        if (++tries < 10) {
                                usleep(1);
                                if (ldapConn) {
@@ -1084,7 +1083,7 @@ static struct ast_config *config_ldap(const char *basedn, const char *table_name
                struct ast_variable *var_val = variable_named(*p, "variable_value");
                struct ast_variable *var_metric = variable_named(*p, "var_metric");
                struct ast_variable *dn = variable_named(*p, "dn");
-                       
+
                ast_debug(3, "category: %s\n", category->value);
                ast_debug(3, "var_name: %s\n", var_name->value);
                ast_debug(3, "var_val: %s\n", var_val->value);
@@ -1503,7 +1502,7 @@ static int update2_ldap(const char *basedn, const char *table_name, va_list ap)
 
                ldap_entry = ldap_first_entry(ldapConn, ldap_result_msg);
 
-               for (i = 0; ldap_entry; i++) { 
+               for (i = 0; ldap_entry; i++) {
                        dn = ldap_get_dn(ldapConn, ldap_entry);
                        if ((error = ldap_modify_ext_s(ldapConn, dn, ldap_mods, NULL, NULL)) != LDAP_SUCCESS)  {
                                ast_log(LOG_ERROR, "Couldn't modify dn:%s because %s", dn, ldap_err2string(error));
index 5fff5d8..e2d93d3 100644 (file)
@@ -123,7 +123,7 @@ static void process_message_callback(GMimeObject *part, gpointer user_data)
                return;
        } else if (GMIME_IS_MULTIPART(part)) {
                GList *l;
-               
+
                ast_log(LOG_WARNING, "Got unexpected GMIME_IS_MULTIPART, trying to process subparts\n");
                l = GMIME_MULTIPART(part)->subparts;
                while (l) {
@@ -365,9 +365,7 @@ static int http_post_callback(struct ast_tcptls_session_instance *ser, const str
        fprintf(f, "\r\n");
 
        if (0 > readmimefile(ser->f, f, boundary_marker, content_len)) {
-               if (option_debug) {
-                       ast_log(LOG_DEBUG, "Cannot find boundary marker in POST request.\n");
-               }
+               ast_debug(1, "Cannot find boundary marker in POST request.\n");
                fclose(f);
 
                return -1;
index a05e78f..75ea729 100644 (file)
@@ -3158,7 +3158,7 @@ static void aji_mwi_cb(const struct ast_event *ast_event, void *data)
        if (ast_eid_cmp(&ast_eid_default, ast_event_get_ie_raw(ast_event, AST_EVENT_IE_EID)))
        {
                /* If the event didn't originate from this server, don't send it back out. */
-               ast_log(LOG_DEBUG, "Returning here\n");
+               ast_debug(1, "Returning here\n");
                return;
        }
 
@@ -3186,7 +3186,7 @@ static void aji_devstate_cb(const struct ast_event *ast_event, void *data)
        if (ast_eid_cmp(&ast_eid_default, ast_event_get_ie_raw(ast_event, AST_EVENT_IE_EID)))
        {
                /* If the event didn't originate from this server, don't send it back out. */
-               ast_log(LOG_DEBUG, "Returning here\n");
+               ast_debug(1, "Returning here\n");
                return;
        }
 
@@ -3246,7 +3246,7 @@ static int aji_handle_pubsub_event(void *data, ikspak *pak)
        item_content = iks_child(item);
        ast_str_to_eid(&pubsub_eid, iks_find_attrib(item_content, "eid"));
        if (!ast_eid_cmp(&ast_eid_default, &pubsub_eid)) {
-               ast_log(LOG_DEBUG, "Returning here, eid of incoming event matches ours!\n");
+               ast_debug(1, "Returning here, eid of incoming event matches ours!\n");
                return IKS_FILTER_EAT;
        }
        if (!strcasecmp(iks_name(item_content), "state")) {
@@ -3271,7 +3271,7 @@ static int aji_handle_pubsub_event(void *data, ikspak *pak)
                        return IKS_FILTER_EAT;
                }
        } else {
-               ast_log(LOG_DEBUG, "Don't know how to handle PubSub event of type %s\n",
+               ast_debug(1, "Don't know how to handle PubSub event of type %s\n",
                        iks_name(item_content));
                return IKS_FILTER_EAT;
        }
index 1d7aead..f5bc2ab 100644 (file)
@@ -343,10 +343,10 @@ static int ast_moh_files_next(struct ast_channel *chan)
        return 0;
 }
 
-static struct ast_frame *moh_files_readframe(struct ast_channel *chan) 
+static struct ast_frame *moh_files_readframe(struct ast_channel *chan)
 {
        struct ast_frame *f = NULL;
-       
+
        if (!(chan->stream && (f = ast_readframe(chan->stream)))) {
                if (!ast_moh_files_next(chan))
                        f = ast_readframe(chan->stream);
@@ -842,7 +842,7 @@ static struct mohclass *_get_mohbyname(const char *name, int warn, int flags, co
 #endif
 
        if (!moh && warn) {
-               ast_log(LOG_DEBUG, "Music on Hold class '%s' not found in memory\n", name);
+               ast_debug(1, "Music on Hold class '%s' not found in memory\n", name);
        }
 
        return moh;
@@ -851,11 +851,11 @@ static struct mohclass *_get_mohbyname(const char *name, int warn, int flags, co
 static struct mohdata *mohalloc(struct mohclass *cl)
 {
        struct mohdata *moh;
-       long flags;     
-       
+       long flags;
+
        if (!(moh = ast_calloc(1, sizeof(*moh))))
                return NULL;
-       
+
        if (pipe(moh->pipe)) {
                ast_log(LOG_WARNING, "Failed to create pipe: %s\n", strerror(errno));
                ast_free(moh);
@@ -1537,7 +1537,7 @@ static void moh_class_destructor(void *obj)
                char buff[8192];
                int bytes, tbytes = 0, stime = 0, pid = 0;
 
-               ast_log(LOG_DEBUG, "killing %d!\n", class->pid);
+               ast_debug(1, "killing %d!\n", class->pid);
 
                stime = time(NULL) + 2;
                pid = class->pid;
@@ -1571,7 +1571,7 @@ static void moh_class_destructor(void *obj)
                        tbytes = tbytes + bytes;
                }
 
-               ast_log(LOG_DEBUG, "mpg123 pid %d and child died after %d bytes read\n", pid, tbytes);
+               ast_debug(1, "mpg123 pid %d and child died after %d bytes read\n", pid, tbytes);
 
                close(class->srcfd);
        }
index 67ba311..84d7284 100644 (file)
@@ -1435,15 +1435,15 @@ static odbc_status odbc_obj_disconnect(struct odbc_obj *obj)
 
        if (obj->parent) {
                if (res == SQL_SUCCESS || res == SQL_SUCCESS_WITH_INFO) {
-                       ast_log(LOG_DEBUG, "Disconnected %d from %s [%s]\n", res, obj->parent->name, obj->parent->dsn);
+                       ast_debug(1, "Disconnected %d from %s [%s]\n", res, obj->parent->name, obj->parent->dsn);
                } else {
-                       ast_log(LOG_DEBUG, "res_odbc: %s [%s] already disconnected\n", obj->parent->name, obj->parent->dsn);
+                       ast_debug(1, "res_odbc: %s [%s] already disconnected\n", obj->parent->name, obj->parent->dsn);
                }
        }
 
        if ((res = SQLFreeHandle(SQL_HANDLE_DBC, obj->con) == SQL_SUCCESS)) {
                obj->con = NULL;
-               ast_log(LOG_DEBUG, "Database handle deallocated\n");
+               ast_debug(1, "Database handle deallocated\n");
        } else {
                SQLGetDiagRec(SQL_HANDLE_DBC, obj->con, 1, state, &err, msg, 100, &mlen);
                ast_log(LOG_WARNING, "Unable to deallocate database handle? %d errno=%d %s\n", res, (int)err, msg);
index f91cdb1..0082fda 100644 (file)
@@ -1127,7 +1127,7 @@ static int ast_rtp_raw_write(struct ast_rtp_instance *instance, struct ast_frame
                                          strerror(errno));
                        } else if (((ast_test_flag(rtp, FLAG_NAT_ACTIVE) == FLAG_NAT_INACTIVE) || rtpdebug) && !ast_test_flag(rtp, FLAG_NAT_INACTIVE_NOWARN)) {
                                /* Only give this error message once if we are not RTP debugging */
-                               if (option_debug || rtpdebug)
+                               if (rtpdebug)
                                        ast_debug(0, "RTP NAT: Can't write RTP to private address %s, waiting for other end to send audio...\n",
                                                  ast_sockaddr_stringify(&remote_address));
                                ast_set_flag(rtp, FLAG_NAT_INACTIVE_NOWARN);
@@ -1417,7 +1417,7 @@ static void process_dtmf_rfc2833(struct ast_rtp_instance *instance, unsigned cha
        }
 
        /* Print out debug if turned on */
-       if (rtpdebug || option_debug > 2)
+       if (rtpdebug)
                ast_debug(0, "- RTP 2833 Event: %08x (len = %d)\n", event, len);
 
        /* Figure out what digit was pressed */
@@ -1433,7 +1433,7 @@ static void process_dtmf_rfc2833(struct ast_rtp_instance *instance, unsigned cha
                resp = 'X';
        } else {
                /* Not a supported event */
-               ast_log(LOG_DEBUG, "Ignoring RTP 2833 Event: %08x. Not a DTMF Digit.\n", event);
+               ast_debug(1, "Ignoring RTP 2833 Event: %08x. Not a DTMF Digit.\n", event);
                return;
        }
 
@@ -1563,7 +1563,7 @@ static struct ast_frame *process_dtmf_cisco(struct ast_rtp_instance *instance, u
        power = data[2];
        event = data[3] & 0x1f;
 
-       if (option_debug > 2 || rtpdebug)
+       if (rtpdebug)
                ast_debug(0, "Cisco DTMF Digit: %02x (len=%d, seq=%d, flags=%02x, power=%d, history count=%d)\n", event, len, seq, flags, power, (len - 4) / 2);
        if (event < 10) {
                resp = '0' + event;
@@ -1663,7 +1663,7 @@ static struct ast_frame *ast_rtcp_read(struct ast_rtp_instance *instance)
                /* Send to whoever sent to us */
                if (ast_sockaddr_cmp(&rtp->rtcp->them, &addr)) {
                        ast_sockaddr_copy(&rtp->rtcp->them, &addr);
-                       if (option_debug || rtpdebug)
+                       if (rtpdebug)
                                ast_debug(0, "RTCP NAT: Got RTCP from other end. Now sending to address %s\n",
                                          ast_sockaddr_stringify(&rtp->rtcp->them));
                }
@@ -1685,8 +1685,8 @@ static struct ast_frame *ast_rtcp_read(struct ast_rtp_instance *instance)
                length &= 0xffff;
 
                if ((i + length) > packetwords) {
-                       if (option_debug || rtpdebug)
-                               ast_log(LOG_DEBUG, "RTCP Read too short\n");
+                       if (rtpdebug)
+                               ast_debug(1, "RTCP Read too short\n");
                        return &ast_null_frame;
                }
 
@@ -2068,7 +2068,7 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc
                        }
                        rtp->rxseqno = 0;
                        ast_set_flag(rtp, FLAG_NAT_ACTIVE);
-                       if (option_debug || rtpdebug)
+                       if (rtpdebug)
                                ast_debug(0, "RTP NAT: Got audio from other end. Now sending to address %s\n",
                                          ast_sockaddr_stringify(&remote_address));
                }
@@ -2103,7 +2103,7 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc
                };
 
                if (!mark) {
-                       if (option_debug || rtpdebug) {
+                       if (rtpdebug) {
                                ast_debug(1, "Forcing Marker bit, because SSRC has changed\n");
                        }
                        mark = 1;
index 19b049f..3c1ce4c 100644 (file)
@@ -289,16 +289,16 @@ static int smdi_toggle_mwi(struct ast_smdi_interface *iface, const char *mailbox
 {
        FILE *file;
        int i;
-       
+
        if (!(file = fopen(iface->name, "w"))) {
                ast_log(LOG_ERROR, "Error opening SMDI interface %s (%s) for writing\n", iface->name, strerror(errno));
                return 1;
-       }       
-       
+       }
+
        ASTOBJ_WRLOCK(iface);
-       
+
        fprintf(file, "%s:MWI ", on ? "OP" : "RMV");
-       
+
        for (i = 0; i < iface->msdstrip; i++)
                fprintf(file, "0");
 
@@ -643,71 +643,71 @@ static void *smdi_read(void *iface_p)
        char *cp = NULL;
        int i;
        int start = 0;
-               
+
        /* read an smdi message */
        while ((c = fgetc(iface->file))) {
 
                /* check if this is the start of a message */
                if (!start) {
                        if (c == 'M') {
-                               ast_log(LOG_DEBUG, "Read an 'M' to start an SMDI message\n");
+                               ast_debug(1, "Read an 'M' to start an SMDI message\n");
                                start = 1;
                        }
                        continue;
                }
-               
+
                if (c == 'D') { /* MD message */
                        start = 0;
 
-                       ast_log(LOG_DEBUG, "Read a 'D' ... it's an MD message.\n");
+                       ast_debug(1, "Read a 'D' ... it's an MD message.\n");
 
                        if (!(md_msg = ast_calloc(1, sizeof(*md_msg)))) {
                                ASTOBJ_UNREF(iface, ast_smdi_interface_destroy);
                                return NULL;
                        }
-                       
+
                        ASTOBJ_INIT(md_msg);
 
                        /* read the message desk number */
                        for (i = 0; i < sizeof(md_msg->mesg_desk_num) - 1; i++) {
                                md_msg->mesg_desk_num[i] = fgetc(iface->file);
-                               ast_log(LOG_DEBUG, "Read a '%c'\n", md_msg->mesg_desk_num[i]);
+                               ast_debug(1, "Read a '%c'\n", md_msg->mesg_desk_num[i]);
                        }
 
                        md_msg->mesg_desk_num[sizeof(md_msg->mesg_desk_num) - 1] = '\0';
-                       
-                       ast_log(LOG_DEBUG, "The message desk number is '%s'\n", md_msg->mesg_desk_num);
+
+                       ast_debug(1, "The message desk number is '%s'\n", md_msg->mesg_desk_num);
 
                        /* read the message desk terminal number */
                        for (i = 0; i < sizeof(md_msg->mesg_desk_term) - 1; i++) {
                                md_msg->mesg_desk_term[i] = fgetc(iface->file);
-                               ast_log(LOG_DEBUG, "Read a '%c'\n", md_msg->mesg_desk_term[i]);
+                               ast_debug(1, "Read a '%c'\n", md_msg->mesg_desk_term[i]);
                        }
 
                        md_msg->mesg_desk_term[sizeof(md_msg->mesg_desk_term) - 1] = '\0';
 
-                       ast_log(LOG_DEBUG, "The message desk terminal is '%s'\n", md_msg->mesg_desk_term);
+                       ast_debug(1, "The message desk terminal is '%s'\n", md_msg->mesg_desk_term);
 
                        /* read the message type */
                        md_msg->type = fgetc(iface->file);
-                
-                       ast_log(LOG_DEBUG, "Message type is '%c'\n", md_msg->type);
+
+                       ast_debug(1, "Message type is '%c'\n", md_msg->type);
 
                        /* read the forwarding station number (may be blank) */
                        cp = &md_msg->fwd_st[0];
                        for (i = 0; i < sizeof(md_msg->fwd_st) - 1; i++) {
                                if ((c = fgetc(iface->file)) == ' ') {
                                        *cp = '\0';
-                                       ast_log(LOG_DEBUG, "Read a space, done looking for the forwarding station\n");
+                                       ast_debug(1, "Read a space, done looking for the forwarding station\n");
                                        break;
                                }
 
                                /* store c in md_msg->fwd_st */
                                if (i >= iface->msdstrip) {