]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add an option to enabling passing music on hold start and stop requests through inste...
authorJoshua Colp <jcolp@digium.com>
Thu, 29 Oct 2009 18:11:26 +0000 (18:11 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 29 Oct 2009 18:11:26 +0000 (18:11 +0000)
acting on them in chan_local.

(closes issue #14709)
Reported by: dimas

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

channels/chan_local.c
doc/localchannel.txt

index 9c2f7e60064728c3a310ce66c08a7971111726a5..58692899cfbf005f479b675af5b8234f4b235096 100644 (file)
@@ -120,6 +120,7 @@ struct local_pvt {
 #define LOCAL_ALREADY_MASQED  (1 << 2) /*!< Already masqueraded */
 #define LOCAL_LAUNCHED_PBX    (1 << 3) /*!< PBX was launched */
 #define LOCAL_NO_OPTIMIZATION (1 << 4) /*!< Do not optimize using masquerading */
+#define LOCAL_MOH_PASSTHRU    (1 << 5) /*!< Pass through music on hold start/stop frames */
 
 static AST_LIST_HEAD_STATIC(locals, local_pvt);
 
@@ -374,9 +375,9 @@ static int local_indicate(struct ast_channel *ast, int condition, const void *da
                return -1;
 
        /* If this is an MOH hold or unhold, do it on the Local channel versus real channel */
-       if (condition == AST_CONTROL_HOLD) {
+       if (!ast_test_flag(p, LOCAL_MOH_PASSTHRU) && condition == AST_CONTROL_HOLD) {
                ast_moh_start(ast, data, NULL);
-       } else if (condition == AST_CONTROL_UNHOLD) {
+       } else if (!ast_test_flag(p, LOCAL_MOH_PASSTHRU) && condition == AST_CONTROL_UNHOLD) {
                ast_moh_stop(ast);
        } else {
                /* Queue up a frame representing the indication as a control frame */
@@ -634,6 +635,8 @@ static struct local_pvt *local_alloc(const char *data, int format)
                *opts++ = '\0';
                if (strchr(opts, 'n'))
                        ast_set_flag(tmp, LOCAL_NO_OPTIMIZATION);
+               if (strchr(opts, 'm'))
+                       ast_set_flag(tmp, LOCAL_MOH_PASSTHRU);
        }
 
        /* Look for a context */
index ccedbebedb3d84459013871a5ce87234809d1a81..33b9fbc2fec15b1da333df5986be65bc7272275b 100644 (file)
@@ -5,10 +5,12 @@ chan_local is a pseudo-channel. Use of this channel simply loops calls back into
 
 * Syntax:
 
- Local/extension@context[/n]
+ Local/extension@context[/nm]
 
 Adding "/n" at the end of the string will make the Local channel not do a native transfer (the "n" stands for "n"o release) upon the remote end answering the line. This is an esoteric, but important feature if you expect the Local channel to handle calls exactly like a normal channel. If you do not have the "no release" feature set, then as soon as the destination (inside of the Local channel) answers the line and one audio frame passes, the variables and dial plan will revert back to that of the original call, and the Local channel will become a zombie and be removed from the active channels list. This is desirable in some circumstances, but can result in unexpected dialplan behavior if you are doing fancy things with variables in your call handling.
 
+Adding "/m" at the end will cause chan_local to forward music on hold start and stop requests. Normally chan_local acts on them and it is started or stopped on the Local channel itself.
+
 * Purpose:
 
 The Local channel construct can be used to establish dialing into any part of the dialplan.