Question : Asterisk play music while continuing Dial Plan

I have an Asterisk Dial Plan that does some processing via a call to the internet using a CURL call. This takes some time, and the caller hears nothing. I would like to be able to setup the Dial Plan that the users would hear music or a specific message (sound file) during the wait. How do I do that? The best thing would be something like "PlayTones" ... "StopPlayTones", but I can't find something similar for playing a sound file.
Thanks in advance.

Answer : Asterisk play music while continuing Dial Plan

Well, thanks for all the advice, but the really simple solution is called AGI.
All it took was a few lines of Perl script, without any classes, to solve this issue.
I have rewritten the script, so that it can be used to call any linux command or script, while having music or a message playing in the background. I also added an option, to force the listener to hear the full message if you would like.
To use this script, just create a file in the /var/lib/asterisk/agi-bin/ directory, called system_background_agi.pl
Copy the attached code to it, and save.
Change the file mode to 755
Now in your asterisk Dial Plan, add something like this one line of code
exten => s,n,agi(system_background_agi.pl|'LinuxCommand CommandOptions'|MusicFileName|1)
The last '1' is optional, and it will force listeners to hear the whole message. Otherwise message stops as soon as LinuxCommand returns.
I hope this helps amyone out there.
Lionscribe




1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
#!/usr/bin/perl
use strict;
my $response, my $system_response;
#clear the STDIN. We just throw away all AGI values, as we don't need them in this script.
while()
{
	chomp;
	last unless length($_);
}
$|=1;
print "STREAM FILE $ARGV[1] \"\"\n";
$system_response = `$ARGV[0]`;
if ($ARGV[2])
{
	$response = ;	#force previous Stream File to finish
}
print "SET VARIABLE SYSTEM_RESPONSE \"$system_response\"\n";
Random Solutions  
 
programming4us programming4us