<p>Thomas Sevestre has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6307">View Change</a></p><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>Change-Id: Iab8a81362b5a1757e2608f70b014ef863200cb42<br>---<br>M include/asterisk/features_config.h<br>M main/features_config.c<br>M main/manager.c<br>3 files changed, 73 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/07/6307/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">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 4a86f4b..2689687 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 17057b3..2a7f7fb 100644<br>--- a/main/manager.c<br>+++ b/main/manager.c<br>@@ -4930,6 +4930,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>@@ -8665,6 +8706,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>@@ -8880,6 +8922,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/6307">change 6307</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/6307"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Iab8a81362b5a1757e2608f70b014ef863200cb42 </div>
<div style="display:none"> Gerrit-Change-Number: 6307 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Thomas Sevestre <thomassevestre@free.fr> </div>