Page 1 of 1

agent not enter phone extension

PostPosted: Thu Feb 03, 2011 3:54 pm
by iulianm
Hello

I think it will be simpler for the agent , when logs in to enter only his username and password and not also the sip extension. When he opens the vicidial web page, to be a script that verify what extension does the agent has in asterisk ( by ip address ) and that's it.

This can be easy done PHP ; When agent access the vicidial webpage we have the IP address and after that we send a event to asterisk like :

Code: Select all
   
 $extension=$a->Getsipextension($ip);
 echo($extension);


And after that the system will now the the agent Agent001 will have that extension assigned.

What do you think?



Code: Select all
 function GETsipextension($ip)
    {
        $p=$this->SIPpeers();
        for($i=0;$i<=count($p);$i++)
        {

            if(trim($p[$i][1])==trim($ip))
            {
                //return 100;
                $pos = strpos($p[$i][0],"/");
                if ($pos === false) {
                    return -1;
                }
                else
                {
                    return substr(strstr($p[$i][0],"/"),1);
                }
            }

        }
        return(-1);
    }


Code: Select all
    function SIPpeers()
    {
     // return $this->send_request('SIPpeers');
     $parameters = array('Command'=>"sip show peers");
     //get data and pars the string to get extension and IP
     $data_pars=$this->send_request('Command', $parameters);
     $data=$data_pars['data'];
     $result=split("\n",$data);
    // return($result);
     $j=0;
     $count=count($result);
     $a=array();
     for($i=2;$i<=$count-3;$i++)
     {
         $ext=substr($result[$i],0,26);
         $ext1=substr($result[$i],26,17);
         $a[$j][0]=$ext;
         $a[$j][1]=$ext1;
         $j++;
      }
     return($a);
    }

PostPosted: Thu Feb 03, 2011 9:20 pm
by mflorell
Please post all code contributions to the Issue Tracker.

This solution would not work for agents behind a NAT firewall, so it really isn't something we would include in the codebase.

PostPosted: Sat Feb 05, 2011 12:37 am
by williamconley
simpler to use the vicidial-group-included sample setup that allows the user to log in first, then use whatever method you like to grab the phone login/phone pass from the user record to auto-fill the phone info. as long as you can "define" all the user's phone identities and assign them in advance, it's not too much of a stretch. but it does violate the hot desk.

you may want to have a look at the URL when an agent has "logged out" and has the "click here to log back in" link. clicking on that link renders a URL that can be used to autofill EVERYTHING, so the user doesn't have to remember any of it. just a favorite/shortcut/bookmark. removing the user's password would even make it secure (would still have to know the pwd to get into the server).