From the log, it seems that the script worked since the extension was answered and the call was initiated. I can't say if the script or the pbx is to be investigated first.
The "originating number" is not use by asterisk, just displayed in the popup.
Are you using any cluster at all? Choosing a specific trunk to dialout is not done in the script. It must be in the extension and route config I think.
Notes about dialing. Dialing is done with this:
First the login...
$oSocket = fsockopen($strHost, 5038, $errnum, $errdesc) or die("Connection to PBX failed");
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");
then calling the extension (like SIP/5000)...
fputs($oSocket, "Action: originate\r\n");
fputs($oSocket, "Channel: $strChannel\r\n");
fputs($oSocket, "WaitTime: $strWaitTime\r\n");
finaly, calling the number using a context...
fputs($oSocket, "CallerId: $strCallerId\r\n");
fputs($oSocket, "Exten: $strExten\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);
In fact, in its simple form, sending parameters and action code followed by 2 empty lines ("\r\n\r\n") is interpreted in asterisk as a command and the PBX executes the command.