Summary:ASTERISK-00739: [patch] New command PlayInterruptibleTones - like PlayTones only interrupted by digits
Reporter:Steve Davies . (stevedavies)Labels:
Date Opened:2004-01-05 06:45:15.000-0600Date Closed:2011-06-07 14:05:14
Versions:Frequency of
Environment:Attachments:( 0) playinterruptibletones.diff
Description:PlayInterruptibleTones is to PlayTones as Background is to Playback.

Asterisk doesn't (seem to) have a way to play a tone whilst waiting for digits to be dialled.  I've seen others use Background to play a recording of a tone.  This patch adds the missing capability.

I use this, as an example, so I can answer incoming calls, play a few seconds of ringing whilst waiting for (secret) special options to be dialled by those in the know.
Comments:By: florian (florian) 2004-01-05 11:13:41.000-0600


I just installed this one, and it seems to handle nicely. I used it to emulate DISA with the proper national tone :-)

exten = s,1,Answer
;exten = s,2,DISA,no-password|local     ; extensions
exten = s,2,PlayInterruptibleTones(dial)

exten = _XXX.,1,Goto(local,${EXTEN},1)

This type is not perfect though, but the app works as a charm..

By: cyb (cyb) 2004-01-11 20:20:19.000-0600

Tested patch... Works great. Applied cleanly.


By: Brian West (bkw918) 2004-03-23 14:01:44.000-0600

do we have a disclaimer on this yet?

By: Olle Johansson (oej) 2004-03-23 14:08:32.000-0600

DOes this apply to current CVS?

By: cloos (cloos) 2004-03-23 16:56:29.000-0600

I just gave it a test.  It should have applied with a small offset on one chunk, but I was forced to apply it manually for some reason....  (perhaps whitespace)

Compiles OK.

There hasn't been any changes to handle_playtones() so this variation should just work....  (the only difference is the value of the interuptable flag passed to

The only real question is whether it is better to add a new command or just add a flag to the existing PlayTones command that allows interuption.  In that case handle_playtones() would need one more arg; if that arg is set the final arg in the call to ast_playtones_start() should be 1, else 0.

Either way it is a trivial but useful addition.

By: Olle Johansson (oej) 2004-03-24 03:22:07.000-0600

Good idea, I would prefer a flag to the current playtones.

stevedavies: Do you have time to integrate your patch as an option to playtones instead? We need to move this patch forward.

By: Steve Davies . (stevedavies) 2004-03-24 04:34:50.000-0600


I don't mind adjusting the patch to be an option to Playtones.

But - is there some consensus that this is the way it will be applied?


By: twisted (twisted) 2004-03-25 13:17:27.000-0600

You are my hero.  Works fine, but I would also like to see it as a flag for playtones... such as PlayTones(dial|i) where i is for interruptable

Also, would it be possble to allow for existing dialplan rules, such as ignorepat lines?

edited on: 03-25-04 12:08

By: Olle Johansson (oej) 2004-03-25 14:21:39.000-0600

Asked around amongst the marshal gang, and it seems like we agree that it's a good thing to integrate it into the main app instead of creating a new app.

By: cloos (cloos) 2004-03-25 16:23:25.000-0600

Since I was the one to bring up integrating it into playtones I've posted a patch to res_indications.c that does that.  (apply it in the res dir w/ -p1)

(It looks like the filename got truncated by either zilla or mantis; it is showing up as just int.diff rather than playtones-int.diff....)

I suspect that patch-sld-20040105-playinterruptibletones-part2.patch remains relevant and should also be applied.

By: cloos (cloos) 2004-03-25 16:31:54.000-0600

Ignore int.diff; playtones_int_fixed.diff also patches the help text for Playtones.  Also, it can be applied at the top dir as the first one should have been.

By: twisted (twisted) 2004-04-29 09:01:24

This is still something I'd like to see in CVS... could you describe in better detail what this patch does, like a feature list?  If it's got everything we need in it, i'll test it, make sure it's cleaned up, and see what we can do about cvs addition, assuming you've got a disclaimer filed.

By: cloos (cloos) 2004-04-29 10:28:21

twisted: are you refering to the patch I uploaded that added the interuptable support as a flag to the palytones app?

All it does is add that option, when specified the tones get interupted just like for background() as compared to playback().  

I do have a disclaimer on file.

By: twisted (twisted) 2004-04-29 21:19:58

Does this honor the ignorepat?  Also, which patch above is the correct one?  I'd like to get rid of all the ones that aren't appropriate.

By: cloos (cloos) 2004-04-29 23:45:50

You can kill int.diff; playtones_int_fixed.diff is my only (working) contribution.  

The first two files go together as the OR's proposal.

As for ignorepat, I do not have any way of testing that (no zap hw).

By: Brian West (bkw918) 2004-05-01 16:54:05

Which patch goes in?

By: cloos (cloos) 2004-05-01 22:42:01

My vote is for playtones_fixed_int.diff instead of patch-sld-20040105-playinterruptibletones.patch.

I think that style was the preferred option, yes?

But patch-sld-20040105-playinterruptibletones-part2.patch may still be relevant.

By: twisted (twisted) 2004-05-01 23:13:42

i applied playtones_fixed_int.diff and it didn't interrupt on keypress... at all.  do you have to apply all three of these? If so, they need to be consolodated into ONE patch that works on current CVS HEAD.

By: twisted (twisted) 2004-05-01 23:34:42

new patch by bkw works fine... just updated to work on current cvs

By: Mark Spencer (markster) 2004-05-01 23:42:39

Close, but you don't patch pbx.c.  Instead, you wait for a digit to happen and then return that digit as the return value of the application (see Background).

By: Brian West (bkw918) 2004-05-02 13:22:37

ok who ever wrote this orginally can fix it :P

By: twisted (twisted) 2004-06-16 23:16:48

apparently there was no intrest in fixing this, so It's being closed.