[asterisk-commits] crichter: trunk r71497 - in /trunk: ./ channels/ channels/misdn/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jun 25 04:37:50 CDT 2007
Author: crichter
Date: Mon Jun 25 04:37:49 2007
New Revision: 71497
URL: http://svn.digium.com/view/asterisk?view=rev&rev=71497
Log:
Merged revisions 71121 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r71121 | crichter | 2007-06-22 17:32:54 +0200 (Fr, 22 Jun 2007) | 9 lines
Merged revisions 70311 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r70311 | crichter | 2007-06-20 16:47:59 +0200 (Mi, 20 Jun 2007) | 1 line
on receiption of cause:44 we mark the channel as in use and inform the user about the situation, we need to test the RESTART stuff then. Also shuffled the empty_chan_in_stack function after the bchannel cleaning functions, to avoid race conditions.
........
................
Modified:
trunk/ (props changed)
trunk/channels/chan_misdn.c
trunk/channels/misdn/isdn_lib.c
trunk/channels/misdn/isdn_lib.h
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_misdn.c?view=diff&rev=71497&r1=71496&r2=71497
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Mon Jun 25 04:37:49 2007
@@ -3258,6 +3258,8 @@
{
struct chan_list *help = list;
+ if (bc->pri) return NULL;
+
chan_misdn_log(6, bc->port, "$$$ find_holded: channel:%d oad:%s dad:%s\n", bc->channel, bc->oad, bc->dad);
for (;help; help = help->next) {
chan_misdn_log(4, bc->port, "$$$ find_holded: --> holded:%d channel:%d\n", help->state==MISDN_HOLDED, help->hold_info.channel);
Modified: trunk/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/isdn_lib.c?view=diff&rev=71497&r1=71496&r2=71497
==============================================================================
--- trunk/channels/misdn/isdn_lib.c (original)
+++ trunk/channels/misdn/isdn_lib.c Mon Jun 25 04:37:49 2007
@@ -549,9 +549,7 @@
static void empty_bc(struct misdn_bchannel *bc)
{
bc->bframe_len=0;
-
-
- bc->in_use= 0;
+
bc->cw= 0;
bc->dec=0;
@@ -673,6 +671,7 @@
mISDN_write_frame(stack->midev, buff, bc->layer_id|FLG_MSG_TARGET|FLG_MSG_DOWN, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
bc->b_stid = 0;
+ bc->in_use = 0;
bc_state_change(bc, BCHAN_CLEANED);
return ret;
@@ -1120,6 +1119,7 @@
bc->port=stack->port;
bc->nt=stack->nt?1:0;
+ bc->pri=stack->pri;
{
ibuffer_t* ibuf= init_ibuffer(MISDN_IBUF_SIZE);
@@ -1502,14 +1502,6 @@
switch (event) {
case EVENT_CONNECT_ACKNOWLEDGE:
-#if 0
- if ( !misdn_cap_is_speech(bc->capability)) {
- int ret=setup_bc(bc);
- if (ret == -EINVAL){
- cb_log(0,bc->port,"send_event: setup_bc failed\n");
- }
- }
-#endif
break;
case EVENT_CONNECT:
@@ -1601,10 +1593,9 @@
}
if (bc) {
+ int channel = bc->channel;
cb_log(4, stack->port, " --> lib: CLEANING UP l3id: %x\n",frm->dinfo);
- if (bc->channel>0)
- empty_chan_in_stack(stack,bc->channel);
-
+
/*bc->pid = 0;*/
bc->need_disconnect=0;
bc->need_release=0;
@@ -1614,6 +1605,10 @@
empty_bc(bc);
clean_up_bc(bc);
+
+ if (channel>0)
+ empty_chan_in_stack(stack,bc->channel);
+
dump_chan_list(stack);
if (bc->stack_holder) {
@@ -2066,12 +2061,16 @@
break;
case EVENT_RELEASE:
case EVENT_RELEASE_COMPLETE:
- if (bc->channel>0)
- empty_chan_in_stack(stack, bc->channel);
+ {
+ int channel=bc->channel;
int tmpcause=bc->cause;
empty_bc(bc);
bc->cause=tmpcause;
clean_up_bc(bc);
+
+ if (channel>0)
+ empty_chan_in_stack(stack, bc->channel);
+ }
break;
default:
@@ -2638,6 +2637,7 @@
empty_chan_in_stack(stack, bc->channel);
empty_bc(bc);
bc_state_change(bc,BCHAN_CLEANED);
+ bc->in_use=0;
cb_log(0, stack->port, "GOT IGNORE SETUP\n");
@@ -2655,14 +2655,22 @@
if (event == EVENT_RELEASE_COMPLETE) {
/* release bchannel only after we've anounced the RELEASE_COMPLETE */
- if (bc->channel>0)
- empty_chan_in_stack(stack,bc->channel);
+ int channel=bc->channel;
int tmpcause=bc->cause;
int tmp_out_cause=bc->out_cause;
empty_bc(bc);
bc->cause=tmpcause;
bc->out_cause=tmp_out_cause;
clean_up_bc(bc);
+
+ if (tmpcause == 44) {
+ cb_log(0,stack->port,"**** Received CAUSE:44, so not cleaning up channel %d\n", channel);
+ cb_log(0,stack->port,"**** This channel is now no longer available,\nplease try to restart it with 'misdn send restart <port> <channel>'\n");
+ set_chan_in_stack(stack,bc->channel);
+ } else {
+ if (channel>0)
+ empty_chan_in_stack(stack,bc->channel);
+ }
}
cb_log(5, stack->port, "Freeing Msg on prim:%x \n",frm->prim);
@@ -3339,11 +3347,14 @@
misdn_split_conf(bc2,bc->conf_id);
}
}
-
- if (bc->channel>0)
- empty_chan_in_stack(stack,bc->channel);
+
+ int channel=bc->channel;
+
empty_bc(bc);
clean_up_bc(bc);
+
+ if (channel>0)
+ empty_chan_in_stack(stack,bc->channel);
}
}
@@ -3377,14 +3388,17 @@
if (!stack->nt) {
/*create clenaup in TE*/
- if (bc->channel>0)
- empty_chan_in_stack(stack,bc->channel);
+ int channel=bc->channel;
+
int tmpcause=bc->cause;
int tmp_out_cause=bc->out_cause;
empty_bc(bc);
bc->cause=tmpcause;
bc->out_cause=tmp_out_cause;
clean_up_bc(bc);
+
+ if (channel>0)
+ empty_chan_in_stack(stack,bc->channel);
}
break;
@@ -3673,9 +3687,21 @@
for (;i<=max;i++) {
dummybc.channel=i;
- cb_log(0, port, "Restarting channel %d\n",i);
+ cb_log(0, port, "Restarting and cleaning channel %d\n",i);
misdn_lib_send_event(&dummybc, EVENT_RESTART);
/*do we need to wait before we get an EVENT_RESTART_ACK ?*/
+
+ /* clean up chan in stack, to be sure we don't think it's
+ * in use anymore */
+ int cnt;
+ for (cnt=0; cnt<=stack->b_num; cnt++) {
+ if (stack->bc[cnt].channel == i) {
+ empty_bc(&stack->bc[cnt]);
+ clean_up_bc(&stack->bc[cnt]);
+ }
+ }
+ empty_chan_in_stack(stack, i);
+
}
return 0;
Modified: trunk/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/isdn_lib.h?view=diff&rev=71497&r1=71496&r2=71497
==============================================================================
--- trunk/channels/misdn/isdn_lib.h (original)
+++ trunk/channels/misdn/isdn_lib.h Mon Jun 25 04:37:49 2007
@@ -202,6 +202,8 @@
struct send_lock *send_lock;
int nt;
+ int pri;
+
int port;
/** init stuff **/
int b_stid;
More information about the asterisk-commits
mailing list