[asterisk-commits] crichter: branch crichter/0.4.0 r39130 - in /team/crichter/0.4.0/channels: ./...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Aug 7 02:04:07 MST 2006


Author: crichter
Date: Mon Aug  7 04:04:06 2006
New Revision: 39130

URL: http://svn.digium.com/view/asterisk?rev=39130&view=rev
Log:
changed naming of mISDN channels, so that hinting works proper

Modified:
    team/crichter/0.4.0/channels/chan_misdn.c
    team/crichter/0.4.0/channels/misdn/isdn_lib.c
    team/crichter/0.4.0/channels/misdn/isdn_lib.h

Modified: team/crichter/0.4.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/chan_misdn.c?rev=39130&r1=39129&r2=39130&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/chan_misdn.c (original)
+++ team/crichter/0.4.0/channels/chan_misdn.c Mon Aug  7 04:04:06 2006
@@ -3002,18 +3002,20 @@
 };
 
 
-static unsigned long glob_channel=0;
+static int glob_channel=0;
 
 static void update_name(struct ast_channel *tmp, int port, int c) 
 {
-	if (c<=0) {
-			c=glob_channel++;
-			snprintf(tmp->name, sizeof(tmp->name), "%s/%d-u%d",
-				 misdn_type, port, c);
-	} else {
-			snprintf(tmp->name, sizeof(tmp->name), "%s/%d-%d",
-				 misdn_type, port, c);
-	}
+	int chan_offset=0;
+	int tmp_port = misdn_cfg_get_next_port(0);
+	for (; tmp_port > 0; tmp_port=misdn_cfg_get_next_port(tmp_port)) {
+		if (tmp_port == port) break;
+		chan_offset+=misdn_lib_port_is_pri(tmp_port)?30:2;
+	}
+	
+	if (c<0) c=0;
+	snprintf(tmp->name, sizeof(tmp->name), "%s/%d-u%d",
+				 misdn_type, chan_offset+c, ++glob_channel);
 
 	chan_misdn_log(3,port," --> updating channel name to [%s]\n",tmp->name);
 	

Modified: team/crichter/0.4.0/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/misdn/isdn_lib.c?rev=39130&r1=39129&r2=39130&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/misdn/isdn_lib.c (original)
+++ team/crichter/0.4.0/channels/misdn/isdn_lib.c Mon Aug  7 04:04:06 2006
@@ -26,6 +26,18 @@
 #ifdef WITH_BEROEC
 static int bec_initialized=0;
 #endif
+
+int misdn_lib_port_is_pri(int port)
+{
+	struct misdn_stack *stack=get_misdn_stack();
+	for ( ; stack; stack=stack->next) {
+		if (stack->port == port) {
+			return stack->pri;
+		}
+	}
+	
+	return -1;
+}
 
 
 int misdn_lib_port_block(int port)

Modified: team/crichter/0.4.0/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/misdn/isdn_lib.h?rev=39130&r1=39129&r2=39130&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/misdn/isdn_lib.h (original)
+++ team/crichter/0.4.0/channels/misdn/isdn_lib.h Mon Aug  7 04:04:06 2006
@@ -417,6 +417,8 @@
 int misdn_lib_port_block(int port);
 int misdn_lib_port_unblock(int port);
 
+int misdn_lib_port_is_pri(int port);
+
 int misdn_lib_port_up(int port, int notcheck);
 
 int misdn_lib_get_port_down(int port);



More information about the asterisk-commits mailing list