[asterisk-commits] dvossel: branch dvossel/gtalk_fixup r290612 - /team/dvossel/gtalk_fixup/chann...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Oct 6 11:24:42 CDT 2010
Author: dvossel
Date: Wed Oct 6 11:24:40 2010
New Revision: 290612
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=290612
Log:
Fixed locking in send digit functions
Modified:
team/dvossel/gtalk_fixup/channels/chan_gtalk.c
Modified: team/dvossel/gtalk_fixup/channels/chan_gtalk.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/gtalk_fixup/channels/chan_gtalk.c?view=diff&rev=290612&r1=290611&r2=290612
==============================================================================
--- team/dvossel/gtalk_fixup/channels/chan_gtalk.c (original)
+++ team/dvossel/gtalk_fixup/channels/chan_gtalk.c Wed Oct 6 11:24:40 2010
@@ -1593,24 +1593,38 @@
static int gtalk_digit_begin(struct ast_channel *chan, char digit)
{
struct gtalk_pvt *p = chan->tech_pvt;
- if (!p) {
- return -1;
- }
-
- return ast_rtp_instance_dtmf_begin(p->rtp, digit);
+ int res = 0;
+
+ ast_mutex_lock(&p->lock);
+ if (p->rtp) {
+ ast_rtp_instance_dtmf_begin(p->rtp, digit);
+ } else {
+ res = -1;
+ }
+ ast_mutex_unlock(&p->lock);
+
+ return res;
}
static int gtalk_digit_end(struct ast_channel *chan, char digit, unsigned int duration)
{
struct gtalk_pvt *p = chan->tech_pvt;
- if (!p) {
- return -1;
- }
- return ast_rtp_instance_dtmf_end(p->rtp, digit);
-}
-
-/* This is not being used at the moment, but I want this code to remain in the code base
- * as a reference.
+ int res = 0;
+
+ ast_mutex_lock(&p->lock);
+ if (p->rtp) {
+ ast_rtp_instance_dtmf_end(p->rtp, digit);
+ } else {
+ res = -1;
+ }
+ ast_mutex_unlock(&p->lock);
+
+ return res;
+}
+
+/* This function is of not in use at the moment, but I am choosing to leave this
+ * within the code base as a reference to how DTMF is possible through
+ * jingle signaling. However, google currently does DTMF through the RTP.
static int gtalk_digit(struct ast_channel *ast, char digit, unsigned int duration)
{
struct gtalk_pvt *p = ast->tech_pvt;
More information about the asterisk-commits
mailing list