Voice Gateway Installtion & Info Doc - leebalaji1234/voiceprotocol GitHub Wiki

Asterisk Asterisk Latest Version: core show version Asterisk 11.11.0 Yum install mpg123 Yum install sox lame /usr/bin/sox /home/barumugam/output.wav -r 8000 -c 1 -s -2 /home/barumugam/output1.wav mpg123 -w /home/barumugam/output.wav /home/barumugam/77.End\ Credit.mp3 PHP 5.3.3 - > sudo yum install php php-cli php-gd php-mysql php-mbstring Yum install mysql mysql-server GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'ukast*$@!' Vi /etc/my.cnf -> under [mysqld] put line “bind-address = 0.0.0.0”

OS Name Latest Version:

cat /etc/*-release & cat /proc/cpuinfo & cat /proc/meminfo Centos 6.5 8gb ram 4 core cpu 60gb

Asterisk Installation Guide:

  1. Check server date date date –set=”” | date --set="2 OCT 2006 18:00:00" Before start setup make sure everything was up to date. Or else use command “yum upgrade && reboot” Check date on the server. It should be matches with the current date

  2. Disable SELINUX Config sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config && reboot Disable selinux config

  3. Asterisk Dependency yum install make wget openssl-devel ncurses-devel newt-devel libxml2-devel kernel-devel gcc gcc-c++ sqlite-devel e2fsprogs-devel keyutils-libs-devel krb5-devel libogg libselinux-devel libsepol-devel libxml2-devel libtiff-devel gmp php-pear php-pear-DB php-gd php-mysql php-pdo kernel-devel ncurses-devel audiofile-devel libogg-devel openssl-develmysql httpdmysql-develmysql-server zlib-devel perl-DateManip sendmail-cf sox make Linux os level dependencies for asterisk package support.

  4. Asterisk Download & Install: wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz tar –zxvf asterisk-11-current.tar.gz (OR) tar –zxf asterisk-11-current.tar.gz 64 Bit: ./configure --libdir=/usr/lib64 && make menuselect && make && make install 32 Bit: ./configure && make menuselect && make && make install make samples make config Configure & make & install & generate sample files and configurations.

  5. Asterisk Service: service asterisk status/start/stop/restart System Service action commands.

  6. Alternate Asterisk Installation: yum install dnsmasq rpm -Uvh http://packages.asterisk.org/centos/6/current/x86_64/RPMS/asterisknow-version-3.0.0-1_centos6.noarch.rpm yum update yum install asterisk asterisk-configs --enablerepo=asterisk-11 service asterisk start

  7. SIP Dialplan Strings: SIP/devicename SIP/username@domain (SIP uri) SIP/username[:password[:md5secret[:authname[:transport]]]]@host[:port] SIP/devicename/extension SIP/devicename/extension/IPorHost SIP/username@domain//IPorHost

  8. OPEN PORT & PERMISSION:

Check PORT Open : nmap -p iptables -A INPUT -p udp -m udp --dport 5060 -j ACCEPT service network restart check port listen : netstat -anp | grep 5060 udp 0 0 0.0.0.0:5060 0.0.0.0:* 22936/asterisk

SIP on UDP port 5060. Other SIP servers may need TCP port 5060 as well

chown –R : filename chmod 755

Asterisk SIP Configurations:

  1. SIP – Session initiation protocol

vi /etc/asterisk/extensions.conf Syntax: [] exten => <extension-no| extension-name>, , vi /etc/asterisk/sip.conf Syntax: [] = Before

Asterisk Folder: cd /var/lib/asterisk/agi-bin All asterisk gateway interface code must be there on the location

Asterisk Configuration Folder: cd /etc/asterisk

  • All configurations present in the folder like sip, dhadi …etc.
    

Asterisk Call Pick Start Folder: For outgoing call: /var/spool/asterisk/outgoing For Voice Mail: /var/spool/asterisk/voicemail

Spool directory is a common auto threading on the Linux. Whatever file put inside the directory that will process and delete.

Asterisk CLI Enter & Exit: User not in root case: asterisk –rvvvvvvvvv User in root case: asterisk –v Exit to Cli: exit or quit

  • Which is helpful to monitor asterisk logs and configurations and modules...Etc.
    

Asterisk Sip & Cli: Reference Link about all kind of cli commands: http://www.voip-info.org/wiki/view/Asterisk+CLI cd /etc/asterisk => sip.conf After modified anything on the sip.conf Enter into asterisk cli and reload module: sip reload After sip reload module reload dialplan it may be useful: dialplan reload Want to view peers on asterisk connects: sip show peers Shell execution asterisk cli commands: asterisk –rx “”

  • Our asterisk will work it like a sip trunk.
    

Asterisk Originate Call on Cli: originate <SIP/PHONE/DHADI>/<phonenumber@sipuser/sipuser/phonenumber> application playback Example: originate SIP/+14049425344@bandwidth application playback /home/barumugam/hike_trans-20140609162525-hike

NFS MOUNT COMMAND (COPY FILE ONE TO ONE SERVERS): Scenario In this how-to I use two systems running with CentOS 6.5, but it will work on all CentOS / RHEL / Scientific Linux 6.x distros. NFS Server IP Address: 192.168.1.250/24 NFS Client IP Address: 192.168.1.251/24

  1. Install NFS in Server system

yum install nfs* -y

 2. Start NFS service

service rpcbind start

chkconfig rpcbind on

service nfs start

chkconfig nfs on

  1. Install NFS in Client System

yum install nfs* -y

  1. Start NFS service

service rpcbind start

chkconfig rpcbind on

service nfs start

chkconfig nfs on

  1. Create shared directories in server Create a shared directory named ‘/var/unixmen_share’ in server and let the client users to read and write files in that directory.

mkdir /var/unixmen_share

chmod 755 /var/unixmen_share/

  1. Export shared directory on NFS Server Edit file /etc/exports,

vi /etc/exports

Add the entry as shown below. /var/unixmen_share/     192.168.1.0/24(rw,sync,no_root_squash,no_all_squash)  where, /var/unixmen_share  – shared directory 192.168.1.0/24           – IP address range of clients rw                               – Writable permission to shared folder sync                            – Synchronize shared directory no_root_squash          – Enable root privilege no_all_squash             – Enable user’s authority 7. Restart the NFS service.

service nfs restart

 8. Mount the share directory in client Create a mount point to mount the share directory ‘var/unixmen_local’ which we created in the earlier step 5.

mkdir /var/nfs_share

 Mount the share from server to client as shown below

mount -t nfs 192.168.1.250:/var/unixmen_share/ /var/nfs_share/

mount.nfs: Connection timed out Probably it will show a connection timed out error which means that the firewall is blocking NFS server. To allow NFS server to access from outbound, goto NFS server system and add the as shown below in the ‘etc/sysconfig/iptables’ file.

vi /etc/sysconfig/iptables

Append the following lines shown in red colour.

Firewall configuration written by system-config-firewall

Manual customization of this file is not recommended.

*filter -A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 32803 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 892 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 875 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 662 -j ACCEPT :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT Now restart the iptables service.

service iptables restart

Again mount the share in client system with command:

mount -t nfs 192.168.1.250:/var/unixmen_share/ /var/nfs_share/

Now the NFS share will mount without any connection timed out error. 9. Verify NFS Verify the share from the server is mounted or not using ‘mount’ command.

mount

Sample output: /dev/mapper/vg_client-lv_root on / type ext4 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")

/dev/sda1 on /boot type ext4 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

nfsd on /proc/fs/nfsd type nfsd (rw)

192.168.1.250:/var/unixmen_share/ on /var/nfs_share type nfs (rw,vers=4,addr=192.168.1.250,clientaddr=192.168.1.251) 10.  Automount the Shares To mount the shares automatically instead of mounting them manually at every reboot, add the following lines shown in red colour in the ‘/etc/fstab’ file of your client system.

vi /etc/fstab

/etc/fstab

Created by anaconda on Sun Mar 3 22[root@client unixmen]:10:15 2013

Accessible filesystems, by reference, are maintained under '/dev/disk'

See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

/dev/mapper/vg_client-lv_root / ext4 defaults 1 1 UUID=1aa7d041-056b-48f4-a773-f713759e981f /boot ext4 defaults 1 2 /dev/mapper/vg_client-lv_swap swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 192.168.1.250:/var/unixmen_share/ /var/nfs_share/ nfs rw,sync,hard,intr 0 0 Reboot the client system and check the share whether it is automatically mounted or not.

mount

Sample output: /dev/mapper/vg_client-lv_root on / type ext4 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")

/dev/sda1 on /boot type ext4 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

nfsd on /proc/fs/nfsd type nfsd (rw)

192.168.1.250:/var/unixmen_share/ on /var/nfs_share type nfs (rw,vers=4,addr=192.168.1.250,clientaddr=192.168.1.251) Thats it. Now NFS server is ready to use.

FOR API CREATION directory api_audio on the root api_csv on the root

audio_wav, tmp on the root

References: Firewall Configurations : http://www.voip-info.org/wiki/view/Asterisk+firewall+rules AGI : http://www.voip-info.org/wiki/view/Asterisk+AGI+php Verifying ports : https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/3/html/Security_Guide/s1-server-ports.html Mysql :https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-centos-6 Apache : http://www.rackspace.com/knowledge_center/article/centos-apache-and-php-install Custom ringtone : http://www.voip-info.org/wiki/view/Asterisk+cmd+MusicOnHold https://www.youtube.com/watch?v=iS1KWMa7bxA

Copy file from one server to another server : http://www.unixmen.com/nfs-server-installation-and-configuration-in-centos-6-3-rhel-6-3-and-scientific-linux-6-3/

Download Link : Download Doc

⚠️ **GitHub.com Fallback** ⚠️