Doesn't receive call in UCP

Hi All.

I have FreePBX version 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:


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;

Try using a channel of:

fputs($socket, “Channel: Local/[email protected]\r\n” );

It helped, thanks!

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.