[asterisk-commits] rizzo: branch rizzo/astobj2 r47569 - /team/rizzo/astobj2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Nov 13 11:24:25 MST 2006


Author: rizzo
Date: Mon Nov 13 12:24:24 2006
New Revision: 47569

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47569
Log:
normalize the order of certain common blocks of code:

	ast_log(... bla bla bla)
	transmit_response(...);
	set_destroy()
	if (authpeer)
		unref_peer(authpeer);


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=47569&r1=47568&r2=47569
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Mon Nov 13 12:24:24 2006
@@ -14510,9 +14510,9 @@
 
 	/* Find parameters to Event: header value and remove them for now */
 	if (ast_strlen_zero(eventheader)) {
-		transmit_response(p, "489 Bad Event", req);
 		if (option_debug > 1)
 			ast_log(LOG_DEBUG, "Received SIP subscribe for unknown event package: <none>\n");
+		transmit_response(p, "489 Bad Event", req);
 		set_destroy(p);
 		return 0;
 	}
@@ -14610,9 +14610,9 @@
 	} else if (!strcmp(event, "message-summary")) { 
 		if (!ast_strlen_zero(accept) && strcmp(accept, "application/simple-message-summary")) {
 			/* Format requested that we do not support */
-			transmit_response(p, "406 Not Acceptable", req);
 			if (option_debug > 1)
 				ast_log(LOG_DEBUG, "Received SIP mailbox subscription for unknown format: %s\n", accept);
+			transmit_response(p, "406 Not Acceptable", req);
 			set_destroy(p);
 			if (authpeer)
 				unref_peer(authpeer);
@@ -14624,10 +14624,10 @@
 		  In most devices, this is configurable to the voicemailmain extension you use
 		*/
 		if (!authpeer || ast_strlen_zero(authpeer->mailbox)) {
+			ast_log(LOG_NOTICE, "Received SIP subscribe for peer without mailbox: %s\n",
+				authpeer ? authpeer->name : "(no peer)");
 			transmit_response(p, "404 Not found (no mailbox)", req);
 			set_destroy(p);
-			ast_log(LOG_NOTICE, "Received SIP subscribe for peer without mailbox: %s\n",
-				authpeer ? authpeer->name : "(no peer)");
 			if (authpeer)
 				unref_peer(authpeer);
 			return 0;
@@ -14645,9 +14645,9 @@
 		p->relatedpeer = authpeer;	/* Link from pvt to peer */
 		/* Do not release authpeer here */
 	} else { /* At this point, Asterisk does not understand the specified event */
-		transmit_response(p, "489 Bad Event", req);
 		if (option_debug > 1)
 			ast_log(LOG_DEBUG, "Received SIP subscribe for unknown event package: %s\n", event);
+		transmit_response(p, "489 Bad Event", req);
 		set_destroy(p);
 		if (authpeer)
 			unref_peer(authpeer);



More information about the asterisk-commits mailing list