[asterisk-commits] crichter: trunk r39131 - in /trunk/channels: ./ misdn/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Aug 7 02:09:18 MST 2006


Author: crichter
Date: Mon Aug  7 04:09:17 2006
New Revision: 39131

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

Modified:
    trunk/channels/chan_misdn.c
    trunk/channels/misdn/isdn_lib.c
    trunk/channels/misdn/isdn_lib.h

Modified: trunk/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_misdn.c?rev=39131&r1=39130&r2=39131&view=diff
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Mon Aug  7 04:09:17 2006
@@ -3042,18 +3042,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++;
-			ast_string_field_build(tmp, name, "%s/%d-u%d",
-				 misdn_type, port, c);
-	} else {
-			 ast_string_field_build(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;
+
+	ast_string_field_build(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: trunk/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/isdn_lib.c?rev=39131&r1=39130&r2=39131&view=diff
==============================================================================
--- trunk/channels/misdn/isdn_lib.c (original)
+++ trunk/channels/misdn/isdn_lib.c Mon Aug  7 04:09:17 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: trunk/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/isdn_lib.h?rev=39131&r1=39130&r2=39131&view=diff
==============================================================================
--- trunk/channels/misdn/isdn_lib.h (original)
+++ trunk/channels/misdn/isdn_lib.h Mon Aug  7 04:09:17 2006
@@ -413,6 +413,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