[svn-commits] branch crichter/0.3.0 r36375 -
/team/crichter/0.3.0/channels/misdn/
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Fri Jun 30 07:04:58 MST 2006
Author: crichter
Date: Fri Jun 30 09:04:57 2006
New Revision: 36375
URL: http://svn.digium.com/view/asterisk?rev=36375&view=rev
Log:
added fix, that if the L2 goes down on ptp-NT that we reinitialize the NT Library. Also if we have no ntflags, we don't pass the filename to the debug routines of mISDNuser.
Modified:
team/crichter/0.3.0/channels/misdn/isdn_lib.c
team/crichter/0.3.0/channels/misdn/isdn_lib.h
Modified: team/crichter/0.3.0/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_lib.c?rev=36375&r1=36374&r2=36375&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.c (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.c Fri Jun 30 09:04:57 2006
@@ -171,7 +171,7 @@
/* from isdn_lib.h */
int init_bc(struct misdn_stack * stack, struct misdn_bchannel *bc, int midev, int port, int bidx, char *msn, int firsttime);
struct misdn_stack* stack_init(int midev, int port, int ptp);
-void stack_te_destroy(struct misdn_stack* stack);
+void stack_destroy(struct misdn_stack* stack);
/* user iface */
int te_lib_init( void ) ; /* returns midev */
void te_lib_destroy(int midev) ;
@@ -1274,10 +1274,15 @@
}
-void stack_te_destroy(struct misdn_stack* stack)
+void stack_destroy(struct misdn_stack* stack)
{
char buf[1024];
if (!stack) return;
+
+ if (stack->nt) {
+ cleanup_Isdnl2(&stack->nst);
+ cleanup_Isdnl3(&stack->nst);
+ }
if (stack->lower_id)
mISDN_write_frame(stack->midev, buf, stack->lower_id, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
@@ -1913,9 +1918,11 @@
{
if (stack->ptp) {
cb_log(-1 , stack->port, "%% GOT L2 DeActivate Info.\n");
+
if (stack->l2upcnt>3) {
cb_log(-1 , stack->port, "!!! Could not Get the L2 up after 3 Attemps!!!\n");
} else {
+ if (stack->nt) misdn_lib_reinit_nt_stack(stack->port);
misdn_lib_get_l2_up(stack);
stack->l2upcnt++;
}
@@ -3426,7 +3433,7 @@
cb_log(0, port, "Restarting this port.\n");
if (stack) {
cb_log(0, port, "Stack:%p\n",stack);
-
+
clear_l3(stack);
{
msg_t *msg=alloc_msg(MAX_MSG_SIZE);
@@ -3448,48 +3455,10 @@
msg_queue_tail(&glob_mgr->activatequeue, msg);
sem_post(&glob_mgr->new_msg);
}
- return 0;
+
+ if (stack->nt)
+ misdn_lib_reinit_nt_stack(stack->port);
- stack_te_destroy(stack);
-
- {
- struct misdn_stack *tmpstack;
- struct misdn_stack *newstack=stack_init(stack->midev ,port, stack->ptp);
-
-
- if (stack == glob_mgr->stack_list) {
- struct misdn_stack *n=glob_mgr->stack_list->next;
- glob_mgr->stack_list = newstack ;
- glob_mgr->stack_list->next = n;
- } else {
- for (tmpstack=glob_mgr->stack_list;
- tmpstack->next;
- tmpstack=tmpstack->next)
- if (tmpstack->next == stack) break;
-
- if (!tmpstack->next) {
- cb_log(-1, port, "Stack to restart not found\n");
- return 0;
- } else {
- struct misdn_stack *n=tmpstack->next->next;
- tmpstack->next=newstack;
- newstack->next=n;
- }
- }
-
- {
- int i;
- for(i=0;i<newstack->b_num; i++) {
- int r;
- if ((r=init_bc(newstack, &newstack->bc[i], newstack->midev,port,i, "", 1))<0) {
- cb_log(-1, port, "Got Err @ init_bc :%d\n",r);
- return 0;
- }
- }
- }
-
- free(stack);
- }
}
return 0;
@@ -3603,13 +3572,19 @@
void misdn_lib_nt_debug_init( int flags, char *file )
{
int static init=0;
+ char *f;
+
+ if (!flags)
+ f=NULL;
+ else
+ f=file;
if (!init) {
- debug_init( flags , file, file, file);
+ debug_init( flags , f, f, f);
init=1;
} else {
debug_close();
- debug_init( flags , file, file, file);
+ debug_init( flags , f, f, f);
}
}
@@ -3747,7 +3722,7 @@
help->bc[i].addr = 0;
}
cb_log (1, help->port, "Destroying this port.\n");
- stack_te_destroy(help);
+ stack_destroy(help);
}
if (global_state == MISDN_INITIALIZED) {
@@ -4181,3 +4156,41 @@
}
+
+void misdn_lib_reinit_nt_stack(int port)
+{
+ struct misdn_stack *stack=find_stack_by_port(port);
+
+ if (stack) {
+ cleanup_Isdnl3(&stack->nst);
+ cleanup_Isdnl2(&stack->nst);
+
+
+ memset(&stack->nst, 0, sizeof(net_stack_t));
+ memset(&stack->mgr, 0, sizeof(manager_t));
+
+ stack->mgr.nst = &stack->nst;
+ stack->nst.manager = &stack->mgr;
+
+ stack->nst.l3_manager = handle_event_nt;
+ stack->nst.device = glob_mgr->midev;
+ stack->nst.cardnr = port;
+ stack->nst.d_stid = stack->d_stid;
+
+ stack->nst.feature = FEATURE_NET_HOLD;
+ if (stack->ptp)
+ stack->nst.feature |= FEATURE_NET_PTP;
+ if (stack->pri)
+ stack->nst.feature |= FEATURE_NET_CRLEN2 | FEATURE_NET_EXTCID;
+
+ stack->nst.l1_id = stack->lower_id;
+ stack->nst.l2_id = stack->upper_id;
+
+ msg_queue_init(&stack->nst.down_queue);
+
+ Isdnl2Init(&stack->nst);
+ Isdnl3Init(&stack->nst);
+ }
+}
+
+
Modified: team/crichter/0.3.0/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_lib.h?rev=36375&r1=36374&r2=36375&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.h (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.h Fri Jun 30 09:04:57 2006
@@ -407,6 +407,8 @@
int misdn_lib_is_ptp(int port);
int misdn_lib_get_maxchans(int port);
+void misdn_lib_reinit_nt_stack(int port);
+
#define PRI_TRANS_CAP_SPEECH 0x0
#define PRI_TRANS_CAP_DIGITAL 0x08
#define PRI_TRANS_CAP_RESTRICTED_DIGITAL 0x09
More information about the svn-commits
mailing list