diff options
author | Christian Richter <christian.richter@beronet.com> | 2006-10-27 11:18:32 +0000 |
---|---|---|
committer | Christian Richter <christian.richter@beronet.com> | 2006-10-27 11:18:32 +0000 |
commit | f19300635f0286385ad23255dade2903651f2c12 (patch) | |
tree | 3756e6fc9a54d0d423ef12a209cf813c436e706d /channels/misdn/isdn_lib.c | |
parent | ebd08b418531d020ecea71a9d78becc85ec7a2d3 (diff) |
Merged revisions 46351-46353 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r46351 | crichter | 2006-10-27 11:49:20 +0200 (Fr, 27 Okt 2006) | 9 lines
Merged revisions 46176 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r46176 | crichter | 2006-10-25 10:41:59 +0200 (Mi, 25 Okt 2006) | 1 line
added nttimeout option to configure wether we disconnect calls on NT timeouts or not during an overlapdial session
........
................
r46352 | crichter | 2006-10-27 11:58:44 +0200 (Fr, 27 Okt 2006) | 1 line
fixed not compile issue, which was just introduced
................
r46353 | crichter | 2006-10-27 12:03:23 +0200 (Fr, 27 Okt 2006) | 9 lines
Merged revisions 46350 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r46350 | crichter | 2006-10-27 11:24:01 +0200 (Fr, 27 Okt 2006) | 1 line
fixed a bug which caused chan_misdn to try to allocate 2 times the same channel on high load, which then caused instability of mISDN. removed a useless function from isdn_lib.c
........
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46354 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/misdn/isdn_lib.c')
-rw-r--r-- | channels/misdn/isdn_lib.c | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/channels/misdn/isdn_lib.c b/channels/misdn/isdn_lib.c index 8c94c5a2e..ce5c118ae 100644 --- a/channels/misdn/isdn_lib.c +++ b/channels/misdn/isdn_lib.c @@ -649,17 +649,12 @@ static int clean_up_bc(struct misdn_bchannel *bc) cb_log(2, stack->port, "$$$ Cleaning up bc with stid :%x pid:%d\n", bc->b_stid, bc->pid); - manager_bchannel_deactivate(bc); - - manager_ec_disable(bc); + manager_bchannel_deactivate(bc); mISDN_write_frame(stack->midev, buff, bc->layer_id|FLG_MSG_TARGET|FLG_MSG_DOWN, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC); - /*mISDN_clear_stack(stack->midev, bc->b_stid);*/ - - bc->b_stid = 0; bc_state_change(bc, BCHAN_CLEANED); @@ -1032,6 +1027,7 @@ int setup_bc(struct misdn_bchannel *bc) mISDN_write_frame(midev, buff, bc->layer_id, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC); bc_state_change(bc,BCHAN_ERROR); + cb_event(EVENT_BCHAN_ERROR, bc, glob_mgr->user_data); return(-EINVAL); } @@ -1042,6 +1038,7 @@ int setup_bc(struct misdn_bchannel *bc) mISDN_write_frame(midev, buff, bc->layer_id, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC); bc_state_change(bc,BCHAN_ERROR); + cb_event(EVENT_BCHAN_ERROR, bc, glob_mgr->user_data); return(-EINVAL); } @@ -1054,6 +1051,8 @@ int setup_bc(struct misdn_bchannel *bc) mISDN_write_frame(midev, buff, bc->layer_id, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC); bc_state_change(bc,BCHAN_ERROR); + cb_event(EVENT_BCHAN_ERROR, bc, glob_mgr->user_data); + return (-EINVAL); } manager_bchannel_activate(bc); @@ -1494,7 +1493,7 @@ static int handle_event ( struct misdn_bchannel *bc, enum event_e event, iframe_ case EVENT_SETUP_ACKNOWLEDGE: setup_bc(bc); - + case EVENT_SETUP: { @@ -1538,22 +1537,6 @@ static int handle_event ( struct misdn_bchannel *bc, enum event_e event, iframe_ return 0; } -static int handle_new_process(struct misdn_stack *stack, iframe_t *frm) -{ - - struct misdn_bchannel* bc=misdn_lib_get_free_bc(stack->port, 0, 1); - - - if (!bc) { - cb_log(0, stack->port, " --> !! lib: No free channel!\n"); - return -1; - } - - cb_log(7, stack->port, " --> new_process: New L3Id: %x\n",frm->dinfo); - bc->l3_id=frm->dinfo; - return 0; -} - static int handle_cr ( struct misdn_stack *stack, iframe_t *frm) { if (!stack) return -1; @@ -1561,9 +1544,15 @@ static int handle_cr ( struct misdn_stack *stack, iframe_t *frm) switch (frm->prim) { case CC_NEW_CR|INDICATION: cb_log(7, stack->port, " --> lib: NEW_CR Ind with l3id:%x on this port.\n",frm->dinfo); - if (handle_new_process(stack, frm) <0) { + + struct misdn_bchannel* bc=misdn_lib_get_free_bc(stack->port, 0, 1); + if (!bc) { + cb_log(0, stack->port, " --> !! lib: No free channel!\n"); return -1; } + + cb_log(7, stack->port, " --> new_process: New L3Id: %x\n",frm->dinfo); + bc->l3_id=frm->dinfo; return 1; case CC_NEW_CR|CONFIRM: return 1; @@ -1796,12 +1785,10 @@ handle_event_nt(void *dat, void *arg) case CC_SETUP|INDICATION: { - iframe_t frm; /* fake te frm to add callref to global callreflist */ - frm.dinfo = hh->dinfo; - frm.addr=stack->upper_id; - frm.prim = CC_NEW_CR|INDICATION; - - if (handle_cr(stack, &frm)< 0) { + struct misdn_bchannel* bc=misdn_lib_get_free_bc(stack->port, 0, 1); + if (!bc) + ERR_NO_CHANNEL: + { msg_t *dmsg; cb_log(4, stack->port, "Patch from MEIDANIS:Sending RELEASE_COMPLETE %x (No free Chan for you..)\n", hh->dinfo); dmsg = create_l3msg(CC_RELEASE_COMPLETE | REQUEST,MT_RELEASE_COMPLETE, hh->dinfo,sizeof(RELEASE_COMPLETE_t), 1); @@ -1809,6 +1796,16 @@ handle_event_nt(void *dat, void *arg) free_msg(msg); return 0; } + + cb_log(7, stack->port, " --> new_process: New L3Id: %x\n",hh->dinfo); + bc->l3_id=hh->dinfo; + + if (bc->channel<=0) { + bc->channel=find_free_chan_in_stack(stack,0,0); + + if (bc->channel<=0) + goto ERR_NO_CHANNEL; + } } break; |