Operating the astguiclient 100% from API within my CRM

Discussions about development of VICIDIAL and astGUIclient

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

Operating the astguiclient 100% from API within my CRM

Postby callforamerica » Wed Apr 22, 2015 7:52 pm

Hi,

We are using vicidial with our custom CRM. The way it works is, when user logs into our crm, they enter the extension # that they are sitting at. Then when they login, we automatically launch another tab to vicidial astguiclient, automating the login process by manipulating the login querystring to the Agent Console. For the rest of the session we don't use the Agent Console at all. In fact, we actually have a DIV that covers up the entire astguiclient tab that says "USE CRM ONLY. DONT CLOSE TAB". All of the commands are controlled from within the CRM it self, the agent never touches the astguiclient window. We have a javascript that communicates every 5 secs with the agent API st_get_agent_active_lead & recording&value=status commands in order to determine the state of the call, and offer the appropriate buttons like resume/pause, hold, dial new number, login to queue, etc. We dispo the call and everything directly within our crm.

I am trying to find a way to ditch the need to login to the astguiclient alltogether (our second tab), by somehow logging in via the API or by other means. Is this possible? When I first did the integration I Just did it quick, but now I'm seeing more load on my database server than I can handle so I'm looking to optimize how I did this. To start, I'm currently considering changing the refresh_interval for the astguiclient from 1000ms to 5000ms. But I am wondering if this will affect my API commands execution time at all. Any reason I couldn't set the refresh_interval to 30,000ms for example, since we don't care about the data that is displayed to the agent in the agent console, as they are not using it.

From what I have tested, the only reason I need to log them into the agent console is to trigger the actual login event, and then keep telling vicidial that the window is still open so it doesn't auto terminate the session. Any ideas on what route I should pursue to eliminate the astguiclient window completely, by inserting into the db and otherwise emulating its login process?
callforamerica
 
Posts: 22
Joined: Wed Apr 22, 2015 7:33 pm

Re: Operating the astguiclient 100% from API within my CRM

Postby mflorell » Wed Apr 22, 2015 9:23 pm

You have to have vicidial.php open, it processes the API commands using javascript, and without it open the API commands will not be run.
mflorell
Site Admin
 
Posts: 18386
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Re: Operating the astguiclient 100% from API within my CRM

Postby chrismervyn20 » Wed Nov 25, 2015 1:33 pm

I am a little late to the party. Nevertheless, here are my two cents.

If you have already replicated all of the basic functionalities via your CRM, you can automate the login procedure also. It is actually extremely easy. If you have the same user/pass combination for each agent in Vicidial and also your CRM, then it would be easier otherwise, you could easily create a table in your CRM database and store the Vicidial Agent user/pass for each User of your CRM.

Once you have forged the above relationship, it is 10 mins of programming. Since, I don't know what Stack/Programming Language your CRM is based on, I am not writing the entire code here, but, I am putting the gist using PHP. If you let me know the language you are using, I would be happy to help with actual code.

Code: Select all
function Vicidial_login($user,$pass,$campaign){
    $postVars = "VD_login=".$user."&VD_pass=".$pass."&VD_campaign"=.$campaign;
    //Initiate Login
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,"http://".$this->host."/agc/vicidial.php");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postURL);
   
    // receive server response
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $loginResponse = curl_exec ($ch);
    curl_close ($ch);               
}

Now you should get the ring back if you have logged in successfully. If you parse the
Code: Select all
$loginResponse
you can handle the error messages.

Let me know, if you need anything more.
chrismervyn20
 
Posts: 23
Joined: Thu Oct 04, 2012 6:26 pm

Re: Operating the astguiclient 100% from API within my CRM

Postby williamconley » Wed Dec 09, 2015 2:06 pm

I don't think that method will get you a functional page capable of running the requisite javascript/AJAX functions. It may be a better idea to create an iFrame that automatically logs in as the agent. It need not be visible at all, but it must be a browser that will run the java. After that, with the java active as an invisible agent session, you can use the agent api functions to control that session and execute the commands.

Merely requesting a login, and capturing the results of the login by curl into a variable in PHP will not allow the javascript code in that text string to execute. And if you add it to another page, you may argue with other functionality on that page, especially if it refreshes.

In fact, if that other page must refresh, you may do better to have TWO iFrames .. one for Vicidial (never refreshes, controlled by AJAX) and one for the CRM, which can refresh (in it's iFrame) as often as necessary, both contained in a master page whose only purpose in existence is to allow those two iframes to coexist after auto-logging in for Vicidial's agent screen. While you're at it, of course, it could also auto-login for the CRM, saving a step for the agent. So ONE login to "whatever" would bounce to the master page which would auto-login both subframes.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)


Return to Development

Who is online

Users browsing this forum: No registered users and 34 guests