[asterisk-commits] mjordan: branch mjordan/cdrs-of-doom r386308 - in /team/mjordan/cdrs-of-doom:...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Apr 22 13:09:30 CDT 2013
Author: mjordan
Date: Mon Apr 22 13:09:27 2013
New Revision: 386308
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386308
Log:
Make things compile
Modified:
team/mjordan/cdrs-of-doom/apps/app_cdr.c
team/mjordan/cdrs-of-doom/apps/app_disa.c
team/mjordan/cdrs-of-doom/include/asterisk/cdr.h
team/mjordan/cdrs-of-doom/include/asterisk/stasis_channels.h
team/mjordan/cdrs-of-doom/main/cdr.c
team/mjordan/cdrs-of-doom/main/channel.c
team/mjordan/cdrs-of-doom/main/channel_internal_api.c
team/mjordan/cdrs-of-doom/main/manager_channels.c
team/mjordan/cdrs-of-doom/main/pbx.c
team/mjordan/cdrs-of-doom/main/stasis_channels.c
Modified: team/mjordan/cdrs-of-doom/apps/app_cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/apps/app_cdr.c?view=diff&rev=386308&r1=386307&r2=386308
==============================================================================
--- team/mjordan/cdrs-of-doom/apps/app_cdr.c (original)
+++ team/mjordan/cdrs-of-doom/apps/app_cdr.c Mon Apr 22 13:09:27 2013
@@ -62,12 +62,8 @@
<syntax>
<parameter name="options">
<optionlist>
- <option name="o">
- <para>Prevent dispatch of the current CDR. Note that
- other CDRs in the chain are not affected by this flag.</para>
- </option>
<option name="v">
- <para>Save the CDR variables.</para>
+ <para>Save the CDR variables during the reset.</para>
</option>
<option name="e">
<para>Enable the CDRs for this channel only (negate
@@ -85,14 +81,9 @@
current time.</para>
<para>3. All variables are wiped from the CDR. Note that this step
can be prevented with the <literal>v</literal> option.</para>
- <para>4. The <literal>billsec</literal> and <literal>duration</literal>
- are re-computed from the new times.</para>
- <para>If the <literal>o</literal> option is specified, any CDRs
- currently created for the channel will not be dispatched. Any
- subsequent CDRs created for a channel will be dispatched normally.</para>
- <para>If the <literal>e</literal> option is specified, the effects
- of the NoCDR application will be lifted. CDRs will be re-enabled for
- this channel.</para>
+ <para>On the other hand, if the <literal>e</literal> option is
+ specified, the effects of the NoCDR application will be lifted. CDRs
+ will be re-enabled for this channel.</para>
</description>
<see-also>
<ref type="application">ForkCDR</ref>
@@ -111,32 +102,40 @@
};
AST_APP_OPTIONS(resetcdr_opts, {
- AST_APP_OPTION('o', AST_CDR_FLAG_DISABLE_DISPATCH),
AST_APP_OPTION('v', AST_CDR_FLAG_KEEP_VARS),
- AST_APP_OPTION('e', AST_CDR_FLAG_DISABLE),
+ AST_APP_OPTION('e', AST_CDR_FLAG_DISABLE_ALL),
});
static int resetcdr_exec(struct ast_channel *chan, const char *data)
{
char *args;
struct ast_flags flags = { 0 };
+ int res = 0;
if (!ast_strlen_zero(data)) {
args = ast_strdupa(data);
ast_app_parse_options(resetcdr_opts, &flags, NULL, args);
}
+ if (ast_test_flag(&flags, AST_CDR_FLAG_DISABLE_ALL)) {
+ if (ast_cdr_clear_property(ast_channel_name(chan), AST_CDR_FLAG_DISABLE_ALL)) {
+ res = 1;
+ }
+ }
if (ast_cdr_reset(ast_channel_name(chan), &flags)) {
+ res = 1;
+ }
+
+ if (res) {
ast_log(AST_LOG_WARNING, "Failed to reset CDR for channel %s\n", ast_channel_name(chan));
}
-
- return 0;
+ return res;
}
static int nocdr_exec(struct ast_channel *chan, const char *data)
{
- if (ast_cdr_disable(ast_channel_name(chan))) {
- ast_log(AST_LOG_WARNING, "Failed to disable CDR on %s\n", ast_channel_name(chan));
+ if (ast_cdr_set_property(ast_channel_name(chan), AST_CDR_FLAG_DISABLE_ALL)) {
+ ast_log(AST_LOG_WARNING, "Failed to disable CDR for channel %s\n", ast_channel_name(chan));
}
return 0;
Modified: team/mjordan/cdrs-of-doom/apps/app_disa.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/apps/app_disa.c?view=diff&rev=386308&r1=386307&r2=386308
==============================================================================
--- team/mjordan/cdrs-of-doom/apps/app_disa.c (original)
+++ team/mjordan/cdrs-of-doom/apps/app_disa.c Mon Apr 22 13:09:27 2013
@@ -362,7 +362,7 @@
if (k == 3) {
int recheck = 0;
- struct ast_flags cdr_flags = { AST_CDR_FLAG_DISABLE_DISPATCH, };
+ struct ast_flags cdr_flags = { AST_CDR_FLAG_DISABLE, };
if (!ast_exists_extension(chan, args.context, exten, 1,
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
@@ -385,7 +385,7 @@
ast_channel_accountcode_set(chan, acctcode);
if (special_noanswer) {
- ast_clear_flag(&cdr_flags, AST_CDR_FLAG_DISABLE_DISPATCH);
+ ast_clear_flag(&cdr_flags, AST_CDR_FLAG_DISABLE);
}
ast_cdr_reset(ast_channel_name(chan), &cdr_flags);
ast_explicit_goto(chan, args.context, exten, 1);
Modified: team/mjordan/cdrs-of-doom/include/asterisk/cdr.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/include/asterisk/cdr.h?view=diff&rev=386308&r1=386307&r2=386308
==============================================================================
--- team/mjordan/cdrs-of-doom/include/asterisk/cdr.h (original)
+++ team/mjordan/cdrs-of-doom/include/asterisk/cdr.h Mon Apr 22 13:09:27 2013
@@ -55,12 +55,12 @@
*/
enum ast_cdr_options {
AST_CDR_FLAG_KEEP_VARS = (1 << 0), /*< Copy variables during the operation */
- AST_CDR_FLAG_DISABLE_DISPATCH = (1 << 1), /* Prevent a CDR from being dispatched */
- AST_CDR_FLAG_DISABLE = (1 << 2), /* Disable the CDR */
- AST_CDR_FLAG_PARTY_A = (1 << 3), /* Used to set a channel as party A */
- AST_CDR_FLAG_FINALIZE = (1 << 4), /* Finalize the recent CDRs */
- AST_CDR_FLAG_SET_ANSWER = (1 << 5), /* If the channel is answered, set the answer time to now */
- AST_CDR_FLAG_RESET = (1 << 6), /* If set, set the start and answer time to now */
+ AST_CDR_FLAG_DISABLE = (1 << 1), /*< Disable the current CDR */
+ AST_CDR_FLAG_DISABLE_ALL = (3 << 1), /*< Disable the CDR and all future CDRs */
+ AST_CDR_FLAG_PARTY_A = (1 << 3), /*< Set the channel as party A */
+ AST_CDR_FLAG_FINALIZE = (1 << 4), /*< Finalize the current CDRs */
+ AST_CDR_FLAG_SET_ANSWER = (1 << 5), /*< If the channel is answered, set the answer time to now */
+ AST_CDR_FLAG_RESET = (1 << 6), /*< If set, set the start and answer time to now */
};
/*!
@@ -224,14 +224,33 @@
int ast_cdr_fork(const char *channel_name, struct ast_flags *options);
/*!
- * \brief Disables the CDR for a channel
- *
- * \param channel_name The channel that the CDR is associated with
- *
- * \retval 0 on success
- * \retval -1 on failure
- */
-int ast_cdr_disable(const char *channel_name);
+ * \brief Set a property on a CDR for a channel
+ *
+ * This function sets specific administrative properties on a CDR for a channel.
+ * This includes properties like preventing a CDR from being dispatched, to
+ * setting the channel as the preferred Party A in future CDRs. See
+ * \ref enum ast_cdr_options for more information.
+ *
+ * \param channel_name The CDR's channel
+ * \param option Option to apply to the CDR
+ *
+ * \retval 0 on success
+ * \retval 1 on error
+ */
+int ast_cdr_set_property(const char *channel_name, enum ast_cdr_options option);
+
+/*!
+ * \brief Clear a property on a CDR for a channel
+ *
+ * Clears a flag previously set by \ref ast_cdr_set_property
+ *
+ * \param channel_name The CDR's channel
+ * \param option Option to clear from the CDR
+ *
+ * \retval 0 on success
+ * \retval 1 on error
+ */
+int ast_cdr_clear_property(const char *channel_name, enum ast_cdr_options option);
/*!
* \brief Reset the detail record
Modified: team/mjordan/cdrs-of-doom/include/asterisk/stasis_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/include/asterisk/stasis_channels.h?view=diff&rev=386308&r1=386307&r2=386308
==============================================================================
--- team/mjordan/cdrs-of-doom/include/asterisk/stasis_channels.h (original)
+++ team/mjordan/cdrs-of-doom/include/asterisk/stasis_channels.h Mon Apr 22 13:09:27 2013
@@ -255,9 +255,17 @@
/*!
* \since 12
+ * \brief Publish a \ref ast_channel_snapshot for a channel.
+ *
+ * \param chan Channel to publish the event for
+ */
+void ast_channel_publish_state(struct ast_channel *chan);
+
+/*!
+ * \since 12
* \brief Publish a \ref ast_channel_varset for a channel.
*
- * \param chan Channel to pulish the event for, or \c NULL for 'none'.
+ * \param chan Channel to publish the event for, or \c NULL for 'none'.
* \param variable Name of the variable being set
* \param value Value.
*/
Modified: team/mjordan/cdrs-of-doom/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/main/cdr.c?view=diff&rev=386308&r1=386307&r2=386308
==============================================================================
--- team/mjordan/cdrs-of-doom/main/cdr.c (original)
+++ team/mjordan/cdrs-of-doom/main/cdr.c Mon Apr 22 13:09:27 2013
@@ -1681,7 +1681,7 @@
continue;
}
- if (ast_test_flag(cdr, AST_CDR_FLAG_DISABLE_DISPATCH)) {
+ if (ast_test_flag(cdr, AST_CDR_FLAG_DISABLE)) {
continue;
}
AST_RWLIST_RDLOCK(&be_list);
@@ -1692,7 +1692,7 @@
}
}
-int ast_cdr_disable(const char *channel_name)
+int ast_cdr_set_property(const char *channel_name, enum ast_cdr_options option)
{
RAII_VAR(struct cdr_object *, cdr,
ao2_find(active_cdrs_by_channel, channel_name, OBJ_KEY),
@@ -1705,7 +1705,33 @@
ao2_lock(cdr);
for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->next) {
- ast_set_flag(&it_cdr->flags, AST_CDR_FLAG_DISABLE);
+ if (it_cdr->fn_table == &finalized_state_fn_table) {
+ continue;
+ }
+ ast_set_flag(&it_cdr->flags, option);
+ }
+ ao2_unlock(cdr);
+
+ return 0;
+}
+
+int ast_cdr_clear_property(const char *channel_name, enum ast_cdr_options option)
+{
+ RAII_VAR(struct cdr_object *, cdr,
+ ao2_find(active_cdrs_by_channel, channel_name, OBJ_KEY),
+ ao2_cleanup);
+ struct cdr_object *it_cdr;
+
+ if (!cdr) {
+ return -1;
+ }
+
+ ao2_lock(cdr);
+ for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->next) {
+ if (it_cdr->fn_table == &finalized_state_fn_table) {
+ continue;
+ }
+ ast_clear_flag(&it_cdr->flags, option);
}
ao2_unlock(cdr);
@@ -1726,19 +1752,6 @@
ao2_lock(cdr);
for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->next) {
- /* enable CDR only */
- if (ast_test_flag(options, AST_CDR_FLAG_DISABLE)) {
- ast_clear_flag(&it_cdr->flags, AST_CDR_FLAG_DISABLE);
- continue;
- }
-
- if (ast_test_flag(options, AST_CDR_FLAG_DISABLE_DISPATCH)) {
- if (!it_cdr->next) {
- ast_set_flag(&it_cdr->flags, AST_CDR_FLAG_DISABLE_DISPATCH);
- }
- continue;
- }
-
/* clear variables */
if (!ast_test_flag(options, AST_CDR_FLAG_KEEP_VARS)) {
while ((vardata = AST_LIST_REMOVE_HEAD(&it_cdr->party_a.variables, entries))) {
@@ -1775,52 +1788,58 @@
return -1;
}
- ao2_lock(cdr);
- cdr_obj = cdr->last;
-
- /* Copy over the basic CDR information. The Party A information is copied
- * over automatically as part of the append
- */
- new_cdr = cdr_object_create_and_append_cdr(cdr_obj);
- if (!new_cdr) {
- return -1;
- }
- new_cdr->fn_table = cdr_obj->fn_table;
- ast_string_field_set(new_cdr, bridge, cdr->bridge);
- new_cdr->disposition = cdr->disposition;
- new_cdr->flags = cdr->flags;
-
- /* If there's a Party B, copy it over as well */
- if (cdr_obj->party_b.snapshot) {
- new_cdr->party_b.snapshot = cdr_obj->party_b.snapshot;
- ao2_ref(new_cdr->party_b.snapshot, +1);
- strcpy(new_cdr->party_b.userfield, cdr_obj->party_b.userfield);
- new_cdr->party_b.flags = cdr_obj->party_b.flags;
- if (ast_test_flag(options, AST_CDR_FLAG_KEEP_VARS)) {
- copy_vars(&new_cdr->party_b.variables, &cdr_obj->party_b.variables);
- }
- }
- new_cdr->start = cdr_obj->start;
- new_cdr->answer = cdr_obj->answer;
-
- /* Modify the times based on the flags passed in */
- if (ast_test_flag(options, AST_CDR_FLAG_FINALIZE)) {
- cdr_object_transition_state(cdr_obj, &finalized_state_fn_table);
- }
- if (ast_test_flag(options, AST_CDR_FLAG_SET_ANSWER)
- && new_cdr->party_a.snapshot->state == AST_STATE_UP) {
- new_cdr->answer = ast_tvnow();
- }
- if (ast_test_flag(options, AST_CDR_FLAG_RESET)) {
- new_cdr->answer = ast_tvnow();
- new_cdr->start = ast_tvnow();
- }
- /* Create and append, by default, copies over the variables */
- if (!ast_test_flag(options, AST_CDR_FLAG_KEEP_VARS)) {
- cdr_free_vars(&new_cdr->party_a.variables);
- }
-
- ao2_unlock(cdr);
+ {
+ SCOPED_AO2LOCK(lock, cdr);
+ cdr_obj = cdr->last;
+ if (cdr_obj->fn_table == &finalized_state_fn_table) {
+ /* If the last CDR in the chain is finalized, don't allow a fork -
+ * things are already dying at this point
+ */
+ return -1;
+ }
+
+ /* Copy over the basic CDR information. The Party A information is
+ * copied over automatically as part of the append
+ */
+ new_cdr = cdr_object_create_and_append_cdr(cdr_obj);
+ if (!new_cdr) {
+ return -1;
+ }
+ new_cdr->fn_table = cdr_obj->fn_table;
+ ast_string_field_set(new_cdr, bridge, cdr->bridge);
+ new_cdr->disposition = cdr->disposition;
+ new_cdr->flags = cdr->flags;
+
+ /* If there's a Party B, copy it over as well */
+ if (cdr_obj->party_b.snapshot) {
+ new_cdr->party_b.snapshot = cdr_obj->party_b.snapshot;
+ ao2_ref(new_cdr->party_b.snapshot, +1);
+ strcpy(new_cdr->party_b.userfield, cdr_obj->party_b.userfield);
+ new_cdr->party_b.flags = cdr_obj->party_b.flags;
+ if (ast_test_flag(options, AST_CDR_FLAG_KEEP_VARS)) {
+ copy_vars(&new_cdr->party_b.variables, &cdr_obj->party_b.variables);
+ }
+ }
+ new_cdr->start = cdr_obj->start;
+ new_cdr->answer = cdr_obj->answer;
+
+ /* Modify the times based on the flags passed in */
+ if (ast_test_flag(options, AST_CDR_FLAG_FINALIZE)) {
+ cdr_object_transition_state(cdr_obj, &finalized_state_fn_table);
+ }
+ if (ast_test_flag(options, AST_CDR_FLAG_SET_ANSWER)
+ && new_cdr->party_a.snapshot->state == AST_STATE_UP) {
+ new_cdr->answer = ast_tvnow();
+ }
+ if (ast_test_flag(options, AST_CDR_FLAG_RESET)) {
+ new_cdr->answer = ast_tvnow();
+ new_cdr->start = ast_tvnow();
+ }
+ /* Create and append, by default, copies over the variables */
+ if (!ast_test_flag(options, AST_CDR_FLAG_KEEP_VARS)) {
+ cdr_free_vars(&new_cdr->party_a.variables);
+ }
+ }
return 0;
}
Modified: team/mjordan/cdrs-of-doom/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/main/channel.c?view=diff&rev=386308&r1=386307&r2=386308
==============================================================================
--- team/mjordan/cdrs-of-doom/main/channel.c (original)
+++ team/mjordan/cdrs-of-doom/main/channel.c Mon Apr 22 13:09:27 2013
@@ -816,26 +816,6 @@
return causes[x].cause;
return -1;
-}
-
-static void publish_channel_state(struct ast_channel *chan)
-{
- RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
- RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
-
- snapshot = ast_channel_snapshot_create(chan);
- if (!snapshot) {
- ast_log(LOG_ERROR, "Allocation error\n");
- return;
- }
-
- message = stasis_message_create(ast_channel_snapshot_type(), snapshot);
- if (!message) {
- return;
- }
-
- ast_assert(ast_channel_topic(chan) != NULL);
- stasis_publish(ast_channel_topic(chan), message);
}
static void publish_cache_clear(struct ast_channel *chan)
@@ -1176,7 +1156,7 @@
* a lot of data into this func to do it here!
*/
if (ast_get_channel_tech(tech) || (tech2 && ast_get_channel_tech(tech2))) {
- publish_channel_state(tmp);
+ ast_channel_publish_state(tmp);
}
ast_channel_internal_finalize(tmp);
@@ -2888,7 +2868,7 @@
ast_cc_offer(chan);
- publish_channel_state(chan);
+ ast_channel_publish_state(chan);
publish_cache_clear(chan);
ast_channel_unref(chan);
@@ -7153,7 +7133,7 @@
ast_channel_redirecting_set(original, ast_channel_redirecting(clonechan));
ast_channel_redirecting_set(clonechan, &exchange.redirecting);
- publish_channel_state(original);
+ ast_channel_publish_state(original);
/* Restore original timing file descriptor */
ast_channel_set_fd(original, AST_TIMING_FD, ast_channel_timingfd(original));
@@ -7316,7 +7296,7 @@
ast_channel_caller(chan)->ani.number.str = ast_strdup(cid_ani);
}
- publish_channel_state(chan);
+ ast_channel_publish_state(chan);
ast_channel_unlock(chan);
}
@@ -7342,7 +7322,7 @@
ast_channel_lock(chan);
ast_party_caller_set(ast_channel_caller(chan), caller, update);
- publish_channel_state(chan);
+ ast_channel_publish_state(chan);
ast_channel_unlock(chan);
}
@@ -7366,7 +7346,7 @@
* we override what they are saying the state is and things go amuck. */
ast_devstate_changed_literal(AST_DEVICE_UNKNOWN, (ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_DEVSTATE_CACHE) ? AST_DEVSTATE_NOT_CACHABLE : AST_DEVSTATE_CACHABLE), name);
- publish_channel_state(chan);
+ ast_channel_publish_state(chan);
return 0;
}
Modified: team/mjordan/cdrs-of-doom/main/channel_internal_api.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/main/channel_internal_api.c?view=diff&rev=386308&r1=386307&r2=386308
==============================================================================
--- team/mjordan/cdrs-of-doom/main/channel_internal_api.c (original)
+++ team/mjordan/cdrs-of-doom/main/channel_internal_api.c Mon Apr 22 13:09:27 2013
@@ -463,7 +463,7 @@
ast_string_field_set(chan, accountcode, value);
/* Some things really like knowing when the accountcode changes. */
- publish_channel_state(chan);
+ ast_channel_publish_state(chan);
}
void ast_channel_linkedid_set(struct ast_channel *chan, const char *value)
@@ -568,7 +568,7 @@
return;
}
chan->amaflags = value;
- publish_channel_state(chan);
+ ast_channel_publish_state(chan);
}
#ifdef HAVE_EPOLL
Modified: team/mjordan/cdrs-of-doom/main/manager_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/main/manager_channels.c?view=diff&rev=386308&r1=386307&r2=386308
==============================================================================
--- team/mjordan/cdrs-of-doom/main/manager_channels.c (original)
+++ team/mjordan/cdrs-of-doom/main/manager_channels.c Mon Apr 22 13:09:27 2013
@@ -156,7 +156,7 @@
</managerEventInstance>
</managerEvent>
<managerEvent language="en_US" name="NewAccountCode">
- <managerEventInstance>
+ <managerEventInstance class="EVENT_FLAG_CALL">
<synopsis>Raised when a Channel's AccountCode is changed.</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/managerEvent[@name='Newchannel']/managerEventInstance/syntax/parameter)" />
Modified: team/mjordan/cdrs-of-doom/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/main/pbx.c?view=diff&rev=386308&r1=386307&r2=386308
==============================================================================
--- team/mjordan/cdrs-of-doom/main/pbx.c (original)
+++ team/mjordan/cdrs-of-doom/main/pbx.c Mon Apr 22 13:09:27 2013
@@ -10578,8 +10578,8 @@
}
if (!ast_strlen_zero(args.answer_cdr) && !strcasecmp(args.answer_cdr, "nocdr")) {
- if (ast_cdr_disable(ast_channel_name(chan))) {
- ast_log(AST_LOG_WARNING, "Failed to disable CDR on channel %s\n", ast_channel_name(chan));
+ if (ast_cdr_set_property(ast_channel_name(chan), AST_CDR_FLAG_DISABLE_ALL)) {
+ ast_log(AST_LOG_WARNING, "Failed to disable CDR on %s\n", ast_channel_name(chan));
}
}
Modified: team/mjordan/cdrs-of-doom/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/main/stasis_channels.c?view=diff&rev=386308&r1=386307&r2=386308
==============================================================================
--- team/mjordan/cdrs-of-doom/main/stasis_channels.c (original)
+++ team/mjordan/cdrs-of-doom/main/stasis_channels.c Mon Apr 22 13:09:27 2013
@@ -430,6 +430,26 @@
}
return ast_json_string_get(ast_json_object_get(obj->blob, "type"));
+}
+
+void ast_channel_publish_state(struct ast_channel *chan)
+{
+ RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
+ RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+
+ snapshot = ast_channel_snapshot_create(chan);
+ if (!snapshot) {
+ ast_log(LOG_ERROR, "Allocation error\n");
+ return;
+ }
+
+ message = stasis_message_create(ast_channel_snapshot_type(), snapshot);
+ if (!message) {
+ return;
+ }
+
+ ast_assert(ast_channel_topic(chan) != NULL);
+ stasis_publish(ast_channel_topic(chan), message);
}
void ast_channel_publish_varset(struct ast_channel *chan, const char *name, const char *value)
More information about the asterisk-commits
mailing list