Asterisk

Asterisk

rafa


;sip.conf

;242454

;Newpass888

;sip.zadarma.com


[general]

srvlookup=yes


[242454]

host=sip.zadarma.com

insecure=invite,port

type=friend

fromdomain=sip.zadarma.com

disallow=all

allow=alaw&ulaw

dtmfmode=auto

secret=password

defaultuser=242454

trunkname=242454

fromuser=242454

callbackextension=242454

context=zadarma-in

qualify=400

directmedia=no


[101]                         ;?????????? ????? ?????? ?????????

secret=password

host=dynamic

type=friend

context=zadarma-out


;installing 

;wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz

sudo apt-get install build-essential wget libssl-dev libncurses5-dev libnewt-dev libxml2-dev linux-headers-$(uname -r) libsqlite3-dev uuid-dev?


astericsFoler/

./configure 

make menuconfig

make

make install 

/astericsFolder 

  make samples

; ls -la | wc -l


run with from etc/asterisk/

  asterisk -cvvv

; start server automatically when rebooting 


;from folder asteriscFolder(in my case asterisk-11.25.0/)

go to foler 

 contrib/

 => init.d/

ls 

;copy rc.debian.asterisk to /etc/init.d/asterisk 

cp rc.debian.asterisk /etc/init.d/asterisk 

=> cd 


;test it

~# /etc/init.d/asterisk start 

-> some error accured 

;have to configure start script to adapt it to ubuntu 

;configuring start script to adabt to ubuntu 


;go to 

-> vim /etc/init.d/asterisk

-> change DAEMON=blahblah to -> binry folder path of asterisk 

if donn't know where bin files just do:

 type asterisk

;it will output smth like bellow:

 -> asterisk is hashed (/usr/sbin/asterisk)

-> ad path after equal sign like:

  DAEMON=/usr/sbin/asterisk

;then change in that file 

ASTVVARRUNDIR = /var/run/asterisk - this subfolder created by make install 

;and the last change in this file 

;change 

 -> ASTETCDIR=/etc/asterisk


;test it 

/etc/init.d/asterisk start 

;it is started but it complains smth like below

;output below

-> privalge escalation protection disabled 

-> see https://wiki.asterisk.org/wiki/x/1lkje1k2j

the prob left 

now it is running like deamon . 

to see that asterisk is running

-> asterisk -r

; and see that cli is running

; type exit to exit


;NOW LETS CREATE asterisk user to make safe the server from attack . becouse we are now on root user(security problem)


; see

-> ps aux 

-> root ----------------------- - -- - - - - -/usr/sbin/asterisk 


;creating new user asterisk 

-> useradd -d /var/lib/asterisk asterisk

;asterisk - is name of new user in ubuntu. path above is used to make a home dir for new user asterisk 

; see asterisk user of users list of ubuntu 


;NEXT make user asterisk access ritght to file system. to do this do following

-> chown -R asterisk /var/spool/asterisk /var/lib/asterisk /var/run/asterisk


;now we have asterisk user and changed some files ounership

;THEN go asterisk-11.25/contrib/init.d#

; and copy from that folder 

cp etc_default_asterisk /etc/default/asterisk

;-> vim /erc/default/asterisk 

; uncomment AST_USER and AST_GROUP


;try start server asterisk 

-> /etc/init.d/asterisk start 


;see ps aux 

; you will see that asterisk run under asterisk user not root user 


;to start cli 

-> asterisk -r 


;Now let;s fix a problem when encounterd when starting servet about Previlege 

;go to and open the file below 

  vim /etc/asterisk/asterisk.conf

;find and uncommet:

-> live_dengerously=no 


;then stop the server /etc/nit.d/asterisk stop

;and run again . you will not see any problems 

/etc/init.d/asterisk start



; now start script in case of reboot 

-> uptade-rc.d asterisk defaults


; vim /etc/network/interfaces 

;add conf from your network 

  address 128.199.254.237 

  netmask 255.255.192.0

  gateway 128.199.192.1

  up ip addr add 10.15.0.7/16 dev eth0

  dns-nameservers 8.8.8.8 8.8.4.4

; ip addr 

;check ping www.google.de

if not ok then add dns addrs to /etc/resolv.conf use vim

-> 8.8.8.8 8.8.4.4 



;NEXT need dhtp server. install it 

apt-get install dhcpd


;adapt it vim /etc/defaults/udhcpd

;and chande DHCPD_ENABLED="yes"


; vim /etc/udhcp.conf change 

1- smth 

2 - dns sever ip 


; install ntp apt-get isntall ntp

;stop /etc/init.d/ntp stop 

;then 

-> ntpdate pool.ntp.org

;it sets local time once to ntp source 

;start ntp 

/etc/init.d/ntp start 

;now it will distribute local time to phones


 

  



 




  





 



DAEMON=/asterisk



  



cd contrib 





9abb580f4d­965641

ssh root@128.199.254.237


Report Page