locked
Converting Socket written in PHP to VB.net RRS feed

  • Question

  • User75027585 posted

    HI Developers

    I am a .Net developer and I want to access a socket that has been opened for me by my service providers. 

    Their socket is written in PHP and I don't understand PHP at all. Themselves they don't understand VB.Net

    Please help me , the management is awaiting for results. The Code in PHP as as below

    <?

     

     

            $num = $_GET['num'];

            $ext = $_GET['ext'];

           

            echo "Dialing $num from $ext : rn";

           

            $timeout = 10;

            $asterisk_ip = "192.168.0.7";

           

            $socket = fsockopen($asterisk_ip,"5019", $errno, $errstr, $timeout);

            fputs($socket, "Action: Loginrn");

            fputs($socket, "UserName: dialerrn");

            fputs($socket, "Secret: bitcornrn");

           

            $wrets=fgets($socket,128);

            echo $wrets;

           

            fputs($socket, "Action: Originatern" );

            fputs($socket, "Channel: SIP/$extrn" );

            fputs($socket, "Exten: $numrn" );

            fputs($socket, "CallerID: $ext From Dialerrn"); //this i put in so that we can track the users in the CDR and it would display "208 From Dialer" in the screen of the phone where the dailer points to

            fputs($socket, "Context: internalrn" );

            fputs($socket, "Priority: 1rn" );

            fputs($socket, "Async: yesrnrn" );

           

            $wrets=fgets($socket,128);

            echo $wrets;

            echo " EN: ".$errno." ER: ".$errstr;

           

            //usleep(10000000);

           

            ?>

     

    Wednesday, September 21, 2011 3:26 AM

Answers

All replies