[asterisk-commits] crichter: branch 1.4 r89172 - in /branches/1.4/channels: ./ misdn/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Nov 12 05:23:57 CST 2007
Author: crichter
Date: Mon Nov 12 05:23:57 2007
New Revision: 89172
URL: http://svn.digium.com/view/asterisk?view=rev&rev=89172
Log:
added restart all interfaces Restart_Indicator, to automatically send a RESTART after the L2 of a PTP Port comes up. Also fixed some places where we have send a RELEASE without need for it.
Modified:
branches/1.4/channels/chan_misdn.c
branches/1.4/channels/misdn/isdn_lib.c
branches/1.4/channels/misdn/isdn_lib_intern.h
branches/1.4/channels/misdn/isdn_msg_parser.c
Modified: branches/1.4/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_misdn.c?view=diff&rev=89172&r1=89171&r2=89172
==============================================================================
--- branches/1.4/channels/chan_misdn.c (original)
+++ branches/1.4/channels/chan_misdn.c Mon Nov 12 05:23:57 2007
@@ -797,7 +797,6 @@
return 0;
}
-
static int misdn_port_block(int fd, int argc, char *argv[])
{
int port;
@@ -872,7 +871,7 @@
static int misdn_port_down (int fd, int argc, char *argv[])
{
int port;
-
+
if (argc != 4)
return RESULT_SHOWUSAGE;
@@ -2422,7 +2421,7 @@
{
struct chan_list *p;
struct misdn_bchannel *bc=NULL;
-
+
ast_log(LOG_DEBUG, "misdn_hangup(%s)\n", ast->name);
if (!ast || ! (p=MISDN_ASTERISK_TECH_PVT(ast) ) ) return -1;
@@ -2510,7 +2509,8 @@
release_chan(bc);
p->state=MISDN_CLEANING;
- misdn_lib_send_event( bc, EVENT_RELEASE_COMPLETE);
+ if (bc->need_release_complete)
+ misdn_lib_send_event( bc, EVENT_RELEASE_COMPLETE);
break;
case MISDN_HOLDED:
case MISDN_DIALING:
@@ -2553,7 +2553,8 @@
/*p->state=MISDN_CLEANING;*/
break;
case MISDN_DISCONNECTED:
- misdn_lib_send_event( bc, EVENT_RELEASE);
+ if (bc->need_release)
+ misdn_lib_send_event( bc, EVENT_RELEASE);
p->state=MISDN_CLEANING; /* MISDN_HUNGUP_FROM_AST; */
break;
@@ -2571,13 +2572,15 @@
chan_misdn_log(1, bc->port, " --> out_cause %d\n",bc->out_cause);
bc->out_cause=-1;
- misdn_lib_send_event(bc,EVENT_RELEASE);
+ if (bc->need_release)
+ misdn_lib_send_event(bc,EVENT_RELEASE);
p->state=MISDN_CLEANING;
break;
default:
if (bc->nt) {
bc->out_cause=-1;
- misdn_lib_send_event(bc, EVENT_RELEASE);
+ if (bc->need_release)
+ misdn_lib_send_event(bc, EVENT_RELEASE);
p->state=MISDN_CLEANING;
} else {
if (bc->need_disconnect)
Modified: branches/1.4/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/misdn/isdn_lib.c?view=diff&rev=89172&r1=89171&r2=89172
==============================================================================
--- branches/1.4/channels/misdn/isdn_lib.c (original)
+++ branches/1.4/channels/misdn/isdn_lib.c Mon Nov 12 05:23:57 2007
@@ -766,15 +766,12 @@
/* Pull Up L1 */
iframe_t act;
act.prim = PH_DEACTIVATE | REQUEST;
- act.addr = (stack->upper_id | FLG_MSG_DOWN) ;
-
-
+ act.addr = stack->lower_id|FLG_MSG_DOWN;
act.dinfo = 0;
act.len = 0;
+ cb_log(1, stack->port, "SENDING PH_DEACTIVATE | REQ\n");
return mISDN_write(stack->midev, &act, mISDN_HEADER_LEN+act.len, TIMEOUT_1SEC);
-
-
}
@@ -1995,6 +1992,14 @@
cb_log(0, stack->port, "%% GOT L2 Activate Info. but we're activated already.. this l2 is faulty, blocking port\n");
cb_event(EVENT_PORT_ALARM, &stack->bc[0], glob_mgr->user_data);
}
+
+ if (stack->ptp && !stack->restart_sent) {
+ /* make sure we restart the interface of the
+ * other side */
+ stack->restart_sent=1;
+ misdn_lib_send_restart(stack->port, -1);
+
+ }
/* when we get the L2 UP, the L1 is UP definitely too*/
stack->l1link = 1;
@@ -3689,8 +3694,6 @@
/*Sends Restart message for every bchnanel*/
int misdn_lib_send_restart(int port, int channel)
{
- int max;
- int i;
struct misdn_bchannel dummybc;
struct misdn_stack *stack=find_stack_by_port(port);
cb_log(0, port, "Sending Restarts on this port.\n");
@@ -3698,26 +3701,24 @@
make_dummy(&dummybc, stack->port, MISDN_ID_GLOBAL, stack->nt, 0);
/*default is all channels*/
- max=stack->pri?30:2;
- i=1;
-
+ if (channel <0) {
+ dummybc.channel=-1;
+ cb_log(0, port, "Restarting and all Interfaces\n");
+ misdn_lib_send_event(&dummybc, EVENT_RESTART);
+
+ return 0;
+ }
+
/*if a channel is specified we restart only this one*/
- if (channel > 0) {
- i=channel;
- max=channel;
- }
-
- for (;i<=max;i++) {
+ if (channel >0) {
int cnt;
- dummybc.channel=i;
- cb_log(0, port, "Restarting and cleaning channel %d\n",i);
+ dummybc.channel=channel;
+ cb_log(0, port, "Restarting and cleaning channel %d\n",channel);
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 */
for (cnt=0; cnt<=stack->b_num; cnt++) {
- if (stack->bc[cnt].channel == i) {
+ if (stack->bc[cnt].channel == channel) {
empty_bc(&stack->bc[cnt]);
clean_up_bc(&stack->bc[cnt]);
stack->bc[cnt].in_use=0;
Modified: branches/1.4/channels/misdn/isdn_lib_intern.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/misdn/isdn_lib_intern.h?view=diff&rev=89172&r1=89171&r2=89172
==============================================================================
--- branches/1.4/channels/misdn/isdn_lib_intern.h (original)
+++ branches/1.4/channels/misdn/isdn_lib_intern.h Mon Nov 12 05:23:57 2007
@@ -78,6 +78,9 @@
time_t l2establish;
int l1link;
+
+ int restart_sent;
+
int midev;
int nt;
Modified: branches/1.4/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/misdn/isdn_msg_parser.c?view=diff&rev=89172&r1=89171&r2=89172
==============================================================================
--- branches/1.4/channels/misdn/isdn_msg_parser.c (original)
+++ branches/1.4/channels/misdn/isdn_msg_parser.c Mon Nov 12 05:23:57 2007
@@ -840,8 +840,13 @@
#if DEBUG
printf("Building RESTART Msg\n");
#endif
- enc_ie_channel_id(&restart->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
- enc_ie_restart_ind(&restart->RESTART_IND, msg, 0x80, nt, bc);
+
+ if (bc->channel > 0) {
+ enc_ie_channel_id(&restart->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
+ enc_ie_restart_ind(&restart->RESTART_IND, msg, 0x80, nt, bc);
+ } else {
+ enc_ie_restart_ind(&restart->RESTART_IND, msg, 0x87, nt, bc);
+ }
cb_log(0,bc->port, "Restarting channel %d\n", bc->channel);
More information about the asterisk-commits
mailing list