I am guessing the AGI command "SET EXTENSION <new extension>" allow for you to set which extension the rest of the call will occur over? So a call comes into the switch and I could make the AGI script check the DID or DNIS which is really in the variable agi_dnid? If not how can I get the DID and what is agi_dnid for? After that I can do a database lookup from the script and then issue the "SET EXTENSION" command to asterisk to allocate the call to the right extension if available? I went to http://home.cogeco.ca /~camstuff/agi.html For the AGI command descriptions. Is there a better/more up to date site?