[Asterisk-Users] Agent setup

CW_ASN cw_asn at fibertel.com.ar
Mon Dec 29 13:12:44 MST 2003


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


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


  ----- Original Message ----- 
  From: Shad Mortazavi 
  To: 'asterisk-users at lists.digium.com' 
  Sent: Monday, December 29, 2003 4:50 PM
  Subject: [Asterisk-Users] Agent setup


  Dear Group,

   

  I have been successful in setting up the Agents, queues and getting agents to log in.

   

  Is there a way that I could configure the system so that the agent is called back. i.e. the agent logs into the system, a call is destined for them and their phone rings.

   

  If some one has this setup I would be very interested in hearing from them.

   

  Warm Regards and Thanks

   

  ---------------

  Shad Mortazavi

  US Technical Manager

  Nexus Management

   



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20031229/da0e32e8/attachment.htm


More information about the asterisk-users mailing list