Installing DooxSwitch

From DooxSwitch wiki
Jump to: navigation, search

SERVER REQUIREMENTS


SERVER REQUIREMENTS:

Harddisk Space

20GB+

RAM

6GB+

Operating System

CentOS 6.6 (64 bit)

PHP

PHP5.3

Apache

Apache v2+

MySQL

MySQL v5+

ionCube

ionCube v4+


more info or requirements

Hardware requirements

Update the system

update the system

yum -y update

disable selinunx

sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config

make reboot

reboot

after reboot is done install dev tools

yum install -y make wget svn openssl-devel ncurses-devel  newt-devel libxml2-devel kernel-devel-`uname -r` gcc gcc-c++ sqlite-devel perl


Install LAMP

install LAMP with php version 5.5 [ CentOS/RHEL 6.x: ]

rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
yum -y install mysql-server httpd php55w php55w-mysql  php55w-pear gcc autoconf make vsftpd gpg php55w-gd php55w-xml php55w-pecl-memcache  php55w-mbstring.x86_64 php55w-common.x86_64 php55w-cli.x86_64 

please follow this short how to to install latest IonCube loader

After install is successful you have to modify the httpd.conf file and change the ServerName to your server IP or Hostname

nano /etc/httpd/conf/httpd.conf 

find

#1 Change to your Server Name
#ServerName www.example.com:80

change to

#1 Change to your Server Name
ServerName x.x.x.x:80


find

#2 Change AllowOverride
AllowOverride None

change to

AllowOverride ALL


you have to modify the php.ini file


#1 Change Memory Limit
memory_limit = 4096M (minimum)

#2 Change Max Execution Time
max_execution_time = 300
#3 Upload Maximum File Size
upload_max_filesize = 80M

#4 Post Maximum File Size
post_max_size = 80M
#5 Set your correct Date and Time Zone
date.timezone = Country/City


check config for httpd and mysql



/etc/init.d/httpd start
chkconfig httpd on
/etc/init.d/mysqld start
chkconfig mysqld on

Setup password for MySQL

sudo /usr/bin/mysql_secure_installation

Install Asterisk 1.8 and Dahdi

install dev tools

yum -y install libxml2-devel libxml2 unixODBC unixODBC-devel mysql-server mysql-devel nano ncurses-devel patch gcc gcc-c++ kernel-devel libtiff-devel libtermcap-devel bison flex curl-devel  libtool-ltdl-devel gmime-devel wge


Download Asterisk and Dahdi

cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.8.9.0.tar.gz
tar xvzf asterisk-1.8.9.0.tar.gz
cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux/releases/dahdi-linux-2.6.0.tar.gz
wget http://downloads.asterisk.org/pub/telephony/dahdi-tools/releases/dahdi-tools-2.6.0.tar.gz
tar xvzf dahdi-linux-2.6.0.tar.gz
tar xvzf dahdi-tools-2.6.0.tar.gz

Install Dahdi

cd /usr/src/dahdi-linux-2.6.0                                                      
make                                                                               
make install                                                                       

Install Dahdi tools

cd /usr/src/dahdi-tools-2.6.0                                                      
./configure                                                                        
make all
make install
make config
chkconfig dahdi on

Install Asterisk

cd /usr/src/asterisk-1.8.9.0
./bootstrap.sh
./configure 
contrib/scripts/get_ilbc_source.sh
contrib/scripts/get_mp3_source.sh
make menuselect.makeopts
menuselect/menuselect --enable format_mp3 --enable res_config_mysql --enable app_mysql --enable cdr_mysql --enable app_meetme --enable chan_iax2  
make && make install
make progdocs
make samples
make config

Check config

chkconfig asterisk on


Install codecs

cd /usr/src

wget http://download.dooxswitch.com/install/codec_g729.so
wget http://download.dooxswitch.com/install/codec_g723.so
mv codec_g729.so /usr/lib/asterisk/modules/codec_g729.so
mv codec_g723.so /usr/lib/asterisk/modules/codec_g723.so

modify Asterisk 1.8 config files

go to /etc/asterisk and modify few files

edit file asterisk.conf

comment out the [directories] section and insert the one below

[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/www/html
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk

edit file cdr_mysql.conf

comment out the [global] section and insert the one below replacing dbname , user and password according to your current settings

[global]
hostname=127.0.0.1
dbname=yourdbname
table=cdr
password=yourdppassword
user=root
port=3306
;sock=/tmp/mysql.sock
;timezone=UTC ; Previously called usegmtime


edit file extconfig.conf and add following to the end

sipusers => mysql,general,sip_buddies
sippeers => mysql,general,sip_buddies
voicemail => mysql,general,voicemail_user
queues => mysql,general,queue_pbx
queue_members => mysql,general,queue_member_pbx
musiconhold => mysql,general,musiconhold
followme => mysql,general,followme
followme_numbers => mysql,general,followme_numbers

edit the extension.conf file

[default]
exten => _X.,1,Wait(1)
exten => _X.,2,AGI(console.php,default)
;
[didww]
exten => _X.,1,Wait(1)
exten => _X.,2,AGI(console.php,did)
exten => _X.,3,Dial(SIP/${outContext}/${phoneCall},,S(${tout}))
exten => _X.,4,Hangup()
exten => h,1,AGI(console.php,endcall)
 ;
[sip]
exten => _X.,1,Wait(1)
exten => _X.,2,AGI(console.php,call)
exten => _X.,3,GotoIf($["${call_record_path}" != ""]?4:8)
exten => _X.,4,Set(MONITOR_FILENAME=${call_record_path})
exten => _X.,5,GotoIf($["${call_record_type}" == "wav"]?6:7)
exten => _X.,6,MixMonitor(${MONITOR_FILENAME}.wav)
exten => _X.,7,MixMonitor(${MONITOR_FILENAME}.wav,W(1),lame -b 16 ${MONITOR_FILENAME}.wav ${MONITOR_FILENAME}.mp3 && rm ${MONITOR_FILENAME}.wav)
exten => _X.,8,NoOp(Date/time call : ${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)})
exten => _X.,9,Dial(${protocol}/${outContext}/${phoneCall},,S(${tout})M(${macroName}^${Greeting}))
exten => _X.,10,GotoIf($["${DIALSTATUS}" != "ANSWER"]?11:12)
exten => _X.,11,GotoIf($["${DIALSTATUS}" != "BUSY"]?2)
exten => _X.,12,NoOp(${DIALSTATUS})
exten => h,1,AGI(console.php,endcall)
exten => h,2,Hangup()
[shortnumber]
;
exten => _X.,1,GotoIf($["${call_record_path}" != ""]?2:4)
exten => _X.,2,Set(MONITOR_FILENAME=${call_record_path})
exten => _X.,3,GotoIf($["${call_record_type}" == "wav"]?4:5)
exten => _X.,4,MixMonitor(${MONITOR_FILENAME}.wav)
exten => _X.,5,MixMonitor(${MONITOR_FILENAME}.wav,W(1),lame -b 16 ${MONITOR_FILENAME}.wav ${MONITOR_FILENAME}.mp3 && rm ${MONITOR_FILENAME}.wav)
exten => _X.,6,AGI(console.php,transfer)
exten => _X.,7,Dial(SIP/${sipid},30,tr)
exten => _X.,8,Set(CHANNEL(language)=${soundLang})
exten => _X.,9,GotoIf($["${redirectNumber}" == ""]?11:17)
exten => _X.,10,GotoIf($["$[redirectShortNumber]" == ""]?11:17)
exten => _X.,11,PlayBack(followme/sorry)
exten => _X.,12,GotoIf(${MAILBOX_EXISTS(${vm_box})}?15:13)
exten => _X.,13,PlayBack(vm-goodbye)
exten => _X.,14,Goto(18)
exten => _X.,15,Voicemail(${vm_box})
exten => _X.,16,PlayBack(vm-goodbye)
exten => _X.,17,AGI(console.php,default)
exten => h,1,AGI(console.php,endcall)
exten => _X.,18,Hangup()
;
[astsms]
exten => _X.,1,NoOp(SMS receiving dialplan invoked)
exten => _X.,n,NoOp(From ${MESSAGE(from)})
exten => _X.,n,NoOp(Body ${MESSAGE(body)})
exten => _X.,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => _X.,n,MessageSend(${ACTUALTO},${MESSAGE(from)})
exten => _X.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _X.,n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
exten => _X.,n,Hangup()
;
; Handle failed messaging
exten => _X.,n(sendfailedmsg),Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Retry later.")
exten => _X.,n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
exten => _X.,n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
exten => _X.,n,MessageSend(${ACTUALFROM},ServiceCenter)
exten => _X.,n,Hangup()
exten => _X.,n,Hangup()
;
[voicemail]
exten => _X.,1, VoiceMailMain(${vm_box})
exten => _X.,2, Hangup()
;
[voicemail_pbx_main]
exten => _X.,1, VoiceMailMain(@pbx_voicemail)
exten => _X.,2, Hangup()
;
[ring_group]
exten => _X.,1,GotoIf($["${call_record_path}" != ""]?2:4)
exten => _X.,2,Set(MONITOR_FILENAME=${call_record_path})
exten => _X.,3,GotoIf($["${call_record_type}" == "wav"]?4:5)
exten => _X.,4,MixMonitor(${MONITOR_FILENAME}.wav)
exten => _X.,5,MixMonitor(${MONITOR_FILENAME}.wav,W(1),lame -V3 ${MONITOR_FILENAME}.wav ${MONITOR_FILENAME}.mp3 && rm ${MONITOR_FILENAME}.wav)
exten => _X.,6,Answer
exten => _X.,7,Playback(some_announce)
exten => _X.,8,Set(CHANNEL(language)=${soundLang})
exten => _X.,9,Queue(${queue_name},tT,,,${timeCall},"console.php,queue")
exten => _X.,10,Playback(some_announce_after_leaving_queue)
exten => _X.,11,GotoIf($["${redirectNumber}" != ""]?12:15)
exten => _X.,12,AGI(console.php,call)
exten => _X.,13,Dial(${protocol}/${outContext}/${phoneCall},,S(${tout})M(${macroName}^${Greeting}))
exten => _X.,14,GotoIf($["${DIALSTATUS}" != "ANSWER"]?12)
exten => _X.,15,GotoIf($["${redirectToRingGroup}" != ""]?16:17)
exten => _X.,16,AGI(console.php,default)
exten => _X.,17,GotoIf($["${ivrId}" != ""]?18:19)
exten => _X.,18,AGI(console.php,ivr)
exten => _X.,19,GotoIf($["${vm_box}" != ""]?20:26)
exten => _X.,20,PlayBack(followme/sorry)
exten => _X.,21,GotoIf(${MAILBOX_EXISTS(${vm_box})}?24:22)
exten => _X.,22,PlayBack(vm-goodbye)
exten => _X.,23,Goto(26)
exten => _X.,24,Voicemail(${vm_box})
exten => _X.,25,PlayBack(vm-goodbye)
exten => h,1,AGI(console.php,endcall)
exten => _X.,26,Hangup()
;
[hunt_group]
;
[open_conference]
exten => _X.,1,GotoIf($["${call_record_path}" != ""]?2:4)
exten => _X.,2,Set(MEETME_RECORDINGFILE=${call_record_path})
exten => _X.,3,MixMonitor(${MEETME_RECORDINGFILE}.wav)
exten => _X.,4,Wait(1)
exten => _X.,5,Background(conf-full)
exten => _X.,6,MeetMe(,${conf_params})
;
[close_conference]
exten => _X.,1,GotoIf($["${call_record_path}" != ""]?2:4)
exten => _X.,2,Set(MEETME_RECORDINGFILE=${call_record_path})
exten => _X.,3,MixMonitor(${MEETME_RECORDINGFILE}.wav)
exten => _X.,4,Wait(1)
exten => _X.,5,Authenticate(${pinCode})
exten => _X.,6,MeetMe(,${conf_params})
;
[queue_test]
exten => _X.,1,Playback(some_announce)
exten => _X.,2,Queue(queue_test,tT,,,300)
exten => _X.,3,Playback(some_announce_after_leaving_queue)
;
[voicemail_not_in_time]
exten => _X.,1,PlayBack(followme/sorry)
exten => _X.,2,GotoIf(${MAILBOX_EXISTS(${vm_box})}?5:3)
exten => _X.,3,PlayBack(vm-goodbye)
exten => _X.,4,Goto(7)
exten => _X.,5,Voicemail(${vm_box})
exten => _X.,6,PlayBack(vm-goodbye)
exten => _X.,7,Hangup()
;
[default_q]
exten => _X.,1,Wait(1)
exten => _X.,2,Dial(SIP/out_test_to_reseller/380955567141,,S(1000))
exten => h,1,Hangup()
;
[callback]
exten => _.,1,Wait(1)
exten => _.,2,Set(CONNECT_TIME=${STRFTIME(${EPOCH},,%d-%m-%Y %H:%M:%S)})
exten => _.,3,AGI(console.php,callbackdial)
exten => _.,4,Dial(SIP/${outContext}/${phoneCall},,S(${tout}))
exten => _.,5,GotoIf($["${DIALSTATUS}" != "ANSWER"]?6:7)
exten => _.,6,GotoIf($["${DIALSTATUS}" != "BUSY" && "${DIALSTATUS}" != "FAILED" ]?3)
exten => _.,7,NoOp(${DIALSTATUS})
exten => h,1,AGI(console.php,endcall)
exten => h,2,Hangup()
;
[card_out]
exten => _.,1,Wait(1)
exten => _.,2,AGI(console.php,cardcallbackdial)
exten => _.,3,Dial(SIP/${outContext}/${phoneCall},,S(${tout}))
exten => _.,4,GotoIf($["${DIALSTATUS}" != "ANSWER"]?5:6)
exten => _.,5,GotoIf($["${DIALSTATUS}" != "BUSY"]?2)
exten => _.,6,NoOp(${DIALSTATUS})
exten => h,1,AGI(console.php,endcall)
exten => h,2,Hangup()
;
[macro-mp3]
exten => s,1,Wait(0.2)
exten => s,2,MP3Player(${ARG1})
;
[macro-tts]
exten => s,1,Wait(0.2)
exten => s,2,AGI(${ARG1},${ARG2},${ARG3});
;
[fax]
;exten => _.,1,Wait(1)
exten => _X.,1,Answer()
exten => _X.,2,AGI(console.php,savefax)
exten => _X.,3,ReceiveFAX(${FAXFILE})
;exten => h,1,AGI(console.php,endfax)
exten => h,1,Hangup()
;
[send-fax]
;exten => _X.,1,Answer()
;exten => _X.,2,Wait(3)
exten => _X.,1,NoOP('Sending FAX, File: ${FILENAME}')
exten => _X.,3,Set(FAXOPT(headerinfo)=FAX OUTGOING)
exten => _X.,4,Set(FAXOPT(localstationid)=LOCAL)
exten => _X.,5,SendFAX(${FILENAME})
;
exten => failed,1,Set(FAXSTATUS=DIALFAIL)
exten => failed,n,Set(FAXERROR=No Answer)
exten => failed,n,Set(FAXPAGES=0)
exten => failed,n,Hangup
;
exten => h,1,NoOp(�Fax Status: ${FAXSTATUS}�)
exten => h,n,NoOp(�Fax Error : ${FAXERROR}�)
exten => h,n,NoOp(�Fax Pages : ${FAXPAGES}�)
;exten => _X.,6,Hangup()
;
[voice_message_not_in_time]
exten => _X.,1,Wait(1)
exten => _X.,2,Set(VOLUME(TX,p)=9)
exten => _X.,3,Set(VOLUME(RX,p)=9)
exten => _X.,4,Progress()
exten => _X.,5,GotoIf($["${mp3FilePath}" != ""]?6:7)
exten => _X.,6,MP3Player(${mp3FilePath})
exten => _X.,7,GotoIf($["${gtText}" != ""]?8)
exten => _X.,8,AGI(googletts.agi,"${gtText}",${gtTextLang})
exten => h,1,Hangup()


edit file manager.conf

you need to enable Asterisk Manager Interface (AMI) and

[general]
enabled = yes
;webenabled = yes
port = 5038
bindaddr =  127.0.0.1

also we need to set a password ( secret ) in order to operate with AMI

[asteriskadmin]
secret = d00x@4dm1n
deny = 0.0.0.0/0.0.0.0
permit = 127.0.0.1/255.255.255.255
read = system,call,log,verbose,command,agent,user,config
write = system,call,log,verbose,command,agent,user,config


edit res_config_mysql.conf comment out the [general] section and insert the one below replacing dbname , user and password according to your current settings

 [general]
 dbhost = 127.0.0.1
 dbname = yourdbname
 dbuser = username
 dbpass = password
 dbport = 3306
 dbsock = /tmp/mysql.sock
 ;dbcharset = latin1


edit file sip.conf

[general]
transport=udp,tcp
context = default
bindport = 5060
allowoverlap=yes
tcpbindaddr = 0.0.0.0 
bindaddr= 0.0.0.0
tcpenable = yes
videosupport=yes
srvlookup=yes
type=peer
realm=0.0.0.0
;disallow=all
;allow=all
;allow=slin
;allow=h261
;allow=h263
;allow=h263p
;allow=h264
;disallow=all                    ; First disallow all codecs
; allow some codecs for unauthenticated callers to hear hgc200 mainly
;allow=g729
;allow=g723
;allow=alaw
;allow=ulaw
disallow=all
allow=all
allowtransfer=yes
dtmfmode = rfc2833
nat=no
useragent=DooxSwitch
canreinvite=no
jbenable = yes
jbmaxsize = 200
jbresyncthreshold = 1000
jbimpl = fixed
jblog = no
insecure = port,invite
;insecure=very
qualifyfreq=30
alwaysauthreject=yes
allowguest=no
;accept_outofcall_message=yes
;outofcall_message_context=astsms
rtcachefriends=yes
;rtautoclear=yes
callcounter = yes
;ringinuse = yes
;limitonpeers=yes
rtptimeout=60
tpholdtimeout=300
;DID settings
#include "custom.conf"


if you want to add any custom settings , trunks or DID's add them to custom.conf

important:

  • grab the latest version of extensions.conf from your client area and place it in /etc/asterksk folder
  • install the GUI before starting asterisk , as you need to populate the DB before asterisk can load properly

Install DooxSwitch GUI

upload archive and extract all content to html root

/var/www/html/

create two directories ( if they are not present )

mkdir /var/www/html/protected/runtime
mkdir /var/www/html/assets

Change file permission

chmod 777 /var/www/html/protected/runtime
chmod 777 /var/www/html/assets
chmod 777 -R /var/www/html/protected/config/
chmod 777 /var/www/html/protected/modules/billing/config/settings.php
chmod 777 /var/www/html/protected/modules/sms/config/settings.php
chmod 777 -R /var/www/html/sounds/
chmod 777 -R /var/www/html/uploads/
chmod 777 /var/www/html/console.php


if not all directories are created


mkdir /var/www/html/protected/config/
mkdir /var/www/html/sounds/
mkdir /var/www/html/uploads/
  • now point your browser to your server ip and follow steps on screen
  • or follow the instructions in this manual

install crontab

crontab -e

press i and paste these crontab commands

*/1 * * * *             /usr/bin/php /var/www/html/cron.php runeveryminute > /var/cron_debug_log.log 2>&1
0 0 1 * *             /usr/bin/php /var/www/html/cron.php invoices > /var/cron_debug_log.log 2>&1
*/1 * * * *		/usr/bin/php /var/www/html/cron.php updatecash > /var/cron_debug_log.log 2>&1
*/1 * * * *             /usr/bin/php /var/www/html/cron.php runeverymorning > /var/cron_debug_log.log 2>&1
*/1 * * * *             /usr/bin/php /var/www/html/cron.php asterisk > /var/cron_debug_log.log 2>&1
*/5 * * * *             /usr/sbin/asterisk -rx "sip reload"


Start asterisk

asterisk -vvv -c

modify fail2ban setting

in order to receive notiffications of bans you need to change dest=you@yourmail.co.uk, and put your email and change sender=fail2ban@local.local identify your machine

[asterisk-iptables]
# if more than 4 attempts are made within 6 hours, ban for 24 hours
enabled  = true
filter   = asterisk
action   = iptables-allports[name=ASTERISK, protocol=all]
             sendmail[name=ASTERISK, dest=you@yourmail.co.uk, sender=fail2ban@local.local]
logpath  = /var/log/asterisk/messages
maxretry = 4
findtime = 21600
bantime = 86400


DooxSwitch Reseller API manual

DooxSwitch Mobile API manual

install text-to-speech google

G723/G729 Codec installation

Setting up https secure connection

Asterisk High availablity

GeoIP Iptables

MySQL Replication

Kamailio Loadbalancing

DNS SRV