<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6769">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">features, manager : Add CancelAtxfer AMI action<br><br>Add action to cancel feature attended transfer with AMI interface<br><br>ASTERISK-27215 #close<br><br>Change-Id: Iab8a81362b5a1757e2608f70b014ef863200cb42<br>---<br>M CHANGES<br>M include/asterisk/features_config.h<br>M main/features_config.c<br>M main/manager.c<br>4 files changed, 96 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/CHANGES b/CHANGES<br>index 4d1395f..63c8c6f 100644<br>--- a/CHANGES<br>+++ b/CHANGES<br>@@ -33,6 +33,10 @@<br> than one. The removed contact is likely the old contact created by<br> "rewrite_contact" that the device is refreshing.<br> <br>+AMI<br>+------------------<br>+ * Added a new CancelAtxfer action that cancels an attended transfer.<br>+<br> ------------------------------------------------------------------------------<br> --- Functionality changes from Asterisk 14 to Asterisk 15 --------------------<br> ------------------------------------------------------------------------------<br>diff --git a/include/asterisk/features_config.h b/include/asterisk/features_config.h<br>index baaff18..1bce50b 100644<br>--- a/include/asterisk/features_config.h<br>+++ b/include/asterisk/features_config.h<br>@@ -117,6 +117,21 @@<br> char *ast_get_chan_features_xferfailsound(struct ast_channel *chan);<br> <br> /*!<br>+ * \brief Get the transfer configuration option atxferabort<br>+ *<br>+ * \note The channel should be locked before calling this function.<br>+ * \note The returned value has to be freed.<br>+ *<br>+ * If no channel is provided, then option is pulled from the global<br>+ * transfer configuration.<br>+ *<br>+ * \param chan The channel to get configuration options for<br>+ * \retval NULL Failed to get configuration<br>+ * \retval non-NULL The atxferabort<br>+ */<br>+char *ast_get_chan_features_atxferabort(struct ast_channel *chan);<br>+<br>+/*!<br> * \brief Configuration relating to call pickup<br> */<br> struct ast_features_pickup_config {<br>diff --git a/main/features_config.c b/main/features_config.c<br>index 8307b12..72cd040 100644<br>--- a/main/features_config.c<br>+++ b/main/features_config.c<br>@@ -1173,6 +1173,21 @@<br> return res;<br> }<br> <br>+char *ast_get_chan_features_atxferabort(struct ast_channel *chan)<br>+{<br>+ char *res;<br>+ struct ast_features_xfer_config *cfg = ast_get_chan_features_xfer_config(chan);<br>+<br>+ if (!cfg) {<br>+ return NULL;<br>+ }<br>+<br>+ res = ast_strdup(cfg->atxferabort);<br>+ ao2_ref(cfg, -1);<br>+<br>+ return res;<br>+}<br>+<br> struct ast_features_pickup_config *ast_get_chan_features_pickup_config(struct ast_channel *chan)<br> {<br> RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);<br>diff --git a/main/manager.c b/main/manager.c<br>index e67efe3..5c0b318 100644<br>--- a/main/manager.c<br>+++ b/main/manager.c<br>@@ -628,6 +628,25 @@<br> <ref type="managerEvent">AttendedTransfer</ref><br> </see-also><br> </manager><br>+ <manager name="CancelAtxfer" language="en_US"><br>+ <synopsis><br>+ Cancel an attended transfer.<br>+ </synopsis><br>+ <syntax><br>+ <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" /><br>+ <parameter name="Channel" required="true"><br>+ <para>The transferer channel.</para><br>+ </parameter><br>+ </syntax><br>+ <description><br>+ <para>Cancel an attended transfer. Note, this uses the configured cancel attended transfer<br>+ feature option (atxferabort) to cancel the transfer. If not available this action will fail.<br>+ </para><br>+ </description><br>+ <see-also><br>+ <ref type="managerEvent">AttendedTransfer</ref><br>+ </see-also><br>+ </manager><br> <manager name="Originate" language="en_US"><br> <synopsis><br> Originate a call.<br>@@ -4959,6 +4978,47 @@<br> return 0;<br> }<br> <br>+static int action_cancel_atxfer(struct mansession *s, const struct message *m)<br>+{<br>+ const char *name = astman_get_header(m, "Channel");<br>+ struct ast_channel *chan = NULL;<br>+ char *feature_code;<br>+ const char *digit;<br>+<br>+ if (ast_strlen_zero(name)) {<br>+ astman_send_error(s, m, "No channel specified");<br>+ return 0;<br>+ }<br>+<br>+ if (!(chan = ast_channel_get_by_name(name))) {<br>+ astman_send_error(s, m, "Channel specified does not exist");<br>+ return 0;<br>+ }<br>+<br>+ ast_channel_lock(chan);<br>+ feature_code = ast_get_chan_features_atxferabort(chan);<br>+ ast_channel_unlock(chan);<br>+<br>+ if (!feature_code) {<br>+ astman_send_error(s, m, "No disconnect feature code found");<br>+ ast_channel_unref(chan);<br>+ return 0;<br>+ }<br>+<br>+ for (digit = feature_code; *digit; ++digit) {<br>+ struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = *digit };<br>+ ast_queue_frame(chan, &f);<br>+ }<br>+ ast_free(feature_code);<br>+<br>+ chan = ast_channel_unref(chan);<br>+<br>+ astman_send_ack(s, m, "CancelAtxfer successfully queued");<br>+<br>+ return 0;<br>+}<br>+<br>+<br> static int check_blacklist(const char *cmd)<br> {<br> char *cmd_copy, *cur_cmd;<br>@@ -8679,6 +8739,7 @@<br> ast_manager_unregister("ListCategories");<br> ast_manager_unregister("Redirect");<br> ast_manager_unregister("Atxfer");<br>+ ast_manager_unregister("CancelAtxfer");<br> ast_manager_unregister("Originate");<br> ast_manager_unregister("Command");<br> ast_manager_unregister("ExtensionState");<br>@@ -8894,6 +8955,7 @@<br> ast_manager_register_xml_core("ListCategories", EVENT_FLAG_CONFIG, action_listcategories);<br> ast_manager_register_xml_core("Redirect", EVENT_FLAG_CALL, action_redirect);<br> ast_manager_register_xml_core("Atxfer", EVENT_FLAG_CALL, action_atxfer);<br>+ ast_manager_register_xml_core("CancelAtxfer", EVENT_FLAG_CALL, action_cancel_atxfer);<br> ast_manager_register_xml_core("Originate", EVENT_FLAG_ORIGINATE, action_originate);<br> ast_manager_register_xml_core("Command", EVENT_FLAG_COMMAND, action_command);<br> ast_manager_register_xml_core("ExtensionState", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_extensionstate);<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6769">change 6769</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/6769"/><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-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Iab8a81362b5a1757e2608f70b014ef863200cb42 </div>
<div style="display:none"> Gerrit-Change-Number: 6769 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@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: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Thomas Sevestre <thomassevestre@free.fr> </div>