Page 1 of 1

AGENT API change_ingroups not functioning

PostPosted: Tue Sep 06, 2022 9:39 pm
by drodecker
Sometimes agents forget to logout and management neglects to notice. For this reason we've created a script to automatically remove agents from InGroups after hours using the Agent API.

The API has been tested to work in the past however it sometimes fails despite returning "SUCCESS".

We have attempted these two API calls; either of which we believe should work:
Code: Select all
http://vicivoip/agc/api.php?source=LocalSplashViciDBAdmin&user=524&pass=XXXX&agent_user=2277&function=change_ingroups&value=REMOVE&blended=NO&ingroup_choices=%20CI_%20CXI%20CXII%20CXINBOUND%20SPAN_CI_%20SPAN_CXI%20SPAN_CXII%20-


Code: Select all
http://10.1.1.80/agc/api.php?source=LocalSplashViciDBAdmin&user=524&pass=XXXX&agent_user=2277&function=change_ingroups&value=CHANGE&blended=NO&ingroup_choices=AGENTDIRECT


Both resulted in "SUCCESS", However the agent remained in the closer InGroups
Image

Any idea why the API call would return SUCCESS in setting the InGroups, yet the user still remains in the InGroups?

VERSION: 2.14-809a
BUILD: 210417-1027
openSUSE Leap 15.1

(Note that the API call responded nearly instantly and there no usage of the system at the time as it's after-hours.)

Re: AGENT API change_ingroups not functioning

PostPosted: Wed Sep 07, 2022 6:21 am
by mflorell
A "SUCCESS" response from the Agent API just means that the server has received a request and triggered an action, not that the action has actually taken place. It is dependent on the data in the request being valid and the agent screen being active and functional for the actions to actually be executed.

As for your example URL, the doc says specifically to "(use plusses + in the URL)" in between the In-Groups, which you don't seem to be doing,
https://www.vicidial.org/docs/AGENT_API.txt

As for a test of the functionality, the Real-Time Report's change-in-groups functionality actually uses this same Agent API function, have you tested that it works from there?

On a side note, the version of VICIdial you are using is over a year old and has known exploits in it, I would strongly recommend upgrading your system to the most recent svn/trunk revision.

Re: AGENT API change_ingroups not functioning

PostPosted: Thu Sep 08, 2022 6:00 pm
by drodecker
Indeed the plusses URL escaping is needed; %20 does not function. Thank you.

Thanks for the tip on the version update. Although were behind a firewall, we'll be fully updating the server.