Jump to content

This is the support site for Andrews & Arnold Ltd, a UK Internet provider. Information on these pages is generally for our customers but may be useful to others, enjoy!

VoIP Phones - Asterisk: Difference between revisions

(DTMF PJSIP)
 
(6 intermediate revisions by 2 users not shown)
It isn't a good idea to have an installation that mixes sip.conf with pjsip.conf.
 
When reading the instructions below be aware which are for sip.conf and which are for pjsip.conf. PJSIP examples are below the SIP examples on this page.
 
=pjsip.conf (PJSIP)=
 
==PJSIP: Trunk registration==
Here is an example of a working pjsip.conf setup where Asterisk will register with A&A to receive calls.
 
In pjsip.conf:
[reg_442082881111]
type = registration
retry_interval = 20
fatal_retry_interval = 20
forbidden_retry_interval = 20
max_retries = 9999
auth_rejection_permanent = no
contact_user = maininbound
expiration = 120
outbound_auth = auth_reg_442082881111
client_uri = sip:+442082881111@voiceless.aa.net.uk
server_uri = sip:voiceless.aa.net.uk
[auth_reg_442082881111]
type = auth
password = BusinessPaidGrewCome
username = +442082881111
[aaisptrunk]
type = aor
contact = sip:+442082881111@voiceless.aa.net.uk
qualify_frequency=20
[aaisptrunk]
type = identify
endpoint = aaisptrunk
match = voiceless.aa.net.uk
[aaisptrunk]
type = endpoint
context = maininbound
dtmf_mode = rfc4733
disallow = all
allow = alaw
allow = ulaw
direct_media = no
rtp_symmetric = yes
aors = aaisptrunk
outbound_auth=auth_reg_442082881111
 
Calls come into the context "maininbound" in extensions.conf - in this example calls get sent onto extension 222 and 205 for 20 seconds and then go to voicemail.
[maininbound]
exten = maininbound,1,Dial(PJSIP/222&PJSIP/205,20)
exten = maininbound,n,Voicemail(222@default,us)
 
In extensions.conf you can dial out via the trunk with:
exten => _X.,1,Dial(PJSIP/${EXTEN}@aaisptrunk,,)
exten => s-BUSY,1,Playtones(busy)
exten => s-CONGESTION,1,Playtones(congestion)
exten => s-CHANUNAVAIL,1,Playtones(unobtainable)
exten => s-NOANSWER,1,Playtones(congestion)
 
==PJSIP: Trunk without registration==
Use the above example but do not include the top section for "[reg_442082881111]".
 
Then set the AAISP control panel to point to your server by hostname or IP address:<br />
[[File:Asterisk pjsip noregistration.png|border]]
 
==PJSIP: Keep-Alive / Anti-Idle==
If you are using a firewall or NAT router with short timeouts on UDP sessions you can force packets to be sent over the connection to keep it alive.
 
Set qualify_frequency in the aor section; This triggers an OPTIONS message every X (as set) seconds.
An example of the aor section follows:
[aaisptrunk]
type = aor
contact = sip:+442082881111@voiceless.aa.net.uk
qualify_frequency=20
 
==PJSIP: IPv6==
By default PJSIP does not listen on IPv6.<br />
At the top of pjsip.conf you will need to add another transport to go along with your IPv4 transport (usually a section with bind set to 0.0.0.0 or your IP address):
 
[transport-udp6]
type=transport
protocol=udp
bind=[::]
 
You may need to force the endpoint to use this transport (a small section of the endpoint section above but with the "transport = " line inserted):
[aaisptrunk]
type = endpoint
transport = transport-udp6
 
==Status and Commands==
A good command within the asterisk software is the show registration command:
asterisk*CLI> pjsip show registrations
<Registration/ServerURI..............................> <Auth..........> <Status.......>
==========================================================================================
reg_442082881111/sip:voiceless.aa.net.uk auth_reg_442082881111 Registered
Objects found: 1
In this example it shows that the Asterisk server is successfully registered with the Andrews & Arnold SIP server.
 
=sip.conf (SIP)=
exten => _X.,1,Dial(SIP/snom)
</syntaxhighlight>
 
=pjsip.conf (PJSIP)=
 
==PJSIP: Trunk registration==
Here is an example of a working pjsip.conf setup where Asterisk will register with A&A to receive calls.
 
In pjsip.conf:
[reg_442082881111]
type = registration
retry_interval = 20
fatal_retry_interval = 20
forbidden_retry_interval = 20
max_retries = 9999
auth_rejection_permanent = no
contact_user = maininbound
expiration = 120
outbound_auth = auth_reg_442082881111
client_uri = sip:+442082881111@voiceless.aa.net.uk
server_uri = sip:voiceless.aa.net.uk
[auth_reg_442082881111]
type = auth
password = BusinessPaidGrewCome
username = +442082881111
[aaisptrunk]
type = aor
contact = sip:+442082881111@voiceless.aa.net.uk
qualify_frequency=20
[aaisptrunk]
type = identify
endpoint = aaisptrunk
match = voiceless.aa.net.uk
[aaisptrunk]
type = endpoint
context = maininbound
dtmf_mode = rfc4733
disallow = all
allow = alaw
allow = ulaw
direct_media = no
aors = aaisptrunk
outbound_auth=auth_reg_442082881111
 
Calls come into the context "maininbound" in extensions.conf - in this example calls get sent onto extension 222 and 205 for 20 seconds and then go to voicemail.
[maininbound]
exten = maininbound,1,Dial(PJSIP/222&PJSIP/205,20)
exten = maininbound,n,Voicemail(222@default,us)
 
In extensions.conf you can dial out via the trunk with:
exten => _X.,1,Dial(PJSIP/${EXTEN}@aaisptrunk,,)
 
==PJSIP: Keep-Alive / Anti-Idle==
If you are using a firewall or NAT router with short timeouts on UDP sessions you can force packets to be sent over the connection to keep it alive.
 
Set qualify_frequency in the aor section; This triggers an OPTIONS message every X (as set) seconds.
An example of the aor section follows:
[aaisptrunk]
type = aor
contact = sip:+442082881111@voiceless.aa.net.uk
qualify_frequency=20
 
==Status and Commands==
A good command within the asterisk software is the show registration command:
asterisk*CLI> pjsip show registrations
<Registration/ServerURI..............................> <Auth..........> <Status.......>
==========================================================================================
reg_442082881111/sip:voiceless.aa.net.uk auth_reg_442082881111 Registered
Objects found: 1
In this example it shows that the Asterisk server is successfully registered with the Andrews & Arnold SIP server.
 
=Further Help=
Customers using Asterisk and AAISP have created a website and IRC channel especially for this!
*http://www.aa-asterisk.org.uk/ [ Dead link @ Dec 2020 ]
*irc://irc.aachat.net/a&a-asterisk
 
=Firewall & Security=
autoreview, editor
102

edits