Page 1 of 1

Session_Id for blind_monitor with NON-AGENT_API

PostPosted: Wed Dec 23, 2015 10:02 pm
by pokiboum
Hi everyone,

I spent lot of time reading all the manual to use NON-AGENT_API and looking in google informations about vicidial API because i'm making a little JAVA program to manage my agents.

I would like to use the blind_monitor function but I have a problem to find the session_id of the agent connected I would like to listen.

Does it exist a way to get the session_id of all agents connected with a command ? I can see the session_id of them in Real Time Report but i would like to have a way to "extract it" to use it my program.

Thanks you for your help !

Re: Session_Id for blind_monitor with NON-AGENT_API

PostPosted: Wed Dec 23, 2015 10:23 pm
by mflorell
After looking into this, it looks like there is nothing other than the real-time report that will show the session id of all agents logged into the system.

This looks like a good candidate for a new feature. Please create a new Issue Tracker ticket for this(with a more in-depth description) and link it in this forum post.

Re: Session_Id for blind_monitor with NON-AGENT_API

PostPosted: Wed Dec 23, 2015 10:53 pm
by williamconley
Or skip the api and just query the live agents table directly. Would be a good api function, though (for those not wanting to give direct db access to someone who must have this information).

Re: Session_Id for blind_monitor with NON-AGENT_API

PostPosted: Sat Dec 26, 2015 6:26 am
by pokiboum
Hi, I found a little solution for my issue, maybe it can help someone :

I found it in AGENT_API ( instead of NON-AGENT_API ) : you have a function "recording", it sends a recording start/stop signal or status of agent recording, the option STATUS of this function displays results of active recording and agent session information, we don't care about it BUT it provide the SessionId in the answer :)

Exemple :
http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=recording&value=STATUS


Result possible :
- ERROR: no user found - 6666
- ERROR: agent_user is not logged in - 6666
- NOTICE: not recording - 6666|||||192.168.1.5|8600051|PAUSED
- NOTICE: recording active - 6666|121242|20120810-012008__6666_|192.168.1.5|2012-08-10 01:20:10|192.168.1.5|8600051|PAUSED

So if the user in logged in, you just have to take the 7th parameter of the result and it's the SessionId of the user ( in the exemple : 8600051 )

rtfm : http://www.vicidial.org/docs/AGENT_API.txt

Re: Session_Id for blind_monitor with NON-AGENT_API

PostPosted: Sat Dec 26, 2015 8:32 am
by mflorell
Good eye for spotting that one!

Although it still won't give you a list of logged-in agents, which would be a very useful and simple function to add.

Re: Session_Id for blind_monitor with NON-AGENT_API

PostPosted: Sat Dec 26, 2015 10:02 am
by mflorell
I just added the "session_id" field to the existing "agent_status" Non-Agent API function.

I also went ahead and added a new "logged_in_agents" Non-Agent API function:


--------------------------------------------------------------------------------
logged_in_agents - list of agents that are logged in to the system

NOTE: api user for this function must have user_level set to 7 or higher and "view reports" enabled

REQUIRED FIELDS-
source - description of what originated the API call (maximum 20 characters)

OPTIONAL FIELDS-
campaigns - pipe-delimited list of campaigns to get status information for "TESTCAMP|INBOUND", default is all campaigns shown
user_groups - pipe-delimited list of user groups to get status information for "ADMIN|AGENTS", default is all user groups shown
show_sub_status - show agent sub-status and pause_code, requires log lookup, (YES|NO) default is NO

SETTINGS FIELDS-
stage - the format of the exported data: csv, tab, pipe(default)
header - include a header(YES) or not(NO). This is optional, default is not to include a header

Example URL strings for API calls:
http://server/vicidial/non_agent_api.ph ... header=YES

Example responses:
ERROR: logged_in_agents USER DOES NOT HAVE PERMISSION TO GET AGENT INFO - 6666|0
ERROR: logged_in_agents NO LOGGED IN AGENTS

A SUCCESS response will not show "SUCCESS", but instead will just print the results in the following format:
user|campaign_id|session_id|status|lead_id|callerid|calls_today|full_name|user_group|user_level
6666|TESTCAMP|8600051|PAUSED|1079409||1|Admin|ADMIN|9

user,campaign_id,session_id,status,lead_id,callerid,calls_today,full_name,user_group,user_level,pause_code,sub_status
6666,TESTCAMP,8600051,INCALL,1079409,M2260919190001079409,1,Admin,ADMIN,9,LOGIN,DEAD
4545,TESTCAMP,8600052,PAUSED,0,,0,4545,MIKESGROUP,8,LOGIN,

NOTE: real_time_sub_status field can consist of: DEAD, DISPO, 3-WAY, PARK, RING, PREVIEW or it can be empty