Summary:ASTERISK-08865: [patch] Asterisk duplicates results for enumlookups
Reporter:Mike Jagdis (mjagdis)Labels:
Date Opened:2007-02-23 11:09:33.000-0600Date Closed:2007-05-16 15:19:47
Versions:Frequency of
Environment:Attachments:( 0) ast-enum.diff
Description:It seems asterisk doesn't cache dns results, so if you loop through results (as in the enum complaint example http://www.voip-info.org/wiki/view/RFC+Compliant+ENUM+Macro) [^] if there are multiple results asterisk will try the same route multiple times as it expects the results from the dns cache to be in the same order all the time, but this doesn't occur.

Asterisk needs to some how cache results for the duration of a call, rather then constant calls to DNS lookups...


This is definitely a bug not a feature request! :-)

If you have 2 enum records for a number with equal weights and one path is unreachable then the combination of re-lookup plus DNS round robin means that you either always see the working path or always see the broken path. i.e. the expected failover doesn't work.
Comments:By: Mike Jagdis (mjagdis) 2007-02-23 13:56:00.000-0600

Added patch.

I propose that an option that contains "%d" should be used to generate and set variables on the local channel for the results while returning the number of results found. i.e. result%d sets result1, result2..., result<n> to the results and returns n.

This is arguably better than caching the DNS reply globally since it means multiple calls will automatically round robin over the set of equally-weight NAPTRs. And it's easier to implement :-)

N.B. Disclaimer on file from Feb 2004.

By: Russell Bryant (russell) 2007-05-16 15:19:46

Thank you very much for your contribution.  However, a patch has just been committed that solves this issue in a slightly different way.  There are two new dialplan functions in trunk, ENUMQUERY and ENUMRESULT.  ENUMQUERY can be used to initiate an ENUM lookup where the results will be cached for the calling channel.  Then, the ENUMRESULT function can be used to access these cached results.  Hopefully this will suit your needs.