[svn-commits] crichter: trunk r72868 - in /trunk: ./ channels/ channels/misdn/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Jul 2 04:23:09 CDT 2007
Author: crichter
Date: Mon Jul 2 04:23:08 2007
New Revision: 72868
URL: http://svn.digium.com/view/asterisk?view=rev&rev=72868
Log:
Merged revisions 72851 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r72851 | crichter | 2007-07-02 10:27:19 +0200 (Mo, 02 Jul 2007) | 9 lines
Merged revisions 72099 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r72099 | crichter | 2007-06-27 15:22:37 +0200 (Mi, 27 Jun 2007) | 1 line
simplified generation for dummy bchannels, also we mark them as dummies, so they are not used later as real-bchannels, optimized the RESTART mechanisms, we block a channel now on cause:44, and send out a RESTART automatically, then on reception of RESTART_ACKNOWLEDGE we unblock the channel again.
........
................
Modified:
trunk/ (props changed)
trunk/channels/chan_misdn.c
trunk/channels/misdn/isdn_lib.c
trunk/channels/misdn/isdn_lib.h
trunk/channels/misdn/isdn_msg_parser.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
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=72868&r1=72867&r2=72868
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Mon Jul 2 04:23:08 2007
@@ -4657,8 +4657,10 @@
case EVENT_RESTART:
- stop_bc_tones(ch);
- release_chan(bc);
+ if (!bc->dummy) {
+ stop_bc_tones(ch);
+ release_chan(bc);
+ }
break;
default:
Modified: trunk/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/isdn_lib.c?view=diff&rev=72868&r1=72867&r2=72868
==============================================================================
--- trunk/channels/misdn/isdn_lib.c (original)
+++ trunk/channels/misdn/isdn_lib.c Mon Jul 2 04:23:08 2007
@@ -41,6 +41,15 @@
return -1;
}
+static void make_dummy(struct misdn_bchannel *dummybc, int port, int l3id, int nt, int channel)
+{
+ memset (dummybc,0,sizeof(struct misdn_bchannel));
+ dummybc->port=port;
+ dummybc->l3_id=l3id;
+ dummybc->nt=nt;
+ dummybc->dummy=1;
+ dummybc->channel=channel;
+}
int misdn_lib_port_block(int port)
{
@@ -597,6 +606,8 @@
static void empty_bc(struct misdn_bchannel *bc)
{
+ bc->dummy=0;
+
bc->bframe_len=0;
bc->cw= 0;
@@ -1585,10 +1596,8 @@
if (!bc) {
cb_log(4, stack->port, " --> Didn't found BC so temporarly creating dummy BC (l3id:%x) on this port.\n", frm->dinfo);
- memset (&dummybc,0,sizeof(dummybc));
- dummybc.port=stack->port;
- dummybc.l3_id=frm->dinfo;
- dummybc.nt=stack->nt;
+ make_dummy(&dummybc, stack->port, frm->dinfo, stack->nt, 0);
+
bc=&dummybc;
}
@@ -1895,10 +1904,7 @@
/** removing procid **/
if (!bc) {
cb_log(4, stack->port, " --> Didn't found BC so temporarly creating dummy BC (l3id:%x) on this port.\n", hh->dinfo);
- memset (&dummybc,0,sizeof(dummybc));
- dummybc.port=stack->port;
- dummybc.l3_id=hh->dinfo;
- dummybc.nt=stack->nt;
+ make_dummy(&dummybc, stack->port, hh->dinfo, stack->nt, 0);
bc=&dummybc;
}
@@ -1996,12 +2002,8 @@
bc=find_bc_by_l3id(stack, hh->dinfo);
if (!bc) {
-
cb_log(4, stack->port, " --> Didn't found BC so temporarly creating dummy BC (l3id:%x).\n", hh->dinfo);
- memset (&dummybc,0,sizeof(dummybc));
- dummybc.port=stack->port;
- dummybc.l3_id=hh->dinfo;
- dummybc.nt=stack->nt;
+ make_dummy(&dummybc, stack->port, hh->dinfo, stack->nt, 0);
bc=&dummybc;
}
if (bc ) {
@@ -2539,6 +2541,7 @@
cb_log(4,stack?stack->port:0,"handle_frm: frm->addr:%x frm->prim:%x\n",frm->addr,frm->prim);
{
+ struct misdn_bchannel dummybc;
struct misdn_bchannel *bc;
int ret=handle_cr(stack, frm);
@@ -2554,6 +2557,11 @@
}
bc=find_bc_by_l3id(stack, frm->dinfo);
+
+ if (!bc && (frm->prim==(CC_RESTART|CONFIRM)) ) {
+ make_dummy(&dummybc, stack->port, MISDN_ID_GLOBAL, stack->nt, 0);
+ bc=&dummybc;
+ }
handle_frm_bc:
if (bc ) {
@@ -2621,12 +2629,19 @@
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);
+ set_chan_in_stack(stack, channel);
+ bc->channel=channel;
+ misdn_lib_send_restart(stack->port, channel);
} else {
if (channel>0)
- empty_chan_in_stack(stack,channel);
+ empty_chan_in_stack(stack, channel);
}
bc->in_use=0;
+ }
+
+ if (event == EVENT_RESTART) {
+ cb_log(0, stack->port, "**** Received RESTART_ACK channel:%d\n", bc->restart_channel);
+ empty_chan_in_stack(stack, bc->restart_channel);
}
cb_log(5, stack->port, "Freeing Msg on prim:%x \n",frm->prim);
@@ -3619,10 +3634,7 @@
cb_log(0, port, "Sending Restarts on this port.\n");
struct misdn_bchannel dummybc;
- memset (&dummybc,0,sizeof(dummybc));
- dummybc.port=stack->port;
- dummybc.l3_id=MISDN_ID_GLOBAL;
- dummybc.nt=stack->nt;
+ make_dummy(&dummybc, stack->port, MISDN_ID_GLOBAL, stack->nt, 0);
/*default is all channels*/
int max=stack->pri?30:2;
@@ -3650,9 +3662,6 @@
stack->bc[cnt].in_use=0;
}
}
- empty_chan_in_stack(stack, i);
-
-
}
return 0;
@@ -3782,10 +3791,7 @@
else {
if (frm->dinfo == MISDN_ID_GLOBAL) {
struct misdn_bchannel dummybc;
- memset (&dummybc,0,sizeof(dummybc));
- dummybc.port=stack->port;
- dummybc.l3_id=MISDN_ID_GLOBAL;
- dummybc.nt=stack->nt;
+ make_dummy(&dummybc, stack->port, MISDN_ID_GLOBAL, stack->nt, 0);
send_msg(glob_mgr->midev, &dummybc, msg);
}
}
Modified: trunk/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/isdn_lib.h?view=diff&rev=72868&r1=72867&r2=72868
==============================================================================
--- trunk/channels/misdn/isdn_lib.h (original)
+++ trunk/channels/misdn/isdn_lib.h Mon Jul 2 04:23:08 2007
@@ -201,6 +201,8 @@
struct misdn_bchannel {
struct send_lock *send_lock;
+ int dummy;
+
int nt;
int pri;
Modified: trunk/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/isdn_msg_parser.c?view=diff&rev=72868&r1=72867&r2=72868
==============================================================================
--- trunk/channels/misdn/isdn_msg_parser.c (original)
+++ trunk/channels/misdn/isdn_msg_parser.c Mon Jul 2 04:23:08 2007
@@ -816,14 +816,10 @@
#endif
{
- int exclusive, channel = 0;
+ int exclusive;
dec_ie_channel_id(restart->CHANNEL_ID, (Q931_info_t *)restart, &exclusive, &bc->restart_channel, nt,bc);
- /* XXX: this is broken... channel is not used */
- if (channel==0xff) /* any channel */
- channel=-1;
- cb_log(3, stack->port, "CC_RESTART Request on channel:%d on this port.\n");
- }
-
+ cb_log(3, stack->port, "CC_RESTART Request on channel:%d on this port.\n", bc->restart_channel);
+ }
}
More information about the svn-commits
mailing list