[asterisk-commits] branch group/autoconf_and_menuselect r18311 - /team/group/autoconf_and_menuse...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Apr 7 09:37:02 MST 2006


Author: russell
Date: Fri Apr  7 11:37:01 2006
New Revision: 18311

URL: http://svn.digium.com/view/asterisk?rev=18311&view=rev
Log: (empty)

Modified:
    team/group/autoconf_and_menuselect/channels/chan_sip.c

Modified: team/group/autoconf_and_menuselect/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/channels/chan_sip.c?rev=18311&r1=18310&r2=18311&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/channels/chan_sip.c (original)
+++ team/group/autoconf_and_menuselect/channels/chan_sip.c Fri Apr  7 11:37:01 2006
@@ -3360,8 +3360,8 @@
 		}
 	}
 	ast_mutex_unlock(&iflock);
-	p = sip_alloc(callid, sin, 1, intended_method);
-	if (p)
+	/* Allocate new call */
+	if ((p = sip_alloc(callid, sin, 1, intended_method)))
 		ast_mutex_lock(&p->lock);
 	return p;
 }
@@ -5531,9 +5531,8 @@
 			r->callid_valid = TRUE;
 		}
 		/* Allocate SIP packet for registration */
-		p=sip_alloc( r->callid, NULL, 0, SIP_REGISTER);
-		if (!p) {
-			ast_log(LOG_WARNING, "Unable to allocate registration call\n");
+		if (!(p = sip_alloc( r->callid, NULL, 0, SIP_REGISTER))) {
+			ast_log(LOG_WARNING, "Unable to allocate registration transaction (memory or socket error)\n");
 			return 0;
 		}
 		if (recordhistory)
@@ -9060,9 +9059,8 @@
 		struct sip_request req;
 		struct ast_variable *var;
 
-		p = sip_alloc(NULL, NULL, 0, SIP_NOTIFY);
-		if (!p) {
-			ast_log(LOG_WARNING, "Unable to build sip pvt data for notify\n");
+		if (!(p = sip_alloc(NULL, NULL, 0, SIP_NOTIFY))) {
+			ast_log(LOG_WARNING, "Unable to build sip pvt data for notify (memory/socket error)\n");
 			return RESULT_FAILURE;
 		}
 
@@ -11752,7 +11750,7 @@
 		p = peer->mwipvt;
 	} else {
 		/* Build temporary dialog for this message */
-		if (!(p = sip_alloc(NULL, NULL, 0, SIP_NOTIFY)))
+		if (!(p = sip_alloc(NULL, NULL, 0, SIP_NOTIFY))) 
 			return -1;
 		if (create_addr_from_peer(p, peer)) {
 			/* Maybe they're not registered, etc. */
@@ -12120,7 +12118,7 @@
 		return NULL;
 	}
 	if (!(p = sip_alloc(NULL, NULL, 0, SIP_INVITE))) {
-		ast_log(LOG_ERROR, "Unable to build sip pvt data for '%s' (Out of memory)\n", (char *)data);
+		ast_log(LOG_ERROR, "Unable to build sip pvt data for '%s' (Out of memory or socket error)\n", (char *)data);
 		*cause = AST_CAUSE_SWITCH_CONGESTION;
 		return NULL;
 	}
@@ -13516,7 +13514,7 @@
 	if (!host) {
 		char *localtmp;
 		ast_copy_string(tmp, get_header(&p->initreq, "To"), sizeof(tmp));
-		if (!strlen(tmp)) {
+		if (ast_strlen_zero(tmp)) {
 			ast_log(LOG_ERROR, "Cannot retrieve the 'To' header from the original SIP request!\n");
 			return 0;
 		}
@@ -13527,7 +13525,7 @@
 			localtmp++;
 			/* This is okey because lhost and lport are as big as tmp */
 			sscanf(localtmp, "%[^<>:; ]:%[^<>:; ]", lhost, lport);
-			if (!strlen(lhost)) {
+			if (ast_strlen_zero(lhost)) {
 				ast_log(LOG_ERROR, "Can't find the host address\n");
 				return 0;
 			}



More information about the asterisk-commits mailing list