Write a schedule for dialing a number and playing a sound file

Hello.
I like to configure Asterisk for dialing a number in a specific time and play a sound file like .mp3. How can I do it?

Any idea?

Thank you.

Pre-convert the sound file to the codec actually used by the call. This is not strictly necessary, but avoids wasting resources during the call.

Use a cron job to add call files specifying the call to be made.

Thank you so much. I found http://the-asterisk-book.com/1.6/call-file.html but I have some questions, What is “[call-file-test]” ? Is it a separate file? Or it is in the above of “a-test.call” file?
In below line:

[call-file-test]
exten => 10,1,Answer()
exten => 10,n,Wait(1)
exten => 10,n,Playback(hello-world)
exten => 10,n,Wait(1)
exten => 10,n,Hangup()

I see “hello-world”, Is it a sound file? For example, Can I change it to exten => 10,n,Playback(/usr/local/my.mp3) ?

Thank you.

There will be may examples on the forum, and both dialstrings and playing sound files are very basic Asterisk operations that every person trying to configure Asterisk needs to know. If you don’t know them, you are going to be continually coming back here for help.

The only subtlety is whether you want to dial a device, with possible onward routing digits, for which you really should already know the syntax, or you want to dial an Asterisk extension, for which you need to read up on local channels.

I found two websites but my questions are about files.

call-file-test is a dialplan context using the context/extension variation of call files. The Answer is redundant, as the call is already answered at that point, and the Hangup is redundant as the call will be hungup on running off the end of the dialplan.

For reasons explained in my initial posting, I’ve never used .mp3 files with Playback. I’m not sure if Asterisk supports them, but, in any case, you never specify the extension when using Playback, as Asterisk choose the version of the file that is most efficient to use of the actual call.

1 Like

Thank you so much but can you reply my questions?
I found http://the-asterisk-book.com/1.6/call-file.html but I have some questions, What is “[call-file-test]” ? Is it a separate file? Or it is in the above of “a-test.call” file?
In below line:

[call-file-test]
exten => 10,1,Answer()
exten => 10,n,Wait(1)
exten => 10,n,Playback(hello-world)
exten => 10,n,Wait(1)
exten => 10,n,Hangup()

I see “hello-world”, Is it a sound file? For example, Can I change it to exten => 10,n,Playback(/usr/local/my.mp3) ?

yes, hello-world is the sound
yes you can specify any file and make sure asterisk can access it.

You do not specify a file. You specify its name without the extension. There must be a t least one file present which matches that name and has an extension for which both Asterisk has an installed format module and it either uses the codec in use for the call, or Asterisk has as set of installed codec modules that can translate it to that for the call.

I’m fairly sure that mp3 is still not a supported format in standard Asterisk because it is not used as a telephony codec and because converting it, on the fly, to any telephony codec is expensive in CPU time.

You should therefore convert the MP3 file to one or more telephony friendly formats, before using it.

1 Like

Thank you. According to http://easyonhold.com/blog/audio-file-formats-for-telephone-system-on-hold/ the .wav file format is good.
How about the “a-test.call” file? All above lines must be in a one file?

[call-file-test]
exten => 10,1,Answer()
exten => 10,n,Wait(1)
exten => 10,n,Playback(hello-world)
exten => 10,n,Wait(1)
exten => 10,n,Hangup()
Channel: SIP/2000
MaxRetries: 2
RetryTime: 60
WaitTime: 30
Context: call-file-test
Extension: 10

Thank you.

.wav files must be 8kHz, 16 bit, mono, signed linear.

The answer to the second question is that you need to hire a consultant, as you do not have the minimal level of knowledge of configuring Asterisk to be effectively supported here.

1 Like

Quick overview…

The [call-file-test] context would likely be placed in the /etc/asterisk/extensions.conf file.

The “Channel: SIP”… -> “Extension:”… would be in a separate file. When you move this file into /var/spool/asterisk/outgoing/ it will initiate the call and drop that call into the context [call-file-test].

1 Like