AsteriskPBXHowTo

From ago control wiki
Jump to: navigation, search

Contents

ago control and Asterisk PBX in 5 Minutes

Install the packages:

apt-get install asterisk agocontrol-asterisk

Basic Asterisk PBX configuration

Add SIP config at end of file /etc/asterisk/sip.conf:

[agoman]
type=friend
regexten=666
callerid="ago man" <666>
host=dynamic 
secret=letmein
allow=gsm 
allow=ulaw
allow=alaw
registertrying=yes

Hint: You can protect password by a md5 hash - execute command:

echo -n "agoman:asterisk:letmein" | md5sum
d4f2ec0e9c9dd6cfb4e940ac30fb9823  -

Copy the md5 and replace "secret=" with:

md5secret=d4f2ec0e9c9dd6cfb4e940ac30fb9823


Add config file /etc/asterisk/manager.d/agocontrol.conf:

[agocontrol]
secret=letmein
permit=127.0.0.1/255.255.255.0
read=system,call,log,verbose,command,agent,user,originate
write=system,call,log,verbose,command,agent,user,originate

After that change restart Asterisk.

Add config to /etc/opt/agocontrol/config.ini:

[asterisk]
username=agocontrol
password=letmein

Start Services:

systemctl start asterisk.service
systemctl start agoasterisk.service

SIP Client Configuration

Get a SIP Client like Linphone from http://www.linphone.org and set up the account with the wizard and choose:

  • I already have a sip account... press Forward
  • Username: agoman
  • Password: letmein
  • Domain: Hostname or IP-ADDRESS-OF-SERVER and press Apply

You will be asked for a username and password - use agoman and letmein here again. You now can do a test call to extension 500.

ago control - first call

Go into the admin interface and check out the UUID of a device type "phone". Now we start a call on the phone calling the number 500:

/opt/agocontrol/bin/messagesend.py -d 00000000-0000-0000-0000-000000000000 -c dial -p number=500

Note: replace 00000000-0000-0000-0000-000000000000 with the UUID of your phone


Sipgate.at Configuration

You want to have a free SIP dial in number for your agoman? Check our an account at www.sipgate.at and here we type:

Add lines to /etc/asterisk/sip.conf (replace SIP-ID and SIP-Passwort):

[sipgate]
type=peer
insecure=invite,port
canreinvite=no
nat=yes
disallow=all
allow=ulaw
host=sipgate.at
outboundproxy=sipgate.at
username=SIP-ID
fromuser = SIP-ID
fromdomain = sipgate.at
secret=SIP-Passwort
registertimeout = 600
sendrpid=pai
dtmfmode=rfc2833
context=default
callbackextension=SIP-ID

Edit /etc/asterisk/extensions.conf (replace SIP-ID):

[default]
exten => SIP-ID,1,Dial(SIP/agoman)
exten => SIP-ID,2,HangUp()

Asterisk Voice Menu to switch device on or off

If you want to have some playground with voice menu and devices you are right here. Just add or modify your extensions.conf like this and change SIP_ID and UUID:

[demo]
include => stdexten
;
; We start with what to do when a call first comes in.
;
exten => s,1,Wait(1)                    ; Wait a second, just for fun
exten => s,n,Answer                     ; Answer the line
exten => s,n,Set(TIMEOUT(digit)=5)      ; Set Digit Timeout to 5 seconds
exten => s,n,Set(TIMEOUT(response)=10)  ; Set Response Timeout to 10 seconds
exten => s,n(instruct),BackGround(agent-pass)   ; Play some instructions
exten => s,n,WaitExten                  ; Wait for an extension to be dialed.

exten => 10,1,System(/opt/agocontrol/bin/messagesend.py -d 00000000-0000-0000-0000-000000000000 -c off)      ; ago control send message
exten => 10,n,Playback(agent-loggedoff)
exten => 10,n,Goto(s,instruct)

exten => 11,1,System(/opt/agocontrol/bin/messagesend.py -d 00000000-0000-0000-0000-000000000000 -c on)      ; ago control send message
exten => 11,n,Playback(agent-loginok)
exten => 11,n,Goto(s,instruct)

;
; # for when they're done 
;
exten => #,1,Playback(tt-somethingwrong)
exten => #,2,Playback(vm-goodbye)
exten => #,n,Hangup                     ; Hang them up.

;
; A timeout and "invalid extension rule"
;
exten => t,1,Goto(#,1)                  ; If they take too long, give up


[default]
include => demo

exten => SIP_ID,1,Goto(default,s,1)
exten => SIP_ID,2,HangUp()


SIP Debug

If you want to see some SIP debug output you can try following:

/etc/init.d/asterisk debug

You are in the Asterisk console now and can start debug for example sip.conf's record "sipgate":

sip set debug peer sipgate

Check if your SIP connection is registerd:

sip show registry
Personal tools