[Asterisk-Dev] How do I originate a call in asterisk call manager using php?

Gary Ruddock garyruddock at hotmail.com
Fri May 21 07:44:27 MST 2004


When I browse to this webpage stuff happens. My Xten sip phone extension 
6001 starts to ring saying theres a call from asterisk.

When I answer the call I would expect asterisk to ring Exten 2500. But I 
just get hung up.

Is there another asterisk command I need to issue?


Any ideas?


<?php
$timeout = 7500;
$socket = fsockopen("10.0.0.4","5038", $errno, $errstr, $timeout);
if (!$socket)
{
  echo 'Socket fail<br>';
  echo $errorno . '<br>';
  echo $errstr . '<br>';
  echo $timeout . '<br>';
}
else
{
//fgets($socket);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: cron\r\n");
fputs($socket, "Secret: xxxxxx\r\n\r\n");
fputs($socket, "Action: Originate\r\n");
fputs($socket, "Channel: SIP/6001\r\n\r\n");
fputs($socket, "Context: Default\r\n");
fputs($socket, "Exten: 2500\r\n");
fputs($socket, "Priority: 1\r\n");
fputs($socket, "Callerid: 01517077777\r\n");
//fputs($socket, "Action: Logoff\r\n");
$wrets=fgets($socket);
echo $wrets .'<br>';
$wrets=fgets($socket);
echo $wrets .'<br>';
$wrets=fgets($socket);
echo $wrets .'<br>';
?>

_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger 
http://www.msn.co.uk/messenger




More information about the asterisk-dev mailing list