]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 378854,378858-378859 via svnmerge from
authorAutomerge script <automerge@asterisk.org>
Thu, 10 Jan 2013 00:20:46 +0000 (00:20 +0000)
committerAutomerge script <automerge@asterisk.org>
Thu, 10 Jan 2013 00:20:46 +0000 (00:20 +0000)
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
bridges/bridge_softmix.c
main/channel.c
main/logger.c

index 432c7e277974ca9ead60079c2c02f80b134d7ca3..bce93cef6cd76f8c06bb2167b020600039f0f352 100644 (file)
@@ -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;
index 1a0b4fc18105b8c9dbfc9ec9f48a1e6767d9ea4d..a04388f4c90f43c5e2033d7d2679e8c5f3a83081 100644 (file)
@@ -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 */
index 5f2234a0f2052ad3582198567db0763b477e12a6..463ee672f523615257353d99640e946eecfc9a57 100644 (file)
@@ -6502,7 +6502,11 @@ static void __ast_change_name_nolink(struct ast_channel *chan, const char *newna
                        <synopsis>Raised when the name of a channel is changed.</synopsis>
                </managerEventInstance>
        ***/
-       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 */
+               int min = 0;
+               int sec = 0;
+
+               if (remain > 0) {
+                       if (remain / 60 > 1) {
+                               min = remain / 60;
+                               sec = remain % 60;
+                       } else {
+                               sec = remain;
+                       }
                }
-       }
 
-       if (!strcmp(sound,"timeleft")) {        /* Queue support */
                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);
 }
 
index 7994fb7dfe92a01fe0287efacf35214d6065b9bf..b4069605d1613827e4066ebbb3b1a0f1f4bd1571 100644 (file)
@@ -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 **));