aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcrichter <crichter@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-07 09:09:17 +0000
committercrichter <crichter@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-07 09:09:17 +0000
commitdba3bf0c2707859a9ab4fb96acf3093d7b4df1f7 (patch)
tree363b12b611849e8a31b478c2a6894d7946ca302c
parent66421e3fc5c359e512f03382abf63a594ce13a2d (diff)
changed naming of mISDN channels, so that hinting works proper
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@39131 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_misdn.c18
-rw-r--r--channels/misdn/isdn_lib.c12
-rw-r--r--channels/misdn/isdn_lib.h2
3 files changed, 24 insertions, 8 deletions
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index f093af080..21edb0d5b 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -3042,18 +3042,20 @@ static struct ast_channel_tech misdn_tech_wo_bridge = {
};
-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);
diff --git a/channels/misdn/isdn_lib.c b/channels/misdn/isdn_lib.c
index b0fab3012..eb26cd901 100644
--- a/channels/misdn/isdn_lib.c
+++ b/channels/misdn/isdn_lib.c
@@ -27,6 +27,18 @@ struct misdn_stack* get_misdn_stack( void );
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)
{
diff --git a/channels/misdn/isdn_lib.h b/channels/misdn/isdn_lib.h
index 918d3a617..736a99f46 100644
--- a/channels/misdn/isdn_lib.h
+++ b/channels/misdn/isdn_lib.h
@@ -413,6 +413,8 @@ int misdn_lib_get_port_info(int port);
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);