<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/17818">View Change</a></p><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;">ami: Add AMI event for Wink<br><br>Adds an AMI event for a wink frame.<br><br>ASTERISK-29830 #close<br><br>Change-Id: I83e426de5e37baed79a4dbcc91e9e8d030ef1b56<br>---<br>M configs/samples/stasis.conf.sample<br>A doc/CHANGES-staging/ami_wink.txt<br>M include/asterisk/stasis_channels.h<br>M main/channel.c<br>M main/manager_channels.c<br>M main/stasis.c<br>M main/stasis_channels.c<br>7 files changed, 53 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/configs/samples/stasis.conf.sample b/configs/samples/stasis.conf.sample</span><br><span>index 6fadc74..b62d1c6 100644</span><br><span>--- a/configs/samples/stasis.conf.sample</span><br><span>+++ b/configs/samples/stasis.conf.sample</span><br><span>@@ -54,6 +54,7 @@</span><br><span> ; decline=ast_channel_dtmf_begin_type</span><br><span> ; decline=ast_channel_dtmf_end_type</span><br><span> ; decline=ast_channel_flash_type</span><br><span style="color: hsl(120, 100%, 40%);">+; decline=ast_channel_wink_type</span><br><span> ; decline=ast_channel_hold_type</span><br><span> ; decline=ast_channel_unhold_type</span><br><span> ; decline=ast_channel_chanspy_start_type</span><br><span>diff --git a/doc/CHANGES-staging/ami_wink.txt b/doc/CHANGES-staging/ami_wink.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..9d27cca</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/ami_wink.txt</span><br><span>@@ -0,0 +1,3 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: ami</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+An AMI event now exists for "Wink".</span><br><span>diff --git a/include/asterisk/stasis_channels.h b/include/asterisk/stasis_channels.h</span><br><span>index 0905dc5..0f28abc 100644</span><br><span>--- a/include/asterisk/stasis_channels.h</span><br><span>+++ b/include/asterisk/stasis_channels.h</span><br><span>@@ -420,6 +420,13 @@</span><br><span> struct stasis_message_type *ast_channel_flash_type(void);</span><br><span> </span><br><span> /*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Message type for when a wink occurs on a channel.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return A stasis message type</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+struct stasis_message_type *ast_channel_wink_type(void);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span> * \since 12</span><br><span> * \brief Message type for when a channel is placed on hold.</span><br><span> *</span><br><span>diff --git a/main/channel.c b/main/channel.c</span><br><span>index cd7513a..d2f0e18 100644</span><br><span>--- a/main/channel.c</span><br><span>+++ b/main/channel.c</span><br><span>@@ -3417,6 +3417,11 @@</span><br><span> ast_channel_publish_blob(chan, ast_channel_flash_type(), NULL);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static void send_wink_event(struct ast_channel *chan)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_publish_blob(chan, ast_channel_wink_type(), NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static void ast_read_generator_actions(struct ast_channel *chan, struct ast_frame *f)</span><br><span> {</span><br><span> struct ast_generator *generator;</span><br><span>@@ -3885,6 +3890,8 @@</span><br><span> f = &ast_null_frame;</span><br><span> } else if (f->subclass.integer == AST_CONTROL_FLASH) {</span><br><span> send_flash_event(chan);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (f->subclass.integer == AST_CONTROL_WINK) {</span><br><span style="color: hsl(120, 100%, 40%);">+ send_wink_event(chan);</span><br><span> }</span><br><span> break;</span><br><span> case AST_FRAME_DTMF_END:</span><br><span>diff --git a/main/manager_channels.c b/main/manager_channels.c</span><br><span>index 4a5def7..c0f7bc7 100644</span><br><span>--- a/main/manager_channels.c</span><br><span>+++ b/main/manager_channels.c</span><br><span>@@ -1017,6 +1017,34 @@</span><br><span> ast_free(channel_event_string);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static void channel_wink_cb(void *data, struct stasis_subscription *sub,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct stasis_message *message)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_channel_blob *obj = stasis_message_data(message);</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_str *channel_event_string;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ channel_event_string = ast_manager_build_channel_state_string(obj->snapshot);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!channel_event_string) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</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%);">+ /*** DOCUMENTATION</span><br><span style="color: hsl(120, 100%, 40%);">+ <managerEvent language="en_US" name="Wink"></span><br><span style="color: hsl(120, 100%, 40%);">+ <managerEventInstance class="EVENT_FLAG_CALL"></span><br><span style="color: hsl(120, 100%, 40%);">+ <synopsis>Raised when a wink occurs on a channel.</synopsis></span><br><span style="color: hsl(120, 100%, 40%);">+ <syntax></span><br><span style="color: hsl(120, 100%, 40%);">+ <channel_snapshot/></span><br><span style="color: hsl(120, 100%, 40%);">+ </syntax></span><br><span style="color: hsl(120, 100%, 40%);">+ </managerEventInstance></span><br><span style="color: hsl(120, 100%, 40%);">+ </managerEvent></span><br><span style="color: hsl(120, 100%, 40%);">+ ***/</span><br><span style="color: hsl(120, 100%, 40%);">+ manager_event(EVENT_FLAG_CALL, "Wink",</span><br><span style="color: hsl(120, 100%, 40%);">+ "%s",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_str_buffer(channel_event_string));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_free(channel_event_string);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static void channel_hangup_handler_cb(void *data, struct stasis_subscription *sub,</span><br><span> struct stasis_message *message)</span><br><span> {</span><br><span>@@ -1380,6 +1408,9 @@</span><br><span> ast_channel_flash_type(), channel_flash_cb, NULL);</span><br><span> </span><br><span> ret |= stasis_message_router_add(message_router,</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_wink_type(), channel_wink_cb, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ret |= stasis_message_router_add(message_router,</span><br><span> ast_channel_hangup_request_type(), channel_hangup_request_cb,</span><br><span> NULL);</span><br><span> </span><br><span>diff --git a/main/stasis.c b/main/stasis.c</span><br><span>index 6dba7b6..5ca35ec 100644</span><br><span>--- a/main/stasis.c</span><br><span>+++ b/main/stasis.c</span><br><span>@@ -121,6 +121,7 @@</span><br><span> <enum name="ast_channel_dtmf_begin_type" /></span><br><span> <enum name="ast_channel_dtmf_end_type" /></span><br><span> <enum name="ast_channel_flash_type" /></span><br><span style="color: hsl(120, 100%, 40%);">+ <enum name="ast_channel_wink_type" /></span><br><span> <enum name="ast_channel_hold_type" /></span><br><span> <enum name="ast_channel_unhold_type" /></span><br><span> <enum name="ast_channel_chanspy_start_type" /></span><br><span>diff --git a/main/stasis_channels.c b/main/stasis_channels.c</span><br><span>index 1da2db5..934de2b 100644</span><br><span>--- a/main/stasis_channels.c</span><br><span>+++ b/main/stasis_channels.c</span><br><span>@@ -1308,6 +1308,7 @@</span><br><span> .to_json = unhold_to_json,</span><br><span> );</span><br><span> STASIS_MESSAGE_TYPE_DEFN(ast_channel_flash_type);</span><br><span style="color: hsl(120, 100%, 40%);">+STASIS_MESSAGE_TYPE_DEFN(ast_channel_wink_type);</span><br><span> STASIS_MESSAGE_TYPE_DEFN(ast_channel_chanspy_start_type);</span><br><span> STASIS_MESSAGE_TYPE_DEFN(ast_channel_chanspy_stop_type);</span><br><span> STASIS_MESSAGE_TYPE_DEFN(ast_channel_fax_type);</span><br><span>@@ -1353,6 +1354,7 @@</span><br><span> STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_dtmf_begin_type);</span><br><span> STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_dtmf_end_type);</span><br><span> STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_flash_type);</span><br><span style="color: hsl(120, 100%, 40%);">+ STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_wink_type);</span><br><span> STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_hold_type);</span><br><span> STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_unhold_type);</span><br><span> STASIS_MESSAGE_TYPE_CLEANUP(ast_channel_chanspy_start_type);</span><br><span>@@ -1408,6 +1410,7 @@</span><br><span> res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_dtmf_begin_type);</span><br><span> res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_dtmf_end_type);</span><br><span> res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_flash_type);</span><br><span style="color: hsl(120, 100%, 40%);">+ res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_wink_type);</span><br><span> res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_hold_type);</span><br><span> res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_unhold_type);</span><br><span> res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_chanspy_start_type);</span><br><span></span><br></pre><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/17818">change 17818</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/+/17818"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I83e426de5e37baed79a4dbcc91e9e8d030ef1b56 </div>
<div style="display:none"> Gerrit-Change-Number: 17818 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </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>