antoine Posted March 23, 2012 Report Share Posted March 23, 2012 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 Quote Link to comment Share on other sites More sharing options...
pbx support Posted April 9, 2012 Report Share Posted April 9, 2012 Not a PHP expert, but can you see everything is sent out on the wire as explained here? - http://wiki.snomone.com/index.php?title=CSTA_example for details. Quote Link to comment Share on other sites More sharing options...
antoine Posted June 17, 2012 Author Report Share Posted June 17, 2012 The solution is to not use EOF in the socket, there is a problemen in php to detect the EOF of snomone Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.