[svn-commits] rizzo: branch rizzo/astobj2 r76061 - /team/rizzo/astobj2/channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jul 20 12:08:18 CDT 2007


Author: rizzo
Date: Fri Jul 20 12:08:17 2007
New Revision: 76061

URL: http://svn.digium.com/view/asterisk?view=rev&rev=76061
Log:

more ast_log -> ast_debug conversion


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=76061&r1=76060&r2=76061
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Fri Jul 20 12:08:17 2007
@@ -15220,14 +15220,14 @@
 	/* If we do not support SIP domains, all transfers are local */
 	if (allow_external_domains && check_sip_domain(p->refer->refer_to_domain, NULL, 0)) {
 		p->refer->localtransfer = 1;
-		if (sipdebug && option_debug > 2)
-			ast_log(LOG_DEBUG, "This SIP transfer is local : %s\n", p->refer->refer_to_domain);
+		if (sipdebug)
+			ast_debug(3, "This SIP transfer is local : %s\n", p->refer->refer_to_domain);
 	} else if (AST_LIST_EMPTY(&domain_list)) {
 		/* This PBX don't bother with SIP domains, so all transfers are local */
 		p->refer->localtransfer = 1;
 	} else
-		if (sipdebug && option_debug > 2)
-			ast_log(LOG_DEBUG, "This SIP transfer is to a remote SIP extension (remote domain %s)\n", p->refer->refer_to_domain);
+		if (sipdebug)
+			ast_debug(3, "This SIP transfer is to a remote SIP extension (remote domain %s)\n", p->refer->refer_to_domain);
 	
 	/* Is this a repeat of a current request? Ignore it */
 	/* Don't know what else to do right now. */
@@ -15265,15 +15265,15 @@
 	/* Find the other part of the bridge (2) - transferee */
 	current.chan2 = ast_bridged_channel(current.chan1);
 	
-	if (sipdebug && option_debug > 2)
-		ast_log(LOG_DEBUG, "SIP %s transfer: Transferer channel %s, transferee channel %s\n", p->refer->attendedtransfer ? "attended" : "blind", current.chan1->name, current.chan2 ? current.chan2->name : "<none>");
+	if (sipdebug)
+		ast_debug(3, "SIP %s transfer: Transferer channel %s, transferee channel %s\n", p->refer->attendedtransfer ? "attended" : "blind", current.chan1->name, current.chan2 ? current.chan2->name : "<none>");
 
 	if (!current.chan2 && !p->refer->attendedtransfer) {
 		/* No bridged channel, propably IVR or echo or similar... */
 		/* Guess we should masquerade or something here */
 		/* Until we figure it out, refuse transfer of such calls */
-		if (sipdebug && option_debug > 2)
-			ast_log(LOG_DEBUG,"Refused SIP transfer on non-bridged channel.\n");
+		if (sipdebug)
+			ast_debug(3,"Refused SIP transfer on non-bridged channel.\n");
 		p->refer->status = REFER_FAILED;
 		append_history(p, "Xfer", "Refer failed. Non-bridged channel.");
 		transmit_response(p, "603 Declined", req);
@@ -15281,8 +15281,8 @@
 	}
 
 	if (current.chan2) {
-		if (sipdebug && option_debug > 3)
-			ast_log(LOG_DEBUG, "Got SIP transfer, applying to bridged peer '%s'\n", current.chan2->name);
+		if (sipdebug)
+			ast_debug(4, "Got SIP transfer, applying to bridged peer '%s'\n", current.chan2->name);
 
 		ast_queue_control(current.chan1, AST_CONTROL_UNHOLD);
 	}
@@ -15294,8 +15294,8 @@
 		if ((res = local_attended_transfer(p, &current, req, seqno)))
 			return res;	/* We're done with the transfer */
 		/* Fall through for remote transfers that we did not find locally */
-		if (sipdebug && option_debug > 3)
-			ast_log(LOG_DEBUG, "SIP attended transfer: Still not our call - generating INVITE with replaces\n");
+		if (sipdebug)
+			ast_debug(4, "SIP attended transfer: Still not our call - generating INVITE with replaces\n");
 		/* Fallthrough if we can't find the call leg internally */
 	}
 
@@ -15309,8 +15309,8 @@
 		ast_clear_flag(&p->flags[0], SIP_GOTREFER);	
 		p->refer->status = REFER_200OK;
 		append_history(p, "Xfer", "REFER to call parking.");
-		if (sipdebug && option_debug > 3)
-			ast_log(LOG_DEBUG, "SIP transfer to parking: trying to park %s. Parked by %s\n", current.chan2->name, current.chan1->name);
+		if (sipdebug)
+			ast_debug(4, "SIP transfer to parking: trying to park %s. Parked by %s\n", current.chan2->name, current.chan1->name);
 		sip_park(current.chan2, current.chan1, req, seqno);
 		return res;
 	} 
@@ -15319,8 +15319,7 @@
 	transmit_response(p, "202 Accepted", req);
 
 	if (current.chan1 && current.chan2) {
-		if (option_debug > 2)
-			ast_log(LOG_DEBUG, "chan1->name: %s\n", current.chan1->name);
+		ast_debug(3, "chan1->name: %s\n", current.chan1->name);
 		pbx_builtin_setvar_helper(current.chan1, "BLINDTRANSFER", current.chan2->name);
 	}
 	if (current.chan2) {
@@ -15382,8 +15381,7 @@
 
 	if (!res) {
 		/* Success  - we have a new channel */
-		if (option_debug > 2)
-			ast_log(LOG_DEBUG, "%s transfer succeeded. Telling transferer.\n", p->refer->attendedtransfer? "Attended" : "Blind");
+		ast_debug(3, "%s transfer succeeded. Telling transferer.\n", p->refer->attendedtransfer? "Attended" : "Blind");
 		transmit_notify_with_sipfrag(p, seqno, "200 Ok", TRUE);
 		if (p->refer->localtransfer)
 			p->refer->status = REFER_200OK;
@@ -15396,8 +15394,7 @@
 		res = 0;
 	} else {
 		ast_clear_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER);	/* Don't delay hangup */
-		if (option_debug > 2)
-			ast_log(LOG_DEBUG, "%s transfer failed. Resuming original call.\n", p->refer->attendedtransfer? "Attended" : "Blind");
+		ast_debug(3, "%s transfer failed. Resuming original call.\n", p->refer->attendedtransfer? "Attended" : "Blind");
 		append_history(p, "Xfer", "Refer failed.");
 		/* Failure of some kind */
 		p->refer->status = REFER_FAILED;
@@ -15419,8 +15416,7 @@
 	if (p->owner && p->owner->_state == AST_STATE_UP) {
 		/* This call is up, cancel is ignored, we need a bye */
 		transmit_response(p, "200 OK", req);
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Got CANCEL on an answered call. Ignoring... \n");
+		ast_debug(1, "Got CANCEL on an answered call. Ignoring... \n");
 		return 0;
 	}
 	stop_media_flows(p); /* Immediately stop RTP, VRTP and UDPTL as applicable */
@@ -15515,8 +15511,8 @@
 	p->invitestate = INV_TERMINATED;
 
 	copy_request(&p->initreq, req);
-	if (sipdebug && option_debug)
-		ast_log(LOG_DEBUG, "Initializing initreq for method %s - callid %s\n", sip_methods[req->method].text, p->callid);
+	if (sipdebug)
+		ast_debug(1, "Initializing initreq for method %s - callid %s\n", sip_methods[req->method].text, p->callid);
 	check_via(p, req);
 	sip_alreadygone(p);
 
@@ -15569,12 +15565,10 @@
 		}
 	} else if (p->owner) {
 		ast_queue_hangup(p->owner);
-		if (option_debug > 2)
-			ast_log(LOG_DEBUG, "Received bye, issuing owner hangup\n");
+		ast_debug(3, "Received bye, issuing owner hangup\n");
 	} else {
 		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
-		if (option_debug > 2)
-			ast_log(LOG_DEBUG, "Received bye, no owner, selfdestruct soon.\n");
+		ast_debug(3, "Received bye, no owner, selfdestruct soon.\n");
 	}
 	transmit_response(p, "200 OK", req);
 
@@ -15612,16 +15606,13 @@
 			/* 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);
 			/* Do not destroy session, since we will break the call if we do */
-			if (option_debug)
-				ast_log(LOG_DEBUG, "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);
+			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;
 		} else if (ast_test_flag(req, SIP_PKT_DEBUG)) {
-			if (option_debug) {
-				if (resubscribe)
-					ast_log(LOG_DEBUG, "Got a re-subscribe on existing subscription %s\n", p->callid);
-				else
-					ast_log(LOG_DEBUG, "Got a new subscription %s (possibly with auth)\n", p->callid);
-			}
+			if (resubscribe)
+				ast_debug(1, "Got a re-subscribe on existing subscription %s\n", p->callid);
+			else
+				ast_debug(1, "Got a new subscription %s (possibly with auth)\n", p->callid);
 		}
 	}
 
@@ -15640,16 +15631,15 @@
 			ast_verbose("Creating new subscription\n");
 
 		copy_request(&p->initreq, req);
-		if (option_debug > 3 && sipdebug)
-			ast_log(LOG_DEBUG, "Initializing initreq for method %s - callid %s\n", sip_methods[req->method].text, p->callid);
+		if (sipdebug)
+			ast_debug(4, "Initializing initreq for method %s - callid %s\n", sip_methods[req->method].text, p->callid);
 		check_via(p, req);
 	} else if (ast_test_flag(req, SIP_PKT_DEBUG) && req_ignore(req))
 		ast_verbose("Ignoring this SUBSCRIBE request\n");
 
 	/* Find parameters to Event: header value and remove them for now */
 	if (ast_strlen_zero(eventheader)) {
-		if (option_debug > 1)
-			ast_log(LOG_DEBUG, "Received SIP subscribe for unknown event package: <none>\n");
+		ast_debug(2, "Received SIP subscribe for unknown event package: <none>\n");
 		transmit_response(p, "489 Bad Event", req);
 		set_destroy(p);
 		return 0;
@@ -15759,8 +15749,7 @@
 	} else if (!strcmp(event, "message-summary")) { 
 		if (!ast_strlen_zero(accept) && strcmp(accept, "application/simple-message-summary")) {
 			/* Format requested that we do not support */
-			if (option_debug > 1)
-				ast_log(LOG_DEBUG, "Received SIP mailbox subscription for unknown format: %s\n", accept);
+			ast_debug(2, "Received SIP mailbox subscription for unknown format: %s\n", accept);
 			transmit_response(p, "406 Not Acceptable", req);
 			set_destroy(p);
 			unref_peer(authpeer);
@@ -15796,8 +15785,7 @@
 		p->relatedpeer = authpeer;	/* Link from pvt to peer */
 		/* Do not release authpeer here */
 	} else { /* At this point, Asterisk does not understand the specified event */
-		if (option_debug > 1)
-			ast_log(LOG_DEBUG, "Received SIP subscribe for unknown event package: %s\n", event);
+		ast_debug(2, "Received SIP subscribe for unknown event package: %s\n", event);
 		transmit_response(p, "489 Bad Event", req);
 		set_destroy(p);
 		unref_peer(authpeer);
@@ -15918,8 +15906,8 @@
 
 	/* Use this as the basis */
 	copy_request(&p->initreq, req);
-	if (option_debug > 3 && sipdebug)
-		ast_log(LOG_DEBUG, "Initializing initreq for method %s - callid %s\n", sip_methods[req->method].text, p->callid);
+	if (sipdebug)
+		ast_debug(4, "Initializing initreq for method %s - callid %s\n", sip_methods[req->method].text, p->callid);
 	check_via(p, req);
 	if ((res = register_verify(p, sin, req, e)) < 0) {
 		const char *reason = "";
@@ -16004,8 +15992,7 @@
 		   within an existing dialog */
 		/* Response to our request -- Do some sanity checks */	
 		if (p->ocseq < seqno) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Ignoring out of order response %d (expecting %d)\n", seqno, p->ocseq);
+			ast_debug(1, "Ignoring out of order response %d (expecting %d)\n", seqno, p->ocseq);
 			return -1;
 		} else if (p->ocseq != seqno) {
 			/* ignore means "don't do anything with it" but still have to 
@@ -16035,14 +16022,12 @@
 	 */			
 	
 	p->method = req->method;	/* Find out which SIP method they are using */
-	if (option_debug > 3)
-		ast_log(LOG_DEBUG, "**** Received %s (%d) - Command in SIP %s\n", sip_methods[p->method].text, sip_methods[p->method].id, req->rlPart1); 
+	ast_debug(4, "**** Received %s (%d) - Command in SIP %s\n", sip_methods[p->method].text, sip_methods[p->method].id, req->rlPart1); 
 
 	if (p->icseq == UNINITIALIZED_ICSEQ) {	/* not initialized - anything is good */
 		p->icseq = seqno;
 	} else if (seqno < p->icseq) {	/* old packet */
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Ignoring too old SIP packet packet %d (expecting >= %d)\n", seqno, p->icseq);
+		ast_debug(1, "Ignoring too old SIP packet packet %d (expecting >= %d)\n", seqno, p->icseq);
 		if (req->method != SIP_ACK)
 			transmit_response(p, "503 Server error", req);	/* We must respond according to RFC 3261 sec 12.2 */
 		return -1;
@@ -16054,8 +16039,7 @@
 		 * side might have lost our message.
 		 */
 		ast_set_flag(req, SIP_PKT_IGNORE);
-		if (option_debug > 2)
-			ast_log(LOG_DEBUG, "Ignoring SIP message because of retransmit (%s Seqno %d, ours %d)\n", sip_methods[p->method].text, p->icseq, seqno);
+		ast_debug(3, "Ignoring SIP message because of retransmit (%s Seqno %d, ours %d)\n", sip_methods[p->method].text, p->icseq, seqno);
 	} else {
 		/* Good sequence number - record it. It can be anything larger than the
 		 * previous sequence number, not necessarily incremented by 1.
@@ -16086,8 +16070,7 @@
 				transmit_response(p, "481 Call/Transaction Does Not Exist", req);
 				sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 			} else {
-				if (option_debug)
-					ast_log(LOG_DEBUG, "Got ACK for unknown dialog... strange.\n");
+				ast_debug(1, "Got ACK for unknown dialog... strange.\n");
 			}
 			return res;
 		}
@@ -16248,8 +16231,8 @@
 	}
 }
 		
-	if (option_debug && res == buflen)
-		ast_log(LOG_DEBUG, "Received packet exceeds buffer. Data is possibly lost\n");
+	if (res == buflen)
+		ast_debug(1, "Received packet exceeds buffer. Data is possibly lost\n");
 	req.len = res;
 	if(sip_debug_test_addr(&sin))	/* Set the debug flag early on packet level */
 		ast_set_flag(&req, SIP_PKT_DEBUG);
@@ -16276,8 +16259,7 @@
 		p = find_call(&req, &sin, req.method);	/* returns p locked */
 		ast_mark(prof_find, 0);
 		if (p == NULL) {
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Invalid SIP message - rejected , no callid, len %d\n", req.len);
+			ast_debug(1, "Invalid SIP message - rejected , no callid, len %d\n", req.len);
 			return 1;
 		}
 		/* Go ahead and lock the owner if it has one -- we may need it */
@@ -16285,8 +16267,7 @@
 		if (!p->owner || !ast_channel_trylock(p->owner))
 			break;	/* locking succeeded */
 		ast_verbose("loop %d p %p chan %p trylock failed\n", lockretry, p, p->owner);
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Failed to grab owner channel lock, trying again. (SIP call %s)\n", p->callid);
+		ast_debug(1, "Failed to grab owner channel lock, trying again. (SIP call %s)\n", p->callid);
 		sip_pvt_unlock(p);
 		p = pvt_unref(p);	/* release the reference, no good anymore */
 		/* Sleep for a very short amount of time */
@@ -16309,8 +16290,7 @@
 	nounlock = 0;
 	if (handle_incoming(p, &req, &sin, &recount, &nounlock)) {
 		/* Request failed */
-		if (option_debug)
-			ast_log(LOG_DEBUG, "SIP message could not be handled, bad request: %-70.70s\n", p->callid[0] ? p->callid : "<no callid>");
+		ast_debug(1, "SIP message could not be handled, bad request: %-70.70s\n", p->callid[0] ? p->callid : "<no callid>");
 	}
 		
 	if (p->owner && !nounlock)
@@ -16529,13 +16509,13 @@
 		if ((res < 0) || (res > 1000))
 			res = 1000;
 		res = ast_io_wait(io, res);
-		if (option_debug && res > 20)
-			ast_log(LOG_DEBUG, "chan_sip: ast_io_wait ran %d all at once\n", res);
+		if (res > 20)
+			ast_debug(1, "chan_sip: ast_io_wait ran %d all at once\n", res);
 		ast_mutex_lock(&monlock);
 		if (res >= 0)  {
 			res = ast_sched_runq(sched);
-			if (option_debug && res >= 20)
-				ast_log(LOG_DEBUG, "chan_sip: ast_sched_runq ran %d all at once\n", res);
+			if (res >= 20)
+				ast_debug(1, "chan_sip: ast_sched_runq ran %d all at once\n", res);
 		}
 		ast_mutex_unlock(&monlock);
 	}
@@ -16700,8 +16680,7 @@
 	if ((tmp = strchr(host, '@')))
 		host = tmp + 1;
 
-	if (option_debug > 2) 
-		ast_log(LOG_DEBUG, "Checking device state for peer %s\n", host);
+	ast_debug(3, "Checking device state for peer %s\n", host);
 
 	if ((p = find_peer(host, NULL, 1))) {
 		if (p->addr.sin_addr.s_addr || p->defaddr.sin_addr.s_addr) {
@@ -16765,8 +16744,7 @@
 		*cause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL;	/* Can't find codec to connect to host */
 		return NULL;
 	}
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Asked to create a SIP channel with formats: %s\n", ast_getformatname_multiple(tmp, sizeof(tmp), oldformat));
+	ast_debug(1, "Asked to create a SIP channel with formats: %s\n", ast_getformatname_multiple(tmp, sizeof(tmp), oldformat));
 
 	if (!(p = sip_alloc(NULL, NULL, 0, SIP_INVITE))) {
 		ast_log(LOG_ERROR, "Unable to build sip pvt data for '%s' (Out of memory or socket error)\n", dest);
@@ -16798,8 +16776,7 @@
 
 	if (create_addr(p, host)) {
 		*cause = AST_CAUSE_UNREGISTERED;
-		if (option_debug > 2)
-			ast_log(LOG_DEBUG, "Cant create SIP call - target device not registred\n");
+		ast_debug(3, "Cant create SIP call - target device not registred\n");
 		sip_destroy(p);
 		return NULL;
 	}
@@ -17111,8 +17088,7 @@
 	if (ast_strlen_zero(configuration))
 		return authlist;
 
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Auth config ::  %s\n", configuration);
+	ast_debug(1, "Auth config ::  %s\n", configuration);
 
 	ast_copy_string(authcopy, configuration, sizeof(authcopy));
 	stringp = authcopy;
@@ -17381,8 +17357,7 @@
 
 		if (realtime) {
 			rpeerobjs++;
-			if (option_debug > 2)
-				ast_log(LOG_DEBUG,"-REALTIME- peer built. Name: %s. Peer objects: %d\n", name, rpeerobjs);
+			ast_debug(3,"-REALTIME- peer built. Name: %s. Peer objects: %d\n", name, rpeerobjs);
 		} else
 			speerobjs++;
 		ASTOBJ_INIT(peer);
@@ -17540,8 +17515,7 @@
 		if ((nowtime - regseconds) > 0) {
 			destroy_association(peer);
 			memset(&peer->addr, 0, sizeof(peer->addr));
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Bah, we're expired (%d/%d/%d)!\n", (int)(nowtime - regseconds), (int)regseconds, (int)nowtime);
+			ast_debug(1, "Bah, we're expired (%d/%d/%d)!\n", (int)(nowtime - regseconds), (int)regseconds, (int)nowtime);
 		}
 	}
 	ast_copy_flags(&peer->flags[0], &peerflags[0], mask[0].flags);
@@ -17829,8 +17803,8 @@
 			if (context)
 				*context++ = '\0';
 
-			if (option_debug && ast_strlen_zero(context))
-				ast_log(LOG_DEBUG, "No context specified at line %d for domain '%s'\n", v->lineno, domain);
+			if (ast_strlen_zero(context))
+				ast_debug(1, "No context specified at line %d for domain '%s'\n", v->lineno, domain);
 			if (ast_strlen_zero(domain))
 				ast_log(LOG_WARNING, "Empty domain specified at line %d\n", v->lineno);
 			else
@@ -18111,14 +18085,10 @@
 		memset(&p->udptlredirip, 0, sizeof(p->udptlredirip));
 	if (!ast_test_flag(&p->flags[0], SIP_GOTREFER)) {
 		if (!p->pendinginvite) {
-			if (option_debug > 2) {
-				ast_log(LOG_DEBUG, "Sending reinvite on SIP '%s' - It's UDPTL soon redirected to IP %s:%d\n", p->callid, ast_inet_ntoa(udptl ? p->udptlredirip.sin_addr : p->ourip.sin_addr), udptl ? ntohs(p->udptlredirip.sin_port) : 0);
-			}
+			ast_debug(3, "Sending reinvite on SIP '%s' - It's UDPTL soon redirected to IP %s:%d\n", p->callid, ast_inet_ntoa(udptl ? p->udptlredirip.sin_addr : p->ourip.sin_addr), udptl ? ntohs(p->udptlredirip.sin_port) : 0);
 			transmit_reinvite_with_sdp(p, TRUE);
 		} else if (!ast_test_flag(&p->flags[0], SIP_PENDINGBYE)) {
-			if (option_debug > 2) {
-				ast_log(LOG_DEBUG, "Deferring reinvite on SIP '%s' - It's UDPTL will be redirected to IP %s:%d\n", p->callid, ast_inet_ntoa(udptl ? p->udptlredirip.sin_addr : p->ourip.sin_addr), udptl ? ntohs(p->udptlredirip.sin_port) : 0);
-			}
+			ast_debug(3, "Deferring reinvite on SIP '%s' - It's UDPTL will be redirected to IP %s:%d\n", p->callid, ast_inet_ntoa(udptl ? p->udptlredirip.sin_addr : p->ourip.sin_addr), udptl ? ntohs(p->udptlredirip.sin_port) : 0);
 			ast_set_flag(&p->flags[0], SIP_NEEDREINVITE);
 		}
 	}
@@ -18165,20 +18135,16 @@
 		}
 		if (!ast_test_flag(&p->flags[0], SIP_GOTREFER)) {
 			if (!p->pendinginvite) {
-				if (option_debug > 2) {
-					if (flag)
-						ast_log(LOG_DEBUG, "Sending reinvite on SIP '%s' - It's UDPTL soon redirected to IP %s:%d\n", p->callid, ast_inet_ntoa(p->udptlredirip.sin_addr), ntohs(p->udptlredirip.sin_port));
-					else
-						ast_log(LOG_DEBUG, "Sending reinvite on SIP '%s' - It's UDPTL soon redirected to us (IP %s)\n", p->callid, ast_inet_ntoa(p->ourip.sin_addr));
-				}
+				if (flag)
+					ast_debug(3, "Sending reinvite on SIP '%s' - It's UDPTL soon redirected to IP %s:%d\n", p->callid, ast_inet_ntoa(p->udptlredirip.sin_addr), ntohs(p->udptlredirip.sin_port));
+				else
+					ast_debug(3, "Sending reinvite on SIP '%s' - It's UDPTL soon redirected to us (IP %s)\n", p->callid, ast_inet_ntoa(p->ourip.sin_addr));
 				transmit_reinvite_with_sdp(p, TRUE);
 			} else if (!ast_test_flag(&p->flags[0], SIP_PENDINGBYE)) {
-				if (option_debug > 2) {
-					if (flag)
-						ast_log(LOG_DEBUG, "Deferring reinvite on SIP '%s' - It's UDPTL will be redirected to IP %s:%d\n", p->callid, ast_inet_ntoa(p->udptlredirip.sin_addr), ntohs(p->udptlredirip.sin_port));
-					else
-						ast_log(LOG_DEBUG, "Deferring reinvite on SIP '%s' - It's UDPTL will be redirected to us (IP %s)\n", p->callid, ast_inet_ntoa(p->ourip.sin_addr));
-				}
+				if (flag)
+					ast_debug(3, "Deferring reinvite on SIP '%s' - It's UDPTL will be redirected to IP %s:%d\n", p->callid, ast_inet_ntoa(p->udptlredirip.sin_addr), ntohs(p->udptlredirip.sin_port));
+				else
+					ast_debug(3, "Deferring reinvite on SIP '%s' - It's UDPTL will be redirected to us (IP %s)\n", p->callid, ast_inet_ntoa(p->ourip.sin_addr));
 				ast_set_flag(&p->flags[0], SIP_NEEDREINVITE);
 			}
 		}
@@ -18189,12 +18155,10 @@
 		} else {
 			memset(&p->udptlredirip, 0, sizeof(p->udptlredirip));
 		}
-		if (option_debug > 2) {
-			if (flag)
-				ast_log(LOG_DEBUG, "Responding 200 OK on SIP '%s' - It's UDPTL soon redirected to IP %s:%d\n", p->callid, ast_inet_ntoa(p->udptlredirip.sin_addr), ntohs(p->udptlredirip.sin_port));
-			else
-				ast_log(LOG_DEBUG, "Responding 200 OK on SIP '%s' - It's UDPTL soon redirected to us (IP %s)\n", p->callid, ast_inet_ntoa(p->ourip.sin_addr));
-		}
+		if (flag)
+			ast_debug(3, "Responding 200 OK on SIP '%s' - It's UDPTL soon redirected to IP %s:%d\n", p->callid, ast_inet_ntoa(p->udptlredirip.sin_addr), ntohs(p->udptlredirip.sin_port));
+		else
+			ast_debug(3, "Responding 200 OK on SIP '%s' - It's UDPTL soon redirected to us (IP %s)\n", p->callid, ast_inet_ntoa(p->ourip.sin_addr));
 		pvt->t38.state = T38_ENABLED;
 		p->t38.state = T38_ENABLED;
 		if (option_debug > 1) {
@@ -18339,17 +18303,12 @@
 	if (changed && !ast_test_flag(&p->flags[0], SIP_GOTREFER)) {
 		if (chan->_state != AST_STATE_UP) {	/* We are in early state */
 			append_history(p, "ExtInv", "Initial invite sent with remote bridge proposal.");
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Early remote bridge setting SIP '%s' - Sending media to %s\n", p->callid, ast_inet_ntoa(rtp ? p->redirip.sin_addr : p->ourip.sin_addr));
+			ast_debug(1, "Early remote bridge setting SIP '%s' - Sending media to %s\n", p->callid, ast_inet_ntoa(rtp ? p->redirip.sin_addr : p->ourip.sin_addr));
 		} else if (!p->pendinginvite) {		/* We are up, and have no outstanding invite */
-			if (option_debug > 2) {
-				ast_log(LOG_DEBUG, "Sending reinvite on SIP '%s' - It's audio soon redirected to IP %s\n", p->callid, ast_inet_ntoa(rtp ? p->redirip.sin_addr : p->ourip.sin_addr));
-			}
+			ast_debug(3, "Sending reinvite on SIP '%s' - It's audio soon redirected to IP %s\n", p->callid, ast_inet_ntoa(rtp ? p->redirip.sin_addr : p->ourip.sin_addr));
 			transmit_reinvite_with_sdp(p, FALSE);
 		} else if (!ast_test_flag(&p->flags[0], SIP_PENDINGBYE)) {
-			if (option_debug > 2) {
-				ast_log(LOG_DEBUG, "Deferring reinvite on SIP '%s' - It's audio will be redirected to IP %s\n", p->callid, ast_inet_ntoa(rtp ? p->redirip.sin_addr : p->ourip.sin_addr));
-			}
+			ast_debug(3, "Deferring reinvite on SIP '%s' - It's audio will be redirected to IP %s\n", p->callid, ast_inet_ntoa(rtp ? p->redirip.sin_addr : p->ourip.sin_addr));
 			/* We have a pending Invite. Send re-invite when we're done with the invite */
 			ast_set_flag(&p->flags[0], SIP_NEEDREINVITE);	
 		}
@@ -18582,8 +18541,7 @@
 /*! \brief Reload module */
 static int sip_do_reload(enum channelreloadreason reason)
 {
-	if (option_debug > 3)
-		ast_log(LOG_DEBUG, "--------------- SIP reload started\n");
+	ast_debug(4, "--------------- SIP reload started\n");
 
 	clear_realm_authentication(authl);
 	clear_sip_domains();
@@ -18594,8 +18552,7 @@
 	ASTOBJ_CONTAINER_TRAVERSE(&regl, 1, do {
 		ASTOBJ_RDLOCK(iterator);
 		if (iterator->register_pvt) {
-			if (option_debug > 2)
-				ast_log(LOG_DEBUG, "Destroying active SIP dialog for registry %s@%s\n", iterator->username, iterator->hostname);
+			ast_debug(3, "Destroying active SIP dialog for registry %s@%s\n", iterator->username, iterator->hostname);
 			/* This will also remove references to the registry */
 			iterator->register_pvt = sip_destroy(iterator->register_pvt);
 		}
@@ -18604,16 +18561,14 @@
 
 	/* Then, actually destroy users and registry */
 	ASTOBJ_CONTAINER_DESTROYALL(&userl, sip_destroy_user);
-	if (option_debug > 3)
-		ast_log(LOG_DEBUG, "--------------- Done destroying user list\n");
+	ast_debug(4, "--------------- Done destroying user list\n");
 	registry_destroy_all();
 	ASTOBJ_CONTAINER_MARKALL(&peerl);
 	reload_config(reason);
 
 	/* Prune peers who still are supposed to be deleted */
 	ASTOBJ_CONTAINER_PRUNE_MARKED(&peerl, sip_destroy_peer);
-	if (option_debug > 3)
-		ast_log(LOG_DEBUG, "--------------- Done destroying pruned peers\n");
+	ast_debug(4, "--------------- Done destroying pruned peers\n");
 
 	sip_poke_all_peers();		/* Send qualify (OPTIONS) to all peers */
 




More information about the svn-commits mailing list