<p>Cirillo Ferreira has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/11097">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_dahdi: Add logical group at DAHDIChannel event and CHANNEL function<br><br>Add logical group at DAHDIChannel event<br>and create "dahdi_group" at CHANNEL function.<br><br>ASTERISK-28317<br><br>Change-Id: Ic1f834cd53982a9707a9748395ee746d6575086a<br>---<br>M channels/chan_dahdi.c<br>1 file changed, 18 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/97/11097/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c</span><br><span>index c40e084..0ef850b 100644</span><br><span>--- a/channels/chan_dahdi.c</span><br><span>+++ b/channels/chan_dahdi.c</span><br><span>@@ -189,6 +189,9 @@</span><br><span> <enum name="dahdi_span"></span><br><span> <para>R/O DAHDI span related to this channel.</para></span><br><span> </enum></span><br><span style="color: hsl(120, 100%, 40%);">+ <enum name="dahdi_group"></span><br><span style="color: hsl(120, 100%, 40%);">+ <para>R/O DAHDI logical group related to this channel.</para></span><br><span style="color: hsl(120, 100%, 40%);">+ </enum></span><br><span> <enum name="dahdi_type"></span><br><span> <para>R/O DAHDI channel type, one of:</para></span><br><span> <enumlist></span><br><span>@@ -466,6 +469,9 @@</span><br><span> <synopsis>Raised when a DAHDI channel is created or an underlying technology is associated with a DAHDI channel.</synopsis></span><br><span> <syntax></span><br><span> <channel_snapshot/></span><br><span style="color: hsl(120, 100%, 40%);">+ <parameter name="DAHDIGroup"></span><br><span style="color: hsl(120, 100%, 40%);">+ <para>The DAHDI logical group associated with this channel.</para></span><br><span style="color: hsl(120, 100%, 40%);">+ </parameter></span><br><span> <parameter name="DAHDISpan"></span><br><span> <para>The DAHDI span associated with this channel.</para></span><br><span> </parameter></span><br><span>@@ -1810,21 +1816,24 @@</span><br><span> {</span><br><span> RAII_VAR(struct ast_str *, channel_string, NULL, ast_free);</span><br><span> struct ast_channel_blob *obj = stasis_message_data(msg);</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_json *span, *channel;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_json *group, *span, *channel;</span><br><span> </span><br><span> channel_string = ast_manager_build_channel_state_string(obj->snapshot);</span><br><span> if (!channel_string) {</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ group = ast_json_object_get(obj->blob, "group");</span><br><span> span = ast_json_object_get(obj->blob, "span");</span><br><span> channel = ast_json_object_get(obj->blob, "channel");</span><br><span> </span><br><span> return ast_manager_event_blob_create(EVENT_FLAG_CALL, "DAHDIChannel",</span><br><span> "%s"</span><br><span style="color: hsl(120, 100%, 40%);">+ "DAHDIGroup: %ull\r\n"</span><br><span> "DAHDISpan: %u\r\n"</span><br><span> "DAHDIChannel: %s\r\n",</span><br><span> ast_str_buffer(channel_string),</span><br><span style="color: hsl(120, 100%, 40%);">+ (ast_group_t)ast_json_integer_get(group),</span><br><span> (unsigned int)ast_json_integer_get(span),</span><br><span> ast_json_string_get(channel));</span><br><span> }</span><br><span>@@ -1834,13 +1843,14 @@</span><br><span> );</span><br><span> </span><br><span> /*! \brief Sends a DAHDIChannel channel blob used to produce DAHDIChannel AMI messages */</span><br><span style="color: hsl(0, 100%, 40%);">-static void publish_dahdichannel(struct ast_channel *chan, int span, const char *dahdi_channel)</span><br><span style="color: hsl(120, 100%, 40%);">+static void publish_dahdichannel(struct ast_channel *chan, ast_group_t group, int span, const char *dahdi_channel)</span><br><span> {</span><br><span> RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);</span><br><span> </span><br><span> ast_assert(dahdi_channel != NULL);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- blob = ast_json_pack("{s: i, s: s}",</span><br><span style="color: hsl(120, 100%, 40%);">+ blob = ast_json_pack("{s: i, s: i, s: s}",</span><br><span style="color: hsl(120, 100%, 40%);">+ "group", group,</span><br><span> "span", span,</span><br><span> "channel", dahdi_channel);</span><br><span> if (!blob) {</span><br><span>@@ -1876,7 +1886,7 @@</span><br><span> /* Real channel */</span><br><span> snprintf(ch_name, sizeof(ch_name), "%d", p->channel);</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- publish_dahdichannel(chan, p->span, ch_name);</span><br><span style="color: hsl(120, 100%, 40%);">+ publish_dahdichannel(chan, p->group, p->span, ch_name);</span><br><span> }</span><br><span> </span><br><span> #ifdef HAVE_PRI</span><br><span>@@ -6759,6 +6769,10 @@</span><br><span> ast_mutex_lock(&p->lock);</span><br><span> snprintf(buf, len, "%d", p->span);</span><br><span> ast_mutex_unlock(&p->lock);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (!strcasecmp(data, "dahdi_group")) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_mutex_lock(&p->lock);</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(buf, len, "%ull", p->group);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_mutex_unlock(&p->lock);</span><br><span> } else if (!strcasecmp(data, "dahdi_type")) {</span><br><span> ast_mutex_lock(&p->lock);</span><br><span> switch (p->sig) {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/11097">change 11097</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/+/11097"/><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-Change-Id: Ic1f834cd53982a9707a9748395ee746d6575086a </div>
<div style="display:none"> Gerrit-Change-Number: 11097 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Cirillo Ferreira <cirillor@lbv.org.br> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>