From 829583a3dcc42b269d93a5e20747b5c8c141985c Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Sun, 18 Jun 2006 19:09:32 +0000 Subject: added TONE_HANGUP, also added Tone generation by mISDN_dsp for post hangup tones, therefore the TONE_X defines are in the isdn_lib.h now. changed a REALEASE to a DISCONNECT in NT Stack, to make tones available in that state. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@34604 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_misdn.c | 31 ++++++++----------------------- channels/misdn/isdn_lib.c | 25 +++++++++++++++++++++++++ channels/misdn/isdn_lib.h | 14 ++++++++++++++ 3 files changed, 47 insertions(+), 23 deletions(-) (limited to 'channels') diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index de28d5106..9c9720c21 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -111,16 +111,6 @@ int misdn_jb_empty(struct misdn_jb *jb, char *data, int len); /* BEGIN: chan_misdn.h */ -enum tone_e { - TONE_NONE=0, - TONE_DIAL, - TONE_ALERTING, - TONE_FAR_ALERTING, - TONE_BUSY, - TONE_CUSTOM, - TONE_FILE -}; - enum misdn_chan_state { MISDN_NOTHING, /*!< at beginning */ @@ -1981,7 +1971,7 @@ static int misdn_hangup(struct ast_channel *ast) return 0; } - stop_bc_tones(p); + /*stop_bc_tones(p);*/ release_unlock; @@ -2008,11 +1998,11 @@ static int misdn_hangup(struct ast_channel *ast) case MISDN_HOLDED: case MISDN_DIALING: start_bc_tones(p); - tone_indicate(p, TONE_BUSY); + tone_indicate(p, TONE_HANGUP); p->state=MISDN_CLEANING; if (bc->nt) - misdn_lib_send_event( bc, EVENT_RELEASE); + misdn_lib_send_event( bc, EVENT_DISCONNECT); else misdn_lib_send_event( bc, EVENT_RELEASE_COMPLETE); @@ -2024,7 +2014,7 @@ static int misdn_hangup(struct ast_channel *ast) chan_misdn_log(2, bc->port, " --> * State Alerting\n"); if (p->orginator != ORG_AST) - tone_indicate(p, TONE_BUSY); + tone_indicate(p, TONE_HANGUP); p->state=MISDN_CLEANING; misdn_lib_send_event( bc, EVENT_DISCONNECT); @@ -2033,7 +2023,7 @@ static int misdn_hangup(struct ast_channel *ast) /* Alerting or Disconect */ chan_misdn_log(2, bc->port, " --> * State Connected\n"); start_bc_tones(p); - tone_indicate(p, TONE_BUSY); + tone_indicate(p, TONE_HANGUP); misdn_lib_send_event( bc, EVENT_DISCONNECT); p->state=MISDN_CLEANING; /* MISDN_HUNGUP_FROM_AST; */ @@ -2129,7 +2119,7 @@ static struct ast_frame *misdn_read(struct ast_channel *ast) if (!ast) return NULL; if (! (tmp=MISDN_ASTERISK_TECH_PVT(ast)) ) return NULL; if (!tmp->bc) return NULL; - + len=read(tmp->pipe[0],tmp->ast_rd_buf,sizeof(tmp->ast_rd_buf)); if (len<=0) { @@ -2367,14 +2357,9 @@ static int tone_indicate( struct chan_list *cl, enum tone_e tone) if (!cl->ast) { chan_misdn_log(-1,cl->bc->port,"Ast Ptr Not existing anymore.. we need to generate tones ourselves now (tbd)\n"); + + misdn_lib_send_tone(cl->bc,tone); return 0; -#if 0 - struct ast_channel *dummy=misdn_new(cl, AST_STATE_RESERVED, cl->bc->dad, cl->bc->oad, AST_FORMAT_ALAW, cl->bc->port, 99); - cl->ast=dummy; - /* return 0; */ - cl->dummy=1; - ast=cl->ast; -#endif } switch (tone) { diff --git a/channels/misdn/isdn_lib.c b/channels/misdn/isdn_lib.c index f45802200..01365d225 100644 --- a/channels/misdn/isdn_lib.c +++ b/channels/misdn/isdn_lib.c @@ -3798,6 +3798,8 @@ void manager_ph_control(struct misdn_bchannel *bc, int c1, int c2) unsigned int *d = (unsigned int*)&ctrl->data.p; struct misdn_stack *stack=get_stack_by_bc(bc); + cb_log(4,bc->port,"ph_control: c1:%x c2:%x\n",c1,c2); + ctrl->prim = PH_CONTROL | REQUEST; ctrl->addr = bc->addr | FLG_MSG_DOWN; ctrl->dinfo = 0; @@ -3915,6 +3917,29 @@ struct misdn_bchannel *stack_holder_find(struct misdn_stack *stack, unsigned lon +void misdn_lib_send_tone(struct misdn_bchannel *bc, enum tone_e tone) +{ + switch(tone) { + case TONE_DIAL: + manager_ph_control(bc, TONE_PATT_ON, TONE_GERMAN_DIALTONE); + break; + + case TONE_ALERTING: + manager_ph_control(bc, TONE_PATT_ON, TONE_GERMAN_RINGING); + break; + + case TONE_HANGUP: + manager_ph_control(bc, TONE_PATT_ON, TONE_GERMAN_HANGUP); + break; + + case TONE_NONE: + default: + manager_ph_control(bc, TONE_PATT_OFF, TONE_GERMAN_HANGUP); + } + +} + + void manager_ec_enable(struct misdn_bchannel *bc) { int ec_arr[2]; diff --git a/channels/misdn/isdn_lib.h b/channels/misdn/isdn_lib.h index b8af625aa..318fa9b67 100644 --- a/channels/misdn/isdn_lib.h +++ b/channels/misdn/isdn_lib.h @@ -21,6 +21,19 @@ +enum tone_e { + TONE_NONE=0, + TONE_DIAL, + TONE_ALERTING, + TONE_FAR_ALERTING, + TONE_BUSY, + TONE_HANGUP, + TONE_CUSTOM, + TONE_FILE +}; + + + #define MAX_BCHANS 30 enum bchannel_state { @@ -376,6 +389,7 @@ int misdn_lib_send_facility(struct misdn_bchannel *bc, enum facility_type fac, v void manager_ec_enable(struct misdn_bchannel *bc); void manager_ec_disable(struct misdn_bchannel *bc); +void misdn_lib_send_tone(struct misdn_bchannel *bc, enum tone_e tone); void get_show_stack_details(int port, char *buf); -- cgit v1.2.3