Open Source Training Seminar FreePBX Paid Support

Ticket #2860 (new Feature Requests)

Opened 4 months ago

Last modified 4 months ago

custom timeout for http CIDlookup

Reported by: bpps Assigned to:
Priority: major Milestone: Cut Line
Component: Other Module Version: 2.4-branch
Keywords: cid lookup timeout Cc:
Confirmation: Confirmed SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

Please add the ability to specify a timeout for http cidlookup so that just in case the internet is down the calls will go thru (I think that now there is a timeout of 45 sec. which is much to long.

could be critical sometimes.

Change History

06/23/08 15:00:34 changed by bpps

ops messed the heading

custom timeout for http CIDlookup

06/23/08 15:27:54 changed by p_lindheimer

  • confirmation changed from Unreviewed to Confirmed.
  • type changed from Bugs to Feature Requests.

Changing to feature request.

Unfortunately there are no options to CURL to provide this, which is how it is currently implemented. It will require a change in implementation, probably using an AGI script, in order to add a timeout.

You could supply your own local version of an http script, and then have that script call the real http service and apply a timeout as requested. Here's something from a quick google search that may help get started (still requires some level of understanding programming a php based script):

http://blog.unitedheroes.net/curl/

06/24/08 01:20:07 changed by bpps

thanks for your advice

after doing a small search on google and tried this which works

right under "case "http":" in the cidlookup module I added

$cl = curl_init();
curl_setopt($cl, CURLOPT_CONNECTTIMEOUT, 5);

it worked as expected

06/24/08 06:28:02 changed by p_lindheimer

  • summary changed from custom tim eout forhttp CIDlookup to custom timeout for http CIDlookup.

I am confused. Are you saying you added those 2 lines to the functions.inc.php file and it made the CURL operation in Asterisk timeout? That doesn't make sense, the CURL function in Asterisk and the CURL functions in PHP don't have anyhing to do do with each other?

06/24/08 06:56:00 changed by bpps

well i'm not a programmer but i tried playing around with what sounded like common sense to me and it worked i have a lookup to a remote server which host our crm data and whenever that site went down (not often) i had no incomming calls they would all get stuck waiting for a response, i inserted these two lines and disconnected the internet, the calls came thru but of course without the name

i think it probbally initilizes the curl command globally and might need to be cleaned up afterwords

06/24/08 07:37:42 changed by p_lindheimer

by the way, you can try this (asterisk modification):

--- func_curl.c 2007-10-26 06:54:30.000000000 -0700
+++ func_curl.modified.c        2008-06-24 07:17:37.000000000 -0700
@@ -104,7 +104,7 @@
                if (!(*curl = curl_easy_init()))
                        return -1;
                curl_easy_setopt(*curl, CURLOPT_NOSIGNAL, 1);
-               curl_easy_setopt(*curl, CURLOPT_TIMEOUT, 180);
+               curl_easy_setopt(*curl, CURLOPT_TIMEOUT, 5);
                curl_easy_setopt(*curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
                curl_easy_setopt(*curl, CURLOPT_USERAGENT, global_useragent);
        }

06/24/08 07:40:51 changed by p_lindheimer

btw - forgot to request, can you run some tests on your change. Can you try setting it to 0 and then a couple of other times, and run some tests each time to time it and see if the timeout is really correlating with those times you set? (0 should be no timeout).

06/24/08 07:55:10 changed by bpps

well seems like i was too fast posting that as it stopped working again now i have to figure out what did help and now stopped i'll keep you updated

06/24/08 08:07:49 changed by p_lindheimer

If you are compiling Asterisk from source, the patch I supplied should be very risk free, you just need to decide what timeout you want to set - my example uses 5 seconds. The file is in the asterisk source tree: ~funcs/func_curl.c

Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads