Asterisk
This guide provides technical configurations for integrating Asterisk with didlogic using two different methods: Digest Authentication (Username/Password) and IP Authentication.
Select the section corresponding to your preferred module (chan_sip or chan_pjsip).
Digest Authentication (User/Pass)
Use this method if your Asterisk server does not have a static IP or if you prefer standard registration.
chan_sip Configuration
Edit /etc/asterisk/sip.conf:
[general]
register => 94986:YOUR_SIP_ACCOUNT_PASSWORD@sip.**.didlogic.net:5060/61354880986
; Register with didlogic SIP trunk
[didlogic_SIP_trunk] ; Name of the SIP trunk
type=friend ; Choose friend as it is used for both inbound and outbound calls
host=sip.**.didlogic.net ; Regional SIP gateway (choose one closest to your location)
defaultuser=94986 ; SIP trunk ID
fromuser=61354880986 ; Outbound Caller ID
remotesecret=YOUR_SIP_ACCOUNT_PASSWORD; SIP trunk password
context=from-siptrunk
insecure=port,invite
canreinvite=no
disallow=all
allow=ulaw
[11111]
type=friend
username=11111
secret=YOUR_SIP_ACCOUNT_PASSWORD
host=dynamic
context=from-internal
disallow=all
allow=ulaw
nat=force_rport,comedia
canreinvite=no
qualify=yes
[99999]
type=friend
username=99999
secret=YOUR_SIP_ACCOUNT_PASSWORD
host=dynamic
context=from-internal
disallow=all
allow=ulaw
nat=force_rport,comedia
canreinvite=no
qualify=yes
Find the full list of didlogic proxy servers here: Outbound Calling
To verify registration:
- Restart your Asterisk server using the following command:
sudo systemctl restart asterisk - Enter the following command to know if the SIP trunk has been registered properly:
asterisk -x "sip show registry"
chan_pjsip Configuration
Edit /etc/asterisk/pjsip.conf:
[transport-udp-main]
type=transport
protocol=udp
bind=0.0.0.0:5060
[auth_didlogic]
type=auth
auth_type=userpass
username=94986 ; SIP trunk ID
password=YOUR_SIP_ACCOUNT_PASSWORD
[DID_Logic_aor]
type=aor
contact=sip:94986@sip.**.didlogic.net:5060
[DID_Logic]
type=endpoint
context=from-siptrunk
disallow=all
allow=ulaw
direct_media=no
from_user=61354880986 ; Outbound Caller ID
from_domain=sip.**.didlogic.net ; regional SIP gateway
aors=DID_Logic_aor
outbound_auth=auth_didlogic
[DID_Logic_identify]
type=identify
endpoint=DID_Logic ; Match the didlogic regional SIP gateways using domain names
match=sip.nl.didlogic.net
match=sip.uk.didlogic.net
match=sip.se.didlogic.net
match=sip.de.didlogic.net
match=sip.za.didlogic.net
match=sip.ca.didlogic.net
match=sip.lax.didlogic.net
match=sip.nyc.didlogic.net
match=sip.hk.didlogic.net
match=sip.sg.didlogic.net
match=sip.au.didlogic.net
match=sip.br.didlogic.net
[reg_didlogic]
type=registration
transport=transport-udp-main
outbound_auth=auth_didlogic
server_uri=sip:sip.**.didlogic.net:5060
client_uri=sip:94986@sip.**.didlogic.net
expiration=120
retry_interval=20
max_retries=10
[11111]
type=endpoint
transport=transport-udp-main
context=from-internal
disallow=all
allow=ulaw
aors=11111
auth=11111
[11111]
type=auth
auth_type=userpass
username=11111
password=YOUR_SIP_ACCOUNT_PASSWORD
[11111]
type=aor
max_contacts=2
contact=sip:[email protected]:5060 ; 192.168.0.105 is internal IP address
To verify registration:
- Restart your Asterisk server using the following command:
sudo systemctl restart asterisk - Enter the following command to know if the SIP trunk has been registered properly:
asterisk -x "pjsip show registrations"
IP Authentication
Use this method for high-volume traffic. Note that when IP authentication is enabled for the SIP account:
- Registration is unnecessary.
- Authentication relies on trusted IP addresses.
- Replace the host with the didlogic SIP trunk IP.
- Clean up any password-related fields in the configuration.
Email [email protected] with your Asterisk server's static IP to enable this on your account.
chan_sip Configuration
Edit /etc/asterisk/sip.conf:
[general]
; No need for registration as we are using IP-based authentication
; Remove the 'register' line entirely.
disallow=all ; Disallow all codecs by default
allow=ulaw ; Allow ulaw codec (common for VoIP calls)
nat=force_rport,comedia ; NAT traversal settings
canreinvite=no ; Disable direct media reinvites
[DID_Logic]
type=friend ; Allows inbound and outbound calls
host=sip.**.didlogic.net ; Replace with the DIDLogic-provided IP
context=from-siptrunk ; Context for inbound calls
insecure=port,invite ; Trust port and INVITE for authentication
canreinvite=no ; Prevent direct media reinvite
disallow=all ; Disallow all codecs
allow=ulaw ; Allow ulaw codec
qualify=yes ; Monitor trunk availability
directmedia=no ; Avoid direct media
chan_pjsip Configuration
Edit /etc/asterisk/pjsip.conf:
[transport-udp-main]
type=transport
protocol=udp
bind=0.0.0.0:5060
; didlogic SIP Trunk using IP Authentication
[DID_Logic]
type=endpoint
context=from-siptrunk
disallow=all
allow=ulaw
direct_media=no
from_domain=sip.nl.didlogic.net
t38_udptl=no
aors=DID_Logic_aor ; Reference to the AOR below
auth=none ; No authentication required (IP-based)
[DID_Logic_aor]
type=aor
contact=sip:sip.nl.didlogic.net:5060
[DID_Logic_identify]
type=identify
endpoint=DID_Logic ; Match the didlogic regional SIP gateways using domain names match=sip.nl.didlogic.net
match=sip.uk.didlogic.net
match=sip.se.didlogic.net
match=sip.de.didlogic.net
match=sip.za.didlogic.net
match=sip.ca.didlogic.net
match=sip.lax.didlogic.net
match=sip.nyc.didlogic.net
match=sip.hk.didlogic.net
match=sip.sg.didlogic.net
match=sip.au.didlogic.net
match=sip.br.didlogic.net
; Internal Extension 11111
[11111]
type=endpoint
transport=transport-udp-main
context=from-internal
disallow=all
allow=ulaw
aors=11111
auth=11111
direct_media=no
[11111]
type=auth
auth_type=userpass
username=11111
password=87786118384AAss
[11111]
type=aor max_contacts=2
contact=sip:[email protected]:5060
; Internal Extension 99999
[99999]
type=endpoint
transport=transport-udp-main
context=from-internal
disallow=all
allow=ulaw
aors=99999
auth=99999
direct_media=no
[99999]
type=auth
auth_type=userpass
username=99999
password=87786118384AAss
[99999]
type=aor
max_contacts=2
contact=sip:[email protected]:5060
Dialplan & Routing
The dialplan is configured in /etc/asterisk/extensions.conf for both modules. Ensure all dialed numbers follow the E.164 format (e.g., 18004516258).
Outbound Calls
; Example for chan_sip
exten => _X.,1,NoOp(Outbound call through DID_Logic SIP trunk)
same => n,Set(CALLERID(num)=61354880986) ; Set your outbound Caller ID here
same => n,Dial(SIP/${EXTEN}@DID_Logic,60)
same => n,Hangup()
; Example for chan_pjsip
exten => _X.,1,Set(CALLERID(num)=61354880986) ; Set your outbound Caller ID here
same => n,Dial(PJSIP/${EXTEN}@DID_Logic,60,g)
same => n,Hangup()
Inbound Calls (didlogic side)
- Navigate to your numbers on the didlogic portal.
- Click Edit on the number you wish to set up.
- Choose SIP URI in the Forward to dropdown.
- Enter the destination in the following format:
+[YourPhoneNumber]@FQDN:port;transport=connection- Example:
[email protected]:5060;transport=udp
- Example:
- Click Add, and it should appear below. Ensure this destination is at the top of the list if you already have other destinations configured.
Inbound Calls (Asterisk side)
In the chan_sip module:
[general]
static=yes
writeprotect=no
clearglobalvars=no
[globals]
; Define any global variables if needed
[from-internal]
; Internal extensions for dialing within the system
exten => 1001,1,Dial(SIP/11111,20) ; Route call to SIP/11111, ring for 20 seconds
exten => 1002,1,Dial(SIP/99999,20) ; Route call to SIP/99999, ring for 20 seconds
[from-siptrunk]
; =============================
; Inbound Call Handling for DID Logic
; =============================
; Handle inbound calls for DID 61354880986 without the '+' prefix
exten => 61354880986,1,NoOp(Inbound call for DID 61354880986)
same => n,Dial(SIP/11111,60) ; Route call to extension 11111, ring for 60 seconds
same => n,Voicemail(1001@default,u) ; Send to voicemail 1001 (unavailable message) if unanswered
same => n,Hangup()
; Handle inbound calls for DID 61354880986 with the '+' prefix
exten => +61354880986,1,NoOp(Inbound call for DID +61354880986)
same => n,Dial(SIP/11111,60) ; Route call to extension 11111, ring for 60 seconds
same => n,Voicemail(1001@default,u) ; Send to voicemail 1001 (unavailable message) if unanswered
same => n,Hangup()
; =============================
; Catch-All for Unknown or Invalid Calls
; =============================
exten => _.,1,NoOp(Unknown inbound call received)
same => n,Hangup()
In the chan_pjsip module:
[general]
static=yes
writeprotect=no
clearglobalvars=no
[globals]
; Define any global variables here if needed
[from-internal]
; =============================
; Internal Extension Dialing
; =============================
exten => 1001,1,Dial(PJSIP/11111,20) ; Route to endpoint 11111, ring for 20 seconds
exten => 1002,1,Dial(PJSIP/99999,20) ; Route to endpoint 99999, ring for 20 seconds
[from-siptrunk]
; =============================
; Inbound Call Handling from DID Logic
; =============================
; Handle inbound calls for DID 61354880986 without the '+' prefix
exten => 61354880986,1,Dial(PJSIP/11111,60) ; Route to endpoint 11111, ring for 60 seconds
same => n,Voicemail(1001@default,u) ; Send to voicemail 1001 (unavailable message)
same => n,Hangup()
; Handle inbound calls for DID 61354880986 with the '+' prefix
exten => +61354880986,1,Dial(PJSIP/11111,60) ; Route to endpoint 11111, ring for 60 seconds
same => n,Voicemail(1001@default,u) ; Send to voicemail 1001 (unavailable message)
same => n,Hangup()
; =============================
; Catch-All for Unhandled Inbound Calls
; =============================
exten => _X.,1,NoOp(Unhandled inbound call to ${EXTEN}) ; Log unhandled calls
same => n,Hangup()
Firewall & Audio (RTP)
To prevent "one-way audio" issues, you must allow RTP traffic.
-
Configure Asterisk: Edit
/etc/asterisk/rtp.conf:[general]
rtpstart=10000
rtpend=20000Save the file and restart Asterisk with the following command:
sudo systemctl restart asterisk -
Update OS Firewall (Ubuntu/UFW):
sudo ufw allow 10000:20000/udp
sudo ufw reload
Troubleshooting Summary
| Issue | Cause | Solution |
|---|---|---|
| Registration Fail | Wrong Gateway | Double-check your regional gateway (e.g., sip.nyc.didlogic.net). |
| No Audio | NAT/Firewall | Ensure UDP ports 10000-20000 are open. |
| Max Call Rate Exceeded | Call rate for the call destination exceeds the max call rate set for your account. | Contact [email protected] to increase the max call rate |
| 402 Payment Req | Low Balance | Refill account balance in the portal. |
| Wrong Dialing Format | The dialed number may be in an incorrect format. | Ensure the dialing format follows the E.164 standard. For example, a call to a US number should be dialed as 18004516258, not 8004516258 or 08004516258. |