RP
Size: a a a
RP
ST
ST
AS
A
A
AP
NK
NK
MR
MR
ИШ
RP
MR
$socket = stream_socket_client("tcp://x.x.x.x:$port");
if($socket)
{
echo "Connected to socket, sending authentication request.\n";
// Prepare authentication request
$authenticationRequest = "Action: Login\r\n";
$authenticationRequest .= "Username: $username\r\n";
$authenticationRequest .= "Secret: $password\r\n";
$authenticationRequest .= "Events: off\r\n\r\n";
// Send authentication request
$authenticate = stream_socket_sendto($socket, $authenticationRequest);
if($authenticate > 0)
{
// Wait for server response
usleep(200000);
// Read server response
$authenticateResponse = fread($socket, 4096);
var_dump($authenticateResponse);
// Check if authentication was successful
if(strpos($authenticateResponse, 'Success') !== false)
{
echo "Authenticated to Asterisk Manager Inteface. Initiating call.\n";
// Prepare originate request
$originateRequest = "Action: Originate\r\n";
$originateRequest .= "Channel: local/$internalPhoneline\r\n";
// $originateRequest .= "Callerid: click 2 Call\r\n";
$originateRequest .= "Exten: $target\r\n";
$originateRequest .= "Context: $context\r\n";
$originateRequest .= "Priority: 1\r\n";
$originateRequest .= "Async: yes\r\n\r\n";
RP
"Channel: local/$internalPhoneline\r\n";
- тут контекст тоже нуженRP
"Channel: SIP/$internalPhoneline\r\n"
RP
MR
[2021-08-13 11:27:38] WARNING[17467] chan_sip.c: Purely numeric hostname (87787529540), and not a peer--rejecting!
RP