Incoming call

Hi all,
I have 4 analog line numbers which I would like to assign to different extension numbers by exploding SIP header and transfer incoming call depending to the DID number.
Here is the rule inside my incoming context get the called number so that I should assign the call to a specific extension:
exten => s,1,goto(${CUT(CUT(SIP_HEADER(TO),@,1),:,2)},1)
exten => 22224204,1,Dial(SIP/10&SIP/11&SIP/12,20,tr)
exten => 22224205,1,Dial(SIP/20&SIP/21,20,tr)

But when I check in my log, the did is empty.
Is there other way I should use to get the DID (by setting DID by channel in my chan_dahdi.conf) so that I should make my configs.
Thanks in advance,


Why are you using a method for extracting information from SIP Headers if you are using DAHDI for incomming calls? Or I am missing something or you need to re-thing your Asterisk scenario.

Thank you for your reply. I think I misunderstood something in incoming call treatment. I think it is me who is missing something. I am stuck and don’t find a solution to recover the called number.
Is there other way I should proceed to identify the called number so that I should route incoming calls depending to the line dialed.
Thank you again.


To be more clear with my issue, I am wondering how I should treat a call coming from one my 3 channels on dadhi to be transfered to one of my internal extensions depending to the channel (i.e. line number called).
Thank you

The DID number is used as the extension! That’s true even for SIP; the SIP To header is not the value that is used for routing.

Please use Asterisk Support for support requests.

Thank you for your help.
I need to transfer incoming calls to different extensions depending to the did number that I am wondering how to get it.
I am going to move my topic in asterisk support as suggested.
Best regards,


Thread duplicated into Asterisk Support (without history). As that is a more correct forum, I would suggest any followup should go there.