Categories

Archives

 

September 2010
M T W T F S S
« Aug    
 12345
6789101112
13141516171819
20212223242526
27282930  
free counters

HowTo: Elastix DAHDI Trunk Routing with DID

If you have multiple FXO (PSTN) lines into your PBX, it is always nice to be able to route these in-bound calls based on the physical line they arrive upon.  Getting this working with DAHDI in Elastix has been driving me up the wall!

This issue has been bugging me for over a week now and I have finally got it to work.  I have two trunks connected via FXO modules on a TDM400 card, but I could not get the DID working with them (CLI with BT sorted).  But once Asterisk had the call, I could not make Asterisk make a decision with call based on which number/line the caller called.  Not the number the caller is calling from, this is CLI or CID, but the number they dialled to make your line ‘ring’.

Asterisk was either saying there was no route and answering the call to say the number you have called is not in service, or just handling the 2 lines in the same way – i.e. it could not tell them apart.  Here I detail my findings so you can process lines automatically.

I had most of the configuration right, but I had to hand edit another configuration file to actually to get the changes made via the web interface actually working.  Trying to find this last little bit of information on the forums has been maddening to say the least.

Changing the route

First you need to correct the router handler, by changing a setting in a configuration file.  There is no graphical interface for this I’m afraid and it is the only file you need to manually edit by a suitable means.

The default setting in this configuration file is ‘from-pstn’ and this needs to be changed to ‘from-zaptel’.  You need to edit:

/etc/asterisk/dahdi-channels.conf

You need to find the correct section for your line connection.  For me this was lines 3 & 4.  Below is the example original settings for my channel 3:

;;; line=”3 WCTDM/4/2 FXSKS”
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 3
callerid=
group=
context=default

And you need to edit this for each channel to become like this:

;;; line=”3 WCTDM/4/2 FXSKS”
signalling=fxs_ks
callerid=asreceived
group=0
context=from-zaptel
channel => 3
callerid=
group=
context=default

Then save the file back and restart Asterisk.

Marking the Channel DID

The next stage is to assign DID numbers to these channels so a decision can be made on how to process the call based on line ID.

Elastix does not have an interface to the required facility, so you need to un-embed the FreePBX console, details are here.

Once in the FreePBX console, you need to choose ‘ZAP Channel DIDs’ from the menu on the left.  You should get a screen similar to:

ZAP DIDs

ZAP DIDs

It is quite simple to complete, needing only 3 bits of information:

  • Channel – The DAHDI channel you are assigning the DID to.
  • Description – Your description for this allocation.  I would suggest an name and a summary of the DID you will be allocating.
  • DID: The DID number need to call to make this channel ‘ring’.

An example UK configuration might look like this for channel 3, used to be routed (Inbound Routes) to the sales department for the number: 01234-123456:

ZAP DID Sample

ZAP DID Sample

Once completed, you can click ‘Submit Changes’.  You need to repeat this for each FXO port you have for inbound calls.

You can then save the changes back and configure the ‘Inbound Routes’ to actually ‘route’ the calls where you want them.

You can actually use almost any number in the DID, but I suggest you use the full number, including the STD, in case you have any ‘out of area’ number.  And it generally reduces confusion in the future.

VN:F [1.9.3_1094]
Rating: 5.0/5 (3 votes cast)
HowTo: Elastix DAHDI Trunk Routing with DID, 5.0 out of 5 based on 3 ratings

Related posts:

  1. HowTo: Securing Elastix This article covers the initial steps in securing the default...
  2. HowTo: Getting UK CLI working with DAHDI FXO UPDATED: This article details my findings on getting getting my...
  3. HowTo: Compress Elastix Logs Last  Updated: 14 September 2009 One problem I noticed very...
  4. HowTo: Asterisk VoiceMail Issues After setting up my new Elastix based FreePBX/Asterisk, the voice...
  5. HowTo: Elastix Incoming SIP Trunk Calls For the last few weeks I have been bashing away...

5 comments to HowTo: Elastix DAHDI Trunk Routing with DID

  • Joe

    Hi,

    Just a note on multi-channels on BT analog lines.
    If your line is not hanging up you may need BT to change the timings on disconnect.
    They normally are set at 30ms but need to be larger for PBX to recognize line drop.
    I got BT to change our clients to 800ms and voila, calls are all dropping perfectly.

    Took me a while to work this out, do I thought I would post up to help anyone else.

    J.

  • Correct. The dahdi-channels.conf changes would only be erased and thus the need to re-enter the details if you change the hardware set-up.

    For some reason the authors of Elastix/FreePBX have not added a custom module to this area. Possibly because the re-detection of hardware will make quite significant changes to the layout of channels. I suspect that you might need to re-configure more than just this file if the new hardware changes re-allocate the channels.

    A small pain I think, and only occurs when you change hardware, which should not be very often. If you have planed your system from the start, then this would only happen with a major upgrade in the future. Most home set-ups are unlikely to change at all, I would hope.

  • Justin

    Just following up…

    I went ahead and made the changes suggested, and everything worked as expected. Thanks!

    One thing I noticed though; in /etc/asterisk/dahdi-channels.conf, there’s a nice big warning telling you the file is auto-generated by dahdi-genconf and that you should not hand edit it. I suppose that means if dahdi-genconf ever gets run in the future, your changes will be lost and your inbound routes that use these DIDs will stop working.

    I *think* dahdi-genconf would only get run if you installed new hardware. Does that sound right?

  • Justin,

    No, I have not experienced any issues.

    While implementing originally, I examined the ‘path’ that calls take for each context and it just adds a few lines of additional code to define the DID before dropping back through to the original “from-pstn”, as the original “from-pstn” path would have been.

    Using “from-zaptel” executes the configurations set-up to allocate the DID to the call and then in effect does a ‘goto’ to continue through “from-pstn”.

    Until you change the context, the allocation of the DID will never take place.

    Hope that makes sense.

  • Justin

    Thanks for writing these instructions! I’ve been looking for this exact info. I’d like to ask: Have you found any side effects to changing the contexts from “from-pstn” to “from-zaptel”? I’d like to make sure I understand any…*risks* before making the change.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>