[asterisk-commits] mmichelson: branch mmichelson/pool_shark r381255 - in /team/mmichelson/pool_s...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 11 17:00:27 CST 2013
Author: mmichelson
Date: Mon Feb 11 17:00:23 2013
New Revision: 381255
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381255
Log:
Hm, resetting automerge apparently didn't work earlier. Try again.
Modified:
team/mmichelson/pool_shark/ (props changed)
team/mmichelson/pool_shark/apps/app_playback.c
team/mmichelson/pool_shark/channels/chan_skinny.c
team/mmichelson/pool_shark/include/asterisk/astobj2.h
team/mmichelson/pool_shark/main/features.c
team/mmichelson/pool_shark/res/res_json.c
team/mmichelson/pool_shark/tests/test_json.c
Propchange: team/mmichelson/pool_shark/
------------------------------------------------------------------------------
automerge = *
Propchange: team/mmichelson/pool_shark/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Propchange: team/mmichelson/pool_shark/
------------------------------------------------------------------------------
--- pool_shark-integrated (original)
+++ pool_shark-integrated Mon Feb 11 17:00:23 2013
@@ -1,1 +1,1 @@
-/team/group/pimp_my_sip:1-381141
+/team/group/pimp_my_sip:1-381254
Propchange: team/mmichelson/pool_shark/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Feb 11 17:00:23 2013
@@ -1,1 +1,1 @@
-/trunk:1-381136
+/trunk:1-381222
Modified: team/mmichelson/pool_shark/apps/app_playback.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark/apps/app_playback.c?view=diff&rev=381255&r1=381254&r2=381255
==============================================================================
--- team/mmichelson/pool_shark/apps/app_playback.c (original)
+++ team/mmichelson/pool_shark/apps/app_playback.c Mon Feb 11 17:00:23 2013
@@ -513,8 +513,8 @@
if (say_cfg) {
ast_config_destroy(say_cfg);
ast_log(LOG_NOTICE, "Reloading say.conf\n");
- say_cfg = newcfg;
- }
+ }
+ say_cfg = newcfg;
if (say_cfg) {
for (v = ast_variable_browse(say_cfg, "general"); v ; v = v->next) {
Modified: team/mmichelson/pool_shark/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark/channels/chan_skinny.c?view=diff&rev=381255&r1=381254&r2=381255
==============================================================================
--- team/mmichelson/pool_shark/channels/chan_skinny.c (original)
+++ team/mmichelson/pool_shark/channels/chan_skinny.c Mon Feb 11 17:00:23 2013
@@ -2402,7 +2402,7 @@
{
struct skinny_req *req;
char *strptr;
- char *thestrings[12];
+ char *thestrings[13];
int i;
int callinfostrleft = MAXCALLINFOSTR;
@@ -2421,7 +2421,11 @@
thestrings[0] = fromnum;
thestrings[1] = ""; /* Appears to be origfrom */
- thestrings[2] = tonum;
+ if (calldirection == SKINNY_OUTGOING) {
+ thestrings[2] = tonum;
+ } else {
+ thestrings[2] = "";
+ }
thestrings[3] = "";
thestrings[4] = "";
thestrings[5] = "";
@@ -2432,10 +2436,11 @@
thestrings[9] = fromname;
thestrings[10] = toname;
thestrings[11] = "";
+ thestrings[12] = "";
strptr = req->data.callinfomessagevariable.calldetails;
- for(i = 0; i < 12; i++) {
+ for(i = 0; i < 13; i++) {
ast_copy_string(strptr, thestrings[i], callinfostrleft);
strptr += strlen(thestrings[i]) + 1;
callinfostrleft -= strlen(thestrings[i]) + 1;
@@ -2474,7 +2479,7 @@
} else if (sub->calldirection == SKINNY_OUTGOING) {
fromname = S_COR(ast_channel_caller(ast)->id.name.valid, ast_channel_caller(ast)->id.name.str, "");
fromnum = S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, "");
- toname = S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, l->lastnumberdialed);
+ toname = S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, "");
tonum = S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, l->lastnumberdialed);
} else {
ast_verb(1, "Error sending Callinfo to %s(%d) - No call direction in sub\n", d->name, l->instance);
@@ -2514,7 +2519,7 @@
} else if (sub->calldirection == SKINNY_OUTGOING) {
fromname = S_COR(ast_channel_caller(ast)->id.name.valid, ast_channel_caller(ast)->id.name.str, "");
fromnum = S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, "");
- toname = S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, l->lastnumberdialed);
+ toname = S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, "");
tonum = S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, l->lastnumberdialed);
} else {
ast_verb(1, "Error sending Callinfo to %s(%d) - No call direction in sub\n", d->name, l->instance);
Modified: team/mmichelson/pool_shark/include/asterisk/astobj2.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark/include/asterisk/astobj2.h?view=diff&rev=381255&r1=381254&r2=381255
==============================================================================
--- team/mmichelson/pool_shark/include/asterisk/astobj2.h (original)
+++ team/mmichelson/pool_shark/include/asterisk/astobj2.h Mon Feb 11 17:00:23 2013
@@ -1224,7 +1224,7 @@
#define ao2_t_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn, tag) \
__ao2_container_alloc_rbtree_debug((ao2_options), (container_options), (sort_fn), (cmp_fn), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__, 1)
-#define ao2_container_alloc_rbtree(ao2_options, container_options, , sort_fn, cmp_fn) \
+#define ao2_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn) \
__ao2_container_alloc_rbtree_debug((ao2_options), (container_options), (sort_fn), (cmp_fn), "", __FILE__, __LINE__, __PRETTY_FUNCTION__, 1)
#elif defined(__AST_DEBUG_MALLOC)
Modified: team/mmichelson/pool_shark/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark/main/features.c?view=diff&rev=381255&r1=381254&r2=381255
==============================================================================
--- team/mmichelson/pool_shark/main/features.c (original)
+++ team/mmichelson/pool_shark/main/features.c Mon Feb 11 17:00:23 2013
@@ -782,15 +782,6 @@
/* module and CLI command definitions */
static const char *parkcall = "Park";
-static struct ast_app *monitor_app = NULL;
-static int monitor_ok = 1;
-
-static struct ast_app *mixmonitor_app = NULL;
-static int mixmonitor_ok = 1;
-
-static struct ast_app *stopmixmonitor_app = NULL;
-static int stopmixmonitor_ok = 1;
-
static pthread_t parking_thread;
struct ast_dial_features {
/*! Channel's feature flags. */
@@ -2286,14 +2277,10 @@
const char *touch_format = NULL;
const char *touch_monitor = NULL;
const char *touch_monitor_prefix = NULL;
-
- if (!monitor_ok) {
- ast_log(LOG_ERROR,"Cannot record the call. The monitor application is disabled.\n");
- return -1;
- }
-
- if (!monitor_app && !(monitor_app = pbx_findapp("Monitor"))) {
- monitor_ok = 0;
+ struct ast_app *monitor_app;
+
+ monitor_app = pbx_findapp("Monitor");
+ if (!monitor_app) {
ast_log(LOG_ERROR,"Cannot record the call. The monitor application is disabled.\n");
return -1;
}
@@ -2377,15 +2364,11 @@
const char *mixmonitor_spy_type = "MixMonitor";
const char *touch_format;
const char *touch_monitor;
+ struct ast_app *mixmonitor_app;
int count = 0;
- if (!mixmonitor_ok) {
- ast_log(LOG_ERROR,"Cannot record the call. The mixmonitor application is disabled.\n");
- return -1;
- }
-
- if (!(mixmonitor_app = pbx_findapp("MixMonitor"))) {
- mixmonitor_ok = 0;
+ mixmonitor_app = pbx_findapp("MixMonitor");
+ if (!mixmonitor_app) {
ast_log(LOG_ERROR,"Cannot record the call. The mixmonitor application is disabled.\n");
return -1;
}
@@ -2418,18 +2401,15 @@
count = ast_channel_audiohook_count_by_source_running(callee_chan, mixmonitor_spy_type, AST_AUDIOHOOK_TYPE_SPY);
ast_channel_unlock(callee_chan);
if (count > 0) {
- if (!stopmixmonitor_ok) {
+ struct ast_app *stopmixmonitor_app;
+
+ stopmixmonitor_app = pbx_findapp("StopMixMonitor");
+ if (!stopmixmonitor_app) {
ast_log(LOG_ERROR,"Cannot stop recording the call. The stopmixmonitor application is disabled.\n");
return -1;
}
- if (!(stopmixmonitor_app = pbx_findapp("StopMixMonitor"))) {
- stopmixmonitor_ok = 0;
- ast_log(LOG_ERROR,"Cannot stop recording the call. The stopmixmonitor application is disabled.\n");
- return -1;
- } else {
- pbx_exec(callee_chan, stopmixmonitor_app, "");
- return AST_FEATURE_RETURN_SUCCESS;
- }
+ pbx_exec(callee_chan, stopmixmonitor_app, "");
+ return AST_FEATURE_RETURN_SUCCESS;
}
ast_log(LOG_WARNING,"Stopped MixMonitors are attached to the channel.\n");
@@ -4309,6 +4289,48 @@
}
/*!
+ * \internal
+ * \brief Check if Monitor needs to be started on a channel.
+ * \since 12.0.0
+ *
+ * \param chan The bridge considers this channel the caller.
+ * \param peer The bridge considers this channel the callee.
+ *
+ * \return Nothing
+ */
+static void bridge_check_monitor(struct ast_channel *chan, struct ast_channel *peer)
+{
+ const char *value;
+ const char *monitor_args = NULL;
+ struct ast_channel *monitor_chan = NULL;
+
+ ast_channel_lock(chan);
+ value = pbx_builtin_getvar_helper(chan, "AUTO_MONITOR");
+ if (!ast_strlen_zero(value)) {
+ monitor_args = ast_strdupa(value);
+ monitor_chan = chan;
+ }
+ ast_channel_unlock(chan);
+ if (!monitor_chan) {
+ ast_channel_lock(peer);
+ value = pbx_builtin_getvar_helper(peer, "AUTO_MONITOR");
+ if (!ast_strlen_zero(value)) {
+ monitor_args = ast_strdupa(value);
+ monitor_chan = peer;
+ }
+ ast_channel_unlock(peer);
+ }
+ if (monitor_chan) {
+ struct ast_app *monitor_app;
+
+ monitor_app = pbx_findapp("Monitor");
+ if (monitor_app) {
+ pbx_exec(monitor_chan, monitor_app, monitor_args);
+ }
+ }
+}
+
+/*!
* \brief bridge the call and set CDR
*
* \param chan The bridge considers this channel the caller.
@@ -4363,22 +4385,7 @@
ast_indicate(peer, AST_CONTROL_RINGING);
}
- if (monitor_ok) {
- const char *monitor_exec;
- struct ast_channel *src = NULL;
- if (!monitor_app) {
- if (!(monitor_app = pbx_findapp("Monitor")))
- monitor_ok=0;
- }
- if ((monitor_exec = pbx_builtin_getvar_helper(chan, "AUTO_MONITOR")))
- src = chan;
- else if ((monitor_exec = pbx_builtin_getvar_helper(peer, "AUTO_MONITOR")))
- src = peer;
- if (monitor_app && src) {
- char *tmp = ast_strdupa(monitor_exec);
- pbx_exec(src, monitor_app, tmp);
- }
- }
+ bridge_check_monitor(chan, peer);
set_config_flags(chan, config);
Modified: team/mmichelson/pool_shark/res/res_json.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark/res/res_json.c?view=diff&rev=381255&r1=381254&r2=381255
==============================================================================
--- team/mmichelson/pool_shark/res/res_json.c (original)
+++ team/mmichelson/pool_shark/res/res_json.c Mon Feb 11 17:00:23 2013
@@ -242,10 +242,10 @@
}
struct ast_json *ast_json_object_get(struct ast_json *object, const char *key)
{
- if (key) {
- return (struct ast_json *)json_object_get((json_t *)object, key);
- }
- return NULL;
+ if (!key) {
+ return NULL;
+ }
+ return (struct ast_json *)json_object_get((json_t *)object, key);
}
int ast_json_object_set(struct ast_json *object, const char *key, struct ast_json *value)
{
@@ -391,13 +391,16 @@
int ast_json_dump_file(struct ast_json *root, FILE *output)
{
- if (root && output) {
- return json_dumpf((json_t *)root, output, dump_flags());
- }
- return -1;
+ if (!root || !output) {
+ return -1;
+ }
+ return json_dumpf((json_t *)root, output, dump_flags());
}
int ast_json_dump_new_file(struct ast_json *root, const char *path)
{
+ if (!root || !path) {
+ return -1;
+ }
return json_dump_file((json_t *)root, path, dump_flags());
}
Modified: team/mmichelson/pool_shark/tests/test_json.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark/tests/test_json.c?view=diff&rev=381255&r1=381254&r2=381255
==============================================================================
--- team/mmichelson/pool_shark/tests/test_json.c (original)
+++ team/mmichelson/pool_shark/tests/test_json.c Mon Feb 11 17:00:23 2013
@@ -395,8 +395,6 @@
ast_test_validate(test, 0 == uut_res);
ast_test_validate(test, LLONG_MIN == ast_json_integer_get(uut));
- ast_json_unref(uut);
-
return AST_TEST_PASS;
}
@@ -460,8 +458,6 @@
ast_test_validate(test, NULL != uut);
ast_test_validate(test, AST_JSON_ARRAY == ast_json_typeof(uut));
ast_test_validate(test, 0 == ast_json_array_size(uut));
-
- ast_json_unref(uut);
return AST_TEST_PASS;
}
@@ -1406,6 +1402,27 @@
return AST_TEST_PASS;
}
+AST_TEST_DEFINE(json_test_pack_ownership)
+{
+ RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
+ RAII_VAR(struct ast_json *, uut, NULL, ast_json_unref);
+
+ switch (cmd) {
+ case TEST_INIT:
+ info->name = "pack_ownership";
+ info->category = "/main/json/";
+ info->summary = "Testing json_pack failure conditions.";
+ info->description = "Test JSON abstraction library.";
+ return AST_TEST_NOT_RUN;
+ case TEST_EXECUTE:
+ break;
+ }
+
+ uut = ast_json_pack("[o]", ast_json_string_create("Am I freed?"));
+
+ return AST_TEST_PASS;
+}
+
AST_TEST_DEFINE(json_test_pack_errors)
{
RAII_VAR(void *, alloc_debug, json_test_init(test), json_test_finish);
@@ -1528,7 +1545,7 @@
/* circular reference testing */
/* Cannot add self */
uut = ast_json_object_create();
- uut_res = ast_json_object_set(uut, "myself", uut);
+ uut_res = ast_json_object_set(uut, "myself", ast_json_ref(uut));
ast_test_validate(test, -1 == uut_res);
ast_test_validate(test, 0 == ast_json_object_size(uut));
@@ -1553,7 +1570,8 @@
}
uut = ast_json_array_create();
- uut_res = ast_json_object_set(uut, "myself", uut);
+ ast_test_validate(test, 0 == ast_json_array_size(uut));
+ uut_res = ast_json_array_append(uut, ast_json_ref(uut));
ast_test_validate(test, -1 == uut_res);
ast_test_validate(test, 0 == ast_json_array_size(uut));
@@ -1636,6 +1654,7 @@
AST_TEST_UNREGISTER(json_test_dump_load_null);
AST_TEST_UNREGISTER(json_test_parse_errors);
AST_TEST_UNREGISTER(json_test_pack);
+ AST_TEST_UNREGISTER(json_test_pack_ownership);
AST_TEST_UNREGISTER(json_test_pack_errors);
AST_TEST_UNREGISTER(json_test_copy);
AST_TEST_UNREGISTER(json_test_deep_copy);
@@ -1688,6 +1707,7 @@
AST_TEST_REGISTER(json_test_dump_load_null);
AST_TEST_REGISTER(json_test_parse_errors);
AST_TEST_REGISTER(json_test_pack);
+ AST_TEST_REGISTER(json_test_pack_ownership);
AST_TEST_REGISTER(json_test_pack_errors);
AST_TEST_REGISTER(json_test_copy);
AST_TEST_REGISTER(json_test_deep_copy);
@@ -1698,4 +1718,7 @@
return AST_MODULE_LOAD_SUCCESS;
}
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "JSON testing.");
+AST_MODULE_INFO(ASTERISK_GPL_KEY, 0, "JSON testing",
+ .load = load_module,
+ .unload = unload_module,
+ .nonoptreq = "res_json");
More information about the asterisk-commits
mailing list