[Freeswitch-users] how to make web call on mod_curl using proxy ?

Jack Nikolas jack.nikolas at ymail.com
Sun Jul 8 19:23:35 MSD 2012


hi All,
i am going to making web call using mod_curl in freeswitch,
it is noticable that on my freeswitch for having  internet access ,user have to  set proxy,
for example set proxy on the address like this: http_proxy=http://10.10.10.1:2343 

now i want to running web call as the following way,but how can i set proxy on lua?

web_url = "http://tycho.usno.navy.mil/cgi-bin/timer.pl"

num_reads = 0

api = freeswitch.API()
session:answer()
while(session:ready() == true and num_reads < 10) do
freeswitch.consoleLog("INFO","URL: " .. web_url .. "\n")
raw_data = api:execute("curl", web_url)
freeswitch.consoleLog("INFO","Raw data:\n" .. raw_data .. "\n\n")

date_time = string.match(raw_data,"<BR>.-UTC",1)
if (date_time == nil) then
freeswitch.consoleLog("INFO","UTC date and time not found\n")
else
freeswitch.consoleLog("INFO","UTC date and time is '" .. date_time .. "'\n")

time = string.gsub(date_time,".-(%d+:%d+:%d+).+","%1")
freeswitch.consoleLog("INFO","Time is '" .. time .. "'\n\n")
session:streamFile("phrase:simple_time:" .. time)
end
num_reads = num_reads + 1
session:execute("sleep","1000")
end
session:hangup()


any help is welcome,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120708/399030d5/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list