Doesn't receive call in UCP

ucp
Tags: #<Tag:0x00007f70265d9cb8>

(Dmitriy) #1

Hi All.

I have FreePBX version 15.0.16.75. I logged in UCP and successfully receive incoming calls there when I call from any Softphone (like Zoiper) to my SIP. So seems my UCP works normal.

But when I try to call to external number through my php script I can’t receive call in UCP (there is no any indication about a call) although I do get call in my Softphone. Both UCP and Softphone registered under same SIP user.

Please help with it. Thanks.

Below is my php script:

<?php

require_once dirname(FILE) . ‘/config.php’;

$asterisk_ip = ASTERISK_IP;
$timeout = 30000;
$ami_login = LOGIN;
$ami_pass = PASS;

$ext = $_GET[‘leg_a’];
$num = $_GET[‘leg_b’];

$socket = fsockopen($asterisk_ip,“5038”, $errno, $errstr, $timeout) or die('Could not connect to: '. $asterisk_ip);
fputs($socket, “Action: Login\r\n”);
fputs($socket, “UserName: $ami_login\r\n”);
fputs($socket, “Secret: $ami_pass\r\n\r\n”);
fputs($socket, “Action: Originate\r\n” );
fputs($socket, “Channel: SIP/$ext\r\n” );
fputs($socket, “Exten: $num\r\n” );
fputs($socket, “Timeout: $timeout\r\n” );
fputs($socket, “Context: outbound-allroutes\r\n” );
fputs($socket, “Priority: 1\r\n” );
fputs($socket, “Async: yes\r\n\r\n” );

$wrets = fgets($socket,128);

if (strpos($wrets, ‘Response: Success’) === 0) {
echo ‘SUCCESS’;
} else {
echo $wrets;
}


(Lorne Gaetz) #2

Try using a channel of:

fputs($socket, “Channel: Local/$ext@from-internal\r\n” );

(Dmitriy) #3

It helped, thanks!