Page 1 of 1

Saving from own web script fields to VICI

PostPosted: Wed Apr 25, 2012 5:38 pm
by amedina
Hi,

I created my own php script, enclosed it in an iframe to display in the script tab in VICI. Values of VICI fields are also populating, but my problem is when they edit the fields from the php script, values were not saved in VICI. How can I save the edited basic fields in VICI? Also, how can I save edited custom fields in VICI?

Please help.

----------------------------------------------------------------------------------
VERSION: 3.1.10 | BUILD: 110430-1642 | Asterisk Version: 1.4.38-vici | Single Server | No Digium/Sangoma Hardware | No Extra Software After Installation

Re: Saving from own web script fields to VICI

PostPosted: Thu Apr 26, 2012 7:47 am
by mflorell
You can use the API to update the lead. If it is still an active call you can use the Agent-API, if not you can use the non-Agent-API:

http://www.vicidial.org/docs/AGENT_API.txt
http://www.vicidial.org/docs/NON-AGENT_API.txt

Re: Saving from own web script fields to VICI

PostPosted: Wed Jun 06, 2012 6:54 pm
by amedina
Hi Matt,

How will I add that in my php script? For example, I'm going to use the update_lead function below.
http://server/vicidial/non_agent_api.ph ... color=blue

Will custom fields be updated if I use Agent_API?
http://server/agc/api.php?source=test&u ... &address1=

What is source?.. source - description of what originated the API call (maximum 20 characters) - Can you explain further please?
----------------------------------------------------------------------------------
VERSION: 3.1.10 | BUILD: 110430-1642 | Asterisk Version: 1.4.38-vici | Single Server | No Digium/Sangoma Hardware | No Extra Software After Installation

Re: Saving from own web script fields to VICI

PostPosted: Thu Jun 07, 2012 9:06 am
by callcrazy
In our setup we use the popup script so I'm not sure if this will work from an iframe.

When agents make changes on our script we write the changes back to the main vicidial lead details form.

Requirement is the script has to be running on the same domain as your agent page. Then you can reference the vicidial form fields like so:

window.opener.document.getElementsByName("phone_number")[0].value = "9999999999";

Re: Saving from own web script fields to VICI

PostPosted: Mon Jun 25, 2012 12:38 pm
by amedina
callcrazy wrote:In our setup we use the popup script so I'm not sure if this will work from an iframe.

When agents make changes on our script we write the changes back to the main vicidial lead details form.

Requirement is the script has to be running on the same domain as your agent page. Then you can reference the vicidial form fields like so:

window.opener.document.getElementsByName("phone_number")[0].value = "9999999999";


Thanks! Will try that one if this Agent API fails :)

mflorell wrote:You can use the API to update the lead. If it is still an active call you can use the Agent-API, if not you can use the non-Agent-API:

http://www.vicidial.org/docs/AGENT_API.txt
http://www.vicidial.org/docs/NON-AGENT_API.txt


Hi Matt,

I tried the non_agent_api in the agent screen (customer already hangs up but had not disposition the call yet), and returned a response, see below.
SUCCESS: update_lead LEAD HAS BEEN UPDATED - 6666|1842296|1 NOTICE: update_lead CUSTOM FIELDS VALUES UPDATED - |1842296|700|0|700|1

I also tried api, response below.
SUCCESS: update_fields lead updated - 6666|201|1842286|address1='',address2='',city='',email='',first_name='johnathan',last_name='moores',postal_code='',state=''

But when i checked the records, fields were not updated at all. Please help.

----------------------------------------------------------------------------------
VERSION: 3.1.10 | BUILD: 110430-1642 | Asterisk Version: 1.4.38-vici | Single Server | No Digium/Sangoma Hardware | No Extra Software After Installation

Re: Saving from own web script fields to VICI

PostPosted: Tue Jun 26, 2012 8:17 am
by mflorell
I couldn't tell you why it's not working in your specific example without a lot more information.

We have dozens of clients that use the APIs without issues, so there is probably something in your processes that aren't being done correctly or at the right time.

Re: Saving from own web script fields to VICI

PostPosted: Fri Jul 06, 2012 10:22 am
by amedina
It's now working.. thanks for all the help guys!


----------------------------------------------------------------------------------
VERSION: 3.1.10 | BUILD: 110430-1642 | Asterisk Version: 1.4.38-vici | Single Server | No Digium/Sangoma Hardware | No Extra Software After Installation