aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorcrichter <crichter@f38db490-d61c-443f-a65b-d21fe96a405b>2006-12-18 10:19:39 +0000
committercrichter <crichter@f38db490-d61c-443f-a65b-d21fe96a405b>2006-12-18 10:19:39 +0000
commit107fc00ba2dfb572bd3804e52111fff891bf6878 (patch)
tree22a03bc84a1ab987db0176c6f288d85788f78630 /channels
parent774f7ad20119fcb84f3f26399a5f119d5f5ba668 (diff)
when our PTP Partner sends us a SETUP with a preselected channel we just accept it, even when we're NT. added some checks for segfaults.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@48552 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_misdn.c10
-rw-r--r--channels/misdn/isdn_lib.c33
2 files changed, 28 insertions, 15 deletions
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index a40735236..65c15a166 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -2393,6 +2393,10 @@ static int dialtone_indicate(struct chan_list *cl)
const struct tone_zone_sound *ts= NULL;
struct ast_channel *ast=cl->ast;
+ if (!ast) {
+ chan_misdn_log(0,cl->bc->port,"No Ast in dialtone_indicate\n");
+ return -1;
+ }
int nd=0;
misdn_cfg_get( cl->bc->port, MISDN_CFG_NODIALTONE, &nd, sizeof(nd));
@@ -2426,6 +2430,12 @@ static int hanguptone_indicate(struct chan_list *cl)
static int stop_indicate(struct chan_list *cl)
{
struct ast_channel *ast=cl->ast;
+
+ if (!ast) {
+ chan_misdn_log(0,cl->bc->port,"No Ast in stop_indicate\n");
+ return -1;
+ }
+
chan_misdn_log(3,cl->bc->port," --> None\n");
misdn_lib_tone_generator_stop(cl->bc);
ast_playtones_stop(ast);
diff --git a/channels/misdn/isdn_lib.c b/channels/misdn/isdn_lib.c
index 46be97954..89cf942e4 100644
--- a/channels/misdn/isdn_lib.c
+++ b/channels/misdn/isdn_lib.c
@@ -666,6 +666,7 @@ int set_chan_in_stack(struct misdn_stack *stack, int channel)
{
cb_log(4,stack->port,"set_chan_in_stack: %d\n",channel);
+ dump_chan_list(stack);
if (channel >=1 ) {
if (!stack->channels[channel-1])
stack->channels[channel-1] = 1;
@@ -1482,15 +1483,16 @@ int handle_event ( struct misdn_bchannel *bc, enum event_e event, iframe_t *frm)
cb_log(0, stack->port, "Any Channel Requested, but we have no more!!\n");
break;
}
- }
-
- if (bc->channel >0 && bc->channel<255) {
- int ret=set_chan_in_stack(stack ,bc->channel);
- if (event == EVENT_SETUP && ret<0){
- /* empty bchannel */
- bc->channel=0;
- bc->out_cause=44;
- misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
+ } else {
+
+ if (bc->channel >0 && bc->channel<255) {
+ int ret=set_chan_in_stack(stack ,bc->channel);
+ if (event == EVENT_SETUP && ret<0){
+ /* empty bchannel */
+ bc->channel=0;
+ bc->out_cause=44;
+ misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
+ }
}
}
@@ -1802,12 +1804,6 @@ handle_event_nt(void *dat, void *arg)
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);
-
- if (bc->channel<=0)
- goto ERR_NO_CHANNEL;
- }
}
break;
@@ -2035,6 +2031,13 @@ handle_event_nt(void *dat, void *arg)
switch (event) {
case EVENT_SETUP:
+ if (bc->channel<=0) {
+ bc->channel=find_free_chan_in_stack(stack,0);
+
+ if (bc->channel<=0)
+ goto ERR_NO_CHANNEL;
+ }
+
if (bc->channel>0 && bc->channel<255) {
if (stack->ptp) {
int ret=set_chan_in_stack(stack, bc->channel);