[Asterisk-Users] (no subject)

Donny Kavanagh kavando at trn.ca
Fri Oct 22 15:06:40 MST 2004


I've been working on the asterisk manager for a few days, today I
started on a little prototype click to talk on the web via php thing.  I
have it working properly except for one thing.  I do a SetVar:
CTTN=<somenumber> over the socket and when the call gets to the socket
its empty.  Is this intended? Is it supposed to work?

Heres my code.

I put the number I wanted to dial into the Account variable and it works
fine, however, when I set it into CTTN using set var, no such luck.  Am
I doing something wrong? Is this feature not intended? Or is it a bug,
anyone have any ideas?  The socket also returns no errors from the call.



Thanks in advance,
Donny

-- code --

<PRE> 
<?php 
$phonenumber1="6164";
$phonenumber2="88626327";
echo ("SetVar: CTTN=$phonenumber2\r\n");
echo ("Account: $phonenumber2\r\n");


$socket = fsockopen("192.168.0.52","5038", $errno, $errstr, $timeout); 
fputs($socket, "Action: Login\r\n"); 
fputs($socket, "UserName: test\r\n"); 
fputs($socket, "Secret: test\r\n");
fputs($socket, "Events: off\r\n\r\n");
 
# fputs($socket, "\r\n\r\n"); 

fputs($socket, "Action: Originate\r\n"); 
fputs($socket, "Channel: Zap/g1/$phonenumber1\r\n"); 
fputs($socket, "MaxRetries: 3\r\n");
fputs($socket, "RetryTime: 30\r\n");
fputs($socket, "WaitTime: 30\r\n");

fputs($socket, "Context: clicktotalk-f\r\n");
fputs($socket, "Extension: s\r\n");
fputs($socket, "Priority: 1\r\n");
fputs($socket, "SetVar: CTTN=$phonenumber2\r\n");
fputs($socket, "Account: $phonenumber2\r\n");
fputs($socket, "Callerid: CRA CTT <(613) 111-1111>\r\n\r\n");

fputs($socket, "Action: Logoff\r\n\r\n"); 
while (!feof($socket)) { 
$wrets .= fread($socket, 8192); 
} 
fclose($socket);
echo $wrets; 
?> 
</pre>


-- and the context -- 
[clicktotalk-f]
exten=> s,1,Answer
exten=> s,2,Wait(2)
exten=> s,3,Noop(${CTTN})
exten=> s,4,Dial(Zap/g1/${ACCOUNTCODE})
exten=> s,5,Hangup

-- the socket reports --
SetVar: CTTN=88626327
Account: 88626327
Asterisk Call Manager/1.0
Response: Success
Message: Authentication accepted

Response: Success
Message: Originate successfully queued

Response: Goodbye
Message: Thanks for all the fish.






More information about the asterisk-users mailing list