]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Only pass through HOLD and UNHOLD control frames when the mohinterpret option
authorRussell Bryant <russell@russellbryant.com>
Fri, 3 Aug 2007 17:01:07 +0000 (17:01 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 3 Aug 2007 17:01:07 +0000 (17:01 +0000)
is set to "passthrough".  This was pointed out by Kevin in the middle of a
training session.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@78063 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index d44fb042033fe5247f00090dc4ae52eae5e4d20c..14f44cebcb1e50dc4be68e4b901fdd5707eeea83 100644 (file)
@@ -3277,23 +3277,24 @@ static int iax2_indicate(struct ast_channel *c, int condition, const void *data,
 
        ast_mutex_lock(&iaxsl[callno]);
        pvt = iaxs[callno];
-       if (!strcasecmp(pvt->mohinterpret, "passthrough")) {
-               res = send_command(pvt, AST_FRAME_CONTROL, condition, 0, data, datalen, -1);
-               ast_mutex_unlock(&iaxsl[callno]);
-               return res;
-       }
 
        switch (condition) {
        case AST_CONTROL_HOLD:
-               ast_moh_start(c, data, pvt->mohinterpret);
+               if (strcasecmp(pvt->mohinterpret, "passthrough")) {
+                       ast_moh_start(c, data, pvt->mohinterpret);
+                       goto done;
+               }
                break;
        case AST_CONTROL_UNHOLD:
-               ast_moh_stop(c);
-               break;
-       default:
-               res = send_command(pvt, AST_FRAME_CONTROL, condition, 0, data, datalen, -1);
+               if (strcasecmp(pvt->mohinterpret, "passthrough")) {
+                       ast_moh_stop(c);
+                       goto done;
+               }
        }
 
+       res = send_command(pvt, AST_FRAME_CONTROL, condition, 0, data, datalen, -1);
+
+done:
        ast_mutex_unlock(&iaxsl[callno]);
 
        return res;