aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--channels/chan_local.c7
-rw-r--r--doc/localchannel.txt4
2 files changed, 8 insertions, 3 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c
index 9c2f7e600..58692899c 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -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 */
diff --git a/doc/localchannel.txt b/doc/localchannel.txt
index ccedbebed..33b9fbc2f 100644
--- a/doc/localchannel.txt
+++ b/doc/localchannel.txt
@@ -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.