[svn-commits] mjordan: branch mjordan/12-stasis-performance r414211 - in /team/mjordan/12-s...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue May 20 09:51:43 CDT 2014
Author: mjordan
Date: Tue May 20 09:51:38 2014
New Revision: 414211
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=414211
Log:
Kill snapshots with fire
Modified:
team/mjordan/12-stasis-performance/ (props changed)
team/mjordan/12-stasis-performance/apps/app_meetme.c
team/mjordan/12-stasis-performance/include/asterisk/stasis_channels.h
team/mjordan/12-stasis-performance/main/cdr.c
team/mjordan/12-stasis-performance/main/cel.c
team/mjordan/12-stasis-performance/main/channel.c
team/mjordan/12-stasis-performance/main/channel_internal_api.c
team/mjordan/12-stasis-performance/main/cli.c
team/mjordan/12-stasis-performance/main/core_local.c
team/mjordan/12-stasis-performance/main/dial.c
team/mjordan/12-stasis-performance/main/endpoints.c
team/mjordan/12-stasis-performance/main/manager.c
team/mjordan/12-stasis-performance/main/pbx.c
team/mjordan/12-stasis-performance/main/pickup.c
team/mjordan/12-stasis-performance/main/stasis_bridges.c
team/mjordan/12-stasis-performance/main/stasis_channels.c
team/mjordan/12-stasis-performance/res/ari/resource_channels.c
team/mjordan/12-stasis-performance/res/res_agi.c
team/mjordan/12-stasis-performance/res/res_pjsip/pjsip_configuration.c
Propchange: team/mjordan/12-stasis-performance/
------------------------------------------------------------------------------
automerge = *
Propchange: team/mjordan/12-stasis-performance/
------------------------------------------------------------------------------
automerge-email = mjordan at digium.com
Modified: team/mjordan/12-stasis-performance/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/apps/app_meetme.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/apps/app_meetme.c (original)
+++ team/mjordan/12-stasis-performance/apps/app_meetme.c Tue May 20 09:51:38 2014
@@ -1379,9 +1379,7 @@
}
}
- ast_channel_lock(chan);
- msg = ast_channel_blob_create(chan, message_type, json_object);
- ast_channel_unlock(chan);
+ msg = ast_channel_blob_create_from_cache(ast_channel_uniqueid(chan), message_type, json_object);
if (!msg) {
return;
Modified: team/mjordan/12-stasis-performance/include/asterisk/stasis_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/include/asterisk/stasis_channels.h?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/include/asterisk/stasis_channels.h (original)
+++ team/mjordan/12-stasis-performance/include/asterisk/stasis_channels.h Tue May 20 09:51:38 2014
@@ -39,17 +39,16 @@
struct ast_channel_snapshot {
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(name); /*!< ASCII unique channel name */
- AST_STRING_FIELD(type); /*!< Type of channel technology */
- AST_STRING_FIELD(accountcode); /*!< Account code for billing */
- AST_STRING_FIELD(peeraccount); /*!< Peer account code for billing */
- AST_STRING_FIELD(userfield); /*!< Userfield for CEL billing */
AST_STRING_FIELD(uniqueid); /*!< Unique Channel Identifier */
AST_STRING_FIELD(linkedid); /*!< Linked Channel Identifier -- gets propagated by linkage */
- AST_STRING_FIELD(hangupsource); /*!< Who is responsible for hanging up this channel */
AST_STRING_FIELD(appl); /*!< Current application */
AST_STRING_FIELD(data); /*!< Data passed to current application */
AST_STRING_FIELD(context); /*!< Dialplan: Current extension context */
AST_STRING_FIELD(exten); /*!< Dialplan: Current extension number */
+ AST_STRING_FIELD(accountcode); /*!< Account code for billing */
+ AST_STRING_FIELD(peeraccount); /*!< Peer account code for billing */
+ AST_STRING_FIELD(userfield); /*!< Userfield for CEL billing */
+ AST_STRING_FIELD(hangupsource); /*!< Who is responsible for hanging up this channel */
AST_STRING_FIELD(caller_name); /*!< Caller ID Name */
AST_STRING_FIELD(caller_number); /*!< Caller ID Number */
AST_STRING_FIELD(caller_dnid); /*!< Dialed ID Number */
@@ -59,31 +58,20 @@
AST_STRING_FIELD(dialed_subaddr); /*!< Dialed subaddress */
AST_STRING_FIELD(connected_name); /*!< Connected Line Name */
AST_STRING_FIELD(connected_number); /*!< Connected Line Number */
- AST_STRING_FIELD(effective_name); /*!< Effective Connected Line Name */
- AST_STRING_FIELD(effective_number); /*!< Effective Connected Line Number */
AST_STRING_FIELD(language); /*!< The default spoken language for the channel */
AST_STRING_FIELD(bridgeid); /*!< Unique Bridge Identifier */
- AST_STRING_FIELD(nativeformats); /*!< Native formats on the channel */
- AST_STRING_FIELD(readformat); /*!< The current read format */
- AST_STRING_FIELD(writeformat); /*!< The current write format */
- AST_STRING_FIELD(writetrans); /*!< The current write translation path */
- AST_STRING_FIELD(readtrans); /*!< The current read translation path */
+ AST_STRING_FIELD(type); /*!< Type of channel technology */
);
- char callid[AST_CALLID_BUFFER_LENGTH]; /*!< Callid for the channel */
struct timeval creationtime; /*!< The time of channel creation */
- struct timeval hanguptime; /*!< When the channel should hang up */
enum ast_channel_state state; /*!< State of line */
int priority; /*!< Dialplan: Current extension priority */
int amaflags; /*!< AMA flags for billing */
int hangupcause; /*!< Why is the channel hanged up. See causes.h */
int caller_pres; /*!< Caller ID presentation. */
struct ast_flags flags; /*!< channel flags of AST_FLAG_ type */
- ast_group_t callgroup; /*!< Call group */
- ast_group_t pickupgroup; /*!< Pickup group */
struct ast_flags softhangup_flags; /*!< softhangup channel flags */
struct varshead *manager_vars; /*!< Variables to be appended to manager events */
- struct varshead *channel_vars; /*!< Variables set on the channel */
int tech_properties; /*!< Properties of the channel's technology */
};
@@ -320,6 +308,9 @@
void ast_channel_publish_blob(struct ast_channel *chan, struct stasis_message_type *type,
struct ast_json *blob);
+void ast_channel_publish_cached_blob(struct ast_channel *chan, struct stasis_message_type *type,
+ struct ast_json *blob);
+
/*!
* \since 12
* \brief Set flag to indicate channel snapshot is being staged.
Modified: team/mjordan/12-stasis-performance/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/main/cdr.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/main/cdr.c (original)
+++ team/mjordan/12-stasis-performance/main/cdr.c Tue May 20 09:51:38 2014
@@ -2120,7 +2120,6 @@
ao2_callback(active_cdrs_by_channel, OBJ_NODATA, cdr_object_finalize_party_b,
old_snapshot);
}
-
}
struct bridge_leave_data {
Modified: team/mjordan/12-stasis-performance/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/main/cel.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/main/cel.c (original)
+++ team/mjordan/12-stasis-performance/main/cel.c Tue May 20 09:51:38 2014
@@ -1791,9 +1791,7 @@
"event_type", event_type,
"event_details", blob);
- ast_channel_lock(chan);
- message = ast_channel_blob_create(chan, cel_generic_type(), cel_blob);
- ast_channel_unlock(chan);
+ message = ast_channel_blob_create_from_cache(ast_channel_uniqueid(chan), cel_generic_type(), cel_blob);
if (message) {
stasis_publish(ast_cel_topic(), message);
}
Modified: team/mjordan/12-stasis-performance/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/main/channel.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/main/channel.c (original)
+++ team/mjordan/12-stasis-performance/main/channel.c Tue May 20 09:51:38 2014
@@ -3988,7 +3988,6 @@
ast_frfree(f);
f = &ast_null_frame;
} else {
- /* Answer the CDR */
ast_setstate(chan, AST_STATE_UP);
}
} else if (f->subclass.integer == AST_CONTROL_READ_ACTION) {
@@ -5337,10 +5336,6 @@
generator_write_format_change(chan);
}
- ast_channel_lock(chan);
- ast_channel_publish_snapshot(chan);
- ast_channel_unlock(chan);
-
return 0;
}
@@ -5419,10 +5414,6 @@
if (direction && ast_channel_generatordata(chan)) {
generator_write_format_change(chan);
}
-
- ast_channel_lock(chan);
- ast_channel_publish_snapshot(chan);
- ast_channel_unlock(chan);
return res;
}
@@ -7649,12 +7640,9 @@
{
struct ast_variable *cur;
- ast_channel_stage_snapshot(chan);
-
- for (cur = vars; cur; cur = cur->next)
+ for (cur = vars; cur; cur = cur->next) {
pbx_builtin_setvar_helper(chan, cur->name, cur->value);
-
- ast_channel_stage_snapshot_done(chan);
+ }
}
static void *silence_generator_alloc(struct ast_channel *chan, void *data)
Modified: team/mjordan/12-stasis-performance/main/channel_internal_api.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/main/channel_internal_api.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/main/channel_internal_api.c (original)
+++ team/mjordan/12-stasis-performance/main/channel_internal_api.c Tue May 20 09:51:38 2014
@@ -943,9 +943,8 @@
ast_channel_name(chan),
call_identifier_to,
call_identifier_from);
-
- ast_channel_publish_snapshot(chan);
-}
+}
+
void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state value)
{
chan->state = value;
@@ -1073,7 +1072,6 @@
void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
{
chan->whentohangup = *value;
- ast_channel_publish_snapshot(chan);
}
void ast_channel_varshead_set(struct ast_channel *chan, struct varshead *value)
{
@@ -1131,7 +1129,6 @@
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
{
chan->callgroup = value;
- ast_channel_publish_snapshot(chan);
}
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
{
@@ -1140,7 +1137,6 @@
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
{
chan->pickupgroup = value;
- ast_channel_publish_snapshot(chan);
}
struct ast_namedgroups *ast_channel_named_callgroups(const struct ast_channel *chan)
{
Modified: team/mjordan/12-stasis-performance/main/cli.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/main/cli.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/main/cli.c (original)
+++ team/mjordan/12-stasis-performance/main/cli.c Tue May 20 09:51:38 2014
@@ -1513,8 +1513,7 @@
static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
- struct ast_channel_snapshot *snapshot;
+ struct ast_channel *chan;
struct timeval now;
char cdrtime[256];
struct ast_str *obuf;/*!< Buffer for CDR variables. */
@@ -1522,6 +1521,12 @@
long elapsed_seconds=0;
int hour=0, min=0, sec=0;
struct ast_var_t *var;
+ char nativeformats[256];
+ struct ast_str *write_transpath = ast_str_alloca(256);
+ struct ast_str *read_transpath = ast_str_alloca(256);
+ struct ast_bridge *bridge;
+ struct ast_callid *callid;
+ char callid_buf[32];
switch (cmd) {
case CLI_INIT:
@@ -1538,31 +1543,43 @@
return CLI_SHOWUSAGE;
}
- now = ast_tvnow();
-
- if (!(msg = stasis_cache_get(ast_channel_cache_by_name(), ast_channel_snapshot_type(), a->argv[3]))) {
- ast_cli(a->fd, "%s is not a known channel\n", a->argv[3]);
- return CLI_SUCCESS;
- }
- snapshot = stasis_message_data(msg);
-
obuf = ast_str_thread_get(&ast_str_thread_global_buf, 16);
if (!obuf) {
return CLI_FAILURE;
}
+
output = ast_str_create(8192);
if (!output) {
return CLI_FAILURE;
}
- if (!ast_tvzero(snapshot->creationtime)) {
- elapsed_seconds = now.tv_sec - snapshot->creationtime.tv_sec;
+ chan = ast_channel_get_by_name(a->argv[3]);
+ if (!chan) {
+ ast_cli(a->fd, "%s is not a known channel\n", a->argv[3]);
+ return CLI_SUCCESS;
+ }
+
+ now = ast_tvnow();
+ ast_channel_lock(chan);
+
+ if (!ast_tvzero(ast_channel_creationtime(chan))) {
+ elapsed_seconds = now.tv_sec - ast_channel_creationtime(chan).tv_sec;
hour = elapsed_seconds / 3600;
min = (elapsed_seconds % 3600) / 60;
sec = elapsed_seconds % 60;
snprintf(cdrtime, sizeof(cdrtime), "%dh%dm%ds", hour, min, sec);
} else {
strcpy(cdrtime, "N/A");
+ }
+
+ ast_translate_path_to_str(ast_channel_writetrans(chan), &write_transpath);
+ ast_translate_path_to_str(ast_channel_readtrans(chan), &read_transpath);
+
+ bridge = ast_channel_get_bridge(chan);
+ callid = ast_channel_callid(chan);
+ if (callid) {
+ ast_callid_strnprint(callid_buf, sizeof(callid_buf), callid);
+ ast_callid_unref(callid);
}
ast_str_append(&output, 0,
@@ -1597,51 +1614,63 @@
" Application: %s\n"
" Data: %s\n"
" Call Identifer: %s\n",
- snapshot->name,
- snapshot->type,
- snapshot->uniqueid,
- snapshot->linkedid,
- S_OR(snapshot->caller_number, "(N/A)"),
- S_OR(snapshot->caller_name, "(N/A)"),
- S_OR(snapshot->connected_number, "(N/A)"),
- S_OR(snapshot->connected_name, "(N/A)"),
- S_OR(snapshot->effective_number, "(N/A)"),
- S_OR(snapshot->effective_name, "(N/A)"),
- S_OR(snapshot->caller_dnid, "(N/A)"),
- snapshot->language,
- ast_state2str(snapshot->state),
- snapshot->state,
- snapshot->nativeformats,
- snapshot->writeformat,
- snapshot->readformat,
- !ast_strlen_zero(snapshot->writetrans) ? "Yes" : "No",
- snapshot->writetrans,
- !ast_strlen_zero(snapshot->readtrans) ? "Yes" : "No",
- snapshot->readtrans,
- (long) snapshot->hanguptime.tv_sec,
+ ast_channel_name(chan),
+ ast_channel_tech(chan)->type,
+ ast_channel_uniqueid(chan),
+ ast_channel_linkedid(chan),
+ S_COR(ast_channel_caller(chan)->id.number.valid,
+ ast_channel_caller(chan)->id.number.str, "(N/A)"),
+ S_COR(ast_channel_caller(chan)->id.name.valid,
+ ast_channel_caller(chan)->id.name.str, "(N/A)"),
+ S_COR(ast_channel_connected(chan)->id.number.valid,
+ ast_channel_connected(chan)->id.number.str, "(N/A)"),
+ S_COR(ast_channel_connected(chan)->id.name.valid,
+ ast_channel_connected(chan)->id.name.str, "(N/A)"),
+ S_COR(ast_channel_connected_effective_id(chan).number.valid,
+ ast_channel_connected_effective_id(chan).number.str, "(N/A)"),
+ S_COR(ast_channel_connected_effective_id(chan).name.valid,
+ ast_channel_connected_effective_id(chan).name.str, "(N/A)"),
+ S_OR(ast_channel_dialed(chan)->number.str, "(N/A)"),
+ ast_channel_language(chan),
+ ast_state2str(ast_channel_state(chan)),
+ ast_channel_state(chan),
+ ast_getformatname_multiple(nativeformats, sizeof(nativeformats), ast_channel_nativeformats(chan)),
+ ast_getformatname(ast_channel_writeformat(chan)),
+ ast_getformatname(ast_channel_readformat(chan)),
+ ast_str_strlen(write_transpath) ? "Yes" : "No",
+ ast_str_buffer(write_transpath),
+ ast_str_strlen(read_transpath) ? "Yes" : "No",
+ ast_str_buffer(read_transpath),
+ ast_channel_whentohangup(chan)->tv_sec,
cdrtime,
- S_OR(snapshot->bridgeid, "(Not bridged)"),
- snapshot->context,
- snapshot->exten,
- snapshot->priority,
- snapshot->callgroup,
- snapshot->pickupgroup,
- S_OR(snapshot->appl, "(N/A)"),
- S_OR(snapshot->data, "(Empty)"),
- S_OR(snapshot->callid, "(None)"));
-
+ bridge ? bridge->uniqueid : "(Not bridged)",
+ ast_channel_context(chan),
+ ast_channel_exten(chan),
+ ast_channel_priority(chan),
+ ast_channel_callgroup(chan),
+ ast_channel_pickupgroup(chan),
+ S_OR(ast_channel_appl(chan), "(N/A)"),
+ S_OR(ast_channel_data(chan), "(Empty)"),
+ S_OR(callid_buf, "(None)")
+ );
ast_str_append(&output, 0, " Variables:\n");
- AST_LIST_TRAVERSE(snapshot->channel_vars, var, entries) {
+ AST_LIST_TRAVERSE(ast_channel_varshead(chan), var, entries) {
ast_str_append(&output, 0, "%s=%s\n", ast_var_name(var), ast_var_value(var));
}
- if (ast_cdr_serialize_variables(snapshot->name, &obuf, '=', '\n')) {
+ if (ast_cdr_serialize_variables(ast_channel_name(chan), &obuf, '=', '\n')) {
ast_str_append(&output, 0, " CDR Variables:\n%s\n", ast_str_buffer(obuf));
}
+
+ ast_channel_unlock(chan);
ast_cli(a->fd, "%s", ast_str_buffer(output));
ast_free(output);
+
+ ao2_cleanup(bridge);
+ ast_channel_unref(chan);
+
return CLI_SUCCESS;
}
Modified: team/mjordan/12-stasis-performance/main/core_local.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/main/core_local.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/main/core_local.c (original)
+++ team/mjordan/12-stasis-performance/main/core_local.c Tue May 20 09:51:38 2014
@@ -328,12 +328,12 @@
RAII_VAR(struct ast_channel_snapshot *, local_one_snapshot, NULL, ao2_cleanup);
RAII_VAR(struct ast_channel_snapshot *, local_two_snapshot, NULL, ao2_cleanup);
- local_one_snapshot = ast_channel_snapshot_create(p->base.owner);
+ local_one_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(p->base.owner));
if (!local_one_snapshot) {
return NULL;
}
- local_two_snapshot = ast_channel_snapshot_create(p->base.chan);
+ local_two_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(p->base.chan));
if (!local_two_snapshot) {
return NULL;
}
@@ -371,7 +371,7 @@
if (source) {
RAII_VAR(struct ast_channel_snapshot *, source_snapshot, NULL, ao2_cleanup);
- source_snapshot = ast_channel_snapshot_create(source);
+ source_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(source));
if (!source_snapshot) {
return;
}
@@ -516,12 +516,12 @@
goto end;
}
- one_snapshot = ast_channel_snapshot_create(owner);
+ one_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(owner));
if (!one_snapshot) {
goto end;
}
- two_snapshot = ast_channel_snapshot_create(chan);
+ two_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(chan));
if (!two_snapshot) {
goto end;
}
Modified: team/mjordan/12-stasis-performance/main/dial.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/main/dial.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/main/dial.c (original)
+++ team/mjordan/12-stasis-performance/main/dial.c Tue May 20 09:51:38 2014
@@ -306,7 +306,7 @@
ast_channel_appl_set(channel->owner, "AppDial2");
ast_channel_data_set(channel->owner, "(Outgoing Line)");
- ast_publish_channel_state(channel->owner);
+
memset(ast_channel_whentohangup(channel->owner), 0, sizeof(*ast_channel_whentohangup(channel->owner)));
/* Inherit everything from he who spawned this dial */
Modified: team/mjordan/12-stasis-performance/main/endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/main/endpoints.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/main/endpoints.c (original)
+++ team/mjordan/12-stasis-performance/main/endpoints.c Tue May 20 09:51:38 2014
@@ -203,9 +203,6 @@
ast_str_container_add(endpoint->channel_ids, ast_channel_uniqueid(chan));
ao2_unlock(endpoint);
- ast_channel_lock(chan);
- ast_publish_channel_state(chan);
- ast_channel_unlock(chan);
endpoint_publish_snapshot(endpoint);
return 0;
Modified: team/mjordan/12-stasis-performance/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/main/manager.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/main/manager.c (original)
+++ team/mjordan/12-stasis-performance/main/manager.c Tue May 20 09:51:38 2014
@@ -3858,7 +3858,7 @@
);
struct ast_str *str = ast_str_create(1000);
struct ao2_iterator it_chans;
- struct timeval now = ast_tvnow();
+ //struct timeval now = ast_tvnow();
if (!ast_strlen_zero(id)) {
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
@@ -3898,7 +3898,7 @@
struct ast_channel_snapshot *snapshot = stasis_message_data(msg);
struct ast_channel *c;
struct ast_str *built = ast_manager_build_channel_state_string_prefix(snapshot, "");
- long elapsed_seconds = 0;
+// long elapsed_seconds = 0;
if (!built) {
continue;
@@ -3928,9 +3928,9 @@
if (!ast_tvzero(snapshot->creationtime)) {
- elapsed_seconds = now.tv_sec - snapshot->creationtime.tv_sec;
- }
-
+// elapsed_seconds = now.tv_sec - snapshot->creationtime.tv_sec;
+ }
+/*
astman_append(s,
"Event: Status\r\n"
"Privilege: Call\r\n"
@@ -3975,7 +3975,7 @@
ast_str_buffer(built),
ast_str_buffer(str),
idText);
-
+*/
ast_free(built);
}
Modified: team/mjordan/12-stasis-performance/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/main/pbx.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/main/pbx.c (original)
+++ team/mjordan/12-stasis-performance/main/pbx.c Tue May 20 09:51:38 2014
@@ -8316,8 +8316,7 @@
/*! \brief CLI support for listing chanvar's variables in a parseable way */
static char *handle_show_chanvar(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
- struct ast_channel_snapshot *snapshot;
+ struct ast_channel *chan;
struct ast_var_t *var;
switch (cmd) {
@@ -8331,19 +8330,23 @@
return ast_complete_channels(a->line, a->word, a->pos, a->n, 3);
}
- if (a->argc != e->args + 1)
+ if (a->argc != e->args + 1) {
return CLI_SHOWUSAGE;
-
- if (!(msg = stasis_cache_get(ast_channel_cache_by_name(), ast_channel_snapshot_type(), a->argv[3]))) {
+ }
+
+ chan = ast_channel_get_by_name(a->argv[e->args]);
+ if (!chan) {
ast_cli(a->fd, "Channel '%s' not found\n", a->argv[e->args]);
- return CLI_FAILURE;
- }
- snapshot = stasis_message_data(msg);
-
- AST_LIST_TRAVERSE(snapshot->channel_vars, var, entries) {
+ return CLI_FAILURE;
+ }
+
+ ast_channel_lock(chan);
+ AST_LIST_TRAVERSE(ast_channel_varshead(chan), var, entries) {
ast_cli(a->fd, "%s=%s\n", ast_var_name(var), ast_var_value(var));
}
-
+ ast_channel_unlock(chan);
+
+ ast_channel_unref(chan);
return CLI_SUCCESS;
}
@@ -10136,7 +10139,7 @@
struct ast_app *app = pbx_findapp(outgoing->app);
if (app) {
- ast_verb(4, "Launching %s(%s) on %s\n", outgoing->app, outgoing->appdata,
+ ast_verb(4, "Launching %s(%s) on %s\n", outgoing->app, S_OR(outgoing->appdata, ""),
ast_channel_name(ast_dial_answered(outgoing->dial)));
pbx_exec(ast_dial_answered(outgoing->dial), app, outgoing->appdata);
} else {
@@ -11393,14 +11396,11 @@
AST_LIST_TRAVERSE_SAFE_END;
if (value && (newvariable = ast_var_assign(name, value))) {
- if (headp == &globals)
+ if (headp == &globals) {
ast_verb(2, "Setting global variable '%s' to '%s'\n", name, value);
+ }
AST_LIST_INSERT_HEAD(headp, newvariable, entries);
ast_channel_publish_varset(chan, name, value);
-
- if (headp != &globals) {
- ast_channel_publish_snapshot(chan);
- }
}
if (chan)
Modified: team/mjordan/12-stasis-performance/main/pickup.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/main/pickup.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/main/pickup.c (original)
+++ team/mjordan/12-stasis-performance/main/pickup.c Tue May 20 09:51:38 2014
@@ -361,9 +361,7 @@
goto pickup_failed;
}
- ast_channel_lock(target);
- target_snapshot = ast_channel_snapshot_create(target);
- ast_channel_unlock(target);
+ target_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(target));
if (!target_snapshot) {
goto pickup_failed;
}
Modified: team/mjordan/12-stasis-performance/main/stasis_bridges.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/main/stasis_bridges.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/main/stasis_bridges.c (original)
+++ team/mjordan/12-stasis-performance/main/stasis_bridges.c Tue May 20 09:51:38 2014
@@ -407,9 +407,7 @@
}
if (chan) {
- ast_channel_lock(chan);
- obj->channel = ast_channel_snapshot_create(chan);
- ast_channel_unlock(chan);
+ obj->channel = ast_channel_snapshot_get_latest(ast_channel_uniqueid(chan));
if (obj->channel == NULL) {
return NULL;
}
@@ -593,9 +591,7 @@
}
}
- ast_channel_lock(pair->channel);
- snapshot_pair->channel_snapshot = ast_channel_snapshot_create(pair->channel);
- ast_channel_unlock(pair->channel);
+ snapshot_pair->channel_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(pair->channel));
if (!snapshot_pair->channel_snapshot) {
return -1;
}
@@ -1072,9 +1068,7 @@
transfer_msg->dest_type = AST_ATTENDED_TRANSFER_DEST_LINK;
for (i = 0; i < 2; ++i) {
- ast_channel_lock(locals[i]);
- transfer_msg->dest.links[i] = ast_channel_snapshot_create(locals[i]);
- ast_channel_unlock(locals[i]);
+ transfer_msg->dest.links[i] = ast_channel_snapshot_get_latest(ast_channel_uniqueid(locals[i]));
if (!transfer_msg->dest.links[i]) {
return;
}
Modified: team/mjordan/12-stasis-performance/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/main/stasis_channels.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/main/stasis_channels.c (original)
+++ team/mjordan/12-stasis-performance/main/stasis_channels.c Tue May 20 09:51:38 2014
@@ -167,23 +167,25 @@
ast_string_field_free_memory(snapshot);
ao2_cleanup(snapshot->manager_vars);
- ao2_cleanup(snapshot->channel_vars);
-}
+}
+
+static int64_t GLOBAL_CUMULATIVE_TIME;
+static int64_t GLOBAL_SNAPSHOTS;
struct ast_channel_snapshot *ast_channel_snapshot_create(struct ast_channel *chan)
{
struct ast_channel_snapshot *snapshot;
struct ast_bridge *bridge;
- char nativeformats[256];
- struct ast_str *write_transpath = ast_str_alloca(256);
- struct ast_str *read_transpath = ast_str_alloca(256);
- struct ast_party_id effective_connected_id;
- struct ast_callid *callid;
+ int64_t snap_time;
+ struct timeval start;
+ struct timeval end;
/* no snapshots for dummy channels */
if (!ast_channel_tech(chan)) {
return NULL;
}
+
+ start = ast_tvnow();
snapshot = ao2_alloc(sizeof(*snapshot), channel_snapshot_dtor);
if (!snapshot || ast_string_field_init(snapshot, 1024)) {
@@ -235,39 +237,23 @@
ao2_cleanup(bridge);
}
- ast_string_field_set(snapshot, nativeformats, ast_getformatname_multiple(nativeformats, sizeof(nativeformats),
- ast_channel_nativeformats(chan)));
- ast_string_field_set(snapshot, readformat, ast_getformatname(ast_channel_readformat(chan)));
- ast_string_field_set(snapshot, writeformat, ast_getformatname(ast_channel_writeformat(chan)));
- ast_string_field_set(snapshot, writetrans, ast_translate_path_to_str(ast_channel_writetrans(chan), &write_transpath));
- ast_string_field_set(snapshot, readtrans, ast_translate_path_to_str(ast_channel_readtrans(chan), &read_transpath));
-
- effective_connected_id = ast_channel_connected_effective_id(chan);
- ast_string_field_set(snapshot, effective_name,
- S_COR(effective_connected_id.name.valid, effective_connected_id.name.str, ""));
- ast_string_field_set(snapshot, effective_number,
- S_COR(effective_connected_id.number.valid, effective_connected_id.number.str, ""));
-
- if ((callid = ast_channel_callid(chan))) {
- ast_callid_strnprint(snapshot->callid, sizeof(snapshot->callid), callid);
- ast_callid_unref(callid);
- }
-
snapshot->creationtime = ast_channel_creationtime(chan);
- snapshot->hanguptime = *(ast_channel_whentohangup(chan));
snapshot->state = ast_channel_state(chan);
snapshot->priority = ast_channel_priority(chan);
snapshot->amaflags = ast_channel_amaflags(chan);
snapshot->hangupcause = ast_channel_hangupcause(chan);
ast_copy_flags(&snapshot->flags, ast_channel_flags(chan), 0xFFFFFFFF);
snapshot->caller_pres = ast_party_id_presentation(&ast_channel_caller(chan)->id);
- snapshot->callgroup = ast_channel_callgroup(chan);
- snapshot->pickupgroup = ast_channel_pickupgroup(chan);
ast_set_flag(&snapshot->softhangup_flags, ast_channel_softhangup_internal_flag(chan));
snapshot->manager_vars = ast_channel_get_manager_vars(chan);
- snapshot->channel_vars = ast_channel_get_vars(chan);
snapshot->tech_properties = ast_channel_tech(chan)->properties;
+
+ end = ast_tvnow();
+
+ snap_time = ast_tvdiff_us(end, start);
+ GLOBAL_CUMULATIVE_TIME += snap_time;
+ GLOBAL_SNAPSHOTS += 1;
return snapshot;
}
@@ -319,7 +305,11 @@
if (caller) {
ast_channel_lock(caller);
- caller_snapshot = ast_channel_snapshot_create(caller);
+ if (ast_strlen_zero(dialstatus)) {
+ caller_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(caller));
+ } else {
+ caller_snapshot = ast_channel_snapshot_create(caller);
+ }
ast_channel_unlock(caller);
if (!caller_snapshot) {
return;
@@ -328,7 +318,11 @@
}
ast_channel_lock(peer);
- peer_snapshot = ast_channel_snapshot_create(peer);
+ if (ast_strlen_zero(dialstatus)) {
+ peer_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(peer));
+ } else {
+ peer_snapshot = ast_channel_snapshot_create(peer);
+ }
ast_channel_unlock(peer);
if (!peer_snapshot) {
return;
@@ -654,9 +648,24 @@
stasis_publish(ast_channel_topic(chan), message);
}
+void ast_channel_publish_cached_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
+{
+ struct stasis_message *message;
+
+ if (!blob) {
+ blob = ast_json_null();
+ }
+
+ message = ast_channel_blob_create_from_cache(ast_channel_uniqueid(chan), type, blob);
+ if (message) {
+ stasis_publish(ast_channel_topic(chan), message);
+ }
+ ao2_cleanup(message);
+}
+
void ast_channel_publish_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
{
- RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+ struct stasis_message *message;
if (!blob) {
blob = ast_json_null();
@@ -666,11 +675,12 @@
if (message) {
stasis_publish(ast_channel_topic(chan), message);
}
+ ao2_cleanup(message);
}
void ast_channel_publish_varset(struct ast_channel *chan, const char *name, const char *value)
{
- RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
+ struct ast_json *blob;
ast_assert(name != NULL);
ast_assert(value != NULL);
@@ -683,7 +693,12 @@
return;
}
- ast_channel_publish_blob(chan, ast_channel_varset_type(), blob);
+ if (chan) {
+ ast_channel_publish_cached_blob(chan, ast_channel_varset_type(), blob);
+ } else {
+ ast_channel_publish_blob(chan, ast_channel_varset_type(), blob);
+ }
+ ast_json_unref(blob);
}
static struct ast_manager_event_blob *varset_to_ami(struct stasis_message *msg)
@@ -1114,3 +1129,4 @@
return res;
}
+
Modified: team/mjordan/12-stasis-performance/res/ari/resource_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/res/ari/resource_channels.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/res/ari/resource_channels.c (original)
+++ team/mjordan/12-stasis-performance/res/ari/resource_channels.c Tue May 20 09:51:38 2014
@@ -859,7 +859,7 @@
return;
}
- snapshot = ast_channel_snapshot_create(chan);
+ snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(chan));
ast_channel_unlock(chan);
if (!ast_strlen_zero(args_app)) {
@@ -1086,7 +1086,7 @@
return;
}
- snapshot = ast_channel_snapshot_create(snoop);
+ snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(snoop));
ast_ari_response_ok(response, ast_channel_snapshot_to_json(snapshot, NULL));
}
Modified: team/mjordan/12-stasis-performance/res/res_agi.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/res/res_agi.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/res/res_agi.c (original)
+++ team/mjordan/12-stasis-performance/res/res_agi.c Tue May 20 09:51:38 2014
@@ -1482,7 +1482,7 @@
ast_uri_encode(agi_buffer, ami_buffer, AMI_BUF_SIZE, ast_uri_http);
startblob = ast_json_pack("{s: s}", "Env", ami_buffer);
ast_channel_lock(chan);
- ast_channel_publish_blob(chan, agi_async_start_type(), startblob);
+ ast_channel_publish_cached_blob(chan, agi_async_start_type(), startblob);
hungup = ast_check_hangup(chan);
ast_channel_unlock(chan);
@@ -1530,7 +1530,7 @@
ast_json_object_set(execblob, "CommandId", ast_json_string_create(cmd->cmd_id));
}
ast_channel_lock(chan);
- ast_channel_publish_blob(chan, agi_async_exec_type(), execblob);
+ ast_channel_publish_cached_blob(chan, agi_async_exec_type(), execblob);
ast_channel_unlock(chan);
free_agi_cmd(cmd);
@@ -1592,7 +1592,7 @@
}
/* notify manager users this channel cannot be controlled anymore by Async AGI */
ast_channel_lock(chan);
- ast_channel_publish_blob(chan, agi_async_end_type(), NULL);
+ ast_channel_publish_cached_blob(chan, agi_async_end_type(), NULL);
ast_channel_unlock(chan);
async_agi_abort:
@@ -3666,7 +3666,7 @@
"ResultCode", result_code,
"Result", result);
ast_channel_lock(chan);
- ast_channel_publish_blob(chan, agi_exec_end_type(), blob);
+ ast_channel_publish_cached_blob(chan, agi_exec_end_type(), blob);
ast_channel_unlock(chan);
}
@@ -3686,7 +3686,7 @@
"CommandId", command_id,
"Command", ami_cmd);
ast_channel_lock(chan);
- ast_channel_publish_blob(chan, agi_exec_start_type(), startblob);
+ ast_channel_publish_cached_blob(chan, agi_exec_start_type(), startblob);
ast_channel_unlock(chan);
parse_args(buf, &argc, argv);
Modified: team/mjordan/12-stasis-performance/res/res_pjsip/pjsip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-stasis-performance/res/res_pjsip/pjsip_configuration.c?view=diff&rev=414211&r1=414210&r2=414211
==============================================================================
--- team/mjordan/12-stasis-performance/res/res_pjsip/pjsip_configuration.c (original)
+++ team/mjordan/12-stasis-performance/res/res_pjsip/pjsip_configuration.c Tue May 20 09:51:38 2014
@@ -1445,7 +1445,7 @@
ast_str_append(&context->output_buffer, 0,
"%*s: %-7s Exten: %-*.*s CLCID: \"%s\" <%s>\n",
indent, "Codec",
- snapshot->nativeformats,
+ "", /*snapshot->nativeformats,*/
flexwidth, flexwidth,
snapshot->exten,
snapshot->connected_name,
More information about the svn-commits
mailing list