Your Call Cannot Be Completed As Dialed

<?php #ip address that asterisk is on. $strHost = "127.0.0.1"; $strUser = "user";#specify the asterisk manager username you want to login with $strSecret = "pwd";#specify the password for the above user #specify the channel (extension) you want to receive the call requests with #e.g. SIP/XXX, IAX2/XXXX, ZAP/XXXX, etc # $strChannel = "SIP/100"; $strChannel = "SIP/1000/phone"; $strContext = "from-internal"; #specify the amount of time you want to try calling the specified channel before hangin up $strWaitTime = "30"; #specify the priority you wish to place on making this call $strPriority = "1"; #specify the maximum amount of retries $strMaxRetry = "2"; $number="phone"; $pos=strpos($number,"local"); if ($number == null) : exit() ; endif ; if ($pos===false) : $errno=0 ; $errstr=0 ; $strCallerId = ""; $oSocket = fsockopen ("localhost", 5038, &$errno, &$errstr, 30); if (!$oSocket) { echo "$errstr ($errno)
\n"; } else { fputs($oSocket, "Action: login\r\n"); fputs($oSocket, "Events: off\r\n"); fputs($oSocket, "Username: $strUser\r\n"); fputs($oSocket, "Secret: $strSecret\r\n\r\n"); fputs($oSocket, "Action: originate\r\n"); fputs($oSocket, "Channel: $strChannel\r\n"); fputs($oSocket, "WaitTime: $strWaitTime\r\n"); fputs($oSocket, "CallerId: $strCallerId\r\n"); fputs($oSocket, "Exten: $number\r\n"); fputs($oSocket, "Context: $strContext\r\n"); fputs($oSocket, "Priority: $strPriority\r\n\r\n"); fputs($oSocket, "Action: Logoff\r\n\r\n"); sleep(2); fclose($oSocket); } echo "Extension $strChannel should be calling $number." ; else : exit() ; endif ; ?>

Your Call Cannot Be Completed As Dialed

Help you with what? You have not asked a question.

You also have not told us what version of FreePBX you are running, and Asterisk and how it was installed.

The declarations fragment you posted is not something you should have to touch.