mirror of
https://github.com/asterisk/asterisk.git
synced 2026-06-17 13:09:57 +00:00
Merge "chan_dahdi: Add logical group at DAHDIChannel event and CHANNEL function" into 16
This commit is contained in:
+18
-4
@@ -185,6 +185,9 @@
|
|||||||
<enum name="dahdi_span">
|
<enum name="dahdi_span">
|
||||||
<para>R/O DAHDI span related to this channel.</para>
|
<para>R/O DAHDI span related to this channel.</para>
|
||||||
</enum>
|
</enum>
|
||||||
|
<enum name="dahdi_group">
|
||||||
|
<para>R/O DAHDI logical group related to this channel.</para>
|
||||||
|
</enum>
|
||||||
<enum name="dahdi_type">
|
<enum name="dahdi_type">
|
||||||
<para>R/O DAHDI channel type, one of:</para>
|
<para>R/O DAHDI channel type, one of:</para>
|
||||||
<enumlist>
|
<enumlist>
|
||||||
@@ -462,6 +465,9 @@
|
|||||||
<synopsis>Raised when a DAHDI channel is created or an underlying technology is associated with a DAHDI channel.</synopsis>
|
<synopsis>Raised when a DAHDI channel is created or an underlying technology is associated with a DAHDI channel.</synopsis>
|
||||||
<syntax>
|
<syntax>
|
||||||
<channel_snapshot/>
|
<channel_snapshot/>
|
||||||
|
<parameter name="DAHDIGroup">
|
||||||
|
<para>The DAHDI logical group associated with this channel.</para>
|
||||||
|
</parameter>
|
||||||
<parameter name="DAHDISpan">
|
<parameter name="DAHDISpan">
|
||||||
<para>The DAHDI span associated with this channel.</para>
|
<para>The DAHDI span associated with this channel.</para>
|
||||||
</parameter>
|
</parameter>
|
||||||
@@ -1727,21 +1733,24 @@ static struct ast_manager_event_blob *dahdichannel_to_ami(struct stasis_message
|
|||||||
{
|
{
|
||||||
RAII_VAR(struct ast_str *, channel_string, NULL, ast_free);
|
RAII_VAR(struct ast_str *, channel_string, NULL, ast_free);
|
||||||
struct ast_channel_blob *obj = stasis_message_data(msg);
|
struct ast_channel_blob *obj = stasis_message_data(msg);
|
||||||
struct ast_json *span, *channel;
|
struct ast_json *group, *span, *channel;
|
||||||
|
|
||||||
channel_string = ast_manager_build_channel_state_string(obj->snapshot);
|
channel_string = ast_manager_build_channel_state_string(obj->snapshot);
|
||||||
if (!channel_string) {
|
if (!channel_string) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
group = ast_json_object_get(obj->blob, "group");
|
||||||
span = ast_json_object_get(obj->blob, "span");
|
span = ast_json_object_get(obj->blob, "span");
|
||||||
channel = ast_json_object_get(obj->blob, "channel");
|
channel = ast_json_object_get(obj->blob, "channel");
|
||||||
|
|
||||||
return ast_manager_event_blob_create(EVENT_FLAG_CALL, "DAHDIChannel",
|
return ast_manager_event_blob_create(EVENT_FLAG_CALL, "DAHDIChannel",
|
||||||
"%s"
|
"%s"
|
||||||
|
"DAHDIGroup: %llu\r\n"
|
||||||
"DAHDISpan: %u\r\n"
|
"DAHDISpan: %u\r\n"
|
||||||
"DAHDIChannel: %s\r\n",
|
"DAHDIChannel: %s\r\n",
|
||||||
ast_str_buffer(channel_string),
|
ast_str_buffer(channel_string),
|
||||||
|
(ast_group_t)ast_json_integer_get(group),
|
||||||
(unsigned int)ast_json_integer_get(span),
|
(unsigned int)ast_json_integer_get(span),
|
||||||
ast_json_string_get(channel));
|
ast_json_string_get(channel));
|
||||||
}
|
}
|
||||||
@@ -1751,13 +1760,14 @@ STASIS_MESSAGE_TYPE_DEFN_LOCAL(dahdichannel_type,
|
|||||||
);
|
);
|
||||||
|
|
||||||
/*! \brief Sends a DAHDIChannel channel blob used to produce DAHDIChannel AMI messages */
|
/*! \brief Sends a DAHDIChannel channel blob used to produce DAHDIChannel AMI messages */
|
||||||
static void publish_dahdichannel(struct ast_channel *chan, int span, const char *dahdi_channel)
|
static void publish_dahdichannel(struct ast_channel *chan, ast_group_t group, int span, const char *dahdi_channel)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
|
RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
|
||||||
|
|
||||||
ast_assert(dahdi_channel != NULL);
|
ast_assert(dahdi_channel != NULL);
|
||||||
|
|
||||||
blob = ast_json_pack("{s: i, s: s}",
|
blob = ast_json_pack("{s: i, s: i, s: s}",
|
||||||
|
"group", group,
|
||||||
"span", span,
|
"span", span,
|
||||||
"channel", dahdi_channel);
|
"channel", dahdi_channel);
|
||||||
if (!blob) {
|
if (!blob) {
|
||||||
@@ -1793,7 +1803,7 @@ static void dahdi_ami_channel_event(struct dahdi_pvt *p, struct ast_channel *cha
|
|||||||
/* Real channel */
|
/* Real channel */
|
||||||
snprintf(ch_name, sizeof(ch_name), "%d", p->channel);
|
snprintf(ch_name, sizeof(ch_name), "%d", p->channel);
|
||||||
}
|
}
|
||||||
publish_dahdichannel(chan, p->span, ch_name);
|
publish_dahdichannel(chan, p->group, p->span, ch_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_PRI
|
#ifdef HAVE_PRI
|
||||||
@@ -6692,6 +6702,10 @@ static int dahdi_func_read(struct ast_channel *chan, const char *function, char
|
|||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
snprintf(buf, len, "%d", p->span);
|
snprintf(buf, len, "%d", p->span);
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
|
} else if (!strcasecmp(data, "dahdi_group")) {
|
||||||
|
ast_mutex_lock(&p->lock);
|
||||||
|
snprintf(buf, len, "%llu", p->group);
|
||||||
|
ast_mutex_unlock(&p->lock);
|
||||||
} else if (!strcasecmp(data, "dahdi_type")) {
|
} else if (!strcasecmp(data, "dahdi_type")) {
|
||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
switch (p->sig) {
|
switch (p->sig) {
|
||||||
|
|||||||
Reference in New Issue
Block a user