From 41eba63840fb697b1b31426934fc78f4d96f9fcb Mon Sep 17 00:00:00 2001 From: Automerge script Date: Thu, 10 Jan 2013 00:20:46 +0000 Subject: [PATCH] Merged revisions 378854,378858-378859 via svnmerge from file:///srv/subversion/repos/asterisk/trunk ........ r378854 | rmudgett | 2013-01-09 17:22:00 -0600 (Wed, 09 Jan 2013) | 1 line Fix logger.c function definition. ........ r378858 | rmudgett | 2013-01-09 17:23:41 -0600 (Wed, 09 Jan 2013) | 6 lines Trivial misc bridge code changes. * softmix_bridge_thread() was redundantly initializing an 8K buffer. * Promoted a debug message to a warning in multiplexed_add_or_remove(). ........ r378859 | rmudgett | 2013-01-09 17:51:45 -0600 (Wed, 09 Jan 2013) | 6 lines * Simple optimization of bridge_playfile(). * Squeezed some redundancy out of update_bridge_vars(). * Wrapped long line in __ast_change_name_nolink(). ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378868 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- bridges/bridge_multiplexed.c | 3 +- bridges/bridge_softmix.c | 2 +- main/channel.c | 73 ++++++++++++++++++++---------------- main/logger.c | 2 +- 4 files changed, 45 insertions(+), 35 deletions(-) diff --git a/bridges/bridge_multiplexed.c b/bridges/bridge_multiplexed.c index 432c7e2779..bce93cef6c 100644 --- a/bridges/bridge_multiplexed.c +++ b/bridges/bridge_multiplexed.c @@ -290,7 +290,8 @@ static void multiplexed_add_or_remove(struct multiplexed_thread *multiplexed_thr ao2_ref(multiplexed_thread, +1); if (ast_pthread_create(&multiplexed_thread->thread, NULL, multiplexed_thread_function, multiplexed_thread)) { ao2_ref(multiplexed_thread, -1); - ast_debug(1, "Failed to create an actual thread for multiplexed thread '%p', trying next time\n", multiplexed_thread); + ast_log(LOG_WARNING, "Failed to create the bridge thread for multiplexed thread '%p', trying next time\n", + multiplexed_thread); } } else if (!multiplexed_thread->service_count && multiplexed_thread->thread != AST_PTHREADT_NULL) { thread = multiplexed_thread->thread; diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c index 1a0b4fc181..a04388f4c9 100644 --- a/bridges/bridge_softmix.c +++ b/bridges/bridge_softmix.c @@ -750,7 +750,7 @@ static int softmix_bridge_thread(struct ast_bridge *bridge) struct softmix_bridge_data *softmix_data = bridge->bridge_pvt; struct ast_timer *timer; struct softmix_translate_helper trans_helper; - int16_t buf[MAX_DATALEN] = { 0, }; + int16_t buf[MAX_DATALEN]; unsigned int stat_iteration_counter = 0; /* counts down, gather stats at zero and reset. */ int timingfd; int update_all_rates = 0; /* set this when the internal sample rate has changed */ diff --git a/main/channel.c b/main/channel.c index 5f2234a0f2..463ee672f5 100644 --- a/main/channel.c +++ b/main/channel.c @@ -6502,7 +6502,11 @@ static void __ast_change_name_nolink(struct ast_channel *chan, const char *newna Raised when the name of a channel is changed. ***/ - ast_manager_event(chan, EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", ast_channel_name(chan), newname, ast_channel_uniqueid(chan)); + ast_manager_event(chan, EVENT_FLAG_CALL, "Rename", + "Channel: %s\r\n" + "Newname: %s\r\n" + "Uniqueid: %s\r\n", + ast_channel_name(chan), newname, ast_channel_uniqueid(chan)); ast_channel_name_set(chan, newname); } @@ -7461,22 +7465,26 @@ struct ast_channel *ast_bridged_channel(struct ast_channel *chan) static void bridge_playfile(struct ast_channel *chan, struct ast_channel *peer, const char *sound, int remain) { - int min = 0, sec = 0, check; + int check; check = ast_autoservice_start(peer); - if (check) + if (check) { return; - - if (remain > 0) { - if (remain / 60 > 1) { - min = remain / 60; - sec = remain % 60; - } else { - sec = remain; - } } - if (!strcmp(sound,"timeleft")) { /* Queue support */ + if (!strcmp(sound, "timeleft")) { /* Queue support */ + int min = 0; + int sec = 0; + + if (remain > 0) { + if (remain / 60 > 1) { + min = remain / 60; + sec = remain % 60; + } else { + sec = remain; + } + } + ast_stream_and_wait(chan, "vm-youhave", ""); if (min) { ast_say_number(chan, min, AST_DIGIT_ANY, ast_channel_language(chan), NULL); @@ -7761,40 +7769,41 @@ static void manager_bridge_event(int onoff, int type, struct ast_channel *c0, st S_COR(ast_channel_caller(c1)->id.number.valid, ast_channel_caller(c1)->id.number.str, "")); } +static void update_bridge_vars_set(struct ast_channel *chan, const char *name, const char *pvtid) +{ + if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "BRIDGEPEER"))) { + pbx_builtin_setvar_helper(chan, "BRIDGEPEER", name); + } + if (pvtid) { + pbx_builtin_setvar_helper(chan, "BRIDGEPVTCALLID", pvtid); + } +} + static void update_bridge_vars(struct ast_channel *c0, struct ast_channel *c1) { const char *c0_name; const char *c1_name; const char *c0_pvtid = NULL; const char *c1_pvtid = NULL; +#define UPDATE_BRIDGE_VARS_GET(chan, name, pvtid) \ + do { \ + name = ast_strdupa(ast_channel_name(chan)); \ + if (ast_channel_tech(chan)->get_pvt_uniqueid) { \ + pvtid = ast_strdupa(ast_channel_tech(chan)->get_pvt_uniqueid(chan)); \ + } \ + } while (0) ast_channel_lock(c1); - c1_name = ast_strdupa(ast_channel_name(c1)); - if (ast_channel_tech(c1)->get_pvt_uniqueid) { - c1_pvtid = ast_strdupa(ast_channel_tech(c1)->get_pvt_uniqueid(c1)); - } + UPDATE_BRIDGE_VARS_GET(c1, c1_name, c1_pvtid); ast_channel_unlock(c1); ast_channel_lock(c0); - if (!ast_strlen_zero(pbx_builtin_getvar_helper(c0, "BRIDGEPEER"))) { - pbx_builtin_setvar_helper(c0, "BRIDGEPEER", c1_name); - } - if (c1_pvtid) { - pbx_builtin_setvar_helper(c0, "BRIDGEPVTCALLID", c1_pvtid); - } - c0_name = ast_strdupa(ast_channel_name(c0)); - if (ast_channel_tech(c0)->get_pvt_uniqueid) { - c0_pvtid = ast_strdupa(ast_channel_tech(c0)->get_pvt_uniqueid(c0)); - } + update_bridge_vars_set(c0, c1_name, c1_pvtid); + UPDATE_BRIDGE_VARS_GET(c0, c0_name, c0_pvtid); ast_channel_unlock(c0); ast_channel_lock(c1); - if (!ast_strlen_zero(pbx_builtin_getvar_helper(c1, "BRIDGEPEER"))) { - pbx_builtin_setvar_helper(c1, "BRIDGEPEER", c0_name); - } - if (c0_pvtid) { - pbx_builtin_setvar_helper(c1, "BRIDGEPVTCALLID", c0_pvtid); - } + update_bridge_vars_set(c1, c0_name, c0_pvtid); ast_channel_unlock(c1); } diff --git a/main/logger.c b/main/logger.c index 7994fb7dfe..b4069605d1 100644 --- a/main/logger.c +++ b/main/logger.c @@ -1355,7 +1355,7 @@ int ast_callid_threadassoc_add(struct ast_callid *callid) return 0; } -int ast_callid_threadassoc_remove() +int ast_callid_threadassoc_remove(void) { struct ast_callid **pointing; pointing = ast_threadstorage_get(&unique_callid, sizeof(struct ast_callid **));