[Asterisk-Users] Agent setup

Josh Rollyson jrollyson at clis.com
Mon Dec 29 13:48:43 MST 2003


CW_ASN wrote:
> Shad:
>  
> Using the AddQueueMember. Launching this command 3 times in different 
> queues, logs one phone to that 3 queues...
>  
> *CLI> show application AddQueueMember
>  
>   -= Info about application 'AddQueueMember' =-
>  
> [Synopsis]:
> Dynamically adds queue members
>  
> [Description]:
>    AddQueueMember(queuename[|interface]):
> Dynamically adds interface to an existing queue
> Returns -1 if there is an error.
> Example: AddQueueMember(techsupport|SIP/3000)
>  
> *CLI>
> Or, you must declare only one extension for all agents, i.e:
>  
> ;LogOn and LogOff in queue: cola
> exten => icola,1,EAGI(opinc.php,cola)
> exten => icola,2,Hangup
> exten => dcola,1,EAGI(opdel.php,cola)
> exten => dcola,2,Hangup

Easier but poorly documented solution. AgentCallbackLogin()

AgentCallbackLogin delivers callo for a logged in agent to an extension. 
- they continue to get calls until they log out (by logging in to a null 
extension (pressing # when prompted for extension)

>  
> The AGIs contains:
>  
> -----------> opinc.php:
>  
> #!/usr/bin/php -q
> <?php
> ob_implicit_flush(true);
> set_time_limit(0);
>  
> function sm($texto) {
>  
> echo("VERBOSE \"".$texto."\"\n");
>  
> }
>  
> function se($comando) {
>  
> echo("exec $comando\n");
>  
> }
>  
> //MAIN PROCEDURE
>  
> $err = fopen("php://stderr","w");
> $in = fopen("php://stdin","r");
>  
> while (!feof($in)) {
>         $temp = str_replace("\n","",fgets($in,4096));
>         $s = split(":",$temp);
>         $agi[str_replace("agi_","",$s[0])] = trim($s[1]);
>  
>         if (($temp == "") || ($temp == "\n")) {
>                 break;
>         }
> }
>  
> $cid=trim($agi["callerid"]);
> $ext=trim($agi["extension"]);
> $tec=trim($agi["type"]);
>  
> $rt1=strpos($cid,"<");
> $rt2=strpos($cid,">");
> if (strpos($cid,"<")>0) {
>         $cid=trim(substr($cid,($rt1+1),(($rt2-$rt1)-1)));
> } else {
>         $cid=trim($cid);
> }
>  
> $cid=stripslashes($cid);
>  
> $cola=$argv[1];
>  
> se("AddQueueMember $cola $tec/$cid");
> se("Playback agent-loginok");
> sm("Agent '$tec/$cid' was included in queue '$cola'");
>  
> ?>
>  
> -----------> opdel.php:
>  
> #!/usr/bin/php -q
> <?php
> ob_implicit_flush(true);
> set_time_limit(0);
>  
> function sm($texto) {
>  
> echo("VERBOSE \"".$texto."\"\n");
>  
> }
>  
> function se($comando) {
>  
> echo("exec $comando\n");
>  
> }
>  
> //MAIN PROCEDURE
>  
> $err = fopen("php://stderr","w");
> $in = fopen("php://stdin","r");
>  
> while (!feof($in)) {
>         $temp = str_replace("\n","",fgets($in,4096));
>         $s = split(":",$temp);
>         $agi[str_replace("agi_","",$s[0])] = trim($s[1]);
>  
>         if (($temp == "") || ($temp == "\n")) {
>                 break;
>         }
> }
>  
> $cid=trim($agi["callerid"]);
> $ext=trim($agi["extension"]);
> $tec=trim($agi["type"]);
>  
> $rt1=strpos($cid,"<");
> $rt2=strpos($cid,">");
> if (strpos($cid,"<")>0) {
>         $cid=trim(substr($cid,($rt1+1),(($rt2-$rt1)-1)));
> } else {
>         $cid=trim($cid);
> }
>  
> $cid=stripslashes($cid);
>  
> $cola=$argv[1];
>  
> se("RemoveQueueMember $cola $tec/$cid");
> se("Playback agent-loggedoff");
> sm("Agent '$tec/$cid' was removed from queue '$cola'");
>  
> ?>
> I know, the code is dirty... but it works for me.
>  
> Hope this helps,
>  
> Regards,
>  
> Gus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 261 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20031229/00b72227/attachment.pgp


More information about the asterisk-users mailing list