external_hangup API request deletes data.

All installation and configuration problems and questions

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

external_hangup API request deletes data.

Postby mrgunston » Wed May 15, 2019 8:54 pm

We have a custom front end for Vicidial. and I am encountering an issue where the data isn't saving when I end the call and I believe this is due to a problem with Vicidial's external_hangup API function.

In the custom screens, ending a call executes the following functions (using API) in this order:

1) external_hangup
2) update_lead
3) external_status

I can see that the lead gets updated in SQL after update_lead runs, but a second later, the newly updated record gets cleared, and after doing some troubleshooting, I figured out that external_hangup is responsible for this.

The evidence for this:

I run the following in SQL (while the lead is incall):
Code: Select all
UPDATE vicidial_list SET first_name = 'Test' WHERE lead_id = 1234


Then I confirm the record has the new value:
Code: Select all
SELECT first_name from vicidial_list where lead_id = 1234


Then I run the following (just through a web browser) to hangup the call:

Code: Select all
http://10.1.0.29/vicidial/api.php?source=XXXX&user=XXXX&pass=XXXX=&function=external_hangup&value=1


The call hangs up, like I expect.

Now I Check the record again:
Code: Select all
SELECT first_name from vicidial_list where lead_id = 1234


But the first_name value is blank.

Am I right in thinking there is an issue with the external_hangup function? Or am I doing something wrong?


ViciBox: 8.1.2 | VERSION: 2.14b0.5 | SVN: 3063 | Clusters: 1 DB / 4 Web/Asterisk Build: 190121-2019
mrgunston
 
Posts: 27
Joined: Tue Oct 11, 2016 9:51 pm

Re: external_hangup API request deletes data.

Postby williamconley » Wed May 15, 2019 9:02 pm

When a call terminates Properly in vicidial, whatever is shown in the Agent Screen will be written to the client record. That WILL delete any information you've stored there while the record was on the agent's screen. Thus if you want to programmatically alter Lead Data while a call is in progress, the proper location to update the information is in the agent screen.

PS: Well documented by the way. I don't like the "build" being segregated from the "version" entirely, but all your information was present and your question was clearly yet succinctly explained. That's very cool. 8-)
Vicidial Installation and Repair, plus Hosting and Colocation
SugarCRM integration - Customization and Add-ons - We Bring It All Together.
http://www.PoundTeam.com # 352-269-0000 # +44 (203) 769-2294 # +506 4001-8914
williamconley
 
Posts: 18507
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: external_hangup API request deletes data.

Postby mrgunston » Wed May 15, 2019 9:06 pm

That makes perfect sense! So, more like a feature than a bug then. :P

Now that I know what is causing the issue, I think I have a good way to work around it. I am just going to parse the main screen values into the iFrame values after a field change.

Thanks William.
mrgunston
 
Posts: 27
Joined: Tue Oct 11, 2016 9:51 pm

Re: external_hangup API request deletes data.

Postby williamconley » Wed May 15, 2019 9:13 pm

This has always been a learning moment for each developer. It often arises from a sudden need for an agent who has Hung Up the call to be able to continue editing the record. But that becomes problematic if the lead calls back and lands on another agent's screen. Now two screens with the same data creates a data storage collision.

So: Agents can ONLY edit the data while on the call with the lead and when that call ends, so does their link to the record. All data is written at the moment the agent pushes "hangup customer". The only leeway is that if the customer hangs up first, the agent has a few seconds to modify the record before Vicidial becomes ... annoying and starts tossing in popups.

However, if you can get javascript into the page it is VERY easy to edit the fields programmatically to push data into them (even those not visible at the moment, obviously). And then Vicidial will handle the "store to DB" moment on your behalf when the call ends.

A little AJAX never hurt anybody, right? 8-)
Vicidial Installation and Repair, plus Hosting and Colocation
SugarCRM integration - Customization and Add-ons - We Bring It All Together.
http://www.PoundTeam.com # 352-269-0000 # +44 (203) 769-2294 # +506 4001-8914
williamconley
 
Posts: 18507
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)


Return to Support

Who is online

Users browsing this forum: No registered users and 22 guests