Activating PJSIP

From MiRTA PBX documentation
Revision as of 06:26, 27 June 2020 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

PJSIP is the new SIP stack for asterisk and even it seems not yet "stable" with changes on every new release, it is the only viable choice if you want to use a recent asterisk version. To use it with MiRTA PBX you need to install the latest asterisk version, but before compiling the new version, some activity needs to be performed.

Start by adding the required library

yum -y install pjproject-devel opus-devel gsm-devel xmlstarlet

create a new /etc/asterisk/pjsip.conf file and enter the following info:

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5080
;local_net=
;external_media_address=
;external_signaling_address=

[transport-tls]
type=transport
protocol=tls
bind=0.0.0.0:5081
;local_net=
;external_media_address=
;external_signaling_address=
cert_file=
priv_key_file=
method=tlsv1

[transport-tcp]
type=transport
protocol=tcp
bind=0.0.0.0:5082
;local_net=
;external_media_address=
;external_signaling_address=

[transport-wss]
type=transport
protocol=wss
bind=0.0.0.0

edit extconfig.conf and add the pjsip table connections:

ps_endpoints => odbc,asterisk1,ps_endpoints,1
ps_endpoints => odbc,asterisk2,ps_endpoints,2
ps_auths => odbc,asterisk1,ps_auths,1
ps_auths => odbc,asterisk2,ps_auths,2
ps_aors => odbc,asterisk1,ps_aors,1
ps_aors => odbc,asterisk2,ps_aors,2
ps_domain_aliases => odbc,asterisk1,ps_domain_aliases,1
ps_domain_aliases => odbc,asterisk2,ps_domain_aliases,2
ps_endpoint_id_ips => odbc,asterisk1,ps_endpoint_id_ips,1
ps_endpoint_id_ips => odbc,asterisk2,ps_endpoint_id_ips,2
ps_contacts => odbc,asterisk1,ps_contacts_****,1
ps_contacts => odbc,asterisk2,ps_contacts_****,2

Where **** is your hostname, like for sipregs

Edit sorcery.conf, comment all and add:

[res_pjsip]
endpoint=realtime,ps_endpoints
auth=realtime,ps_auths
aor=realtime,ps_aors
domain_alias=realtime,ps_domain_aliases
contact=realtime,ps_contacts

[res_pjsip_endpoint_identifier_ip]
identify=realtime,ps_endpoint_id_ips

[res_pjsip_publish_asterisk]
asterisk-publication=realtime,ps_asterisk_publications

[res_pjsip_outbound_publish]
outbound-publish=realtime,ps_outbound_publishes

[res_pjsip_pubsub]
inbound-publication=realtime,ps_inbound_publications