API Call to external Server through Dynamic Routes Module

Hi,

I am a newbie with Dynamic Routes and API’s. In my organization, we have hundreds of customers. Each customer has their own identification number.

So, It has been a bit difficult for our agents to identify each customer’s information detail and for this reason, I have created a simple Dynamic Route that does the following:

  1. Call comes in and hits our Dynamic Route (done)
  2. User is prompted to dial their id number (done)
  3. The id number is then used to verify the customer’s name and other personal details, which then are sent to the agent. (This is my issue)
  4. The dialed id number is sent to our agents as well (done)

So we have an integration with a system that is hosting all of our customer’s information details and they have an API that we can use to request specific information based on the customer’s id number. I’ve been reading through these posts from a couple of years ago: FreePBX Rest API to get information from Database and https://www.reddit.com/r/freepbx/comments/nedty8/comment/gyha5c7/

Some have recommended Dynamic Routes to make API calls.

All is good until there, the issue is that the company hosting our customer’s information uses a token to securely authenticate the GET API call. I am wondering how this integration of using Dynamic Routes to make API Calls is done. There is no issue if I have to create a script that does all the API calls, however, I am not sure how to reference this within Dynamic Routes.

Hope someone can shed a light on me this issue :slight_smile:

https://wiki.freepbx.org/display/FPG/Dynamic+Routes+User+Guide

You need to collect the variable in one dynamic route, then use a second dynamic route to fire the API.

If the token is dynamic and you need to prompt for that first, you could use the dynamic route to call and store the token as a variable to be able to use it on subsequent dynamic routes.