<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19927">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span></span><br></pre><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_senddtmf: Add SendFlash AMI action.<br><br>Adds an AMI action to send a flash event<br>on a channel.<br><br>ASTERISK-30440 #close<br><br>Change-Id: I4707aeecb3cd8f3e63fd0c3fe009798943c369c9<br>---<br>M apps/app_senddtmf.c<br>A doc/CHANGES-staging/ami_hook_flash.txt<br>2 files changed, 65 insertions(+), 0 deletions(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_senddtmf.c b/apps/app_senddtmf.c</span><br><span>index c119d8c..ed54809 100644</span><br><span>--- a/apps/app_senddtmf.c</span><br><span>+++ b/apps/app_senddtmf.c</span><br><span>@@ -97,6 +97,23 @@</span><br><span> <para>Plays a dtmf digit on the specified channel.</para></span><br><span> </description></span><br><span> </manager></span><br><span style="color: hsl(120, 100%, 40%);">+ <manager name="SendFlash" language="en_US"></span><br><span style="color: hsl(120, 100%, 40%);">+ <synopsis></span><br><span style="color: hsl(120, 100%, 40%);">+ Send a hook flash on a specific channel.</span><br><span style="color: hsl(120, 100%, 40%);">+ </synopsis></span><br><span style="color: hsl(120, 100%, 40%);">+ <syntax></span><br><span style="color: hsl(120, 100%, 40%);">+ <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" /></span><br><span style="color: hsl(120, 100%, 40%);">+ <parameter name="Channel" required="true"></span><br><span style="color: hsl(120, 100%, 40%);">+ <para>Channel name to send hook flash to.</para></span><br><span style="color: hsl(120, 100%, 40%);">+ </parameter></span><br><span style="color: hsl(120, 100%, 40%);">+ <parameter name="Receive" required="false"></span><br><span style="color: hsl(120, 100%, 40%);">+ <para>Emulate receiving a hook flash on this channel instead of sending it out.</para></span><br><span style="color: hsl(120, 100%, 40%);">+ </parameter></span><br><span style="color: hsl(120, 100%, 40%);">+ </syntax></span><br><span style="color: hsl(120, 100%, 40%);">+ <description></span><br><span style="color: hsl(120, 100%, 40%);">+ <para>Sends a hook flash on the specified channel.</para></span><br><span style="color: hsl(120, 100%, 40%);">+ </description></span><br><span style="color: hsl(120, 100%, 40%);">+ </manager></span><br><span> ***/</span><br><span> </span><br><span> enum read_option_flags {</span><br><span>@@ -218,12 +235,41 @@</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static int manager_send_flash(struct mansession *s, const struct message *m)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *channel = astman_get_header(m, "Channel");</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *receive_s = astman_get_header(m, "Receive");</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_channel *chan;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!(chan = ast_channel_get_by_name(channel))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ astman_send_error(s, m, "Channel not found");</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_true(receive_s)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_frame f = { AST_FRAME_CONTROL, };</span><br><span style="color: hsl(120, 100%, 40%);">+ f.subclass.integer = AST_CONTROL_FLASH;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_queue_frame(chan, &f);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_frame f = { AST_FRAME_CONTROL, };</span><br><span style="color: hsl(120, 100%, 40%);">+ f.subclass.integer = AST_CONTROL_FLASH;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_lock(chan);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_write(chan, &f);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_unlock(chan);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ chan = ast_channel_unref(chan);</span><br><span style="color: hsl(120, 100%, 40%);">+ astman_send_ack(s, m, "Flash successfully queued");</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static int unload_module(void)</span><br><span> {</span><br><span> int res;</span><br><span> </span><br><span> res = ast_unregister_application(senddtmf_name);</span><br><span> res |= ast_manager_unregister("PlayDTMF");</span><br><span style="color: hsl(120, 100%, 40%);">+ res |= ast_manager_unregister("SendFlash");</span><br><span> </span><br><span> return res;</span><br><span> }</span><br><span>@@ -233,6 +279,7 @@</span><br><span> int res;</span><br><span> </span><br><span> res = ast_manager_register_xml("PlayDTMF", EVENT_FLAG_CALL, manager_play_dtmf);</span><br><span style="color: hsl(120, 100%, 40%);">+ res |= ast_manager_register_xml("SendFlash", EVENT_FLAG_CALL, manager_send_flash);</span><br><span> res |= ast_register_application_xml(senddtmf_name, senddtmf_exec);</span><br><span> </span><br><span> return res;</span><br><span>diff --git a/doc/CHANGES-staging/ami_hook_flash.txt b/doc/CHANGES-staging/ami_hook_flash.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..5bf1e34</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/ami_hook_flash.txt</span><br><span>@@ -0,0 +1,4 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: app_senddtmf</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The SendFlash AMI action now allows sending</span><br><span style="color: hsl(120, 100%, 40%);">+a hook flash event on a channel.</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19927">change 19927</a>. To unsubscribe, or for help writing mail filters, 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/c/asterisk/+/19927"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I4707aeecb3cd8f3e63fd0c3fe009798943c369c9 </div>
<div style="display:none"> Gerrit-Change-Number: 19927 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: N A <asterisk@phreaknet.org> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>