<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9214">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve
Sean Bright: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">AMI PlayDTMF Action: Make not compete with channel's media thread.<br><br>There can be one and only one thread handling a channel's media at a time.<br>Otherwise, we don't know which thread is going to handle the media frames.<br><br>ASTERISK-27625<br><br>Change-Id: Ia341f1a6f4d54f2022261abec9021fe5b2eb4905<br>---<br>M apps/app_senddtmf.c<br>M include/asterisk/channel.h<br>M main/channel.c<br>3 files changed, 37 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/apps/app_senddtmf.c b/apps/app_senddtmf.c<br>index 178b13f..e0362e7 100644<br>--- a/apps/app_senddtmf.c<br>+++ b/apps/app_senddtmf.c<br>@@ -167,7 +167,7 @@<br> return 0;<br> }<br> <br>- ast_senddigit(chan, *digit, duration_ms);<br>+ ast_senddigit_external(chan, *digit, duration_ms);<br> <br> chan = ast_channel_unref(chan);<br> <br>diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h<br>index 295fcbe..16b8a7b 100644<br>--- a/include/asterisk/channel.h<br>+++ b/include/asterisk/channel.h<br>@@ -2225,14 +2225,32 @@<br> <br> /*!<br> * \brief Send a DTMF digit to a channel.<br>+ *<br> * \param chan channel to act upon<br> * \param digit the DTMF digit to send, encoded in ASCII<br> * \param duration the duration of the digit ending in ms<br>+ *<br>+ * \pre This must only be called by the channel's media handler thread.<br>+ *<br> * \return 0 on success, -1 on failure<br> */<br> int ast_senddigit(struct ast_channel *chan, char digit, unsigned int duration);<br> <br> /*!<br>+ * \brief Send a DTMF digit to a channel from an external thread.<br>+ *<br>+ * \param chan channel to act upon<br>+ * \param digit the DTMF digit to send, encoded in ASCII<br>+ * \param duration the duration of the digit ending in ms<br>+ *<br>+ * \pre This must only be called by threads that are not the channel's<br>+ * media handler thread.<br>+ *<br>+ * \return 0 on success, -1 on failure<br>+ */<br>+int ast_senddigit_external(struct ast_channel *chan, char digit, unsigned int duration);<br>+<br>+/*!<br> * \brief Send a DTMF digit to a channel.<br> * \param chan channel to act upon<br> * \param digit the DTMF digit to send, encoded in ASCII<br>diff --git a/main/channel.c b/main/channel.c<br>index 92ec444..a29c968 100644<br>--- a/main/channel.c<br>+++ b/main/channel.c<br>@@ -4832,12 +4832,28 @@<br> <br> int ast_senddigit(struct ast_channel *chan, char digit, unsigned int duration)<br> {<br>+ if (duration < AST_DEFAULT_EMULATE_DTMF_DURATION) {<br>+ duration = AST_DEFAULT_EMULATE_DTMF_DURATION;<br>+ }<br> if (ast_channel_tech(chan)->send_digit_begin) {<br> ast_senddigit_begin(chan, digit);<br>- ast_safe_sleep(chan, (duration >= AST_DEFAULT_EMULATE_DTMF_DURATION ? duration : AST_DEFAULT_EMULATE_DTMF_DURATION));<br>+ ast_safe_sleep(chan, duration);<br> }<br> <br>- return ast_senddigit_end(chan, digit, (duration >= AST_DEFAULT_EMULATE_DTMF_DURATION ? duration : AST_DEFAULT_EMULATE_DTMF_DURATION));<br>+ return ast_senddigit_end(chan, digit, duration);<br>+}<br>+<br>+int ast_senddigit_external(struct ast_channel *chan, char digit, unsigned int duration)<br>+{<br>+ if (duration < AST_DEFAULT_EMULATE_DTMF_DURATION) {<br>+ duration = AST_DEFAULT_EMULATE_DTMF_DURATION;<br>+ }<br>+ if (ast_channel_tech(chan)->send_digit_begin) {<br>+ ast_senddigit_begin(chan, digit);<br>+ usleep(duration * 1000);<br>+ }<br>+<br>+ return ast_senddigit_end(chan, digit, duration);<br> }<br> <br> int ast_prod(struct ast_channel *chan)<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9214">change 9214</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9214"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ia341f1a6f4d54f2022261abec9021fe5b2eb4905 </div>
<div style="display:none"> Gerrit-Change-Number: 9214 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>