aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_rtp_asterisk.c
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-19 14:38:02 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-19 14:38:02 +0000
commitbb1f97bd51df46d811cf50d9632da8bf52e33f0a (patch)
tree93a1dedba92cb2fbac1bbba0114c7ef3fdffac1a /res/res_rtp_asterisk.c
parent513a96935056ac1603155820a71b9f3f4e8f46ae (diff)
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) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@264114 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_rtp_asterisk.c')
-rw-r--r--res/res_rtp_asterisk.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index af1f1ebca..07f7bf392 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -1502,10 +1502,11 @@ static struct ast_frame *process_dtmf_cisco(struct ast_rtp_instance *instance, u
}
} 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;