I’m working on this project that when a user calls, they input their zip code and the system looks up a phone number associated with it.
After the number has been retrieved I prompt the user to be transferred to the found phone number.
Otherwise they are returned to the main phone line.
I am stuck trying to figure out how to dial that phone number.
Some information about my setup:
I’m running FreePBX in its development mode in a virtual machine with only an internal ip address.
I have a custom module built to inject a dialplan and control the settings for retrieving the phone numbers.
The dialplan is setup to run an AGI script under a custom context.
I have setup a few extensions to test with. 2 users and 1 virtual for the custom dialplan.
I use a custom destination to act as the destination for the virtual extension. The custom destination then runs under the custom context which calls my AGI script.
Besides the above, I have not configured anything else about the server.
At the end of the agi script, either the user is transferred to the new destination based on their zip code, or they are returned to the main line if their zip code didn’t return a number.
I know with my current setup I won’t be able to dial a real phone number, but I figured I would at least be able to dial one of the users, or a feature code.
I call the dial application from the agi script like so
agi->exec_dial("PJSIP", $phone )
However, I get back the error:
ERROR: res_pjsip.c:3533 ast_sip_create_dialog_uac: Endpoint '6002': Could not create dialog to invalid URI '6002'. Is endpoint registered and reachable?
Is this an issue with being on a custom context?
Do I need to transfer back to a different context to call a local user. If that is the case, what about when going into production and it needs to dial an actual phone number?