How to configure PJSIP Endpoint and Dial Plan on Debian 12

To Configure PJSIP Endpoint And Dialplan On Debian 12

Introduction

A SIP endpoint is a simple configuration profile for a device such as a phone or a remote server. Asterisk Dialplan context, which handles calls originating from the endpoint, and the audio codecs allowed for the endpoint are defined here.

Procedure

Step 1: Check the OS version using following command

root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

Step 2: Go to the Following location by using following command

root@linuxhelp:-# cd /etc/asterisk

Step 3: Edit and Make endpoint configuration on pjsip.conf file by using following command

root@linuxhelp:/etc/asterisk# vim pjsip.conf
[167]
auth_type=userpass
type=auth
username=167
password=123456

[167]
type=aor
qualify_frequency=60
max_contacts=1
remove_existing=yes
qualify_timeout=3.0
authenticate_qualify=no


[167]
context=internal
auth=167
aors=167
type=endpoint
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
callerid="linuxhelp" <167>

[168]
auth_type=userpass
type=auth
username=168
password=123456

[168]
type=aor
qualify_frequency=60
max_contacts=1
remove_existing=yes
qualify_timeout=3.0
authenticate_qualify=no


[168]
context=internal
auth=168
aors=168
type=endpoint
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
callerid="linuxhelp2" <168>

[tcp_transport]
type=transport ; Must be of type 'transport'
protocol=tcp
bind=0.0.0.0
tos=cs3
cos=3
allow_reload=false
[udp_transport]
type=transport ; Must be of type 'transport'
protocol=udp
bind=0.0.0.0
tos=cs3
cos=3
allow_reload=false

Step 4: Edit and Make Dialplan Configuration on extensions.conf file by using following command

root@linuxhelp:/etc/asterisk# vim extensions.conf


[internal]
exten => 167,1,Dial(PJSIP/167)
exten => 168,2,Dial(PJSIP/168)

Step 5: Login to Asterisk Console by using following command

root@linuxhelp:~# sudo asterisk -rvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Asterisk 20.4.0, 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.4.0 currently running on linuxhelp (pid = 910)
linuxhelp*CLI>

Step 6: Reload the pjsip by using following 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)
[Aug 26 18:38:07] NOTICE[2811]: 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 7: Show the Endpoints details by using following 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                                              Unavailable   0 of inf
     InAuth:  167/167
        Aor:  167                                                1
  Transport:  tcp_transport             tcp      3     96  0.0.0.0:5060

 Endpoint:  168/168                                              Unavailable   0 of inf
     InAuth:  168/168
        Aor:  168                                                1
  Transport:  tcp_transport             tcp      3     96  0.0.0.0:5060


Objects found: 2

Step 8: Show the Authendicaton details by using following command

linuxhelp*CLI> pjsip show auths

  I/OAuth:  <AuthId/UserName.............................................................>
==========================================================================================

     Auth:  167/167
     Auth:  168/168

Objects found: 2

Step 9: Show the aor (Address Of Records) Details by using following command

linuxhelp*CLI> pjsip show aors

      Aor:  <Aor..............................................>  <MaxContact>
    Contact:  <Aor/ContactUri............................> <Hash....> <Status> <RTT(ms)..>
==========================================================================================

      Aor:  167                                                  1

      Aor:  168                                                  1


Objects found: 2

Step 10: Reload the dialplan by using following command

linuxhelp*CLI> dialplan reload
Dialplan reloaded.
  == Setting global variable 'CONSOLE' to 'Console/dsp'
  == Setting global variable 'IAXINFO' to 'guest'
  == Setting global variable 'TRUNK' to 'DAHDI/G2'
  == Setting global variable 'TRUNKMSD' to '1'
    -- Including switch 'DUNDi/e164' in context 'dundi-e164-switch'
    -- Including switch 'Lua/' in context 'local'
    -- Including switch 'Lua/' in context 'demo'
    -- Including switch 'Lua/' in context 'public'
    -- Including switch 'Lua/' in context 'default'
    -- Including switch 'DUNDi/e164' in context 'ael-dundi-e164-switch'
    -- Time to scan old dialplan and merge leftovers back into the new: 0.001601 sec
    -- Time to restore hints and swap in new dialplan: 0.000005 sec
    -- Time to delete the old dialplan: 0.000101 sec
    -- Total time merge_contexts_delete: 0.001707 sec
    -- pbx_config successfully loaded 51 contexts (enable debug for details).
[Aug 26 18:39:34] WARNING[2809]: pbx.c:8797 ast_context_verify_includes: Context 'local' tries to include nonexistent context 'iaxtel700'

Step 11: Open Zoiper Software by click continue as a free user as shown in below image

Step 12: Give the Username, Password and Click Login as shown in below image

Step 13: Fill in Server Hostname as shown in below image

Step 14: Zoiper5 Dashboard Will Open as shown in below image

Step 15: Open Microsip and configure endpoint details as shown in below image

Step 16: Make call from one extension to another extension as shown in below image

Conclusion

We have reached the end of this article. In this guide, we have walked you through the steps required to create pjsip endpoint and dialplan on Debian 12. Your feedback is much welcome.

FAQ
Q
How to reload the extensions.conf file?
A
By running the following command dialplan reload
Q
How to reload the pjsip.conf file?
A
By running the following command pjsip reload
Q
What is an Asterisk call?
A
Asterisk is a powerful tool for building call center systems and solutions.
Q
What is a SIP endpoint?
A
A SIP endpoint is a device that makes and receives calls through your gateway.
Q
What is Dialplan in Asterisk?
A
The Asterisk dialplan is responsible for routing calls, often called the heart of an Asterisk system.