Transfer Queue Call using AMI


#1

Hi All,

Here is the scenario

  1. call is coming to queue and transfered to agent.
  2. Agent talk and wants to transfer the call to other agent using AMI (Redirect)
  3. we originate a new call and put the agent2 in meetme room with caller and agent1.
  4. it is working fine as conference but when any of two main channel hangs up (Caller or First Agent). Second channel will autometically hang up.
  5. I am using asterisk 1.4.41

Is it a bug or do i need to change my dialplan

Thanks

Vijay Goyal


#2

extensions.conf

exten = s,1,queue(testqueue|hRt|||800|agentupdate.php,${lang})

AMI code (PHP):

//Call agent and put him in a conference room

$file = fsockopen(“localhost”,“5038”);
fwrite($file, “Action: Login\r\n”);
fwrite($file, “UserName: admin\r\n”);
fwrite($file, “Secret: alliance\r\n”);
$actionid=rand(000000000,9999999999);
fwrite($file, “actionid: “.$actionid.”\r\n\r\n”);

fwrite($file, “Action: originate\r\n”);
fwrite($file, “Channel: SIP/$transferchan\r\n”);
fwrite($file, “Callerid: $extn\r\n”);
fwrite($file, “Context: konfer\r\n”);
fwrite($file, “Exten: 2001\r\n”);
fwrite($file, “Priority: 1\r\n”);
$actionid4=rand(000000000,9999999999);
fwrite($file, “actionid: “.$actionid4.”\r\n\r\n”);

fwrite($file, “Action: Logoff\r\n”);
$actionid3=rand(000000000,9999999999);
fwrite($file, “actionid: “.$actionid3.”\r\n\r\n”);
fclose($file);

//Redirct caller and agent to conference room
$file = fsockopen(“localhost”,“5038”);
fwrite($file, “Action: Login\r\n”);
fwrite($file, “UserName: admin\r\n”);
fwrite($file, “Secret: alliance\r\n”);
$actionid=rand(000000000,9999999999);
fwrite($file, “actionid: “.$actionid.”\r\n\r\n”);

fwrite($file, “Action: Redirect\r\n”);
fwrite($file, “Channel: $callerchannel\r\n”);
fwrite($file, “ExtraChannel: $extn\r\n”);
fwrite($file, “Exten: 2001\r\n”);
fwrite($file, “Context: konfer\r\n”);
fwrite($file, “Priority: 1\r\n”);
$actionid2=rand(000000000,9999999999);
fwrite($file, “actionid: “.$actionid2.”\r\n\r\n”);

fwrite($file, “Action: Logoff\r\n”);
$actionid3=rand(000000000,9999999999);
fwrite($file, “actionid: “.$actionid3.”\r\n\r\n”);

fclose($file);

//Remove Agent 1 from meetme

$file = fsockopen(“localhost”,“5038”);
fwrite($file, “Action: Login\r\n”);
fwrite($file, “UserName: admin\r\n”);
fwrite($file, “Secret: alliance\r\n”);
$actionid=rand(000000000,9999999999);
fwrite($file, “actionid: “.$actionid.”\r\n\r\n”);
stream_set_timeout($file, 1);
$response = stream_get_contents($file);
fwrite($file, “Action: Redirect\r\n”);
fwrite($file, “Channel: $chnlname\r\n”);
fwrite($file, “Exten: s\r\n”);
fwrite($file, “Context: hangup\r\n”);
fwrite($file, “Priority: 1\r\n”);
$actionid2=rand(000000000,9999999999);
fwrite($file, “actionid: “.$actionid2.”\r\n\r\n”);
$response = stream_get_contents($file);
fwrite($file, “Action: Logoff\r\n”);
$actionid3=rand(000000000,9999999999);
fwrite($file, “actionid: “.$actionid3.”\r\n\r\n”);
$response = stream_get_contents($file);
fclose($file);


#3

Depends on the options used for the conference.


#4

David55 thanks for your reply

i am using as follows

exten = _XXXX,n,meetme(${EXTEN},1rq)

This is problem only comes when hangup occured on any of two main channels (caller and actual agent --assigned by queue). If 2 nd agent disconnect call, rest 2 channels will remain active in meet me room.

If there is any option kindly let me know

thanks again


#5

any help?


#6

??


#7

You are not waiting 24 hours between bumps. My view on this is that we would need a lot more debugging output to get a start on this, but it may well involve digging into the source code to understand what is going on. There are maybe a dozen regulars here, many of whom won’t be able to got to the last stage. You will have to accept that you might not get an answer, or the answer might be “that’s the way it is”.


#8

it worked after upgrading system to asterisk-1.8.8