From cc3938c1989d0b9f6a907ee2d64f2f66a01b2e29 Mon Sep 17 00:00:00 2001 From: russell Date: Fri, 19 Jan 2007 17:49:38 +0000 Subject: Merge the changes from the /team/group/vldtmf_fixup branch. The main bug being addressed here is a problem introduced when two SIP channels using SIP INFO dtmf have their media directly bridged. So, when a DTMF END frame comes into Asterisk from an incoming INFO message, Asterisk would try to emulate a digit of some length by first sending a DTMF BEGIN frame and sending a DTMF END later timed off of incoming audio. However, since there was no audio coming in, the DTMF_END was never generated. This caused DTMF based features to no longer work. To fix this, the core now knows when a channel doesn't care about DTMF BEGIN frames (such as a SIP channel sending INFO dtmf). If this is the case, then Asterisk will not emulate a digit of some length, and will instead just pass through the single DTMF END event. Channel drivers also now get passed the length of the digit to their digit_end callback. This improves SIP INFO support even further by enabling us to put the real digit duration in the INFO message instead of a hard coded 250ms. Also, for an incoming INFO message, the duration is read from the frame and passed into the core instead of just getting ignored. (issue #8597, maybe others...) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@51311 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_gtalk.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'channels/chan_gtalk.c') diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c index 59f40cc61..530af5b25 100644 --- a/channels/chan_gtalk.c +++ b/channels/chan_gtalk.c @@ -173,7 +173,9 @@ AST_MUTEX_DEFINE_STATIC(gtalklock); /*!< Protect the interface list (of gtalk_pv /* Forward declarations */ static struct ast_channel *gtalk_request(const char *type, int format, void *data, int *cause); -static int gtalk_digit(struct ast_channel *ast, char digit); +static int gtalk_digit(struct ast_channel *ast, char digit, unsigned int duration); +static int gtalk_digit_begin(struct ast_channel *ast, char digit); +static int gtalk_digit_end(struct ast_channel *ast, char digit, unsigned int duration); static int gtalk_call(struct ast_channel *ast, char *dest, int timeout); static int gtalk_hangup(struct ast_channel *ast); static int gtalk_answer(struct ast_channel *ast); @@ -198,8 +200,8 @@ static const struct ast_channel_tech gtalk_tech = { .description = "Gtalk Channel Driver", .capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1), .requester = gtalk_request, - .send_digit_begin = gtalk_digit, - .send_digit_end = gtalk_digit, + .send_digit_begin = gtalk_digit_begin, + .send_digit_end = gtalk_digit_end, .bridge = ast_rtp_bridge, .call = gtalk_call, .hangup = gtalk_hangup, @@ -1341,7 +1343,17 @@ static int gtalk_indicate(struct ast_channel *ast, int condition, const void *da return res; } -static int gtalk_digit(struct ast_channel *ast, char digit) +static int gtalk_digit_begin(struct ast_channel *chan, char digit) +{ + return gtalk_digit(chan, digit, 0); +} + +static int gtalk_digit_end(struct ast_channel *chan, char digit, unsigned int duration) +{ + return gtalk_digit(chan, digit, duration); +} + +static int gtalk_digit(struct ast_channel *ast, char digit, unsigned int duration) { struct gtalk_pvt *p = ast->tech_pvt; struct gtalk *client = p->parent; @@ -1376,8 +1388,8 @@ static int gtalk_digit(struct ast_channel *ast, char digit) iks_insert_node(gtalk, dtmf); ast_mutex_lock(&p->lock); - if(ast->dtmff.frametype == AST_FRAME_DTMF) { - ast_verbose("Sending 250ms dtmf!\n"); + if (ast->dtmff.frametype == AST_FRAME_DTMF) { + ast_log(LOG_DEBUG, "Sending 250ms dtmf!\n"); } else if (ast->dtmff.frametype == AST_FRAME_DTMF_BEGIN) { iks_insert_attrib(dtmf, "action", "button-down"); } else if (ast->dtmff.frametype == AST_FRAME_DTMF_END) { -- cgit v1.2.3