Skip to main content

How to Enable and configure the pjsip in vicidial

In this article i have provided the steps to enable and configure the PJSIP in Vicidial. Vicidial have enabled the option to support the PJSIP protocol for both Carriers/Trunk and Phones (extensions) starting from Asterisk 16.

  Description: Asterisk - PJSIP

PJSIP is a free and open source multimedia communication library written in C language implementing standard based protocols such as SIP, SDP, RTP, STUN, TURN, and ICE.PJSIP is both compact and feature rich. It supports audio, video, presence, and instant messaging
Beginning with Asterisk 13.8.0, a stable version of pjproject is included in Asterisk's ./third-party directory and is enabled with the --with-pjproject-bundled option to ./configure. Beginning with Asterisk 15.0.0, it is enabled by default but can be disabled with the --without-pjproject-bundled option to ./configure

  Steps to Activate PJSIP in Vicidial

  Pre-Requisites 

Asterisk 16 downloaded from http://download.vicidial.com/ , Check either beta-apps folder or required-apps folder for asterisk 16 software


If you using Vicibox 10 with asteirsk 16 is good to go, or if asterisk 13 is installed then install asterisk by running the command the command vicibox-ast16 to install the asterisk 16 version.


For scratch instal Remove the asterisk 13 and install asterisk 16 with PJSIP support


that is ./configure --with-pjproject-bundled

  Step 1 : Changing the SIP Bindport

By default chan_sip module will be installed in asterisk which is binded to port 5060, for PJSIP to work properly we need to shift the bind port 5060 to PJSIP and use 5061 for chan_sip.

edit the file sip.conf by using the vi editor

vi /etc/asterisk/sip.conf

change
bindport=5060
to
bindport=5061

save the file (:wq!)

  Step 2: Disable the websocket

Edit the sip.conf file and disable the websocket by setting the value to false as shown below

websocket_enabled=false
note: if websocket_endabled options is not there add it and set to false and save the file.

  Step 3: PJSIP bind port to 5060

Edit the pjsip.conf file using vi or nano editor and set the bind option as show below

change
[transport-udp]
type=transport
protocol=udp    ;udp,tcp,tls,ws,wss
bind = 0.0.0.0:5060


save the config and reboot the vicidial once to take effect the changes.

  Step 4: Enabling PJSIP in vicidial

In vicidial you can use PJSIP or SIP or BOTH PJSIP and SIP to work together.

Login to your vicidial admin portal (http://Serverip/vicidial/admin.php) with admin credentials which should have full admin permissions. 

 Navigate to Admin > System Settings

Change the "Allowed SIP Stacks"
By default SIP is enabled, change it to PJSIP if you want to use only PJSIP,
if you want to use both PJSIP and SIP stacks then select SIP_and_PJSIP
note:
if you select SIP_and_PJSIP ,you need to manually select the options while creating phones and carriers.

  Creating PJSIP Phones in Vicidial

    In vicidial the PJSIP phones are created using the asterisk PJSIP Wizard ,all you need is to create a phones in normal way you create SIP phones and select PJSIP under Client Protocol, the vicidial will run the PJSIP wizard on background and create PJSIP phones for you.
For more details on PJSIP wizard check the below link
https://wiki.asterisk.org/wiki/display/AST/PJSIP+Configuration+Wizard

  Creating PJSIP carrier/trunk in Vicidial

    In vicidial you need to manually create the PJSIP configuration for PJSIP carriers as show below.

Below is the sample PJSIP carrier settings.

For example the carrier name is pjsiptrunk
Under Vicidial admin portal Navigate to 
Admin > Carriers
Create a new carrier , under account entry add the below sample PJSIP settings

Example for IP based authentication trunk with trunk ip 10.10.10.17

note: replace 10.10.10.17 with your trunk IP


[pjsiptrunk] type = aor contact = sip:10.10.10.17 qualify_frequency = 15 maximum_expiration = 3600 minimum_expiration = 60 default_expiration = 120 [pjsiptrunk] type = identify endpoint = pjsiptrunk match = 10.10.10.17 [pjsiptrunk] type = endpoint context = trunkinbound dtmf_mode = none disallow = all allow = ulaw rtp_symmetric = yes rewrite_contact = yes rtp_timeout = 60 use_ptime = yes moh_suggest = default direct_media = no trust_id_inbound = yes send_rpid = yes inband_progress = no tos_audio = ef language = en aors = pjsiptrunk
Example for PJSIP trunk with username and password authenticated
note: replace username and secret with your pjsip trunk credentials
[pjsiptrunk]
type=registration
retry_interval=20
max_retries=10
contact_user=username
expiration=600
transport=0.0.0.0-udp
outbound_auth=pjsiptrunk
client_uri=sip:username@10.10.10.17:5060
server_uri=sip:10.10.10.17:5060

[pjsiptrunk]
type=auth
auth_type=userpass
password=secret
username=username

[pjsiptrunk]
type=aor
qualify_frequency=60
contact=sip:username@10.10.10.17:5060
default_expiration=600

[pjsiptrunk]
type=identify
endpoint=pjsiptrunk
match=10.10.10.17

[pjsiptrunk]
type=endpoint
transport=0.0.0.0-udp
context=trunkinbound
dtmf_mode=rfc4733
disallow=all
allow=alaw
allow=ulaw
allow=g729
direct_media=no
rtp_symmetric=yes
trust_id_inbound=yes
send_rpid=yes
;from_domain=10.10.10.17
inband_progress=yes
rewrite_contact=yes
;force_rport=yes
aors=pjsiptrunk

  Vicidial PJSIP Dialplan

       In Asterisk the Channel variable name for the PJSIP protocol is PJSIP, below is the sample dialplan to dialout via PJSIP trunk , for example our carrier nam context set in pjsip.conf is pjsiptrunk .

exten => _9X.,1,AGI(agi://127.0.0.1:4577/call_log) exten => _9X.,n,Dial(PJSIP/${EXTEN:1}@PJSIPCARRIER,30,Tto) exten => _9X.,n,Hangup()

  Supplementary

Below are referral links used for this article.
vicidial.org/docs/PJSIP_SUPPORT.txt
wiki.asterisk.org/wiki/display/AST/PJSIP+Configuration+Wizard

Comments

Popular posts from this blog

Vicidial Scratch installation Alma -9

Step 1 – Download the dependencies   hostnamectl set-hostname xxxxxx.xxxxx.xxx ### Use YOUR SubDomain vi /etc/hosts ##Change domain name for actual server ip (xxx.xxx.xxx.xxx   complete domain name    subdomain only) timedatectl set-timezone Asia/Kolkata yum check-update yum update -y yum -y install epel-release yum update -y yum install git -y yum install -y kernel* sudo dnf install kernel-devel-$(uname -r) -y #Disable SELINUX sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config     reboot Step 2 – Run the Script cd /usr/src/ git clone https://github.com/manish23k/vicidial-install-scripts cd vicidial-install-scripts chmod +x alma-rocky9-ast16.sh ./alma-rocky9-ast16.sh Or the Asterisk 18 version: chmod +x alma-rocky9-ast18.sh ./alma-rocky9-ast18.sh ####For PHP 8 use this script. chmod +x main-installer-php8.sh ./main-installer-php8.sh

Vicidial Scratch installation Debian 11 with Asterisk 16, WebRTC and Dynamic Portal

  Vicidial Scratch installation Debian 11  Asterisk 16, WebRTC and Dynamic Portal apt update apt upgrade apt-get install git nano wget cd /usr/src/ git clone https://github.com/manish23k/Vici_Install_Scripts_Deb_11.git cd Vici_Install_Scripts_Deb_11/ chmod +x *.sh Run ./vici_install_deb_ast16.sh Install WebRTC ./vicidial-install-webrtc.sh Once Done with Configuration Secure Server with Vici Dynamic Portal Run ./vici_dynportal.sh

How to delete old call logs and other logs in vicidial or goautodial.

Step 1 : SSH to the server using the Putty Step 2:   login to mysql by typing   mysql -p                    (if you dont know password try below command )               mysql -ucron -p1234 Step 3 : select the asterisk database by typing               use asterisk step 4: Run the below command to check total disk occupied by asterisk database                SELECT table_schema AS "asterisk", ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)" FROM information_schema.TABLES GROUP BY table_schema; Step 5 : Run the below command to check disk space consumed by each table in asterisk database SELECT table_name AS "Table", ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)" FROM information_schema.TABLES WHERE table_schema = "asterisk" ORDER BY (data_length + inde...