Custom context not correctly executed


I’m using Elastix 2.4 and FreePBX 2.8.1.

I’m trying to route incoming calls depending on the DDI passed over the trunk by OVH (option DDI redirect) in the “To” field of the SIP header (which is actually sent, like sip:[email protected]…).

I added a custom context in extensions_custom.conf:

exten => s,1,Goto(from-trunk,${CUT(CUT(SIP_HEADER(To),@,1),:,2)},1)

and replaced the context in PEER DETAILS by context=custom-get-did-ovh instead of context=from-trunk. USER Details is empty (I also tried to include a context call here, it was useless).

Problem is: the line becomes unavailable (I get a message from the provider saying so).

The context is correctly displayed if I try “dialplan show custom-get-did-ovh”.

I also tried to add some debug information:

  • if I add exten => s,1,NoOp(OK) in the context [custom-get-did-ovh]: nothing happens in the CLI command line called by asterisk -rvvvvvvv.

  • if I add exten => s,1,NoOp(OK) in the context [from-trunk] in extensions.conf (and obviously reload the params or restart asterisk), I can’t see anything in the CLI command line!

It seems like my modifications are not taken into account.

Any idea?

Thank you!


Try changing the s to “_X.” (without quotes), i.e.

exten => _X.,1,Goto(from-trunk,${CUT(CUT(SIP_HEADER(To),@,1),:,2)},1)

Thank you, it works!

Can you just explain the difference between s and _X. so that I get smarter?