[Asterisk-Users] Manager API on gives the DIALSTATUS of the first picked up channel?

Jeremy Lichfield jeremy at daqe.com
Fri Jan 21 11:51:21 MST 2005


Hi All!

Let me explain the problem. When using the Originate 
command from the manager api, the dialstatus variable returns results 
for whichever phone picks up first, and in this case it is the IAX/2 
connection. It doesn't matter if Zap/G2/XXXXXXX is set as the channel, 
or an extension either. What I am ultimately trying to do is get the 
dialstatus of the Zap/X/XXXXXXX channel, i.e., BUSY, ANSWER, 
  NOANSWER........ Is there anyway to specify which channel you want to 
monitor with dialstatus? Or does anyone know a work around?

I'm running Asterisk CVS-v1-0-12/20/04. I'm using PHP with Manager API  
Here is the code:

####################################################################
# Make call
####################################################################
$socket = fsockopen($ask_db,"5038", $errno, $errstr, $timeout);
if (!$socket) {
echo "$errstr ($errno)<br /\n";
} else {
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: $ask_us\r\n");
fputs($socket, "Secret: $ask_pd\r\n\r\n");

fputs($socket, "Action: Originate\r\n");
// Note I have tried both using the remote SIP user throught IAX2 and  
Originating the call using the Zap channel
fputs($socket, "Channel:  
IAX2/askdaqe:a\$teri\$k at teenlighthouse/$user_ext at auto_answer\r\n");    
//This connects to a remote SIP user
fputs($socket, "Context: askdaqe\r\n");
fputs($socket, "Exten: 100\r\n");
fputs($socket, "Priority: 1\r\n");
fputs($socket, "Variable:  
UID=$uid|USER_EXT=$user_ext|COMPANY=teenlighthouse|USER_PHONE=$ask_phone 
\r\n");
fputs($socket, "Callerid: DAQE Dialer\r\n\r\n"); // DAQE is the name of  
my CRM

fclose($socket);u fputs($socket, "Action: Logoff\r\n\r\n");

while (!feof($socket)) {
$content = fread($socket, 8192);
echo $content."<br\n";
}
fclose($socket);

Here is my Dial Plan:

[askdaqe]

; DAQE Dialing Out
exten =100,1,Playback(vm-dialout)
exten =100,2,Dial(Zap/g2/1${USER_PHONE},10,tT)
exten =100,3,Goto(s-${DIALSTATUS},1)
exten =s-CANCEL,1,NoOp(Cancell)
exten =s-ANSWER,1,NoOp(Test Were In)
exten =s-ANSWER,2,Goto(h,1)
exten =s-NOANSWER,1,NoOp(NOANSWER)
exten =s-BUSY,1,NoOp(BUSY)
exten =s-CONGESTION,1,NoOp(CONGESTION)
exten =s-CHANUNAVAIL,1,NoOp(CHANUNAVAIL)

; When DAQE Dialer Hangs Up
exten =h,1,DeadAGI(end_call.php)
exten =h,2,NoOp(Hang Up Dail Status ${DIALSTATUS})

Is there any patches in the latest CVS-HEAD? Also do you know if having  
a PRI and getting the HANGUPCAUSE might solve the problem?

Thanking you in advance,
Jeremy




More information about the asterisk-users mailing list