aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_readexten.c
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-14 21:32:03 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-14 21:32:03 +0000
commit18a4f74b964be21c04c434cf7fa152e37eaf3f85 (patch)
tree87284eccd4a545bbd16e4e62093c4a3a8257d9a5 /apps/app_readexten.c
parentc0d77c97545b3dbaa525cb46b54e120bf04e9ff2 (diff)
Allow tonelist as argument to ReadExten.
ReadExten already supported playing a tonezone from indications.conf. It now has the ability to use a tonelist like 440+480/2000|0/4000 (closes issue #15185) Reported by: jcovert Patches: app_readexten.c.patch uploaded by jcovert (license 551) Tested by: qwell Patch modified by me, to maintain backwards compatibility. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@234776 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_readexten.c')
-rw-r--r--apps/app_readexten.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/apps/app_readexten.c b/apps/app_readexten.c
index b6b6305a5..f8f4a1bfc 100644
--- a/apps/app_readexten.c
+++ b/apps/app_readexten.c
@@ -55,7 +55,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
</option>
<option name="i">
<para>Play <replaceable>filename</replaceable> as an indication tone from your
- <filename>indications.conf</filename></para>
+ <filename>indications.conf</filename> or a directly specified list of
+ frequencies and durations.</para>
</option>
<option name="n">
<para>Read digits even if the channel is not answered.</para>
@@ -204,10 +205,21 @@ static int readexten_exec(struct ast_channel *chan, const char *data)
ast_playtones_stop(chan);
ast_stopstream(chan);
- if (ts && ts->data[0])
+ if (ts && ts->data[0]) {
res = ast_playtones_start(chan, 0, ts->data, 0);
- else if (arglist.filename)
- res = ast_streamfile(chan, arglist.filename, chan->language);
+ } else if (arglist.filename) {
+ if (ast_test_flag(&flags, OPT_INDICATION) && ast_fileexists(arglist.filename, NULL, chan->language) <= 0) {
+ /*
+ * We were asked to play an indication that did not exist in the config.
+ * If no such file exists, play it as a tonelist. With any luck they won't
+ * have a file named "350+440.ulaw"
+ * (but honestly, who would do something so silly?)
+ */
+ res = ast_playtones_start(chan, 0, arglist.filename, 0);
+ } else {
+ res = ast_streamfile(chan, arglist.filename, chan->language);
+ }
+ }
for (x = 0; x < maxdigits; x++) {
ast_debug(3, "extension so far: '%s', timeout: %d\n", exten, timeout);