redial

Simple Asterisk Application

February 8th, 2012 in Interactive Telecommunications by 0 Comments

Dial: 1-646-792-0139 x105

Assignment: Using the Dialplan, build your own simple Asterisk application. Play around with different Asterisk commands, and build some simple logic with variables and extensions.

Response: Code is under [ev526_week_2]. I develop a simple phone tree, which does the following, depending on the next extension sued:

  1. Phonetically spell out “One”
  2. Playback morse code version of “All your base belong to us”.
  3. Playback multiple tones.
  4. System talk back to user
  5. Play monkey sounds
  6. Talk about weasels
  7. Activate voicemail

When accessing the system, callers are greeted. The dialplan is also in a loop, so the caller will always go back to the root directory until they hangup.

Code:

[ev526_week_2]
exten => s,1,Answer()
same => 2,Background(dir-welcome)
same => 3,Background(vm-extension)
same => n,WaitExten(5)
exten => 1,1,Answer()
same => n,SayNumber(${EXTEN})
same => n,SayPhonetic("ONE")
same => n,GoTo(ev526_week_2,s,3)
exten => 2,1,Answer()
same => n,MorseCode("All your base belong to us.")
same => n,GoTo(ev526_week_2,s,3)
exten => 3,1,Answer()
same => n,PlayTones(480+620/250,0/250)
same => n,Wait(4)
same => n,StopPlaytones()
same => n,PlayTones(480+620/500,0/500)
same => n,Wait(4)
same => n,StopPlaytones()
same => n,Wait(1)
same => n,GoTo(ev526_week_2,s,3)
exten => 4,1,Answer()
same => n,System(echo 'Guess what, All your base now belong to us. Tra la la, la la la, lalala' | text2wave -scale 1.5 -F 8000 -o /home/ev526/base_meme.wav)
same => n,Background(/home/ev526/base_meme)
same => n,GoTo(ev526_week_2,s,3)
exten => 5,1,Answer()
same => n,Playback(tt-monkeysintro)
same => n,Background(tt-monkeys)
same => n,GoTo(ev526_week_2,s,3)
exten => 6,1,Answer()
same => n,Playback(tt-somethingwrong)
same => n,Playback(tt-weasels)
same => n,GoTo(ev526_week_2,s,3)
exten => 7,1,Voicemail(105@voicemail_ev526)
same => n,Hangup();
exten => a,1,VoiceMailMain(105@voicemail_ev526)
same => n,Hangup()
exten => i,1,Answer()
same => n,Playback(pbx-invalid)
same => n,GoTo(ev526_week_2,s,3)
exten => t,1,Answer()
same => n,Playback(vm-goodbye)
same => n,hangup()

Author: ezraezra

I see you looking...

Leave a Reply