• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to Create PJSIP Endpoints with Templates on Asterisk

  • 00:43 lsb_release -a
  • 00:58 systemctl status asterisk
  • 01:25 vim /etc/asterisk/pjsip.conf
  • 05:05 asterisk -rvvvvvvvvvvvvvvvvvvvv
  • 05:18 pjsip reload
  • 05:34 pjsip show endpoints
  • 06:40 vim /etc/asterisk/pjsip.conf
  • 08:09 asterisk -rvvvvvvvvvvvvvvvvvvvv
  • 08:23 pjsip reload
  • 08:33 pjsip show endpoints
7607

To Create PJSIP Endpoint With Templates On Asterisk

Introduction

PJSIP is a free and Open Source multimedia communication library based on C language that implements standard-based protocols such as SIP, SDP, RTP, STUN, TURN, and ICE. Configuration templates are means to avoid repetitive sections in Asterisk configuration files, such as extensions.conf, sip.conf, or iax.conf.

Procedure

Step 1: Check the OS version by using the below command

root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:    22.04
Codename:    jammy

Step 2: Check the status of the Asterisk by using the below command

root@linuxhelp:~# systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
     Loaded: loaded (/etc/init.d/asterisk; generated)
     Active: active (running) since Wed 2023-07-19 09:51:07 IST; 4h 25min ago
       Docs: man:systemd-sysv-generator(8)
      Tasks: 79 (limit: 4537)
     Memory: 80.1M
        CPU: 3min 5.635s
     CGroup: /system.slice/asterisk.service
             └─1443 /usr/sbin/asterisk
Jul 19 09:51:07 linuxhelp systemd[1]: Starting LSB: Asterisk PBX...
Jul 19 09:51:07 linuxhelp asterisk[1420]:  * Starting Asterisk PBX: asterisk
Jul 19 09:51:07 linuxhelp asterisk[1420]:    ...done.
Jul 19 09:51:07 linuxhelp systemd[1]: Started LSB: Asterisk PBX.
Jul 19 09:51:14 linuxhelp asterisk[1443]: radcli: rc_read_config: rc_read_config: can't open /etc/radiusclient-ng/r>
Jul 19 09:51:14 linuxhelp asterisk[1443]: radcli: rc_read_config: rc_read_config: can't open /etc/radiusclient-ng/r>

**Step 3: Edit the pjsip.conf file to add the templates for endpoints by using the below command **

root@linuxhelp:~# vim /etc/asterisk/pjsip.conf
Add the below lines
[customtemplate](!)
language=en
deny=0.0.0.0/0.0.0.0
trust_id_inbound=yes
send_rpid=no
transport=tcp_transport
rtcp_mux=no
call_group=
pickup_group=
disallow=all
allow=ulaw,alaw,gsm
mailboxes=300
permit=0.0.0.0/0.0.0.0
ice_support=no
use_avpf=no
dtls_cert_file=
dtls_private_key=
dtls_ca_file=
dtls_setup=actpass
dtls_verify=no
media_encryption=no
message_context=
subscribe_context=
allow_subscribe=yes
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
direct_media=no
media_use_received_transport=no

[167](customtemplate)
context=internal
auth=167
aors=167
type=endpoint
callerid="linuxhelp" <167>

[168](customtemplate)
context=internal
auth=168
aors=168
type=endpoint
callerid="linuxhelp2" <168>

Step 4: Login to the Asterisk CLI mode by using the below command

root@linuxhelp:~# asterisk -rvvvvvvvvvvvvvvvvvvvv
Asterisk 20.3.1, Copyright (C) 1999 - 2022, Sangoma Technologies Corporation and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 20.3.1 currently running on linuxhelp (pid = 1443)

Step 5: Reload the pjsip.conf file by running the below command

linuxhelp*CLI> pjsip reload
Module 'res_pjsip.so' reloaded successfully.
Module 'res_pjsip_authenticator_digest.so' reloaded successfully.
Module 'res_pjsip_endpoint_identifier_ip.so' reloaded successfully.
Module 'res_pjsip_mwi.so' reloaded successfully.
Module 'res_pjsip_notify.so' reloaded successfully.
Module 'res_pjsip_outbound_publish.so' reloaded successfully.
Module 'res_pjsip_publish_asterisk.so' reloaded successfully.
Module 'res_pjsip_outbound_registration.so' reloaded successfully.
    -- Reloading module 'res_pjsip.so' (Basic SIP resource)
[Jul 19 14:24:14] NOTICE[14072]: res_pjsip/config_transport.c:768 transport_apply: Transport 'tcp_transport' is not fully reloadable, not reloading: protocol, bind, TLS (everything but certificate and private key if filename is unchanged), TCP, ToS, or CoS options.
[Jul 19 14:24:14] NOTICE[14072]: res_pjsip/config_transport.c:768 transport_apply: Transport 'udp_transport' is not fully reloadable, not reloading: protocol, bind, TLS (everything but certificate and private key if filename is unchanged), TCP, ToS, or CoS options.
[Jul 19 14:24:14] NOTICE[14072]: sorcery.c:1348 sorcery_object_load: Type 'system' is not reloadable, maintaining previous values
    -- Reloading module 'res_pjsip_authenticator_digest.so' (PJSIP authentication resource)
    -- Reloading module 'res_pjsip_endpoint_identifier_ip.so' (PJSIP IP endpoint identifier)
    -- Reloading module 'res_pjsip_mwi.so' (PJSIP MWI resource)
    -- Reloading module 'res_pjsip_notify.so' (CLI/AMI PJSIP NOTIFY Support)
    -- Reloading module 'res_pjsip_outbound_publish.so' (PJSIP Outbound Publish Support)
    -- Reloading module 'res_pjsip_publish_asterisk.so' (PJSIP Asterisk Event PUBLISH Support)
    -- Reloading module 'res_pjsip_outbound_registration.so' (PJSIP Outbound Registration Support)

Step 6: Show the endpoints by using the below command

linuxhelp*CLI> pjsip show endpoints
 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <criteria.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time.....>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
==========================================================================================

 Endpoint:  167/167                                              Not in use    0 of inf
     InAuth:  167/167
        Aor:  167                                                1
      Contact:  167/sip:167@192.168.6.101:63382;transport= 3c2cd8e775 Avail         5.455
  Transport:  tcp_transport             tcp      3     96  0.0.0.0:5060

 Endpoint:  168/168                                              Not in use    0 of inf
     InAuth:  168/168
        Aor:  168                                                1
      Contact:  168/sip:168@192.168.6.101:5060;ob          a377386ab4 Avail         1.783
  Transport:  tcp_transport             tcp      3     96  0.0.0.0:5060


Objects found: 2

SNAP 1

Result : 
    -- Executing [168@internal:1] Dial("PJSIP/167-00000016", "PJSIP/168") in new stack
    -- Called PJSIP/168
    -- PJSIP/168-00000017 is ringing
  == Everyone is busy/congested at this time (1:1/0/0)
    -- Auto fallthrough, channel 'PJSIP/167-00000016' status is 'BUSY'

Step 7: Now create 2 templates by editing the pjsip.conf file

root@linuxhelp:~# vim /etc/asterisk/pjsip.conf
Add the following lines 
[customtemplate](!)
language=en
deny=0.0.0.0/0.0.0.0
trust_id_inbound=yes
send_rpid=no
transport=tcp_transport
rtcp_mux=no
call_group=
pickup_group=
disallow=all
[customtemplate2](!)
allow=ulaw,alaw,gsm
mailboxes=300
permit=0.0.0.0/0.0.0.0
ice_support=no
use_avpf=no
dtls_cert_file=
dtls_private_key=
dtls_ca_file=
dtls_setup=actpass
dtls_verify=no
media_encryption=no
message_context=
subscribe_context=
allow_subscribe=yes
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
direct_media=no
media_use_received_transport=no

[167](customtemplate,customtemplate2)
context=internal
auth=167
aors=167
type=endpoint
callerid="linuxhelp" <167>

[168](customtemplate,cusomtemplate2)
context=internal
auth=168
aors=168
type=endpoint
callerid="linuxhelp2" <168>

Step 8: Login to the Asterisk CLI mode by using the below command

root@linuxhelp:~# asterisk -rvvvvvvvvvvvvvvvvvvvv
Asterisk 20.3.1, Copyright (C) 1999 - 2022, Sangoma Technologies Corporation and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 20.3.1 currently running on linuxhelp (pid = 1443)

Step 9: Reload the pjsip.conf file by running the below command

linuxhelp*CLI> pjsip reload
Module 'res_pjsip.so' reloaded successfully.
Module 'res_pjsip_authenticator_digest.so' reloaded successfully.
Module 'res_pjsip_endpoint_identifier_ip.so' reloaded successfully.
Module 'res_pjsip_mwi.so' reloaded successfully.
Module 'res_pjsip_notify.so' reloaded successfully.
Module 'res_pjsip_outbound_publish.so' reloaded successfully.
Module 'res_pjsip_publish_asterisk.so' reloaded successfully.
Module 'res_pjsip_outbound_registration.so' reloaded successfully.
    -- Reloading module 'res_pjsip.so' (Basic SIP resource)
[Jul 19 14:24:14] NOTICE[14072]: res_pjsip/config_transport.c:768 transport_apply: Transport 'tcp_transport' is not fully reloadable, not reloading: protocol, bind, TLS (everything but certificate and private key if filename is unchanged), TCP, ToS, or CoS options.
[Jul 19 14:24:14] NOTICE[14072]: res_pjsip/config_transport.c:768 transport_apply: Transport 'udp_transport' is not fully reloadable, not reloading: protocol, bind, TLS (everything but certificate and private key if filename is unchanged), TCP, ToS, or CoS options.
[Jul 19 14:24:14] NOTICE[14072]: sorcery.c:1348 sorcery_object_load: Type 'system' is not reloadable, maintaining previous values
    -- Reloading module 'res_pjsip_authenticator_digest.so' (PJSIP authentication resource)
    -- Reloading module 'res_pjsip_endpoint_identifier_ip.so' (PJSIP IP endpoint identifier)
    -- Reloading module 'res_pjsip_mwi.so' (PJSIP MWI resource)
    -- Reloading module 'res_pjsip_notify.so' (CLI/AMI PJSIP NOTIFY Support)
    -- Reloading module 'res_pjsip_outbound_publish.so' (PJSIP Outbound Publish Support)
    -- Reloading module 'res_pjsip_publish_asterisk.so' (PJSIP Asterisk Event PUBLISH Support)
    -- Reloading module 'res_pjsip_outbound_registration.so' (PJSIP Outbound Registration Support)

Step 10: Show endpoints by running the below command

linuxhelp*CLI> pjsip show endpoints
 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <criteria.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time.....>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
==========================================================================================

 Endpoint:  167/167                                              Not in use    0 of inf
     InAuth:  167/167
        Aor:  167                                                1
      Contact:  167/sip:167@192.168.6.101:63382;transport= 3c2cd8e775 Avail         9.071
  Transport:  tcp_transport             tcp      3     96  0.0.0.0:5060

 Endpoint:  168/168                                              Not in use    0 of inf
     InAuth:  168/168
        Aor:  168                                                1
      Contact:  168/sip:168@192.168.6.101:5060;ob          a377386ab4 Avail         1.486
  Transport:  tcp_transport             tcp      3     96  0.0.0.0:5060


Objects found: 2

SNAP 2

Conclusion

By this how to Create PJSIP Endpoints with Templates on Asterisk has come to an end.

Tags:
elijah
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What is Pjsip in Asterisk?

A

pjsip. conf is a flat text file composed of sections like most configuration files used with Asterisk.

Q

What is the default port used by PJSIP?

A

Default UDP port 5160

Q

How to reload pjsip.conf ?

A

By running the following command pjsip reload

Q

What is AOR in Pjsip?

A

Address of Record (AOR): According to the official Asterisk documentation, an AOR tells Asterisk "where an endpoint can be contacted."

Q

What is Auth in pjsip?

A

Address of Record (AOR): According to the official Asterisk documentation, an AOR tells Asterisk "where an endpoint can be contacted."

Related Tutorials in How to Create PJSIP Endpoints with Templates on Asterisk

Related Tutorials in How to Create PJSIP Endpoints with Templates on Asterisk

How to install Meld tool in Ubuntu
How to install Meld tool in Ubuntu
Feb 25, 2017
How to install Dconf-Editor on Ubuntu 18.04
How to install Dconf-Editor on Ubuntu 18.04
Jul 14, 2018
How to install and update OpenSSL on Ubuntu 16.04
How to install and update OpenSSL on Ubuntu 16.04
Mar 9, 2017
How to install GLib 2.0 on Ubuntu 17.04
How to install GLib 2.0 on Ubuntu 17.04
May 22, 2017
How to Install Android Emulator on Ubuntu 20.4.1
How to Install Android Emulator on Ubuntu 20.4.1
Jul 13, 2021
How To Install AnyDesk on Ubuntu 16.04
How To Install AnyDesk on Ubuntu 16.04
Apr 4, 2018
How to install Genymotion 2.12.1 on Ubuntu 18.04
How to install Genymotion 2.12.1 on Ubuntu 18.04
Jul 9, 2018
How to install Timeshift 18.4 on Ubuntu 18.04
How to install Timeshift 18.4 on Ubuntu 18.04
Jul 6, 2018

Related Forums in How to Create PJSIP Endpoints with Templates on Asterisk

Related Forums in How to Create PJSIP Endpoints with Templates on Asterisk

Ubuntu
matthew class=
Failed to enable unit: Refusing to operate on linked unit file sshd.service
Apr 15, 2019
Ubuntu
mason class=
Passwd: You may not view or modify password information for root On Ubuntu 19.04
May 27, 2019
Ubuntu
isaac class=
/etc/apt/sources.list Permission denied
May 18, 2017
Ubuntu
yousuf class=
lsb_release command not working : Debian
Jan 18, 2018
ifconfig command
jackbrookes class=
what is the location of the ifconfig program on your machine?
Jan 4, 2018
Ubuntu
mason class=
"E: Package 'php-mcrypt' has no installation candidate" error on Ubuntu 20.4.1
Mar 15, 2021
NFS
luke class=
clnt_create: RPC: Program not registered
Apr 25, 2017
Apache
isaac class=
How to disable apache welcome page on Ubuntu
Dec 15, 2018

Related News in How to Create PJSIP Endpoints with Templates on Asterisk

Related News in How to Create PJSIP Endpoints with Templates on Asterisk

How To Install Mixxx on Ubuntu 16.04
How To Install Mixxx on Ubuntu 16.04
Oct 11, 2017
Ubuntu 17.04 released with greater expectations
Ubuntu 17.04 released with greater expectations
Apr 15, 2017
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Mar 1, 2017
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Sep 2, 2017
Ubuntu Unity is no more: One Linux dream has been axed
Ubuntu Unity is no more: One Linux dream has been axed
Apr 7, 2017
What’s next for Ubuntu Linux Desktop?
What’s next for Ubuntu Linux Desktop?
Apr 11, 2017
Say Hi to Ubuntu's new mascot
Say Hi to Ubuntu's new mascot
Mar 22, 2019
KDE Connect App was removed from Google Play Store and brought back in 24 hours
KDE Connect App was removed from Google Play Store and brought back in 24 hours
Mar 22, 2019
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Elijah ?
Remote Desktop Connection Has Stopped Working

When accessing my remote machine server using remote desktop on a windows machine I am getting this error

forum (1)

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.