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
This commit is contained in:
Christian Richter
2006-06-18 19:09:32 +00:00
parent e49a367ecf
commit 829583a3dc
3 changed files with 47 additions and 23 deletions

View File

@@ -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) {

View File

@@ -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];

View File

@@ -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);