How to install Asterisk, connect Zoiper and MicroSIP, and write Java code using JVoIP

How to install Asterisk, connect Zoiper and MicroSIP, and write Java code using JVoIP

Algorhythm

3 года назад

6,029 Просмотров

-----------------------------Installation-----------------------------
-install the required dependencies
sudo apt -y install bison
sudo apt -y install wget
sudo apt -y install openssl
sudo apt -y install libssl-dev
sudo apt -y install libasound2-dev
sudo apt -y install libc6-dev
sudo apt -y install libxml2-dev
sudo apt -y install libsqlite3-dev
sudo apt -y install libnewt-dev
sudo apt -y install libncurses5-dev
sudo apt -y install zlib1g-dev
sudo apt -y install gcc
sudo apt -y install g++
sudo apt -y install make
sudo apt -y install perl
sudo apt -y install uuid-dev
sudo apt -y install git
sudo apt -y install subversion
sudo apt -y install libjansson-dev
sudo apt -y install unixodbc-dev
sudo apt -y install unixodbc-bin
sudo apt -y install unixodbc
sudo apt -y install autoconf
sudo apt -y install libedit-dev
sudo apt -y install build-essential

-download asterisk to the desired location
cd /usr/src
sudo curl -O http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-16-current.tar.gz
sudo tar xvf asterisk-16-current.tar.gz
cd asterisk*/

-make sure all dependencies are resolved
sudo contrib/scripts/install_prereq install

-build and install asterisk
sudo ./configure

-build Asterisk
sudo make

-install Asterisk
sudo make install

-you can optionally install the documentation
sudo make progdocs

-install configs and samples
sudo make samples
sudo make config
sudo ldconfig

-restart the asterisk service
sudo systemctl restart asterisk

-if you want to start the service on bootup
sudo systemctl enable asterisk

-check if the service is running
systemctl status asterisk

-open http ports 5060 and 5061
sudo ufw allow proto tcp from any to any port 5060,5061

-to bring up asterisk CLI
sudo asterisk -rvv

-----------------------------Configuration-----------------------------
-configuring the sip.conf file. make a copy of the original file and edit the new one
cd /etc/asterisk
sudo mv sip.conf sip.conf.default
sudo nano sip.conf

-inside the file, write the following configs
[general]
context=dummy
allowguest=yes
disallow=all
allow=ulaw

-then in the same file, add the following sections for devices
[Tom]
type=friend
secret=tom1234
host=dynamic
qualify=yes
context=from-internal

[Jerry]
type=friend
secret=jerry1234
host=dynamic
qualify=yes
context=from-internal

[Bob]
type=friend
secret=bob1234
host=dynamic
qualify=yes
context=from-internal

-sign in to each softphone and the phones should register to the server.
-however you wont be able to make any calls at this point because there are no extensions defined at the moment

-configuring the extensions.conf file. make a copy of the original file and edit the new one
sudo mv extensions.conf extensions.conf.default
sudo nano extensions.conf

-paste the following in the file
[from-internal]
exten=(greater than symbol)5000,1,dial(SIP/Tom,10)
exten=(greater than symbol)5001,1,dial(SIP/Jerry,10)
exten=(greater than symbol)5002,1,dial(SIP/Bob,10)

#restart the server
sudo systemctl restart asterisk

#you should be able to call each other now from the softphones

-----------------------------Writing code-----------------------------
#lets write some code to interact with the server. go to sip.conf and add the following under general section
callevent=yes
notifyhold=yes
callcounter=yes

#add the user, which is our custom app to sip.conf
[App]
type=friend
secret=app1234
host=dynamic
qualify=yes
context=from-internal

#add the extension for the custom app to extensions.conf under the from-internal context
exten=(greater than symbol)5003,1,dial(SIP/App,10)

Тэги:

#Asterisk #Zoiper #MicroSIP #Java #JVoIP
Ссылки и html тэги не поддерживаются


Комментарии: