diff options
author | crichter <crichter@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-03 11:15:02 +0000 |
---|---|---|
committer | crichter <crichter@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-03 11:15:02 +0000 |
commit | 85c5dfacde36d18174e5f2953cc90385d3377962 (patch) | |
tree | 1c4d5429dbada9b0a007b83f1cb8b4285295acff /channels/chan_misdn.c | |
parent | c99b23c3b78490ed9b112c06730a00de4903b0f3 (diff) |
Merged revisions 49313 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r49313 | crichter | 2007-01-03 10:06:50 +0100 (Mi, 03 Jan 2007) | 41 lines
Merged revisions 48319,48321,48467,48552,48576,49135,49303 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r48319 | crichter | 2006-12-06 15:35:25 +0100 (Mi, 06 Dez 2006) | 1 line
changed a few debugs to higher debug levels
........
r48321 | crichter | 2006-12-06 16:48:45 +0100 (Mi, 06 Dez 2006) | 1 line
added the export and import of the MISDN_ADDRESS_COMPLETE Variable to inidcate wether the extension is already completely dialed or if there might come additional digits by information elements. also added some docs for that.
........
r48467 | crichter | 2006-12-14 14:03:49 +0100 (Do, 14 Dez 2006) | 1 line
removed FIXUP state. added check for channel allocation conflict when we create a setup while the other site creates a setup on the same channel, besides the check we resolve this conflict.
........
r48552 | crichter | 2006-12-18 11:19:39 +0100 (Mo, 18 Dez 2006) | 1 line
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.
........
r48576 | crichter | 2006-12-19 14:08:51 +0100 (Di, 19 Dez 2006) | 1 line
when we reject a channel, because it's in use already, we shouldn't process the setup anymore. made the channel allocation a bit easier and more understandable, removed a few unused lines
........
r49135 | crichter | 2007-01-02 11:07:22 +0100 (Di, 02 Jan 2007) | 1 line
added check for channel ranges in the set/empty channel functions. set pmp_l1_check default to no. added misdn restart pid cli command. added cleaning of channel when we send a RELEASE_COMPLETE.
........
r49303 | crichter | 2007-01-03 09:24:00 +0100 (Mi, 03 Jan 2007) | 9 lines
* Added check for bridging in misdn_call to avoid setting echocancellation
when 2 mISDN channels are involved and when bridging is set. That lead
to a kernel panic before under different situations, because we switched
about 2 times between hardware bridging and echocancelation
* readded MISDN_URATE variable which got lost before, this should make app_v110
work again
* fixed typo
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@49321 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_misdn.c')
-rw-r--r-- | channels/chan_misdn.c | 88 |
1 files changed, 58 insertions, 30 deletions
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index 154a87b2f..5a2c8a420 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -132,7 +132,6 @@ enum misdn_chan_state { /* misdn_hangup */ MISDN_HOLDED, /*!< if this chan is holded */ MISDN_HOLD_DISCONNECT, /*!< if this chan is holded */ - MISDN_FIXUP/*!< if this chan is holded */ }; @@ -778,6 +777,20 @@ static int misdn_restart_port (int fd, int argc, char *argv[]) return 0; } +static int misdn_restart_pid (int fd, int argc, char *argv[]) +{ + int pid; + + if (argc != 4) + return RESULT_SHOWUSAGE; + + pid = atoi(argv[3]); + + misdn_lib_pid_restart(pid); + + return 0; +} + static int misdn_port_up (int fd, int argc, char *argv[]) { int port; @@ -933,7 +946,6 @@ static struct state_struct state_array[] = { {MISDN_HUNGUP_FROM_MISDN,"HUNGUP_FROM_MISDN"}, /* when DISCONNECT/RELEASE/REL_COMP cam from misdn */ {MISDN_HOLDED,"HOLDED"}, /* when DISCONNECT/RELEASE/REL_COMP cam from misdn */ {MISDN_HOLD_DISCONNECT,"HOLD_DISCONNECT"}, /* when DISCONNECT/RELEASE/REL_COMP cam from misdn */ - {MISDN_FIXUP,"FIXUP"}, /**/ {MISDN_HUNGUP_FROM_AST,"HUNGUP_FROM_AST"} /* when DISCONNECT/RELEASE/REL_COMP came out of */ /* misdn_hangup */ }; @@ -1411,6 +1423,8 @@ static struct ast_cli_entry chan_misdn_clis[] = { "Usage: misdn port unblock\n" }, { {"misdn","restart","port", NULL}, misdn_restart_port, "Restarts the given port", "Usage: misdn restart port\n" }, + { {"misdn","restart","pid", NULL}, misdn_restart_pid, "Restarts the given pid", + "Usage: misdn restart pid\n" }, { {"misdn","port","up", NULL}, misdn_port_up, "Tries to establish L1 on the given port", "Usage: misdn port up <port>\n" }, { {"misdn","port","down", NULL}, misdn_port_down, "Tries to deacivate the L1 on the given port", @@ -1427,7 +1441,6 @@ static struct ast_cli_entry chan_misdn_clis[] = { "Usage: misdn set crypt debug <level>\n" } }; - static int update_config (struct chan_list *ch, int orig) { if (!ch) { @@ -1951,6 +1964,15 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout) misdn_set_opt_exec(ast,opts); else chan_misdn_log(2,port,"NO OPTS GIVEN\n"); + + /*check for bridging*/ + int bridging; + misdn_cfg_get( 0, MISDN_GEN_BRIDGING, &bridging, sizeof(int)); + if (bridging && ch->other_ch) { + chan_misdn_log(0, port, "Disabling EC on both Sides\n"); + ch->bc->ec_enable=0; + ch->other_ch->bc->ec_enable=0; + } r=misdn_lib_send_event( newbc, EVENT_SETUP ); @@ -2026,7 +2048,6 @@ static int misdn_answer(struct ast_channel *ast) } p->state = MISDN_CONNECTED; - misdn_lib_echo(p->bc,0); stop_indicate(p); if ( ast_strlen_zero(p->bc->cad) ) { @@ -2113,7 +2134,6 @@ static int misdn_fixup(struct ast_channel *oldast, struct ast_channel *ast) chan_misdn_log(1, p->bc?p->bc->port:0, "* IND: Got Fixup State:%s L3id:%x\n", misdn_get_ch_state(p), p->l3id); p->ast = ast ; - p->state=MISDN_FIXUP; return 0; } @@ -2248,7 +2268,7 @@ static int misdn_indication(struct ast_channel *ast, int cond, const void *data, chan_misdn_log(1, p->bc->port, " --> *\tUNHOLD pid:%d\n",p->bc?p->bc->pid:-1); break; default: - ast_log(LOG_NOTICE, " --> * Unknown Indication:%d pid:%d\n",cond,p->bc?p->bc->pid:-1); + chan_misdn_log(1, p->bc->port, " --> * Unknown Indication:%d pid:%d\n",cond,p->bc?p->bc->pid:-1); } return 0; @@ -2281,7 +2301,6 @@ static int misdn_hangup(struct ast_channel *ast) if (ast->_state == AST_STATE_RESERVED || p->state == MISDN_NOTHING || p->state == MISDN_HOLDED || - p->state == MISDN_FIXUP || p->state == MISDN_HOLD_DISCONNECT ) { CLEAN_CH: @@ -2676,29 +2695,12 @@ static enum ast_bridge_result misdn_bridge (struct ast_channel *c0, if (ch1 && ch2 ) ; else return -1; - int bridging; misdn_cfg_get( 0, MISDN_GEN_BRIDGING, &bridging, sizeof(int)); if (bridging) { - int ecwb, ec; - misdn_cfg_get( ch1->bc->port, MISDN_CFG_ECHOCANCELWHENBRIDGED, &ecwb, sizeof(int)); - misdn_cfg_get( ch1->bc->port, MISDN_CFG_ECHOCANCEL, &ec, sizeof(int)); - if ( !ecwb && ec ) { - chan_misdn_log(2, ch1->bc->port, "Disabling Echo Cancellor when Bridged\n"); - ch1->bc->ec_enable=0; - manager_ec_disable(ch1->bc); - } - misdn_cfg_get( ch2->bc->port, MISDN_CFG_ECHOCANCELWHENBRIDGED, &ecwb, sizeof(int)); - misdn_cfg_get( ch2->bc->port, MISDN_CFG_ECHOCANCEL, &ec, sizeof(int)); - if ( !ecwb && ec) { - chan_misdn_log(2, ch2->bc->port, "Disabling Echo Cancellor when Bridged\n"); - ch2->bc->ec_enable=0; - manager_ec_disable(ch2->bc); - } /* trying to make a mISDN_dsp conference */ chan_misdn_log(1, ch1->bc->port, "I SEND: Making conference with Number:%d\n", ch1->bc->pid +1); - misdn_lib_bridge(ch1->bc,ch2->bc); } @@ -2777,6 +2779,10 @@ static int dialtone_indicate(struct chan_list *cl) const struct ind_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)); @@ -2810,6 +2816,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); @@ -3553,6 +3565,11 @@ void import_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_ if (ch->other_ch) ch->other_ch->other_ch=ch; } } + + tmp=pbx_builtin_getvar_helper(chan,"MISDN_ADDRESS_COMPLETE"); + if (tmp && (atoi(tmp) == 1)) { + bc->sending_complete=1; + } } void export_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_list *ch) @@ -3561,6 +3578,16 @@ void export_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_ 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); + + if (bc->sending_complete) { + sprintf(tmp,"%d",bc->sending_complete); + pbx_builtin_setvar_helper(chan,"MISDN_ADDRESS_COMPLETE",tmp); + } + + if (bc->urate) { + sprintf(tmp,"%d",bc->urate); + pbx_builtin_setvar_helper(chan,"MISDN_URATE",tmp); + } } int add_in_calls(int port) @@ -3608,7 +3635,6 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) if (event != EVENT_BCHAN_DATA && event != EVENT_TONE_GENERATE) { /* Debug Only Non-Bchan */ int debuglevel=1; - if ( event==EVENT_CLEANUP && !user_data) debuglevel=5; @@ -4191,8 +4217,6 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) misdn_lib_send_event(bc,EVENT_CONNECT_ACKNOWLEDGE); struct ast_channel *bridged=AST_BRIDGED_P(ch->ast); - - misdn_lib_echo(bc,0); stop_indicate(ch); if (bridged && !strcasecmp(bridged->tech->type,"mISDN")) { @@ -4378,7 +4402,11 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) int ret=write(ch->pipe[1], bc->bframe, bc->bframe_len); if (ret<=0) { - chan_misdn_log(-1, bc->port, "Write returned <=0 (err=%s)\n",strerror(errno)); + chan_misdn_log(-1, bc->port, "Write returned <=0 (err=%s) --> hanging up channel\n",strerror(errno)); + + stop_bc_tones(ch); + hangup_chan(ch); + release_chan(bc); } } else { chan_misdn_log(1, bc->port, "Wripe Pipe full!\n"); @@ -4547,7 +4575,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) break; default: - ast_log(LOG_NOTICE, "Got Unknown Event\n"); + chan_misdn_log(1,0, "Got Unknown Event\n"); break; } @@ -4773,7 +4801,7 @@ static int misdn_facility_exec(struct ast_channel *chan, void *data) strncpy((char *)ch->bc->fac_out.u.CDeflection.DeflectedToNumber, tok, sizeof(ch->bc->fac_out.u.CDeflection.DeflectedToNumber)); misdn_lib_send_event(ch->bc, EVENT_FACILITY); } else { - ast_log(LOG_WARNING, "Unknown Facility: %s\n",tok); + chan_misdn_log(1, ch->bc->port, "Unknown Facility: %s\n",tok); } return 0; |