From dcca8f345fa55b146fe6b0930df18b226809cc70 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Fri, 19 Jan 2007 18:06:03 +0000 Subject: Merged revisions 51311 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r51311 | russell | 2007-01-19 11:49:38 -0600 (Fri, 19 Jan 2007) | 23 lines 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: https://origsvn.digium.com/svn/asterisk/trunk@51314 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- 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 456a536c9..3e6f4d4f0 100644 --- a/channels/chan_gtalk.c +++ b/channels/chan_gtalk.c @@ -170,7 +170,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); @@ -195,8 +197,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, @@ -1338,7 +1340,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; @@ -1373,8 +1385,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