agent not enter phone extension
Posted: Thu Feb 03, 2011 3:54 pm
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 :
And after that the system will now the the agent Agent001 will have that extension assigned.
What do you think?
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);
}