How can I route custom code back into the gui

I am building some custom dialplan outside of freepbx.

The code does some routing based on the FROM_DID, so I want to be able to grab certain DIDs in my Inbound Routes and pass them to a Custom Destination referencing my code.

The problem is I need to also route this code back into freepbx again once my custom dialplan has processed.

ie:

  1. call comes in on DID
  2. inbound route pushes call to my custom app
  3. custom app plays an IVR (non freepbx), and does some db lookups
  4. caller may select final option in IVR which will transfer to a Queue or Ring Group
  5. The Q or RingGroup number must be determined by the original DID that the call came in on

So the problem is the system may aquire new DIDs on a random basis, and I would like to easily configure where the call goes in step 5 using the FreePBX GUI, but dont know how to pull the call flow back into the GUI.

anyone?? - would I just send it back to s extension in [from-pstn]??

exten => “whatever you have here”,n,GoTo(from-pstn,s,“wherever you want to go”)

GoTo function http://www.voip-info.org/wiki/view/Asterisk+cmd+goto