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.
-Justin
________________________________
From: [email protected] 
[mailto:[email protected]] On Behalf Of C. Savinovich
Sent: Monday, February 04, 2013 9:16 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] problem to socket programming in AGI


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?

Christian Savinovich
VoIP & Telephony Consultant
646-982-3572


-------- Original Message --------
Subject: Re: [asterisk-users] problem to socket programming in AGI
From: Justin Killen 
<[email protected]<mailto:[email protected]>>
Date: Mon, February 04, 2013 12:05 pm
To: Asterisk Users Mailing List - Non-Commercial Discussion
<[email protected]<mailto:[email protected]>>


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 
(http://php.net/manual/en/function.fsockopen.php), I see this example:
<?php
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)<br />\n";
} else {
    $out = "GET / HTTP/1.1\r\n";
    $out .= "Host: www.example.com<http://www.example.com>\r\n";
    $out .= "Connection: Close\r\n\r\n";
    fwrite($fp, $out);
    while (!feof($fp)) {
        echo fgets($fp, 128);
    }
    fclose($fp);
}
?>

I would first try running that (put in your host and port) and see what the 
error string coming back is.

-Justin
________________________________
From: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] On Behalf Of Muhammad
Sent: Monday, February 04, 2013 5:07 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: [asterisk-users] problem to socket programming in AGI

Hi,
I know maybe this question is not related to asterisk, but I want to make XML 
RPC web service to other http server.
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).

what is the problem. is this related to elastix(asterisk) server?
________________________________
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to