[asterisk-bugs] [Asterisk 0012920]: [patch] Added CURL() Function Timeout Argument
noreply at bugs.digium.com
noreply at bugs.digium.com
Fri Jul 11 14:26:59 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: 07-11-2008 14:26 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.
======================================================================
----------------------------------------------------------------------
davevg - 07-11-08 14:26
----------------------------------------------------------------------
Ok finally got around to trying to test this. Few issues:
The current patch will not compile on centos5 due to curl version number
differences:
curl --version
curl 7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b
zlib/1.2.3 libidn/0.6.5
Protocols: tftp ftp telnet dict ldap http file https ftps
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
uname -a
Linux asterisk 2.6.18-8.1.10.el5 http://bugs.digium.com/view.php?id=1 SMP Thu
Sep 13 12:17:54 EDT 2007 i686
i686 i386 GNU/Linux
The problem is CURLOPT_TIMEOUT_MS and CURLOPT_CONNECTTIMEOUT_MS. Both the
_MS options were added in 7.16.2. The standard whole second timeouts
appear to be there.
After removing the _MS option and changing the type from OT_INTEGER_MS to
OT_INTEGER it compiled fine. Another small change is the cookie parameter
should be CURLOPT_COOKIE.
In testing I 1st wanted to test the httptimeout option. So I set the
dialplan up like this:
exten => 77,1,Answer()
exten => 77,n,NoOp(${EPOCH})
exten => 77,n,Set(CURLOPT(httptimeout)=10)
exten => 77,n,Set(foo=${CURL(http://192.168.175.97/nascar/test.pl)})
exten => 77,n,NoOp(${EPOCH})
exten => 77,n,Hangup
This seems to ignore the timeout, but when it does actually get a return
from the page, it cores.
Backtrace will be attached to this bug shortly.
Issue History
Date Modified Username Field Change
======================================================================
07-11-08 14:26 davevg Note Added: 0090120
======================================================================
More information about the asterisk-bugs
mailing list