aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_zap.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-29 05:07:04 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-29 05:07:04 +0000
commitd6dcf07573202bf10e5c153c613fb6c246a90f5a (patch)
tree75adefc13c1d6ad70d813b3255a4187fa86731d8 /channels/chan_zap.c
parent2cddcd249de9272cdaaa6da05541706f63415718 (diff)
make ast_read() able to handle channel read()/exception() methods that return a chain of frames
cleanup code in ast_read() add AST_FRAME_DTMF_BEGIN and AST_FRAME_DTMF_END so that variable-length DTMF events can be supported teach chan_zap to send DTMF_BEGIN and DTMF_END when appropriate git-svn-id: http://svn.digium.com/svn/asterisk/trunk@8850 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_zap.c')
-rw-r--r--channels/chan_zap.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index d4a5c591d..a5dbf7874 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -3560,12 +3560,14 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
pthread_t threadid;
pthread_attr_t attr;
struct ast_channel *chan;
+ struct ast_frame dtmf_frame = { .frametype = AST_FRAME_DTMF };
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
index = zt_get_index(ast, p, 0);
p->subs[index].f.frametype = AST_FRAME_NULL;
+ p->subs[index].f.subclass = 0;
p->subs[index].f.datalen = 0;
p->subs[index].f.samples = 0;
p->subs[index].f.mallocd = 0;
@@ -3590,12 +3592,17 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
ast_log(LOG_DEBUG, "Detected %sdigit '%c'\n", p->pulsedial ? "pulse ": "", res & 0xff);
#ifdef ZAPATA_PRI
if (!p->proceeding && p->sig == SIG_PRI && p->pri && p->pri->overlapdial) {
- p->subs[index].f.frametype = AST_FRAME_NULL;
- p->subs[index].f.subclass = 0;
+ /* absorb event */
} else {
#endif
- p->subs[index].f.frametype = AST_FRAME_DTMF;
+ /* Send a DTMF event for 'legacy' channels and all applications,
+ and a DTMF_BEGIN event for channels that handle variable duration
+ DTMF events
+ */
+ p->subs[index].f.frametype = AST_FRAME_DTMF_BEGIN;
p->subs[index].f.subclass = res & 0xff;
+ dtmf_frame.subclass = res & 0xff;
+ p->subs[index].f.next = ast_frdup(&dtmf_frame);
#ifdef ZAPATA_PRI
}
#endif
@@ -3606,10 +3613,13 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
if (res & ZT_EVENT_DTMFDOWN) {
ast_log(LOG_DEBUG, "DTMF Down '%c'\n", res & 0xff);
- p->subs[index].f.frametype = AST_FRAME_NULL;
- p->subs[index].f.subclass = 0;
+ /* Mute conference */
zt_confmute(p, 1);
- /* Mute conference, return null frame */
+ /* Send a DTMF_BEGIN event for devices that want variable
+ duration DTMF events
+ */
+ p->subs[index].f.frametype = AST_FRAME_DTMF_BEGIN;
+ p->subs[index].f.subclass = res & 0xff;
return &p->subs[index].f;
}
@@ -3705,8 +3715,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
alarm2str(res), p->channel);
/* fall through intentionally */
case ZT_EVENT_ONHOOK:
- if (p->radio)
- {
+ if (p->radio) {
p->subs[index].f.frametype = AST_FRAME_CONTROL;
p->subs[index].f.subclass = AST_CONTROL_RADIO_UNKEY;
break;
@@ -3820,8 +3829,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
break;
case ZT_EVENT_RINGOFFHOOK:
if (p->inalarm) break;
- if (p->radio)
- {
+ if (p->radio) {
p->subs[index].f.frametype = AST_FRAME_CONTROL;
p->subs[index].f.subclass = AST_CONTROL_RADIO_KEY;
break;