Configuring DDI’s on WxC DVX trunks with Asterisk / trixbox

By Steve Biddle, in , posted: 25-Mar-2010 10:18

I've been a user of WxC's VFX VoIP service for a number of years now and believe they offer New Zealand's best VoIP platform for both residential and business users.

WxC offer two VoIP products in the marketplace - a residential VoIP offering called VFX and a business offering called DVX. DVX is a true SIP trunking service and offers features such as multiple inbound DDI numbers that are not available using the VFX service. I've configured VFX on numerous Asterisk systems and DVX on numerous Epygi Quadro PBX's but had never configured a DVX trunk on an Asterisk based system until I sat down last week to test a configuration.

If you're configuring multiple phone numbers with a SIP based system the easiest way is to create an individual SIP registration for each line. This defeats the purpose of a SIP trunk however and doesn't deliver a truly scalable solution - if you had 200 DDI numbers for example you would require 200 SIP registrations which is a lot of unnecessary SIP traffic. A true SIP trunking product such as the Broadsoft solution WxC offer can handle all these DDI's through a single parent registration however Asterisk needs a few tweaks to be able to handle these DDI numbers correctly.

My understanding is that people who have deployed DVX in the past have manually added additional registration lines to their sip.conf or sip_custom.conf files to forward these DDI numbers to the correct inbound route. I decided to look at a much easier way to do this that avoids requiring multiple SIP registrations and after a few minutes work came up with a new custom context that can be used as your inbound trunk in your DVX settings.


By default Asterisk can't see the DDI number - it processes it's inbound route thinking the originating number is the parent registration


Executing [91234560@from-trunk-dvx:1]


This context looks at the inbound SIP URI and extracts the DDI from the To: header and then passes this through to the regular from-trunk context that is used for inbound calls.


SIP/SPgtXt7P1OlxZDN9ao-b7c33798", "DVXDDI="User1 3bitdemo" <;rinstance=4baa739e26af491b


It can now pass this to the from-trunk context using the number 91234561 rather than 91234560


To configure this you you need to manually edit extensions_custom.conf and add the following

exten => _.,1,Noop(Extract DVX DDI/DID info from SIP URI header. By Steve Biddle
exten => _.,n,Noop(NoOp(SIP_HEADER : ${SIP_HEADER})
exten => _.,n,Set(DVXDDI=${SIP_HEADER(To)})
exten => _.,n,Set(DVXDDI=${CUT(DVXDDI,@,1)})
exten => _.,n,Set(DVXDDINAME=${CUT(DVXDDI,",1)})
exten => _.,n,Set(DVXDDI=${CUT(DVXDDI,:,2)})
exten => _.,n,Goto(from-trunk,${DVXDDI},1)


In your sip.conf or FreePBX web interface change the context=from-trunk to context=from-trunk-dvx

You can now configure these inbound routes using the DDI number and set the extension you require these to go to. This now results in a single SIP parent registration rather than multiple registrations for each DDI number.


And now a plug from me..If anybody is interested in assistance or support with Asterisk based systems or wanting help in deploying an Asterisk based PBX feel free to contact me!

Other related posts:
Obihai OBi 200 Analogue Telephone Adapter (ATA) Review
Raspberry Pi – the ultimate home Asterisk PBX.
G.722 HD Audio. What’s the big deal?

Comment by nzsouthernman, on 25-Mar-2010 13:47

Cool Steve - thanks for this post. Do you think this'll work with a 2Talk trunk & Trixbox?
Saw you on Saturday at the GZ Pizza in CHC but by the time I went looking for you later on to introduce myself and have a chat I lost you. :(

Author's note by sbiddle, on 25-Mar-2010 13:57

2talk works in a slightly different way and doesn't deliver SIP trunks in the same way Broadsoft does. There isn't any need to do this.

Comment by maverick, on 25-Mar-2010 15:10

Nice work Steve, we appreciate the work you do for the Asterisk community, and this will definetly help out users wanting to use Asterisk as a True SIP trunking offering.

Comment by Zeon, on 27-Mar-2010 21:20

I love the timing! Just last week I finally got this working with trixbox 2.8 and DVX - I take it you absed your solution off the FreePBX one?

Author's note by sbiddle, on 28-Mar-2010 15:27

I didn't base it off the FreePBX one, I didn't realise they had anything like this.

I'd seen a few people comment over there years that they were unable to get DVX DDI's working with trixbox. The simple fix was to create additional registrations using the DDI in sip.conf however this in some ways defeats the point of a parent registration. The easiest way was to simply extract the DDI from the SIP URI because Asterisk simply ignores it.

Something similair would probably work with any VoIP provider using Broadsoft.

sbiddle's profile

Steve Biddle
New Zealand

I'm an engineer who loves building solutions to solve problems.

I also love sharing my views and analysis of the tech world on this blog, along with the odd story about aviation and the travel industry.

My interests and skillset include:

*VoIP (Voice over IP). I work with various brands of hardware and PBX's on a daily basis
  -Asterisk (incl PiaF, FreePBX, Elastix)

  -xDSL deployments

*Structured cabling
  -Home/office cabling
  -Phone & Data

*Computer networking
  -Mikrotik hardware
  -WAN/LAN solutions

*Wireless solutions
  -Motel/Hotel hotspot deployments
  -Outdoor wireless deployments, both small and large scale
  -Temporary wireless deployments
*CCTV solutions
  -Analogue and IP

I'm an #avgeek who loves to travel the world (preferably in seat 1A) and stay in nice hotels.

+My views do no represent my employer. I'm sure they'll be happy to give their own if you ask them.

You can contact me here or by email at