redial

More Asterisk Apps

February 10th, 2012 in Interactive Telecommunications by 0 Comments

Assignment:

  • Setup a softphone for your use with Asterisk
  • Try out the “Dial” application both through the Dialplan and with “call files”. (Be responsible)

Response:

  • Zoiper (the sofphone software I’m using) doesn’t seem to happy with SIP; it will not play the audio or accept any extension. IAX on the other hand, works like a charm.
  • I can finally record & playback phone calls, which is pretty exciting in it self.

Code:

exten => s,1,goto(ev526_week_3,s,1)

[ev526_sip]
exten => s,1,Goto(ev526_sip,1,1);
exten => _X,1,Answer();
same => n,SayPhonetic("TWO")
exten => _X,n,Goto(ev526,s,1);

[ev526_iax]
exten => s,1,Goto(ev526_iax,1,1)
exten => _X,1,Answer()
same => n,SayPhonetic("TWO")
exten => _X,n,Goto(ev526,s,1)

[ev526_week_3]
exten => s,1,Answer()
same => n,Background(dir-welcome)
same => n,Background(vm-extension)
same => n,WaitExten(5)
exten => 1,1,Answer()
same => n,NoOp(${CALLERID(all)})
same => n,NoOp(${CALLERID(num)})
same => n,NoOp(${SIPUSERAGENT})
same => n,NoOp(${EXTEN})

;Save into datavase
same => n,Set(the_date=${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)})) ;creates current time
same => n,Set(DB(ev526/lastcalltime)=${the_date}) ;save date to database
same => n,Set(LASTCALLTIME=${DB(ev526/lastcalltime)}) ;get value to use

;Update database
same => n,Set(DID_SOMETHING=${DB(ev526/something)})
same => n,Set(DID_SOMETHING=$[1 + ${DID_SOMETHING}])
same => n,Set(DB(ev526/something)=${DID_SOMETHING})

same => n,Wait(5)
same => n,GoTo(ev526_week_3,s,1)
exten => 2,1,Answer()
;To "real" phone
same => n,Dial(SIP/itp_jnctn/19498423052,30,r);
exten => 3,1,Answer()
;To "soft" phone
same => n,Dial(IAX2/ev526_iax,30,r)
;Reset caller ID to new number
;same => n,Set(CALLERID(num)=11231231234)
exten => 4,1,Answer()
;Record specific time period, stop recording when # is pressed
same => n,Record(/home/ev526/asterisk_sounds/rec/say_something.gsm,5,30)
;Playback with Controls
same => n,ControlPlayback(/home/ev526/asterisk_sounds/rec/say_something,1000,#,*,0,1,2)
same => n,GoTo(ev526_week_3,s,1)
exten => 5,1,Answer()
;Record until caller hangs up
same => n,Record(/home/ev526/asterisk_sounds/rec/say_something.gsm,,,k)
exten => 6,1,Answer()
;Record both parties in a conversation
same => n,Monitor(wav,/home/ev526/asterisk_sounds/rec/call_monitor);
same => n,Dial(SIP/itp_jnctn/19498423052,30,r);
exten => 7,1,Answer()
same => n,ControlPlayback(/home/ev526/asterisk_sounds/rec/call_monitor-in,1000,#,*,0,1,2)
same => n,GoTo(ev526_week_3,s,1)

Author: ezraezra

I see you looking...

Leave a Reply