<html><body><span style="font-family:Verdana; color:#000000; font-size:10pt;"><div><br></div><div>I would just type in the web service url manually in a browser, and if the browser displays the response, then there it is, the connection to the host server is open.<br></div><div><br></div><div>Christian Savinovich</div><div><strong><em>VoIP & Telephony Consultant</em></strong></div><div>646-982-3572</div><div> </div><div><br><br></div>
<blockquote id="replyBlockquote" webmail="1" style="border-left: 2px solid blue; margin-left: 8px; padding-left: 8px; font-size:10pt; color:black; font-family:verdana;">
<div id="wmQuoteWrapper">
-------- Original Message --------<br>
Subject: Re: [asterisk-users] problem to socket programming in AGI<br>
From: Justin Killen <<a href="mailto:jkillen@allamericanasphalt.com">jkillen@allamericanasphalt.com</a>><br>
Date: Mon, February 04, 2013 12:25 pm<br>
To: Asterisk Users Mailing List - Non-Commercial Discussion<br>
<<a href="mailto:asterisk-users@lists.digium.com">asterisk-users@lists.digium.com</a>><br>
<br>
<!--[if !mso]> <style>
#wmQuoteWrapper v\:* {behavior:url(#default#VML);}
#wmQuoteWrapper o\:* {behavior:url(#default#VML);}
#wmQuoteWrapper w\:* {behavior:url(#default#VML);}
#wmQuoteWrapper .shape {behavior:url(#default#VML);}
</style> <![endif]--> <style>
#wmQuoteWrapper /* Font Definitions */ @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;}
#wmQuoteWrapper @font-face {font-family:Verdana; panose-1:2 11 6 4 3 5 4 4 2 4;}
#wmQuoteWrapper /* Style Definitions */ p.MsoNormal, #wmQuoteWrapper li.MsoNormal, #wmQuoteWrapper div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";}
#wmQuoteWrapper code {font-family:"Courier New";}
#wmQuoteWrapper span.EmailStyle21 {mso-style-type:personal; font-family:Arial; color:navy;}
#wmQuoteWrapper span.EmailStyle22 {mso-style-type:personal-reply; font-family:Arial; color:navy;}
#wmQuoteWrapper @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in;}
#wmQuoteWrapper div.Section1 {page:Section1;}
</style> <div class="Section1"> <div class="MsoNormal" style="font-size:12pt;"><font color="navy" face="Arial" size="2"><span style="font-size: 10.0pt;font-family:Arial;color:navy">Yes, I think curl would probably be a better option than trying to use sockets directly, but if the socket won’t connect it doesn’t really matter what higher level method is used. <o:p></o:p></span></font></div> <div> <div> <div class="MsoNormal" style="font-size:12pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><font color="navy" face="Arial" size="2"><span style="font-size:10.0pt;font-family:Arial; color:navy">-Justin</span></font> <o:p></o:p></div> </div> </div> <div> <div class="MsoNormal" style="font-size:12pt;text-align:center" align="center"><font face="Times New Roman" size="3"><span style="font-size:12.0pt"> <hr tabindex="-1" align="center" size="2" width="100%"> </span></font></div> <div class="MsoNormal" style="font-size:12pt;"><b><font face="Tahoma" size="2"><span style="font-size:10.0pt; font-family:Tahoma;font-weight:bold">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size:10.0pt;font-family:Tahoma"> <a href="mailto:asterisk-users-bounces@lists.digium.com">asterisk-users-bounces@lists.digium.com</a> [<a href="mailto:asterisk-users-bounces@lists.digium.com">mailto:asterisk-users-bounces@lists.digium.com</a>] <b><span style="font-weight: bold">On Behalf Of </span></b>C. Savinovich<br> <b><span style="font-weight:bold">Sent:</span></b> Monday, February 04, 2013 9:16 AM<br> <b><span style="font-weight:bold">To:</span></b> Asterisk Users Mailing List - Non-Commercial Discussion<br> <b><span style="font-weight:bold">Subject:</span></b> Re: [asterisk-users] problem to socket programming in AGI</span></font><o:p></o:p></div> </div> <div class="MsoNormal" style="font-size:12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12.0pt"><o:p> </o:p></span></font></div> <div> <div class="MsoNormal" style="font-size:12pt;"><font color="black" face="Verdana" size="2"><span style="font-size:10.0pt;font-family:Verdana;color:black"><o:p> </o:p></span></font></div> </div> <div> <div class="MsoNormal" style="font-size:12pt;"><font color="black" face="Verdana" size="2"><span style="font-size:10.0pt;font-family:Verdana;color:black">I don't get it, if it is a web service, why do you use sockets? Isn't it just a matter of calling the web service using curl,and then wait for the response? what am I missing?<o:p></o:p></span></font></div> </div> <div> <div class="MsoNormal" style="font-size:12pt;"><font color="black" face="Verdana" size="2"><span style="font-size:10.0pt;font-family:Verdana;color:black"><o:p> </o:p></span></font></div> </div> <div> <div class="MsoNormal" style="font-size:12pt;"><font color="black" face="Verdana" size="2"><span style="font-size:10.0pt;font-family:Verdana;color:black">Christian Savinovich<o:p></o:p></span></font></div> </div> <div> <div class="MsoNormal" style="font-size:12pt;"><em><b><i><font color="black" face="Verdana" size="2"><span style="font-size:10.0pt;font-family:Verdana;color:black;font-weight:bold">VoIP & Telephony Consultant</span></font></i></b></em><font color="black" face="Verdana" size="2"><span style="font-size:10.0pt;font-family:Verdana;color:black"><o:p></o:p></span></font></div> </div> <div> <div class="MsoNormal" style="font-size:12pt;"><font color="black" face="Verdana" size="2"><span style="font-size:10.0pt;font-family:Verdana;color:black">646-982-3572<o:p></o:p></span></font></div> </div> <div> <div class="MsoNormal" style="font-size:12pt;"><font color="black" face="Verdana" size="2"><span style="font-size:10.0pt;font-family:Verdana;color:black"> <o:p></o:p></span></font></div> </div> <div> <div class="MsoNormal" style="font-size:12pt;margin-bottom:12.0pt"><font color="black" face="Verdana" size="2"><span style="font-size:10.0pt;font-family:Verdana;color:black"><o:p> </o:p></span></font></div> </div> <blockquote style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 6.0pt; margin-left:6.0pt;margin-top:5.0pt;margin-bottom:5.0pt" id="replyBlockquote" webmail="1"> <div id="wmQuoteWrapper"> <div class="MsoNormal" style="font-size:12pt;"><font color="black" face="Verdana" size="2"><span style="font-size:10.0pt;font-family:Verdana;color:black">-------- Original Message --------<br> Subject: Re: [asterisk-users] problem to socket programming in AGI<br> From: Justin Killen <<a target="_blank" href="mailto:jkillen@allamericanasphalt.com"><font color="black"><span style="color:windowtext">jkillen@allamericanasphalt.com</span></font></a>><br> Date: Mon, February 04, 2013 12:05 pm<br> To: Asterisk Users Mailing List - Non-Commercial Discussion<br> <<a target="_blank" href="mailto:asterisk-users@lists.digium.com"><font color="black"><span style="color:windowtext">asterisk-users@lists.digium.com</span></font></a>><br> <br> <br> <o:p></o:p></span></font></div> <u1:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"> <div> <div> <div class="MsoNormal" style="font-size:12pt;"><font color="navy" face="Arial" size="2"><span style="font-size: 10.0pt;font-family:Arial;color:navy">You are correct, this is not an asterisk question. What I would suggest would be to run your script outside of asterisk and debug the connection. Looking at the php doc page for fsockopen (<a href="http://php.net/manual/en/function.fsockopen.php" target="_blank"><u><font color="blue"><span style="color:blue">http://php.net/manual/en/function.fsockopen.php</span></font></u></a>), I see this example:<u1:p></u1:p></span></font><font color="black" face="Verdana"><span style="font-family:Verdana;color:black"><o:p></o:p></span></font></div> </div> <div> <div class="MsoNormal" style="font-size:12pt;"><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt;color:#0000BB"><?php</span></font></code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New";color:#0000BB"><br> <code><font face="Courier New">$fp </font></code></span></font><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; color:#007700">= </span></font></code><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt;color:#0000BB">fsockopen</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; color:#007700">(</span></font></code><code><font color="#dd0000" face="Courier New" size="2"><span style="font-size:10.0pt;color:#DD0000">"www.example.com"</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; color:#007700">, </span></font></code><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt;color:#0000BB">80</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; color:#007700">, </span></font></code><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt;color:#0000BB">$errno</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; color:#007700">, </span></font></code><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt;color:#0000BB">$errstr</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; color:#007700">, </span></font></code><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt;color:#0000BB">30</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; color:#007700">);</span></font></code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New"; color:#007700"><br> <code><font face="Courier New">if (!</font></code></span></font><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; color:#0000BB">$fp</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;color:#007700">) {</span></font></code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New";color:#007700"><br> <code><font face="Courier New"> echo </font></code></span></font><code><font color="#dd0000" face="Courier New" size="2"><span style="font-size:10.0pt; color:#DD0000">"</span></font></code><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt;color:#0000BB">$errstr</span></font></code><code><font color="#dd0000" face="Courier New" size="2"><span style="font-size:10.0pt; color:#DD0000"> (</span></font></code><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt;color:#0000BB">$errno</span></font></code><code><font color="#dd0000" face="Courier New" size="2"><span style="font-size:10.0pt; color:#DD0000">)<br />\n"</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; color:#007700">;</span></font></code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New"; color:#007700"><br> <code><font face="Courier New">} else {</font></code><br> <code><font face="Courier New"> </font></code></span></font><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; color:#0000BB">$out </span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;color:#007700">= </span></font></code><code><font color="#dd0000" face="Courier New" size="2"><span style="font-size:10.0pt; color:#DD0000">"GET / HTTP/1.1\r\n"</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; color:#007700">;</span></font></code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New"; color:#007700"><br> <code><font face="Courier New"> </font></code></span></font><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; color:#0000BB">$out </span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;color:#007700">.= </span></font></code><code><font color="#dd0000" face="Courier New" size="2"><span style="font-size:10.0pt; color:#DD0000">"Host: <a target="_blank" href="http://www.example.com"><u><font color="blue"><span style="color:blue">www.example.com</span></font></u></a>\r\n"</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; color:#007700">;</span></font></code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New"; color:#007700"><br> <code><font face="Courier New"> </font></code></span></font><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; color:#0000BB">$out </span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;color:#007700">.= </span></font></code><code><font color="#dd0000" face="Courier New" size="2"><span style="font-size:10.0pt; color:#DD0000">"Connection: Close\r\n\r\n"</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; color:#007700">;</span></font></code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;font-family:"Courier New"; color:#007700"><br> <code><font face="Courier New"> </font></code></span></font><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; color:#0000BB">fwrite</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;color:#007700">(</span></font></code><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; color:#0000BB">$fp</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;color:#007700">, </span></font></code><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; color:#0000BB">$out</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;color:#007700">);</span></font></code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New";color:#007700"><br> <code><font face="Courier New"> while (!</font></code></span></font><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; color:#0000BB">feof</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;color:#007700">(</span></font></code><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; color:#0000BB">$fp</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;color:#007700">)) {</span></font></code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New";color:#007700"><br> <code><font face="Courier New"> echo </font></code></span></font><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; color:#0000BB">fgets</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;color:#007700">(</span></font></code><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; color:#0000BB">$fp</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;color:#007700">, </span></font></code><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; color:#0000BB">128</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;color:#007700">);</span></font></code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New";color:#007700"><br> <code><font face="Courier New"> }</font></code><br> <code><font face="Courier New"> </font></code></span></font><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; color:#0000BB">fclose</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;color:#007700">(</span></font></code><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt; color:#0000BB">$fp</span></font></code><code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt;color:#007700">);</span></font></code><font color="#007700" face="Courier New" size="2"><span style="font-size:10.0pt; font-family:"Courier New";color:#007700"><br> <code><font face="Courier New">}</font></code><br> </span></font><code><font color="#0000bb" face="Courier New" size="2"><span style="font-size:10.0pt;color:#0000BB">?></span></font></code><code><font color="black" face="Courier New" size="2"><span style="font-size:10.0pt;color:black"> </span></font></code><font color="black" face="Verdana"><span style="font-family: Verdana;color:black"><o:p></o:p></span></font></div> </div> <u1:p></u1:p> <div> <div class="MsoNormal" style="font-size:12pt;"><font color="navy" face="Arial" size="2"><span style="font-size: 10.0pt;font-family:Arial;color:navy"><u1:p> </u1:p></span></font><font color="black" face="Verdana"><span style="font-family:Verdana;color:black"><o:p></o:p></span></font></div> </div> <div> <div class="MsoNormal" style="font-size:12pt;"><font color="navy" face="Arial" size="2"><span style="font-size: 10.0pt;font-family:Arial;color:navy">I would first try running that (put in your host and port) and see what the error string coming back is.<u1:p></u1:p></span></font><font color="black" face="Verdana"><span style="font-family:Verdana;color:black"><o:p></o:p></span></font></div> </div> <div> <div class="MsoNormal" style="font-size:12pt;"><font color="navy" face="Arial" size="2"><span style="font-size: 10.0pt;font-family:Arial;color:navy"><u1:p> </u1:p></span></font><font color="black" face="Verdana"><span style="font-family:Verdana;color:black"><o:p></o:p></span></font></div> </div> <div> <div> <div style="margin-top:5.0pt;margin-bottom:5.0pt"> <div class="MsoNormal" style="font-size:12pt;"><font color="navy" face="Arial" size="2"><span style="font-size: 10.0pt;font-family:Arial;color:navy">-Justin<u1:p></u1:p></span></font><font color="black" face="Verdana"><span style="font-family:Verdana;color:black"><o:p></o:p></span></font></div> </div> </div> </div> <div> <div class="MsoNormal" style="font-size:12pt;text-align:center" align="center"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black"> <hr tabindex="-1" align="center" size="2" width="100%"> </span></font></div> <div> <div class="MsoNormal" style="font-size:12pt;"><b><font color="black" face="Tahoma" size="2"><span style="font-size:10.0pt;font-family:Tahoma;color:black;font-weight:bold">From:</span></font></b><font color="black" face="Tahoma" size="2"><span style="font-size:10.0pt;font-family:Tahoma; color:black"> <a target="_blank" href="mailto:asterisk-users-bounces@lists.digium.com"><u><font color="blue"><span style="color:blue">asterisk-users-bounces@lists.digium.com</span></font></u></a> [<a target="_blank" href="mailto:asterisk-users-bounces@lists.digium.com"><u><font color="blue"><span style="color:blue">mailto:asterisk-users-bounces@lists.digium.com</span></font></u></a>] <b><span style="font-weight:bold">On Behalf Of </span></b>Muhammad<br> <b><span style="font-weight:bold">Sent:</span></b> Monday, February 04, 2013 5:07 AM<br> <b><span style="font-weight:bold">To:</span></b> <st1:personname u2:st="on">Asterisk Users Mailing List - Non-Commercial Discussion</st1:personname><br> <b><span style="font-weight:bold">Subject:</span></b> [asterisk-users] problem to socket programming in AGI</span></font><font color="black" face="Verdana"><span style="font-family:Verdana;color:black"><o:p></o:p></span></font></div> <u1:p></u1:p></div> </div> <div> <div class="MsoNormal" style="font-size:12pt;"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black"><u1:p> </u1:p></span></font><font color="black" face="Verdana"><span style="font-family:Verdana;color:black"><o:p></o:p></span></font></div> </div> <div> <div> <div class="MsoNormal" style="font-size:12pt;"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">Hi,<br> I know maybe this question is not related to asterisk, but I want to make XML RPC web service to other http server.<br> I have elastix system. it is https and problem is source not destination server. In xml rpc we have fsockopen connection to connect destination server(xml rpc server). It return me connect error(0).<br> <br> what is the problem. is this related to elastix(asterisk) server?<u1:p></u1:p></span></font><font color="black" face="Verdana"><span style="font-family:Verdana;color:black"><o:p></o:p></span></font></div> </div> </div> </div> <div class="MsoNormal" style="font-size:12pt;text-align:center" align="center"><font color="black" face="Verdana" size="2"><span style="font-size:10.0pt;font-family:Verdana; color:black"> <hr align="center" size="2" width="100%"> </span></font></div> <div class="MsoNormal" style="font-size:12pt;"><font color="black" face="Verdana" size="2"><span style="font-size:10.0pt;font-family:Verdana;color:black">--<br> _____________________________________________________________________<br> -- Bandwidth and Colocation Provided by <a target="_blank" href="http://www.api-digital.com"><u><font color="blue"><span style="color:blue">http://www.api-digital.com</span></font></u></a> --<br> New to Asterisk? Join us for a live introductory webinar every Thurs:<br> <a target="_blank" href="http://www.asterisk.org/hello"><u><font color="blue"><span style="color:blue">http://www.asterisk.org/hello</span></font></u></a><br> <br> asterisk-users mailing list<br> To UNSUBSCRIBE or update options visit:<br> <a target="_blank" href="http://lists.digium.com/mailman/listinfo/asterisk-users"><u><font color="blue"><span style="color:blue">http://lists.digium.com/mailman/listinfo/asterisk-users</span></font></u></a> <o:p></o:p></span></font></div> </u1:smarttagtype></div> </blockquote> </div> <hr>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</a>
</div>
</blockquote></span></body></html>