aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_dial.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-02-09 19:33:31 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-02-09 19:33:31 +0000
commitdb0f61682e5dea346cc4e237889e69fdbb2b6140 (patch)
tree9c9a58dcf37b2000592e12f3bbb5a10a2060aab4 /apps/app_dial.c
parent0648ff1247433fe097b6a90d940ced73a105f39d (diff)
Temporarily change musicclass on channel to one specified in Dial so that the 'm' option functions properly. (issue #8969 reported by christianbee)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@53749 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_dial.c')
-rw-r--r--apps/app_dial.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 72baab797..e1ad65d13 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -1238,7 +1238,14 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
strcpy(status, "NOANSWER");
if (ast_test_flag(outgoing, OPT_MUSICBACK)) {
moh = 1;
- ast_moh_start(chan, opt_args[OPT_ARG_MUSICBACK], NULL);
+ if (!ast_strlen_zero(opt_args[OPT_ARG_MUSICBACK])) {
+ char *original_moh = ast_strdupa(chan->musicclass);
+ ast_string_field_set(chan, musicclass, opt_args[OPT_ARG_MUSICBACK]);
+ ast_moh_start(chan, opt_args[OPT_ARG_MUSICBACK], NULL);
+ ast_string_field_set(chan, musicclass, original_moh);
+ } else {
+ ast_moh_start(chan, NULL, NULL);
+ }
ast_indicate(chan, AST_CONTROL_PROGRESS);
} else if (ast_test_flag(outgoing, OPT_RINGBACK)) {
ast_indicate(chan, AST_CONTROL_RINGING);
@@ -1296,8 +1303,11 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
time and make the caller believe the peer hasn't picked up yet */
if (ast_test_flag(&opts, OPT_MUSICBACK) && !ast_strlen_zero(opt_args[OPT_ARG_MUSICBACK])) {
+ char *original_moh = ast_strdupa(chan->musicclass);
ast_indicate(chan, -1);
+ ast_string_field_set(chan, musicclass, opt_args[OPT_ARG_MUSICBACK]);
ast_moh_start(chan, opt_args[OPT_ARG_MUSICBACK], NULL);
+ ast_string_field_set(chan, musicclass, original_moh);
} else if (ast_test_flag(&opts, OPT_RINGBACK)) {
ast_indicate(chan, AST_CONTROL_RINGING);
sentringing++;