Dear Friends,
I hope to work my code
This code is in PHP et the socket part was take on wiki.pbxnsip.com
thanks for your help
<?
$db="test";
$pbxnsipdomainip[$db] ="192.168.1.5";
$pbxnsipport[$db] ="80";
$pbxnsipdomain[$db] ="test.company.com";
function pbx_soap( $req ) {
global $debug,$pbxnsipdomain,$pbxnsipport,$pbxnsipdomainip,$db;
$dbhandle = fsockopen($pbxnsipdomainip[$db], $pbxnsipport[$db], $errno, $errstr);
if (!$dbhandle) { echo "<font color=red>$errstr ($errno)</font><br>\n"; }
//$request = "POST /soap.xml HTTP/1.0\r\n";
$request .= "Content-Type: text/xml\r\n";
$request .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$request .= $req;
fwrite($dbhandle, $request);
//fwrite($fp, $header.$req);
while (!feof($dbhandle)) { $items .= fgets($dbhandle, 1024);}
fclose($dbhandle);
return($item);
}
function session_csta(){
GLOBAL $pbxServer,$pbxnsipdomain,$db;
$soap='<?xml version="1.0" encoding="UTF-8">
<StartApplicationSession xmlns="http://www.ecma-international.org/standards/ecma-354/appl_session/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<applicationInfo>
<applicationID>My App</applicationID>
<applicationSpecificInfo>
<tns:SessionLoginInfo xmlns:tns="http:// www.pbxnsip.com/schemas/csta/login">
<tns:userName>40</tns:userName>
<tns:password>1234</tns:password>
<tns:domain>test.company.com</tns:domain>
<tns:sessionCleanupDelay>60</tns:sessionCleanupDelay>
</tns:SessionLoginInfo>
</applicationSpecificInfo>
</applicationInfo>
<requestedProtocolVersions>
<protocolVersion>http://www.ecma-international.org/standards/ecma-323/csta/ed3</protocolVersion>
<protocolVersion>http://www.ecma-international.org/standards/ecma-323/csta/ed4</protocolVersion>
<protocolVersion>http://www.ecma-international.org/standards/ecma-323/csta/ed5</protocolVersion>
</requestedProtocolVersions>
<requestedSessionDuration>180</requestedSessionDuration>
</StartApplicationSession>
';
$content=pbx_soap($soap);
return ($content);
}
print (session_csta());
?>
csta.php