[asterisk-bugs] [Asterisk 0012920]: [patch] Added CURL() Function Timeout Argument

noreply at bugs.digium.com noreply at bugs.digium.com
Tue Jun 24 11:43:28 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=12920 
====================================================================== 
Reported By:                davevg
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   12920
Category:                   Functions/func_curl
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     feedback
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 124707 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             06-23-2008 16:12 CDT
Last Modified:              06-24-2008 11:43 CDT
====================================================================== 
Summary:                    [patch] Added CURL() Function Timeout Argument
Description: 
If you have a long running web script the CURL function is currently hard
coded to timeout after 180 seconds.  This patch adds a 3rd parameter to the
function which when set overrides the 180 second default.

Example usage:
exten => 1,1,Set(foo=${CURL(http://127.0.0.1/test.pl,,3)})
Which will set a timeout of 3 seconds on the CURL call.
====================================================================== 

---------------------------------------------------------------------- 
 Corydon76 - 06-24-08 11:43  
---------------------------------------------------------------------- 
Looking over the bounty, it appears that they also want other options to be
settable.  You might want to change this even more, possibly by creating a
CURLOPT() function, whose values can be set, e.g.

Set(CURLOPT(timeout)=30)
Set(CURLOPT(connecttimeout)=10)
Set(CURLOPT(proxy)=http://foo)
Set(CURLOPT(proxytype)=http)
Set(CURLOPT(proxyport)=9138)
etc.

There are a full list of options available on the libcurl API page:
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
(although there are probably a few that aren't terribly useful)

I'd store the data on a channel datastore structure, which is allocated
per-channel.  Perhaps even if the channel structure is not passed into the
function, it should set a global value (which channels will inherit, if not
overridden directly).  Those global values could be stored directly within
variables within the module itself. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
06-24-08 11:43  Corydon76      Note Added: 0089153                          
======================================================================




More information about the asterisk-bugs mailing list