[asterisk-commits] branch oej/test-this-branch r29692 - /team/oej/test-this-branch/channels/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue May 23 06:55:16 MST 2006


Author: oej
Date: Tue May 23 08:55:15 2006
New Revision: 29692

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

Modified:
    team/oej/test-this-branch/channels/chan_sip.c

Modified: team/oej/test-this-branch/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_sip.c?rev=29692&r1=29691&r2=29692&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_sip.c (original)
+++ team/oej/test-this-branch/channels/chan_sip.c Tue May 23 08:55:15 2006
@@ -2406,17 +2406,15 @@
 		*port++ = '\0';
 	dialog->sa.sin_family = AF_INET;
 	dialog->timer_t1 = 500; /* Default SIP retransmission timer T1 (RFC 3261) */
-	p = find_peer(peer, NULL, 1);
-
-	if (p) {
-		found++;
+
+	/* Do we have a device with this name? */
+	if ((p = find_peer(peer, NULL, 1))) {
 		if (create_addr_from_peer(dialog, p))
 			ASTOBJ_UNREF(p, sip_destroy_device);
 		return 0;
 	}
-	if (found)
-		return -1;
-
+
+	/* We have no peer, try to use name as a host name */
 	hostn = peer;
 	portno = port ? atoi(port) : DEFAULT_SIP_PORT;
 	if (srvlookup) {
@@ -2684,7 +2682,6 @@
 static int update_call_counter(struct sip_pvt *fup, int event)
 {
 	char name[256];
-	int *inuse, *call_limit, *inringing = NULL;
 	int outgoing = ast_test_flag(&fup->flags[0], SIP_OUTGOING);
 	struct sip_peer *device = NULL;
 
@@ -2719,14 +2716,12 @@
 			} else {
 				device->inUse= 0;
 			}
-			if (inringing) {
-				if (ast_test_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING)) {
-					if (*inringing > 0)
-						(*inringing)--;
-					else
-						ast_log(LOG_WARNING, "Inringing for peer '%s' < 0?\n", fup->peername);
-					ast_clear_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING);
-				}
+			if (ast_test_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING)) {
+				if (device->inRinging > 0)
+					(device->inRinging)--;
+				else
+					ast_log(LOG_DEBUG, "Inringing for peer '%s' < 0?\n", fup->peername);
+				ast_clear_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING);
 			}
 			if (option_debug > 1 || sipdebug) {
 				ast_log(LOG_DEBUG, "Call %s %s '%s' removed from call limit %d\n", outgoing ? "to" : "from", device->type & SIP_USER ? "user":"peer", name, device->call_limit);
@@ -2741,9 +2736,9 @@
 					return -1; 
 				}
 			}
-			if (inringing && (event == INC_CALL_RINGING)) {
+			if (event == INC_CALL_RINGING) {
 				if (!ast_test_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING)) {
-					device->inringing++;
+					device->inRinging++;
 					ast_set_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING);
 				}
 			}
@@ -2753,16 +2748,13 @@
 			}
 			break;
 		case DEC_CALL_RINGING:
-			if (inringing) {
-				if (ast_test_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING)) {
-					if (*inringing > 0)
-						(*inringing)--;
-					else
-						ast_log(LOG_WARNING, "Inringing for peer '%s' < 0?\n", fup->peername);
-					ast_clear_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING);
-				}
+			if (ast_test_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING)) {
+				if (device->inRinging > 0)
+					(device->inRinging)--;
+				else
+					ast_log(LOG_WARNING, "Inringing for device '%s' < 0?\n", device->name);
+				ast_clear_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING);
 			}
-			break;
 			break;
 		default:
 			ast_log(LOG_ERROR, "update_call_counter(%s, %d) called with no event!\n", name, event);



More information about the asterisk-commits mailing list