All integration guides
Connect Asterisk to TelecomsXchange
In short: Create a PJSIP endpoint, aor and identify for sip01.telecomsxchange.com on UDP 5060 with no registration, matching 174.136.44.213 for inbound. Authorise your public IP on the TelecomsXchange account or add an outbound_auth with the VoIP login, and dial PJSIP/TECH_PREFIX + E.164 number.
Asterisk to a purchased route
- Your AsteriskPJSIP endpoint, identified by IP
- then, 80039#447700900123, TelecomsXchangesip01, UDP 5060
- Seller's routeThe route you purchased
On this page
This guide connects Asterisk's PJSIP channel driver to TelecomsXchange: outbound calls to a purchased route, and inbound calls on routes you sell or numbers you bought. For the full list of TelecomsXchange values, see Connect a SIP platform.
Warning
TelecomsXchange does not accept SIP REGISTER. Don't create a type=registration section for it. Asterisk is recognised by its source IP or by digest authentication on the INVITE.
Before you start#
- A SIP account with Asterisk's public IP, for example
203.0.113.10, or a VoIP login and password from Edit Account → Add SIP Digest Auth. - A purchased route and its tech prefix from My Interconnections, for example
80039#. - Asterisk 20 or 22 with
res_pjsiploaded, and a public IP (or a known NAT address). - To sell: a route with IP Address:Port set to your Asterisk, for example
203.0.113.10:5060, and the values in Interconnect Info.
How do I send calls to TelecomsXchange?#
- Add a UDP transport, if you don't already have one. Behind NAT, set the external addresses so the SDP carries your public IP:
; /etc/asterisk/pjsip.conf
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
; only behind NAT: your public IP and your private network
external_media_address=203.0.113.10
external_signaling_address=203.0.113.10
local_net=10.0.0.0/8- Add the TelecomsXchange trunk. There is no registration section:
; /etc/asterisk/pjsip.conf
[tcxc]
type=aor
contact=sip:sip01.telecomsxchange.com:5060
[tcxc]
type=endpoint
transport=transport-udp
aors=tcxc
context=from-tcxc ; inbound calls from TelecomsXchange land here
disallow=all
allow=g729,ulaw,alaw ; TCXC passes codecs through: offer what the route supports
direct_media=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
;outbound_auth=tcxc-auth ; uncomment for digest authentication (below)
[tcxc]
type=identify
endpoint=tcxc
match=174.136.44.213 ; TelecomsXchange platform IP (sip01 resolves to it)- Add the dial plan.
TECH_PREFIXis the route's prefix from My Interconnections; Asterisk dials it in front of the E.164 number:
; /etc/asterisk/extensions.conf
[globals]
TECH_PREFIX=80039#
[to-tcxc]
; 00 + international number
exten => _00X.,1,Dial(PJSIP/${TECH_PREFIX}${EXTEN:2}@tcxc,60)
same => n,Hangup()
; international number without 00, e.g. 447700900123
exten => _[1-9]X.,1,Dial(PJSIP/${TECH_PREFIX}${EXTEN}@tcxc,60)
same => n,Hangup()Include to-tcxc in the context your phones or customers dial from, then run core reload (or module reload res_pjsip.so and dialplan reload).
Digest variant. If you send from an IP that isn't on the account, use the account's VoIP login and password. Asterisk answers TelecomsXchange's 401 or 407 challenge with them:
; /etc/asterisk/pjsip.conf
[tcxc-auth]
type=auth
auth_type=userpass
username=VOIP_LOGIN ; Edit Account → VoIP Login
password=VOIP_PASSWORD ; Edit Account → VoIP PasswordThen uncomment outbound_auth=tcxc-auth on the tcxc endpoint.
Tip
To pick routes per destination, use one TECH_PREFIX variable per route, or dial a routing group prefix such as 444101# and let TelecomsXchange choose.
How do I receive calls from TelecomsXchange?#
Calls on routes you sell, and on numbers you bought, come from 174.136.44.213 over UDP, from source ports 5060 to 5072, with the number in E.164 format such as 14165551234.
- Allow
174.136.44.213on your firewall for UDP 5060, and open your RTP range (rtp.conf, by default 10000 to 20000). - The
identifysection above maps that IP to thetcxcendpoint, so calls enter thefrom-tcxccontext. Route them there:
; /etc/asterisk/extensions.conf
[from-tcxc]
; number you bought, delivered to sip:14165551234@203.0.113.10:5060
exten => 14165551234,1,Dial(PJSIP/reception,30)
same => n,Hangup()
; seller route: send everything on to your own carrier or gateway
exten => _X.,1,Dial(PJSIP/${EXTEN}@my-upstream,60)
same => n,Hangup()- If your route has an Outgoing Prefix or strips digits (Edit Route → Outgoing Number Translation Parameters), match the number in that format.
Warning
Keep from-tcxc separate from the context your phones use. Only calls matched by identify should reach it; unmatched INVITEs are challenged or rejected, unless you have defined an anonymous endpoint.
How do I receive calls on numbers I bought?#
Set the number's SIP Endpoint (Primary) in DID Settings to your Asterisk, for example sip:14165551234@203.0.113.10:5060. TelecomsXchange sends the INVITE from 174.136.44.213, which the identify section matches, so the call arrives in from-tcxc with ${EXTEN} set to the user part.
How do I test it?#
- In the Asterisk CLI, turn on SIP logging:
pjsip set logger on. Check the trunk withpjsip show endpoint tcxc. - Place a test call, for example
channel originate Local/447700900123@to-tcxc application Playback demo-congrats. - In the log, look for the INVITE to
80039#447700900123(or80039%23447700900123) and the reply. On the shell,sngrep port 5060shows the same flow as a ladder. - In the portal, watch the call in Live Calls and find its SIP code in Logs → CDR (Voice).
What if something goes wrong?#
| You see | What to do |
|---|---|
| 401 or 407 repeated, then the call fails | Asterisk isn't answering the challenge. Add the tcxc-auth section, set outbound_auth=tcxc-auth, and check the VoIP login and password on Edit Account. |
| 403 Forbidden | Asterisk's public IP isn't authorised and no credentials were sent. Compare the IP in pjsip set logger with the account's IP Address and Additional Allowed IPs; check the account isn't blocked or out of balance. |
| 404 Not Found | Missing or wrong tech prefix, or +/00 left in the number. Check TECH_PREFIX and the Request-URI in the log. |
| 408 Request Timeout | No reply from sip01. Check outbound UDP 5060 on your firewall and that sip01.telecomsxchange.com resolves on the server. |
| 503 Service Unavailable | The route is blocked or failed on the seller's side. Check My Interconnections; try another route or a routing group. |
| One-way or no audio | Set external_media_address and local_net on the transport, keep rtp_symmetric=yes, and open the RTP range on your firewall. |
| Inbound calls rejected with 401 or 403 | The identify doesn't match: check match=174.136.44.213 with pjsip show identifies, and the firewall. |
| Inbound call arrives but goes nowhere | No extension in from-tcxc matches the E.164 number; check the number format and any Outgoing Prefix on your route. |
References#
Common questions
Can Asterisk register to TelecomsXchange?
No. TelecomsXchange is peering only and does not accept REGISTER, so don't add a registration section. Asterisk is recognised by its source IP, or by answering the digest challenge with outbound_auth.
Which Asterisk versions does this cover?
The PJSIP configuration shown works on the current long-term-support releases, Asterisk 20 and 22. The legacy chan_sip driver has been removed from Asterisk.
Do I need a separate endpoint for inbound calls?
No. One endpoint named tcxc can carry both directions: the identify section matches 174.136.44.213 and puts inbound calls in the endpoint's context.
Where does the tech prefix go?
In the Dial() string, before the number: Dial(PJSIP/80039#447700900123@tcxc). Each purchased route has its own prefix in My Interconnections.
- Can Asterisk register to TelecomsXchange?
- No. TelecomsXchange is peering only and does not accept REGISTER, so don't add a registration section. Asterisk is recognised by its source IP, or by answering the digest challenge with outbound_auth.
- Which Asterisk versions does this cover?
- The PJSIP configuration shown works on the current long-term-support releases, Asterisk 20 and 22. The legacy chan_sip driver has been removed from Asterisk.
- Do I need a separate endpoint for inbound calls?
- No. One endpoint named tcxc can carry both directions: the identify section matches 174.136.44.213 and puts inbound calls in the endpoint's context.
- Where does the tech prefix go?
- In the Dial() string, before the number: Dial(PJSIP/80039#447700900123@tcxc). Each purchased route has its own prefix in My Interconnections.
Finished this guide?
This guide matches platform build 83b4ebc9. Markdown version.