--- pbx.c 2005-06-10 08:46:46.176116500 -0400 +++ pbx.c.new 2005-06-10 22:51:15.743600300 -0400 @@ -251,13 +251,14 @@ { "BackGround", pbx_builtin_background, "Play a file while awaiting extension", - " Background(filename1[&filename2...][|options[|langoverride]]): Plays\n" + " Background(filename1[&filename2...][|options[|langoverride[|digits]]]): Plays\n" "given files, while simultaneously waiting for the user to begin typing\n" "an extension. The timeouts do not count until the last BackGround\n" "application has ended. Options may also be included following a pipe \n" "symbol. The 'langoverride' may be a language to use for playing the prompt\n" - "which differs from the current language of the channel. Returns -1 if \n" - "the channel was hung up, or if the file does not exist. Returns 0 otherwise.\n\n" + "which differs from the current language of the channel. The 'digits' may be a\n" + "string of digits that background will break on, otherwise it uses any digit.\n" + "Returns -1 if the channel was hung up, or if the file does not exist. Returns 0 otherwise.\n\n" " Options:\n" " 's' - causes the playback of the message to be skipped\n" " if the channel is not in the 'up' state (i.e. it\n" @@ -5530,11 +5531,12 @@ int res = 0; int argc; char *args; - char *argv[3]; + char *argv[4]; char *options = NULL; char *filename = NULL; char *front = NULL, *back = NULL; char *lang = NULL; + char *digits = NULL; struct ast_flags flags = {0}; args = ast_strdupa(data); @@ -5546,6 +5548,8 @@ options = argv[1]; if (argc > 2) lang = argv[2]; + if (argc > 3) + digits = argv[3]; } else { ast_log(LOG_WARNING, "Background requires an argument (filename)\n"); } @@ -5554,6 +5558,9 @@ if (!lang) lang = chan->language; + if (!digits) + digits = AST_DIGIT_ANY; + if (options) { if (!strcasecmp(options, "skip")) flags.flags = BACKGROUND_SKIP; @@ -5584,7 +5591,7 @@ } res = ast_streamfile(chan, front, lang); if (!res) { - res = ast_waitstream(chan, AST_DIGIT_ANY); + res = ast_waitstream(chan, digits); ast_stopstream(chan); } else { ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char*)data);