Accessing Non Agent API custom fields values from AGI

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Accessing Non Agent API custom fields values from AGI

Postby josecapurro » Mon Aug 06, 2018 10:39 am

VERSION: 2.14-583a | BUILD: 161226-2224 | ViciBox 7.0.4 | KVM virtual host with 10 remote agents and one IAX trunk | 5 agents | One inbound campaign | Two outbound auto-dial no-live-agents-only-play-audio campaigns | No extra software | 4 GB RAM | 50 GB HDD |

Hello there!

Is there a way to use the values sent via non_agent_api.php from an AGI script.

I have an AGI script which streams some audio files based on its input.

I have successfully configured an auto-dial campaign to dial without any live agents and play a message, per the Manager Manual.

From an external system, i send new leads to the list using add_lead.

What i want is after configuring some custom fields, read their values from the AGI, say custom_invoice_total=50, and play a message to the customer saying it has a USD 50 pending invoice.

I see the Settings Container AGI option but i can not, for the life of me, find documentation for use the feature. I have found only the email example.

Any insights?
josecapurro
 
Posts: 25
Joined: Tue Sep 01, 2015 9:12 am

Re: Accessing Non Agent API custom fields values from AGI

Postby mflorell » Mon Aug 06, 2018 11:35 am

Yes, it's all stored in the database. For custom fields, you need the "entry_list_id" from the lead, then use that to query the "custom_X" table for the custom data(where "X" is the "entry_list_id" of the lead).
mflorell
Site Admin
 
Posts: 18335
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Re: Accessing Non Agent API custom fields values from AGI

Postby josecapurro » Mon Aug 06, 2018 2:02 pm

Thanks Matt. Now i know how to retrieve the custom field value for a lead.

Now, the next thing: I can't see how do i know from an AGI script which lead ID is being dialed. How do i know?

For example: i see agi-VDAD_ALL_outbound.agi sets _CAMPCUST, so i can retrieve that from an AGI script with get_variable.

But how do i get the lead_id or something to get the custom field value from the DB?

I do not know if i am overcomplicating the issue.
josecapurro
 
Posts: 25
Joined: Tue Sep 01, 2015 9:12 am

Re: Accessing Non Agent API custom fields values from AGI

Postby mflorell » Mon Aug 06, 2018 2:35 pm

We use the CallerIDname to store the lead_id as the last 10 digits of the value(it's zero padded).

For example: V8061533330000828507

The lead_id is the last 10 digits:; "0000828507", in a lot of programming languages you can just add 0 to this to get the integer of the lead_id: "828507"


As for getting the CallerID, it's stored as a channel variable in Asterisk.
mflorell
Site Admin
 
Posts: 18335
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida


Return to Support

Who is online

Users browsing this forum: No registered users and 61 guests