aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--channels/chan_misdn.c70
-rw-r--r--channels/misdn/isdn_lib.c34
-rw-r--r--channels/misdn_config.c3
3 files changed, 53 insertions, 54 deletions
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index 9d2a0e9df..154a87b2f 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -1045,8 +1045,8 @@ static int misdn_show_cls (int fd, int argc, char *argv[])
print_bc_info(fd, help, bc);
} else {
if (help->state == MISDN_HOLDED) {
- chan_misdn_log(0, 0, "ITS A HOLDED BC:\n");
- chan_misdn_log(0,0," --> l3_id: %x\n"
+ chan_misdn_log(2, 0, "ITS A HOLDED BC:\n");
+ chan_misdn_log(2,0," --> l3_id: %x\n"
" --> dad:%s oad:%s\n"
" --> hold_port: %d\n"
" --> hold_channel: %d\n"
@@ -1444,8 +1444,7 @@ static int update_config (struct chan_list *ch, int orig)
int port=bc->port;
- chan_misdn_log(5,port,"update_config: Getting Config\n");
-
+ chan_misdn_log(7,port,"update_config: Getting Config\n");
int hdlc=0;
misdn_cfg_get( port, MISDN_CFG_HDLC, &hdlc, sizeof(int));
@@ -1911,7 +1910,7 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
chan_misdn_log(1, port, "* CALL: %s\n",dest);
- chan_misdn_log(1, port, " --> * dad:%s tech:%s ctx:%s\n",ast->exten,ast->name, ast->context);
+ chan_misdn_log(2, port, " --> * dad:%s tech:%s ctx:%s\n",ast->exten,ast->name, ast->context);
chan_misdn_log(3, port, " --> * adding2newbc ext %s\n",ast->exten);
if (ast->exten) {
@@ -1967,7 +1966,7 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
return -1;
}
- chan_misdn_log(1, port, " --> * SEND: State Dialing pid:%d\n",newbc?newbc->pid:1);
+ chan_misdn_log(2, port, " --> * SEND: State Dialing pid:%d\n",newbc?newbc->pid:1);
ast_setstate(ast, AST_STATE_DIALING);
ast->hangupcause=16;
@@ -2137,12 +2136,11 @@ static int misdn_indication(struct ast_channel *ast, int cond, const void *data,
return -1;
}
- chan_misdn_log(1, p->bc->port, "* IND : Indication [%d] from %s\n",cond, ast->exten);
+ chan_misdn_log(5, p->bc->port, "* IND : Indication [%d] from %s\n",cond, ast->exten);
switch (cond) {
case AST_CONTROL_BUSY:
- chan_misdn_log(1, p->bc->port, "* IND :\tbusy\n");
- chan_misdn_log(1, p->bc->port, " --> * SEND: State Busy pid:%d\n",p->bc?p->bc->pid:-1);
+ chan_misdn_log(1, p->bc->port, "* IND :\tbusy pid:%d\n",p->bc?p->bc->pid:-1);
ast_setstate(ast,AST_STATE_BUSY);
p->bc->out_cause=17;
@@ -2155,41 +2153,42 @@ static int misdn_indication(struct ast_channel *ast, int cond, const void *data,
return -1;
break;
case AST_CONTROL_RING:
- chan_misdn_log(1, p->bc->port, " --> * IND :\tring pid:%d\n",p->bc?p->bc->pid:-1);
+ chan_misdn_log(1, p->bc->port, "* IND :\tring pid:%d\n",p->bc?p->bc->pid:-1);
return -1;
break;
case AST_CONTROL_RINGING:
+ chan_misdn_log(1, p->bc->port, "* IND :\tringing pid:%d\n",p->bc?p->bc->pid:-1);
switch (p->state) {
case MISDN_ALERTING:
- chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d but I was Ringing before, so ignoreing it\n",p->bc?p->bc->pid:-1);
+ chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d but I was Ringing before, so ignoreing it\n",p->bc?p->bc->pid:-1);
break;
case MISDN_CONNECTED:
- chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d but Connected, so just send TONE_ALERTING without state changes \n",p->bc?p->bc->pid:-1);
+ chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d but Connected, so just send TONE_ALERTING without state changes \n",p->bc?p->bc->pid:-1);
return -1;
break;
default:
p->state=MISDN_ALERTING;
- chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d\n",p->bc?p->bc->pid:-1);
+ chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d\n",p->bc?p->bc->pid:-1);
misdn_lib_send_event( p->bc, EVENT_ALERTING);
if (p->other_ch && p->other_ch->bc) {
if (misdn_inband_avail(p->other_ch->bc)) {
- chan_misdn_log(1,p->bc->port, " --> other End is mISDN and has inband info available\n");
+ chan_misdn_log(2,p->bc->port, " --> other End is mISDN and has inband info available\n");
break;
}
if (!p->other_ch->bc->nt) {
- chan_misdn_log(1,p->bc->port, " --> other End is mISDN TE so it has inband info for sure (?)\n");
+ chan_misdn_log(2,p->bc->port, " --> other End is mISDN TE so it has inband info for sure (?)\n");
break;
}
}
- chan_misdn_log(1, p->bc->port, " --> * SEND: State Ring pid:%d\n",p->bc?p->bc->pid:-1);
+ chan_misdn_log(3, p->bc->port, " --> * SEND: State Ring pid:%d\n",p->bc?p->bc->pid:-1);
ast_setstate(ast,AST_STATE_RINGING);
if ( !p->bc->nt && (p->orginator==ORG_MISDN) && !p->incoming_early_audio )
- chan_misdn_log(1,p->bc->port, " --> incoming_early_audio off\n");
+ chan_misdn_log(2,p->bc->port, " --> incoming_early_audio off\n");
else
return -1;
}
@@ -2328,10 +2327,10 @@ static int misdn_hangup(struct ast_channel *ast)
}
chan_misdn_log(1, bc->port, "* IND : HANGUP\tpid:%d ctx:%s dad:%s oad:%s State:%s\n",p->bc?p->bc->pid:-1, ast->context, ast->exten, AST_CID_P(ast), misdn_get_ch_state(p));
- chan_misdn_log(2, bc->port, " --> l3id:%x\n",p->l3id);
- chan_misdn_log(1, bc->port, " --> cause:%d\n",bc->cause);
- chan_misdn_log(1, bc->port, " --> out_cause:%d\n",bc->out_cause);
- chan_misdn_log(1, bc->port, " --> state:%s\n", misdn_get_ch_state(p));
+ chan_misdn_log(3, bc->port, " --> l3id:%x\n",p->l3id);
+ chan_misdn_log(3, bc->port, " --> cause:%d\n",bc->cause);
+ chan_misdn_log(2, bc->port, " --> out_cause:%d\n",bc->out_cause);
+ chan_misdn_log(2, bc->port, " --> state:%s\n", misdn_get_ch_state(p));
switch (p->state) {
case MISDN_CALLING:
@@ -2416,7 +2415,7 @@ static int misdn_hangup(struct ast_channel *ast)
}
- chan_misdn_log(1, bc->port, "Channel: %s hanguped new state:%s\n",ast->name,misdn_get_ch_state(p));
+ chan_misdn_log(3, bc->port, " --> Channel: %s hanguped new state:%s\n",ast->name,misdn_get_ch_state(p));
return 0;
}
@@ -2728,9 +2727,9 @@ static enum ast_bridge_result misdn_bridge (struct ast_channel *c0,
/* got hangup .. */
if (!f)
- chan_misdn_log(1,ch1->bc->port,"Read Null Frame\n");
+ chan_misdn_log(4,ch1->bc->port,"Read Null Frame\n");
else
- chan_misdn_log(1,ch1->bc->port,"Read Frame Controll class:%d\n",f->subclass);
+ chan_misdn_log(4,ch1->bc->port,"Read Frame Controll class:%d\n",f->subclass);
*fo=f;
*rc=who;
@@ -3309,11 +3308,11 @@ static void hangup_chan(struct chan_list *ch)
return;
}
- cb_log(1,port,"hangup_chan\n");
+ cb_log(5,port,"hangup_chan called\n");
if (ch->need_hangup)
{
- cb_log(1,port,"-> hangup\n");
+ cb_log(2,port," --> hangup\n");
send_cause2ast(ch->ast,ch->bc,ch);
ch->need_hangup=0;
ch->need_queue_hangup=0;
@@ -3323,7 +3322,7 @@ static void hangup_chan(struct chan_list *ch)
}
if (!ch->need_queue_hangup) {
- cb_log(1,port,"No need to queue hangup\n");
+ cb_log(2,port," --> No need to queue hangup\n");
}
ch->need_queue_hangup=0;
@@ -3332,7 +3331,7 @@ static void hangup_chan(struct chan_list *ch)
if (ch->ast)
ast_queue_hangup(ch->ast);
- cb_log(1,port,"-> queue_hangup\n");
+ cb_log(2,port," --> queue_hangup\n");
} else {
cb_log(1,port,"Cannot hangup chan, no ast\n");
}
@@ -3352,7 +3351,7 @@ static void release_chan(struct misdn_bchannel *bc) {
ast=ch->ast;
}
- chan_misdn_log(1, bc->port, "release_chan: bc with l3id: %x\n",bc->l3_id);
+ chan_misdn_log(5, bc->port, "release_chan: bc with l3id: %x\n",bc->l3_id);
/*releaseing jitterbuffer*/
if (ch->jb ) {
@@ -3548,7 +3547,7 @@ void import_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_
tmp=pbx_builtin_getvar_helper(chan,"MISDN_PID");
if (tmp) {
ch->other_pid=atoi(tmp);
- chan_misdn_log(1,bc->port,"IMPORT_PID: importing pid:%s\n",tmp);
+ chan_misdn_log(3,bc->port," --> IMPORT_PID: importing pid:%s\n",tmp);
if (ch->other_pid >0) {
ch->other_ch=find_chan_by_pid(cl_te,ch->other_pid);
if (ch->other_ch) ch->other_ch->other_ch=ch;
@@ -3559,7 +3558,7 @@ void import_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_
void export_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_list *ch)
{
char tmp[32];
- chan_misdn_log(1,bc->port,"EXPORT_PID: pid:%d\n",bc->pid);
+ chan_misdn_log(3,bc->port," --> EXPORT_PID: pid:%d\n",bc->pid);
sprintf(tmp,"%d",bc->pid);
pbx_builtin_setvar_helper(chan,"_MISDN_PID",tmp);
}
@@ -4171,15 +4170,15 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
ast_queue_control(ch->ast, AST_CONTROL_RINGING);
ast_setstate(ch->ast, AST_STATE_RINGING);
- cb_log(1,bc->port,"Set State Ringing\n");
+ cb_log(7,bc->port," --> Set State Ringing\n");
if ( misdn_cap_is_speech(bc->capability) && misdn_inband_avail(bc)) {
cb_log(1,bc->port,"Starting Tones, we have inband Data\n");
start_bc_tones(ch);
} else {
- cb_log(1,bc->port,"We have no inband Data, the other end must create ringing\n");
+ cb_log(3,bc->port," --> We have no inband Data, the other end must create ringing\n");
if (ch->far_alerting) {
- cb_log(1,bc->port,"The other end can not do ringing eh ?.. we must do all ourself..");
+ cb_log(1,bc->port," --> The other end can not do ringing eh ?.. we must do all ourself..");
start_bc_tones(ch);
/*tone_indicate(ch, TONE_FAR_ALERTING);*/
}
@@ -4451,6 +4450,9 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
ch->bc=bc;
ch->state = MISDN_CONNECTED;
+ ch->hold_info.port=0;
+ ch->hold_info.channel=0;
+
struct ast_channel *hold_ast=AST_BRIDGED_P(ch->ast);
if (hold_ast) {
diff --git a/channels/misdn/isdn_lib.c b/channels/misdn/isdn_lib.c
index adc8ca203..69b88edf8 100644
--- a/channels/misdn/isdn_lib.c
+++ b/channels/misdn/isdn_lib.c
@@ -434,10 +434,10 @@ static int find_free_chan_in_stack(struct misdn_stack *stack, struct misdn_bchan
{
int i;
- cb_log(1,stack->port,"find_free_chan: req_chan:%d\n",channel);
+ cb_log(5,stack->port,"find_free_chan: req_chan:%d\n",channel);
if (channel < 0 || channel > MAX_BCHANS) {
- cb_log(4, stack->port, " !! out of bound call to find_free_chan_in_stack! (ch:%d)\n", channel);
+ cb_log(0, stack->port, " !! out of bound call to find_free_chan_in_stack! (ch:%d)\n", channel);
return 0;
}
@@ -446,7 +446,7 @@ static int find_free_chan_in_stack(struct misdn_stack *stack, struct misdn_bchan
for (i = 0; i < stack->b_num; i++) {
if (i != 15 && (channel < 0 || i == channel)) { /* skip E1 Dchannel ;) and work with chan preselection */
if (!stack->channels[i]) {
- cb_log (1, stack->port, " --> found chan%s: %d\n", channel>=0?" (preselected)":"", i+1);
+ cb_log (3, stack->port, " --> found chan%s: %d\n", channel>=0?" (preselected)":"", i+1);
stack->channels[i] = 1;
bc->channel=i+1;
cb_event(EVENT_NEW_CHANNEL, bc, NULL);
@@ -455,7 +455,7 @@ static int find_free_chan_in_stack(struct misdn_stack *stack, struct misdn_bchan
}
}
- cb_log (4, stack->port, " !! NO FREE CHAN IN STACK\n");
+ cb_log (1, stack->port, " !! NO FREE CHAN IN STACK\n");
dump_chan_list(stack);
return 0;
@@ -1677,8 +1677,6 @@ int misdn_lib_port_up(int port, int check)
stack;
stack=stack->next) {
- if ( !stack->ptp && !check) return 1;
-
if (stack->port == port) {
if (stack->blocked) {
@@ -1696,7 +1694,7 @@ int misdn_lib_port_up(int port, int check)
return 0;
}
} else {
- if ( stack->l1link)
+ if ( !check || stack->l1link )
return 1;
else {
cb_log(0,port, "Port down PMP\n");
@@ -2034,7 +2032,7 @@ handle_event_nt(void *dat, void *arg)
if (stack->ptp)
set_chan_in_stack(stack, bc->channel);
else
- cb_log(0,stack->port," --> PTMP but channel requested\n");
+ cb_log(3,stack->port," --> PTMP but channel requested\n");
} else {
@@ -3195,7 +3193,7 @@ int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event )
}
cb_log(1, stack->port, "I SEND:%s oad:%s dad:%s pid:%d\n", isdn_get_info(msgs_g, event, 0), bc->oad, bc->dad, bc->pid);
- cb_log(1, stack->port, " --> bc_state:%s\n",bc_state2str(bc->bc_state));
+ cb_log(4, stack->port, " --> bc_state:%s\n",bc_state2str(bc->bc_state));
misdn_lib_log_ies(bc);
switch (event) {
@@ -4218,7 +4216,7 @@ void manager_ec_enable(struct misdn_bchannel *bc)
struct misdn_stack *stack=get_stack_by_bc(bc);
- cb_log(1, stack?stack->port:0,"ec_enable\n");
+ cb_log(4, stack?stack->port:0,"ec_enable\n");
if (!misdn_cap_is_speech(bc->capability)) {
cb_log(1, stack?stack->port:0, " --> no speech? cannot enable EC\n");
@@ -4226,7 +4224,7 @@ void manager_ec_enable(struct misdn_bchannel *bc)
}
if (bc->ec_enable) {
- cb_log(1, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d training:%d\n",bc->ec_deftaps, bc->ec_training);
+ cb_log(3, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d training:%d\n",bc->ec_deftaps, bc->ec_training);
switch (bc->ec_deftaps) {
case 4:
@@ -4262,7 +4260,7 @@ void manager_ec_disable(struct misdn_bchannel *bc)
{
struct misdn_stack *stack=get_stack_by_bc(bc);
- cb_log(1, stack?stack->port:0,"ec_disable\n");
+ cb_log(4, stack?stack->port:0," --> ec_disable\n");
if (!misdn_cap_is_speech(bc->capability)) {
cb_log(1, stack?stack->port:0, " --> no speech? cannot disable EC\n");
@@ -4270,7 +4268,7 @@ void manager_ec_disable(struct misdn_bchannel *bc)
}
if ( ! bc->ec_enable) {
- cb_log(1, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n");
+ cb_log(3, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n");
manager_ph_control(bc, ECHOCAN_OFF, 0);
}
}
@@ -4287,7 +4285,7 @@ void misdn_join_conf(struct misdn_bchannel *bc, int conf_id)
manager_ph_control(bc, CMX_RECEIVE_OFF, 0);
manager_ph_control(bc, CMX_CONF_JOIN, conf_id);
- cb_log(1,bc->port, "Joining bc:%x in conf:%d\n",bc->addr,conf_id);
+ cb_log(3,bc->port, "Joining bc:%x in conf:%d\n",bc->addr,conf_id);
char data[16];
int len=15;
@@ -4305,13 +4303,13 @@ void misdn_split_conf(struct misdn_bchannel *bc, int conf_id)
manager_ph_control(bc, CMX_RECEIVE_ON, 0);
manager_ph_control(bc, CMX_CONF_SPLIT, conf_id);
- cb_log(1,bc->port, "Splitting bc:%x in conf:%d\n",bc->addr,conf_id);
+ cb_log(4,bc->port, "Splitting bc:%x in conf:%d\n",bc->addr,conf_id);
}
void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2) {
int conf_id=bc1->pid +1;
- cb_log(1, bc1->port, "I Send: BRIDGE from:%d to:%d\n",bc1->port,bc2->port);
+ cb_log(4, bc1->port, "I Send: BRIDGE from:%d to:%d\n",bc1->port,bc2->port);
struct misdn_bchannel *bc_list[]={
bc1,bc2,NULL
@@ -4320,7 +4318,7 @@ void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2)
for (bc=bc_list; *bc; bc++) {
(*bc)->conf_id=conf_id;
- cb_log(1, (*bc)->port, " --> bc_addr:%x\n",(*bc)->addr);
+ cb_log(4, (*bc)->port, " --> bc_addr:%x\n",(*bc)->addr);
switch((*bc)->bc_state) {
case BCHAN_ACTIVATED:
@@ -4355,7 +4353,7 @@ void misdn_lib_split_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel
void misdn_lib_echo(struct misdn_bchannel *bc, int onoff)
{
- cb_log(1,bc->port, " --> ECHO %s\n", onoff?"ON":"OFF");
+ cb_log(3,bc->port, " --> ECHO %s\n", onoff?"ON":"OFF");
manager_ph_control(bc, onoff?CMX_ECHO_ON:CMX_ECHO_OFF, 0);
}
diff --git a/channels/misdn_config.c b/channels/misdn_config.c
index 6745417e9..fc90ccf2b 100644
--- a/channels/misdn_config.c
+++ b/channels/misdn_config.c
@@ -112,7 +112,7 @@ static const struct misdn_cfg_spec port_spec[] = {
"\tBut be aware! a broken or plugged off cable might be used for a group call\n"
"\tas well, since chan_misdn has no chance to distinguish if the L1 is down\n"
"\tbecause of a lost Link or because the Provider shut it down..." },
- { "block_on_alarm", MISDN_CFG_ALARM_BLOCK, MISDN_CTYPE_BOOL, "yes", NONE ,
+ { "block_on_alarm", MISDN_CFG_ALARM_BLOCK, MISDN_CTYPE_BOOL, "no", NONE ,
"Block this port if we have an alarm on it."
"default: yes\n" },
{ "hdlc", MISDN_CFG_HDLC, MISDN_CTYPE_BOOL, "no", NONE,
@@ -308,7 +308,6 @@ static const struct misdn_cfg_spec port_spec[] = {
"MSN's for TE ports, listen on those numbers on the above ports, and\n"
"\tindicate the incoming calls to Asterisk.\n"
"\tHere you can give a comma seperated list, or simply an '*' for any msn." },
-
};
static const struct misdn_cfg_spec gen_spec[] = {