Remove some unnecessary calls to ast_bridged_channel() in chan_iax2.c
authorRichard Mudgett <rmudgett@digium.com>
Wed, 1 May 2013 20:00:53 +0000 (20:00 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 1 May 2013 20:00:53 +0000 (20:00 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@387182 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index 9457390..a4ea9b5 100644 (file)
@@ -10426,21 +10426,21 @@ static int socket_process_helper(struct iax2_thread *thread)
 
                                        ast_set_flag64(iaxs[fr->callno], IAX_QUELCH);
                                        if (ies.musiconhold) {
+                                               const char *moh_suggest;
+
                                                iax2_lock_owner(fr->callno);
                                                if (!iaxs[fr->callno] || !iaxs[fr->callno]->owner) {
                                                        break;
                                                }
-                                               if (ast_bridged_channel(iaxs[fr->callno]->owner)) {
-                                                       const char *moh_suggest = iaxs[fr->callno]->mohsuggest;
-
-                                                       /*
-                                                        * We already hold the owner lock so we do not
-                                                        * need to check iaxs[fr->callno] after it returns.
-                                                        */
-                                                       iax2_queue_control_data(fr->callno, AST_CONTROL_HOLD, 
-                                                               S_OR(moh_suggest, NULL),
-                                                               !ast_strlen_zero(moh_suggest) ? strlen(moh_suggest) + 1 : 0);
-                                               }
+
+                                               /*
+                                                * We already hold the owner lock so we do not
+                                                * need to check iaxs[fr->callno] after it returns.
+                                                */
+                                               moh_suggest = iaxs[fr->callno]->mohsuggest;
+                                               iax2_queue_control_data(fr->callno, AST_CONTROL_HOLD,
+                                                       S_OR(moh_suggest, NULL),
+                                                       !ast_strlen_zero(moh_suggest) ? strlen(moh_suggest) + 1 : 0);
                                                ast_channel_unlock(iaxs[fr->callno]->owner);
                                        }
                                }
@@ -10465,13 +10465,12 @@ static int socket_process_helper(struct iax2_thread *thread)
                                        if (!iaxs[fr->callno]->owner) {
                                                break;
                                        }
-                                       if (ast_bridged_channel(iaxs[fr->callno]->owner)) {
-                                               /*
-                                                * We already hold the owner lock so we do not
-                                                * need to check iaxs[fr->callno] after it returns.
-                                                */
-                                               iax2_queue_control_data(fr->callno, AST_CONTROL_UNHOLD, NULL, 0);
-                                       }
+
+                                       /*
+                                        * We already hold the owner lock so we do not
+                                        * need to check iaxs[fr->callno] after it returns.
+                                        */
+                                       iax2_queue_control_data(fr->callno, AST_CONTROL_UNHOLD, NULL, 0);
                                        ast_channel_unlock(iaxs[fr->callno]->owner);
                                }
                                break;