From trunk context to Extensions_custom.conf then to from-pstn

I have a custom applications that needs to write to asterisk.

I want calls from a trunk to go directly to extension_custom.conf context then if it falls through to then return to the from-pstn context where freepbx then would treat it as a normal incoming call with an inbound call route.

Is this possible can I have a trunk forward to a custom_extension.conf context?

Would there be anyway other way to do this ?

Could I have all calls go to a custom context then come back to be routed by freepbx?

I have 100 - 200 iax2 extensions that need to be generated with direct did numbers and I don’t want to do it manually with the gui I would just rather have a script create them then create the call routes. The problem is I still need to have the freepbx gui ontop of asterisk.

Any help on this would be welcome.

Thank You, you guys are awesome love freepbx.

the incoming calls will go to which ever context you direct them to go to in your trunk configuration.

The standard configuration goes to from-pstn because that is what is configured, but you can change it to anything you like.

So you can go to your own context, pre-process the call, and then send it into the standard from-pstn context with a proper goto. That’s one option, there are other ways depending on the specifics of your situation.

okay cool, I have the trunk forwarding to the custom context working but the problem I am having now is the proper Goto statement

this is what I have so far

(I put 555 to mask the real number but that part is working)
exten => 5555555555,1,NoOp()
exten => 5555555555,n,Verbose(Incoming from 5555555555);
exten => 5555555555,n,Dial(IAX2/iax0/5555555555)

exten => _NXXNXXXXXX,1,Noop(Goto from-pstn)
exten => _NXXNXXXXXX,n,Goto(from-pstn,${EXTEN},1)

How would I get numbers that are not matched to go to the regular from-pstn context

Thank You