]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Replace direct checks of option_debug with DEBUG_ATLEAST macro.
authorCorey Farrell <git@cfware.com>
Wed, 7 Mar 2018 06:29:13 +0000 (01:29 -0500)
committerCorey Farrell <git@cfware.com>
Wed, 7 Mar 2018 22:02:49 +0000 (17:02 -0500)
Checking option_debug directly is incorrect as it ignores file/module
specific debug settings.  This system-wide change replaces nearly all
direct checks for option_debug with the DEBUG_ATLEAST macro.

Change-Id: Ic342d4799a945dbc40ac085ac142681094a4ebf0

16 files changed:
addons/chan_ooh323.c
apps/app_directory.c
apps/app_minivm.c
apps/app_voicemail.c
cdr/cdr_pgsql.c
cel/cel_pgsql.c
channels/chan_dahdi.c
channels/chan_sip.c
main/callerid.c
main/config.c
main/netsock2.c
main/pbx.c
main/sched.c
res/res_config_ldap.c
res/res_config_pgsql.c
res/res_rtp_asterisk.c

index 5d5f5fe997adaae9d13a6e7e5ae771bfa7fd16d3..91f6e8fa9b51eeb6bec8d9008f5b5323fb569d3e 100644 (file)
@@ -1174,8 +1174,7 @@ static int ooh323_answer(struct ast_channel *ast)
                                p->alertsent = 1;
                        }
                        ast_setstate(ast, AST_STATE_UP);
-                       if (option_debug)
-                               ast_debug(1, "ooh323_answer(%s)\n", ast_channel_name(ast));
+                       ast_debug(1, "ooh323_answer(%s)\n", ast_channel_name(ast));
                        ast_channel_unlock(ast);
                        ooAnswerCall(p->callToken);
                }
index f644d9c68280a163d372c02acc98e5559c90b300..d2f479c09b3e97bd4b366d6e133bf79e4af17d8e 100644 (file)
@@ -817,10 +817,10 @@ static int do_directory(struct ast_channel *chan, struct ast_config *vmcfg, stru
        /* Sort items */
        sort_items(sorted, count);
 
-       if (option_debug) {
-               ast_debug(2, "Listing matching entries:\n");
+       if (DEBUG_ATLEAST(2)) {
+               ast_log(LOG_DEBUG, "Listing matching entries:\n");
                for (ptr = sorted, i = 0; i < count; i++, ptr++) {
-                       ast_debug(2, "%s: %s\n", ptr[0]->exten, ptr[0]->name);
+                       ast_log(LOG_DEBUG, "%s: %s\n", ptr[0]->exten, ptr[0]->name);
                }
        }
 
index 2c57e04dc8137ad0acf5466edf285cb55cdda877..a3dcef8a70195a9326e33efabb1e27008fd0f327 100644 (file)
@@ -1440,7 +1440,7 @@ static int sendmail(struct minivm_template *template, struct minivm_account *vmu
                ast_debug(1, "Using default subject for this email \n");
        }
 
-       if (option_debug > 2)
+       if (DEBUG_ATLEAST(3))
                fprintf(p, "X-Asterisk-debug: template %s user account %s@%s\n", template->name, vmu->username, vmu->domain);
        fprintf(p, "MIME-Version: 1.0\n");
 
index db6b75741b9ce9cca8cbbe65103aed59aacb7db1..089e7d21be74221168b171a4a10389a00469d490 100644 (file)
@@ -3640,7 +3640,7 @@ static void set_update(MAILSTREAM * stream)
        char buf[1024] = "";
 
        if (!(user = get_user_by_mailbox(mailbox, buf, sizeof(buf))) || !(vms = get_vm_state_by_imapuser(user, 0))) {
-               if (user && option_debug > 2)
+               if (user && DEBUG_ATLEAST(3))
                        ast_log(AST_LOG_WARNING, "User %s mailbox not found for update.\n", user);
                return;
        }
index 4430e51053aa9e1e5a004fde1e708f264d69bc3e..064ffb32bf3291111c6114c8aacca4180fb2e0ff 100644 (file)
@@ -649,20 +649,20 @@ static int config_module(int reload)
                return -1;
        }
 
-       if (option_debug) {
+       if (DEBUG_ATLEAST(1)) {
                if (ast_strlen_zero(pghostname)) {
-                       ast_debug(1, "using default unix socket\n");
+                       ast_log(LOG_DEBUG, "using default unix socket\n");
                } else {
-                       ast_debug(1, "got hostname of %s\n", pghostname);
+                       ast_log(LOG_DEBUG, "got hostname of %s\n", pghostname);
                }
-               ast_debug(1, "got port of %s\n", pgdbport);
-               ast_debug(1, "got user of %s\n", pgdbuser);
-               ast_debug(1, "got dbname of %s\n", pgdbname);
-               ast_debug(1, "got password of %s\n", pgpassword);
-               ast_debug(1, "got application name of %s\n", pgappname);
-               ast_debug(1, "got sql table name of %s\n", table);
-               ast_debug(1, "got encoding of %s\n", encoding);
-               ast_debug(1, "got timezone of %s\n", tz);
+               ast_log(LOG_DEBUG, "got port of %s\n", pgdbport);
+               ast_log(LOG_DEBUG, "got user of %s\n", pgdbuser);
+               ast_log(LOG_DEBUG, "got dbname of %s\n", pgdbname);
+               ast_log(LOG_DEBUG, "got password of %s\n", pgpassword);
+               ast_log(LOG_DEBUG, "got application name of %s\n", pgappname);
+               ast_log(LOG_DEBUG, "got sql table name of %s\n", table);
+               ast_log(LOG_DEBUG, "got encoding of %s\n", encoding);
+               ast_log(LOG_DEBUG, "got timezone of %s\n", tz);
        }
 
        pgsql_reconnect();
index a79bfab748d3df1cc73464cf033f06f60169ff20..3f257aea64099cc61b898c8983eca826ffc2dc96 100644 (file)
@@ -534,18 +534,18 @@ static int process_my_load_module(struct ast_config *cfg)
        if ((tmp = ast_variable_retrieve(cfg, "global", "show_user_defined"))) {
                cel_show_user_def = ast_true(tmp) ? 1 : 0;
        }
-       if (option_debug) {
+       if (DEBUG_ATLEAST(3)) {
                if (ast_strlen_zero(pghostname)) {
-                       ast_debug(3, "cel_pgsql: using default unix socket\n");
+                       ast_log(LOG_DEBUG, "cel_pgsql: using default unix socket\n");
                } else {
-                       ast_debug(3, "cel_pgsql: got hostname of %s\n", pghostname);
+                       ast_log(LOG_DEBUG, "cel_pgsql: got hostname of %s\n", pghostname);
                }
-               ast_debug(3, "cel_pgsql: got port of %s\n", pgdbport);
-               ast_debug(3, "cel_pgsql: got user of %s\n", pgdbuser);
-               ast_debug(3, "cel_pgsql: got dbname of %s\n", pgdbname);
-               ast_debug(3, "cel_pgsql: got password of %s\n", pgpassword);
-               ast_debug(3, "cel_pgsql: got sql table name of %s\n", table);
-               ast_debug(3, "cel_pgsql: got show_user_defined of %s\n",
+               ast_log(LOG_DEBUG, "cel_pgsql: got port of %s\n", pgdbport);
+               ast_log(LOG_DEBUG, "cel_pgsql: got user of %s\n", pgdbuser);
+               ast_log(LOG_DEBUG, "cel_pgsql: got dbname of %s\n", pgdbname);
+               ast_log(LOG_DEBUG, "cel_pgsql: got password of %s\n", pgpassword);
+               ast_log(LOG_DEBUG, "cel_pgsql: got sql table name of %s\n", table);
+               ast_log(LOG_DEBUG, "cel_pgsql: got show_user_defined of %s\n",
                        cel_show_user_def ? "Yes" : "No");
        }
 
index d5e79ffcfb114a5b9ceecbb13023ed6f319b32ab..866926736cab256572ee427db35195107c2ec631 100644 (file)
@@ -15167,14 +15167,14 @@ retry:
                ast_mutex_lock(&p->lock);
                if (p->owner && !p->restartpending) {
                        if (ast_channel_trylock(p->owner)) {
-                               if (option_debug > 2)
+                               if (DEBUG_ATLEAST(3))
                                        ast_verbose("Avoiding deadlock\n");
                                /* Avoid deadlock since you're not supposed to lock iflock or pvt before a channel */
                                ast_mutex_unlock(&p->lock);
                                ast_mutex_unlock(&iflock);
                                goto retry;
                        }
-                       if (option_debug > 2)
+                       if (DEBUG_ATLEAST(3))
                                ast_verbose("Softhanging up on %s\n", ast_channel_name(p->owner));
                        ast_softhangup_nolock(p->owner, AST_SOFTHANGUP_EXPLICIT);
                        p->restartpending = 1;
index 0a5caecb96111ed4263f58b4f8509a52152e73de..1ec44969504aa5101c9bb671e5460ebc0e14f9c5 100644 (file)
@@ -22332,7 +22332,7 @@ static void sip_dump_history(struct sip_pvt *dialog)
                return;
        }
 
-       if (!option_debug && !sipdebug) {
+       if (!sipdebug && !DEBUG_ATLEAST(1)) {
                if (!errmsg) {
                        ast_log(LOG_NOTICE, "You must have debugging enabled (SIP or Asterisk) in order to dump SIP history.\n");
                        errmsg = 1;
@@ -22340,20 +22340,20 @@ static void sip_dump_history(struct sip_pvt *dialog)
                return;
        }
 
-       ast_debug(1, "\n---------- SIP HISTORY for '%s' \n", dialog->callid);
+       ast_log(LOG_DEBUG, "\n---------- SIP HISTORY for '%s' \n", dialog->callid);
        if (dialog->subscribed) {
-               ast_debug(1, "  * Subscription\n");
+               ast_log(LOG_DEBUG, "  * Subscription\n");
        } else {
-               ast_debug(1, "  * SIP Call\n");
+               ast_log(LOG_DEBUG, "  * SIP Call\n");
        }
        if (dialog->history) {
                AST_LIST_TRAVERSE(dialog->history, hist, list)
-                       ast_debug(1, "  %-3.3d. %s\n", ++x, hist->event);
+                       ast_log(LOG_DEBUG, "  %-3.3d. %s\n", ++x, hist->event);
        }
        if (!x) {
-               ast_debug(1, "Call '%s' has no history\n", dialog->callid);
+               ast_log(LOG_DEBUG, "Call '%s' has no history\n", dialog->callid);
        }
-       ast_debug(1, "\n---------- END SIP HISTORY for '%s' \n", dialog->callid);
+       ast_log(LOG_DEBUG, "\n---------- END SIP HISTORY for '%s' \n", dialog->callid);
 }
 
 
index a9864da4004f0d1b4a1ed68c59d79d4d0995ea86..a411bd3178d546db8580636f93dffb9f6a23aaec 100644 (file)
@@ -503,7 +503,7 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s
                                                case 0x06: /* short dial number */
                                                case 0x07: /* reserved */
                                                default:   /* reserved */
-                                                       if (option_debug > 1)
+                                                       if (DEBUG_ATLEAST(2))
                                                                ast_log(LOG_NOTICE, "did info:#1=%X\n", (unsigned)cid->rawdata[x]);
                                                        break ;
                                                }
index eec6c0260b18bd35f18bd6f58d9a3802f9e2603b..6bc1eda703fc9c6547553f40b1a0db3b5140b726 100644 (file)
@@ -2787,9 +2787,7 @@ int ast_config_text_file_save2(const char *configfile, const struct ast_config *
                        }
                        cat = cat->next;
                }
-               if (!option_debug) {
-                       ast_verb(2, "Saving '%s': saved\n", fn);
-               }
+               ast_verb(2, "Saving '%s': saved\n", fn);
        } else {
                ast_debug(1, "Unable to open for writing: %s\n", fn);
                ast_verb(2, "Unable to write '%s' (%s)\n", fn, strerror(errno));
index 5f94a750af6fc838ac1e2d592cda59f7392c4d32..90835c32f7c437cc6c035015856963b7e8992f2c 100644 (file)
@@ -445,7 +445,7 @@ uint16_t _ast_sockaddr_port(const struct ast_sockaddr *addr, const char *file, i
                && addr->ss.ss_family == AF_INET6) {
                return ntohs(((struct sockaddr_in6 *)&addr->ss)->sin6_port);
        }
-       if (option_debug >= 1) {
+       if (DEBUG_ATLEAST(1)) {
                ast_log(__LOG_DEBUG, file, line, func, "Not an IPv4 nor IPv6 address, cannot get port.\n");
        }
        return 0;
@@ -463,7 +463,7 @@ void _ast_sockaddr_set_port(struct ast_sockaddr *addr, uint16_t port, const char
        } else if (addr->len == sizeof(struct sockaddr_in6)
                && addr->ss.ss_family == AF_INET6) {
                ((struct sockaddr_in6 *)&addr->ss)->sin6_port = htons(port);
-       } else if (option_debug >= 1) {
+       } else if (DEBUG_ATLEAST(1)) {
                ast_log(__LOG_DEBUG, file, line, func,
                        "Not an IPv4 nor IPv6 address, cannot set port.\n");
        }
@@ -659,7 +659,7 @@ int _ast_sockaddr_to_sin(const struct ast_sockaddr *addr,
                return 0;
        }
 
-       if (addr->ss.ss_family != AF_INET && option_debug >= 1) {
+       if (addr->ss.ss_family != AF_INET && DEBUG_ATLEAST(1)) {
                ast_log(__LOG_DEBUG, file, line, func, "Address family is not AF_INET\n");
        }
 
@@ -672,7 +672,7 @@ void _ast_sockaddr_from_sin(struct ast_sockaddr *addr, const struct sockaddr_in
 {
        memcpy(&addr->ss, sin, sizeof(*sin));
 
-       if (addr->ss.ss_family != AF_INET && option_debug >= 1) {
+       if (addr->ss.ss_family != AF_INET && DEBUG_ATLEAST(1)) {
                ast_log(__LOG_DEBUG, file, line, func, "Address family is not AF_INET\n");
        }
 
index 8e588198af19cee6e5f826af923763c88ba194a8..b4599de0ee5506e775caaa42e10f45a761e78b7e 100644 (file)
@@ -7424,13 +7424,13 @@ static int ast_add_extension2_lockopt(struct ast_context *con,
                        ast_add_hint(tmp);
                }
        }
-       if (option_debug) {
+       if (DEBUG_ATLEAST(1)) {
                if (tmp->matchcid == AST_EXT_MATCHCID_ON) {
-                       ast_debug(1, "Added extension '%s' priority %d (CID match '%s') to %s (%p)\n",
-                                         tmp->name, tmp->priority, tmp->cidmatch_display, con->name, con);
+                       ast_log(LOG_DEBUG, "Added extension '%s' priority %d (CID match '%s') to %s (%p)\n",
+                               tmp->name, tmp->priority, tmp->cidmatch_display, con->name, con);
                } else {
-                       ast_debug(1, "Added extension '%s' priority %d to %s (%p)\n",
-                                         tmp->name, tmp->priority, con->name, con);
+                       ast_log(LOG_DEBUG, "Added extension '%s' priority %d to %s (%p)\n",
+                               tmp->name, tmp->priority, con->name, con);
                }
        }
 
index 222c69183ab82471a9074d13e82597f6939ea4d1..9729ccbc8d54e5999a769253710c2054b81d34a3 100644 (file)
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #ifdef DEBUG_SCHEDULER
-#define DEBUG(a) do { \
-       if (option_debug) \
-               DEBUG_M(a) \
-       } while (0)
+#define DEBUG(a) a
 #else
 #define DEBUG(a)
 #endif
@@ -550,8 +547,7 @@ int ast_sched_add_variable(struct ast_sched_context *con, int when, ast_sched_cb
        }
 #ifdef DUMP_SCHEDULER
        /* Dump contents of the context while we have the lock so nothing gets screwed up by accident. */
-       if (option_debug)
-               ast_sched_dump(con);
+       ast_sched_dump(con);
 #endif
        if (con->sched_thread) {
                ast_cond_signal(&con->sched_thread->cond);
@@ -651,8 +647,7 @@ int _ast_sched_del(struct ast_sched_context *con, int id, const char *file, int
 
 #ifdef DUMP_SCHEDULER
        /* Dump contents of the context while we have the lock so nothing gets screwed up by accident. */
-       if (option_debug)
-               ast_sched_dump(con);
+       ast_sched_dump(con);
 #endif
        if (con->sched_thread) {
                ast_cond_signal(&con->sched_thread->cond);
@@ -713,25 +708,33 @@ void ast_sched_report(struct ast_sched_context *con, struct ast_str **buf, struc
 void ast_sched_dump(struct ast_sched_context *con)
 {
        struct sched *q;
-       struct timeval when = ast_tvnow();
+       struct timeval when;
        int x;
        size_t heap_size;
+
+       if (!DEBUG_ATLEAST(1)) {
+               return;
+       }
+
+       when = ast_tvnow();
 #ifdef SCHED_MAX_CACHE
-       ast_debug(1, "Asterisk Schedule Dump (%zu in Q, %u Total, %u Cache, %u high-water)\n", ast_heap_size(con->sched_heap), con->eventcnt - 1, con->schedccnt, con->highwater);
+       ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%zu in Q, %u Total, %u Cache, %u high-water)\n",
+               ast_heap_size(con->sched_heap), con->eventcnt - 1, con->schedccnt, con->highwater);
 #else
-       ast_debug(1, "Asterisk Schedule Dump (%zu in Q, %u Total, %u high-water)\n", ast_heap_size(con->sched_heap), con->eventcnt - 1, con->highwater);
+       ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%zu in Q, %u Total, %u high-water)\n",
+               ast_heap_size(con->sched_heap), con->eventcnt - 1, con->highwater);
 #endif
 
-       ast_debug(1, "=============================================================\n");
-       ast_debug(1, "|ID    Callback          Data              Time  (sec:ms)   |\n");
-       ast_debug(1, "+-----+-----------------+-----------------+-----------------+\n");
+       ast_log(LOG_DEBUG, "=============================================================\n");
+       ast_log(LOG_DEBUG, "|ID    Callback          Data              Time  (sec:ms)   |\n");
+       ast_log(LOG_DEBUG, "+-----+-----------------+-----------------+-----------------+\n");
        ast_mutex_lock(&con->lock);
        heap_size = ast_heap_size(con->sched_heap);
        for (x = 1; x <= heap_size; x++) {
                struct timeval delta;
                q = ast_heap_peek(con->sched_heap, x);
                delta = ast_tvsub(q->when, when);
-               ast_debug(1, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n",
+               ast_log(LOG_DEBUG, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n",
                        q->sched_id->id,
                        q->callback,
                        q->data,
@@ -739,7 +742,7 @@ void ast_sched_dump(struct ast_sched_context *con)
                        (long int)delta.tv_usec);
        }
        ast_mutex_unlock(&con->lock);
-       ast_debug(1, "=============================================================\n");
+       ast_log(LOG_DEBUG, "=============================================================\n");
 }
 
 /*! \brief
index 78f1fa80e26a25f063c0eafe45ac672d806fc1d9..e3935e07045b41b1237215159e029a30cd9f7814 100644 (file)
@@ -550,11 +550,11 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf
                        } /*!< while (ldap_attribute_name) */
                        ber_free(ber, 0);
                        if (static_table_config == table_config) {
-                               if (option_debug > 2) {
+                               if (DEBUG_ATLEAST(3)) {
                                        const struct ast_variable *tmpdebug = variable_named(var, "variable_name");
                                        const struct ast_variable *tmpdebug2 = variable_named(var, "variable_value");
                                        if (tmpdebug && tmpdebug2) {
-                                               ast_debug(3, "Added to vars - %s = %s\n", tmpdebug->value, tmpdebug2->value);
+                                               ast_log(LOG_DEBUG, "Added to vars - %s = %s\n", tmpdebug->value, tmpdebug2->value);
                                        }
                                }
                                vars[entry_index++] = var;
@@ -1620,14 +1620,14 @@ static int update2_ldap(const char *basedn, const char *table_name, const struct
 
        /* Ready to update */
        ast_debug(3, "Modifying %zu matched entries\n", entry_count);
-       if (option_debug > 2) {
+       if (DEBUG_ATLEAST(3)) {
                size_t i;
                for (i = 0; modifications[i]; i++) {
                        if (modifications[i]->mod_op != LDAP_MOD_DELETE) {
-                               ast_debug(3, "%s => %s\n", modifications[i]->mod_type,
-                                               modifications[i]->mod_values[0]);
+                               ast_log(LOG_DEBUG, "%s => %s\n", modifications[i]->mod_type,
+                                       modifications[i]->mod_values[0]);
                        } else {
-                               ast_debug(3, "deleting %s\n", modifications[i]->mod_type);
+                               ast_log(LOG_DEBUG, "deleting %s\n", modifications[i]->mod_type);
                        }
                }
        }
index b4f5aa2275699545d305999c9b45047dbbf0939f..d06b2b00848e97bee2b7b9159e0984e688bd0ee6 100644 (file)
@@ -1560,16 +1560,16 @@ static int parse_config(int is_reload)
 
        ast_config_destroy(config);
 
-       if (option_debug) {
+       if (DEBUG_ATLEAST(1)) {
                if (!ast_strlen_zero(dbhost)) {
-                       ast_debug(1, "PostgreSQL RealTime Host: %s\n", dbhost);
-                       ast_debug(1, "PostgreSQL RealTime Port: %i\n", dbport);
+                       ast_log(LOG_DEBUG, "PostgreSQL RealTime Host: %s\n", dbhost);
+                       ast_log(LOG_DEBUG, "PostgreSQL RealTime Port: %i\n", dbport);
                } else {
-                       ast_debug(1, "PostgreSQL RealTime Socket: %s\n", dbsock);
+                       ast_log(LOG_DEBUG, "PostgreSQL RealTime Socket: %s\n", dbsock);
                }
-               ast_debug(1, "PostgreSQL RealTime User: %s\n", dbuser);
-               ast_debug(1, "PostgreSQL RealTime Password: %s\n", dbpass);
-               ast_debug(1, "PostgreSQL RealTime DBName: %s\n", dbname);
+               ast_log(LOG_DEBUG, "PostgreSQL RealTime User: %s\n", dbuser);
+               ast_log(LOG_DEBUG, "PostgreSQL RealTime Password: %s\n", dbpass);
+               ast_log(LOG_DEBUG, "PostgreSQL RealTime DBName: %s\n", dbname);
        }
 
        if (!pgsql_reconnect(NULL)) {
index 1dcae3b1e87328f75e838107d17a200f2f80862e..04e9fa5716a77e7f69a5b5046a5630258d1bf2b5 100644 (file)
@@ -4164,11 +4164,9 @@ static int ast_rtp_write(struct ast_rtp_instance *instance, struct ast_frame *fr
        format = frame->subclass.format;
        if (ast_format_cmp(rtp->lasttxformat, format) == AST_FORMAT_CMP_NOT_EQUAL) {
                /* Oh dear, if the format changed we will have to set up a new smoother */
-               if (option_debug > 0) {
-                       ast_debug(1, "Ooh, format changed from %s to %s\n",
-                               ast_format_get_name(rtp->lasttxformat),
-                               ast_format_get_name(frame->subclass.format));
-               }
+               ast_debug(1, "Ooh, format changed from %s to %s\n",
+                       ast_format_get_name(rtp->lasttxformat),
+                       ast_format_get_name(frame->subclass.format));
                ao2_replace(rtp->lasttxformat, format);
                if (rtp->smoother) {
                        ast_smoother_free(rtp->smoother);
@@ -5251,7 +5249,7 @@ static int bridge_p2p_rtp_write(struct ast_rtp_instance *instance,
                                ast_sockaddr_stringify(&remote_address),
                                strerror(errno));
                } else if (((ast_test_flag(bridged, FLAG_NAT_ACTIVE) == FLAG_NAT_INACTIVE) || rtpdebug) && !ast_test_flag(bridged, FLAG_NAT_INACTIVE_NOWARN)) {
-                       if (option_debug || rtpdebug) {
+                       if (rtpdebug || DEBUG_ATLEAST(1)) {
                                ast_log(LOG_WARNING,
                                        "RTP NAT: Can't write RTP to private "
                                        "address %s, waiting for other end to "
@@ -5585,13 +5583,14 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc
        if (ext) {
                hdrlen += (ntohl(rtpheader[hdrlen/4]) & 0xffff) << 2;
                hdrlen += 4;
-               if (option_debug) {
+               if (DEBUG_ATLEAST(1)) {
                        unsigned int profile;
                        profile = (ntohl(rtpheader[3]) & 0xffff0000) >> 16;
-                       if (profile == 0x505a)
-                               ast_debug(1, "Found Zfone extension in RTP stream - zrtp - not supported.\n");
-                       else
-                               ast_debug(1, "Found unknown RTP Extensions %x\n", profile);
+                       if (profile == 0x505a) {
+                               ast_log(LOG_DEBUG, "Found Zfone extension in RTP stream - zrtp - not supported.\n");
+                       } else {
+                               ast_log(LOG_DEBUG, "Found unknown RTP Extensions %x\n", profile);
+                       }
                }
        }