Asterisk on slackware(64) 14.1

Here is my little guide on getting asterisk phone server up and running on slackware64 14.1
This guide will also have a quick look on the fax part, where you can recieve faxes and have them delivered straight into your mailbox.

First you need to install the needed things..

(i have packed up the files i used and put it available for download here: http://bostad.us/faxpack.tgz)

Download the following files
Asterisk (Asterisk 12.4.0 used in this guide(asterisk-12.4.0.tar.gz))
Jansson libraries (Jansson 2.6 used in this guide(jansson-2.6.tar.gz))

This guide is built on using the faxpack available for download from above.

cd /root/
mkdir asterisk-install
cd asterisk-install
wget http://bostad.us/faxpack.tgz

tar -zxvf faxpack.tgz

tar -zxvf jansson-2.6.tar.gz
cd jansson-2.6/
./configure ; make ; make install
cd ..

unpack Asterisk files
tar -zxvf asterisk-12.4.0.tar.gz
cd asterisk-12.4.0/
./configure ; make ; make install ; make samples
cd ..

Register for a free license for 1 fax line
http://www.digium.com/en/products/software/fax-for-asterisk

Use the download link at http://www.digium.com/en/products/software/fax-for-asterisk
to choose your configuration (i used the res_fax_digium-12.0_1.3.1-barcelona_64.tar.gz)

You also need the register program from digium

Run the register program from digium, read the license
Fill out the information

and then you will get a line that states:
Wrote license to /var/lib/asterisk/licenses/SOMETHING

Then you need to copy the file res_fax_digium.so from the file you downloaded from the download link above into
/usr/lib/asterisk/modules/

Since we are going on a 64bit slackware you need to do the following:
cp /usr/lib/libasteriskssl.so.1 /usr/lib64/
cp /usr/local/lib/libjansson.so.4 /usr/local/lib64/
cp /usr/local/lib/libjansson.so.4 /usr/lib64/

Start asterisk with the command: asterisk

To go into asterisk, type at the command line:
asterisk -rvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
modules load res_fax
modules load res_fax_digium

If you get the error:
asterisk*CLI> module load res_fax_digium
Unable to load module res_fax_digium
Command ‘module load res_fax_digium’ failed.
[Sep 17 13:54:05] WARNING[26158]: loader.c:523 load_dynamic_module: Error loading module ‘res_fax_digium’: /usr/lib/asterisk/modules/res_fax_digium.so: wrong ELF class: ELFCLASS32
[Sep 17 13:54:05] WARNING[26158]: loader.c:1032 load_resource: Module ‘res_fax_digium’ could not be loaded.
You have chosen the wrong file to download from the digium page.

When you get this you are correct and done.
== Adding single Free FAX For Asterisk license
== Found total of 1 FAX for Asterisk licenses
== res_fax_digium limiting support to 1 sessions
— Registered handler for ‘DIGIUM’ (Digium FAX Driver)
== Manager registered action FaxLicenseStatus
== Manager registered action FaxLicenseList
Loaded res_fax_digium.so => (Digium G.711 and T.38 FAX Technologies

Now all you have to do is configure asterisk for incoming and outgoing calls, and setup the fax recieving system


 

Now over to the configuration

My configuration files, used with 3 numbers i have from phonzo.no , two for incoming calls, and one for fax

If you have any suggestions, or comments about improvements, please send me an email to bent¨bostad.us (change the ¨ with @)


 

asterisk.conf

[directories](!)
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astdbdir => /var/lib/asterisk
astkeydir => /var/lib/asterisk
astdatadir => /var/lib/asterisk
astagidir => /var/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk
astsbindir => /usr/sbin

[options]
documentation_language = en_US  ; Set the language you want documentation
; displayed in. Value is in the same format as
; locale names.

[compat]
pbx_realtime=1.6
res_agi=1.6
app_set=1.6


 

(of course i have changed some information here)
sip.conf

[general]
register =>SIPAUTHID1:SIPPWD1@sip.phonzo.com/DISPLAYNAME1
register =>SIPAUTHID2:SIPPWD2@sip.phonzo.com/DISPLAYNAME2
registertimeout=20
context=phonzo
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
subscribecontext=from-sip

[phonzo1]
canreinvite=no
username=SIPAUTHID1
fromuser=SIPAUTHID1
secret=SIPPWD1
context=phonzo
type=peer
fromdomain=sip.phonzo.com
host=sip.phonzo.com
dtmfmode=rfc2833
disallow=all
allow=ulaw
nat=yes
insecure=invite

[phonzo2]
canreinvite=no
username=SIPAUTHID2
fromuser=SIPAUTHID2
secret=SIPPWD2
context=phonzo
type=friend
fromdomain=sip.phonzo.com
host=sip.phonzo.com
dtmfmode=rfc2833
g726nonstandard=yes
call-limit=1
disallow=all
allow=alaw
allow=ulaw
;allow=g726
nat=yes
insecure=very

;(for the fax line, i have disabled g726)

 

; ext 100  (100 is the internal phone number for sip client)
[100]
type=friend
host=dynamic
secret=MYSUPERDUPERPASS
context=internal
mailbox=100@default
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
allow=ulaw
allow=g722
allow=g729
nat=force_rport,comedia

; ext 200
[200]
type=friend
host=dynamic
secret=MYSUPERDUPERPASS
context=internal
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
allow=ulaw
allow=g722
allow=g729
nat=force_rport,comedia

; ext 300
[300]
type=friend
host=dynamic
secret=MYSUPERDUPERPASS
context=internal
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
allow=ulaw
allow=g722
allow=g729
nat=force_rport,comedia

; ext 500 voip adapter linje 1 (dette er vanlig tlf)
[500]
type=friend
host=dynamic
secret=MYSUPERDUPERPASS
context=internal
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
allow=ulaw
allow=g722
allow=g729
nat=force_rport,comedia

; ext 501 voip adapter linje 2 (dette er faxen)
[501]
type=friend
host=dynamic
secret=MYSUPERDUPERPASS
context=internal
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
allow=ulaw
allow=g722
allow=g729
nat=force_rport,comedia


queues.conf

[general]
autofill=yes             ; distribute all waiting callers to available members
shared_lastcall=yes      ; respect the wrapup time for members logged into more
; than one queue

[bob]
musicclass=bob
strategy=ringall
joinempty=yes
leavewhenempty=no
ringinuse=no
periodic-announce=/var/lib/asterisk/sounds/venter-bent
periodic-announce-frequency=20 ; seconds
announce-holdtime=no
announce-frequency=30
announce-position=no
announce-position-limit=1
queue-holdtime=/var/lib/asterisk/sounds/forventet-ventetid-1-time

[dba]
musicclass=dba
strategy=ringall
joinempty=yes
leavewhenempty=no
ringinuse=no
periodic-announce=/var/lib/asterisk/sounds/takk-for-at-du-venter-din-samtale-er-viktig
periodic-announce-frequency=100 ; seconds


 

extensions.conf – In this file you control how calls are routed.

[default]
exten => _.,1,Hangup()

[phonzo]

exten => 4785240807,1,Verbose(3,Innkommende fax)
same => n,Set(FAXOPT(headerinfo)=»IM A LAME ASSHOLE»)
same => n,Set(FAXOPT(localstationid)=0047mycoolfaxnumber)
same => n,Set(FAXOPT(maxrate)=14400)
same => n,Set(FAXDEST=/tmp)
same => n,Set(tempfax=${STRFTIME(,,%C%y%m%d%H%M)})
same => n,ReceiveFax(${FAXDEST}/${tempfax}.tif)
same => n,Verbose(3,- Fax mottak ferdig med status: ${FAXSTATUS})
same => n,System(/bin/mailfax «${tempfax}» «${CALLERID(all)}» «${EXTEN}» «${FAXSTATUS}» )

;When the fax has been recieved, lets call an external program to generate the email and mail it. (/bin/mailfax)
exten => 4764009410,1,Answer
exten => 4764009410,n,Verbose(Incoming call from ${CALLERID(num)})
exten => 4764009410,n,Background(/var/lib/asterisk/sounds/til-bent2)
exten => 4764009410,n,Queue(bob)
exten => 4764009410,n,Hangup()

exten => 4738702313,1,Answer()
exten => 4738702313,n,Verbose(Incoming call from ${CALLERID(num)})
exten => 4738702313,n,Background(/var/lib/asterisk/sounds/sentralbord/til-dba)
exten => 4738702313,n,Queue(dba)
exten => 4738702313,n,Hangup()

[internal]
; All outgoing calls are transmitted thru phonzo1 extension,
exten => _XXX,1,D,Dial(SIP/${EXTEN})
exten => _XXXXXXXXXX,1,Dial(SIP/phonzo1/${EXTEN})
exten => _XXXXXXXX,1,Dial(SIP/phonzo1/${EXTEN})

; Calls to ext 100
exten => 100,1,Dial(SIP/100)
exten => 100,n,Hangup

; Calls to ext 200
exten => 200,1,Dial(SIP/200)
exten => 200,n,Hangup

; Calls to ext 300
exten => 300,1,Dial(SIP/300)
exten => 300,n,Hangup

 


Remember to put the asterisk command in rc.local for automatic startup after powerloss or reboot.

 

Legg igjen en kommentar