[asterisk-commits] file: branch 1.4 r53749 - /branches/1.4/apps/app_dial.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Feb 9 12:33:32 MST 2007


Author: file
Date: Fri Feb  9 13:33:31 2007
New Revision: 53749

URL: http://svn.digium.com/view/asterisk?view=rev&rev=53749
Log:
Temporarily change musicclass on channel to one specified in Dial so that the 'm' option functions properly. (issue #8969 reported by christianbee)

Modified:
    branches/1.4/apps/app_dial.c

Modified: branches/1.4/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_dial.c?view=diff&rev=53749&r1=53748&r2=53749
==============================================================================
--- branches/1.4/apps/app_dial.c (original)
+++ branches/1.4/apps/app_dial.c Fri Feb  9 13:33:31 2007
@@ -1238,7 +1238,14 @@
 		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 @@
 			   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++;



More information about the asterisk-commits mailing list