[asterisk-commits] dvossel: trunk r264114 - /trunk/res/res_rtp_asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 19 09:38:07 CDT 2010


Author: dvossel
Date: Wed May 19 09:38:02 2010
New Revision: 264114

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=264114
Log:
fixes crash during dtmf

During the processing of Cisco dtmf the dtmf samples were
not being calculated correctly.  In an attempt to determine
what sample rate was being used, a NULL frame was processed
which caused a crash.  This patch resolves this.

(closes issue #17248)
Reported by: falves11
Patches:
      issue_17248.diff uploaded by dvossel (license 671)


Modified:
    trunk/res/res_rtp_asterisk.c

Modified: trunk/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_rtp_asterisk.c?view=diff&rev=264114&r1=264113&r2=264114
==============================================================================
--- trunk/res/res_rtp_asterisk.c (original)
+++ trunk/res/res_rtp_asterisk.c Wed May 19 09:38:02 2010
@@ -1502,10 +1502,11 @@
 		}
 	} else if ((rtp->resp == resp) && !power) {
 		f = create_dtmf_frame(instance, AST_FRAME_DTMF_END, ast_rtp_instance_get_prop(instance, AST_RTP_PROPERTY_DTMF_COMPENSATE));
-		f->samples = rtp->dtmfsamples * (rtp_get_rate(f->subclass.codec) / 1000);
+		f->samples = rtp->dtmfsamples * (rtp->lastrxformat ? (rtp_get_rate(rtp->lastrxformat) / 1000) : 8);
 		rtp->resp = 0;
 	} else if (rtp->resp == resp)
-		rtp->dtmfsamples += 20 * (rtp_get_rate(f->subclass.codec) / 1000);
+		rtp->dtmfsamples += 20 * (rtp->lastrxformat ? (rtp_get_rate(rtp->lastrxformat) / 1000) : 8);
+
 	rtp->dtmf_timeout = 0;
 
 	return f;




More information about the asterisk-commits mailing list