From: Joshua Colp Date: Fri, 9 Feb 2007 19:33:31 +0000 (+0000) Subject: Temporarily change musicclass on channel to one specified in Dial so that the 'm... X-Git-Tag: 1.4.1~120 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1ba2aa702d8b85d418685f18410a2085091dab83;p=thirdparty%2Fasterisk.git 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: https://origsvn.digium.com/svn/asterisk/branches/1.4@53749 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_dial.c b/apps/app_dial.c index 72baab7970..e1ad65d132 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++;