[asterisk-bugs] [Asterisk-GUI 0014156]: Cannot sort dialplan outgoing calling rules

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Jan 15 09:47:42 CST 2009


The following issue has been CLOSED 
====================================================================== 
http://bugs.digium.com/view.php?id=14156 
====================================================================== 
Reported By:                dkerr
Assigned To:                awk
====================================================================== 
Project:                    Asterisk-GUI
Issue ID:                   14156
Category:                   Service Providers/Trunks
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     closed
Asterisk Version:           1.4.21.2 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 4389 
Disclaimer on File?:        N/A 
Request Review:              
Resolution:                 no change required
Fixed in Version:           
====================================================================== 
Date Submitted:             2008-12-31 15:21 CST
Last Modified:              2009-01-15 09:47 CST
====================================================================== 
Summary:                    Cannot sort dialplan outgoing calling rules
Description: 
The implementation of dialplans and outbound calling rules in the GUI
introduces a nasty problem due to sorting (or lack thereof). Take a simple
example where you want to route tollfree calls over a different voip
carrier.

If you create the dialplan by directly editing extensions.conf you might
create something like this...

[DLPN_DefaultDialPlan]
exten =
_1NXXNXXXXXX,1,Macro(trunkdial-failover-0.3,${voip1}/${EXTEN:0},,voip1,)
exten =
_1800NXXXXXX,1,Macro(trunkdial-failover-0.3,${voip2}/${EXTEN:0},,voip2,)
exten =
_1888NXXXXXX,1,Macro(trunkdial-failover-0.3,${voip2}/${EXTEN:0},,voip2,)
exten =
_1877NXXXXXX,1,Macro(trunkdial-failover-0.3,${voip2}/${EXTEN:0},,voip2,)
exten =
_1866NXXXXXX,1,Macro(trunkdial-failover-0.3,${voip2}/${EXTEN:0},,voip2,)

This would work nicely because asterisk would sort the extension patterns
and it would match against the 1800/1888/1877/1866 before matching against
1NXX.

But the GUI does not let me create such a dialplan. I cannot add more than
one dial pattern to a calling rule. So I am forced to create something like
this...

[CallingRule_DomesticLD]
exten =
_1NXXNXXXXXX,1,Macro(trunkdial-failover-0.3,${voip1}/${EXTEN:0},,voip1,)
[CallingRule_DomesticTollfree800]
exten =
_1800NXXXXXX,1,Macro(trunkdial-failover-0.3,${voip2}/${EXTEN:0},,voip2,)
[CallingRule_DomesticTollfree888]
exten =
_1888NXXXXXX,1,Macro(trunkdial-failover-0.3,${voip2}/${EXTEN:0},,voip2,)
[CallingRule_DomesticTollfree877]
exten =
_1877NXXXXXX,1,Macro(trunkdial-failover-0.3,${voip2}/${EXTEN:0},,voip2,)
[CallingRule_DomesticTollfree866]
exten =
_1866NXXXXXX,1,Macro(trunkdial-failover-0.3,${voip2}/${EXTEN:0},,voip2,)

Then in the dialplan GUI page I get to select the calling rules I want,
which creates...

[DLPN_DefaultDialPlan]
include = CallingRule_DomesticLD
include = CallingRule_DomesticTollfree800
include = CallingRule_DomesticTollfree888
include = CallingRule_DomesticTollfree877
include = CallingRule_DomesticTollfree866

So, what's the problem?  Well apart from being very cumbersome to create
so many calling rules, the real problem is that asterisk does not sort
extension patterns across "includes".  Patterns inside each include are
sorted, but then the DLPN_DefaultDialPlan is parsed in the order each
include is listed in the context. In the above example DomesticLD is first
and so it's pattern of _1NXX matches both tollfree and toll calls... the
tollfree patterns are never matched.

Manually editing the extension.conf file provides a workaround of sorts.
You can manually add multiple patterns to a calling rule. So you can make
[CallingRule_DomesticLD] look exactly like my first example above. And,
while the GUI calling rules page can't create such a thing, if you create
one manually the GUI page recognizes it and lets you edit it (even change
the order of each pattern... which is unnecessary and a NoOp as asterisk
sorts anyway). But that doesn't fix the core problem of sorting the include
statements in the dialplan which is needed.


Proposed fix...
1) the Dialplan GUI needs redesigned to allow sorting the order that
Calling Rules are included.
2) the Calling Rules GUI needs design change to allow adding patterns to
an existing rule.

I don't have time to tackle a patch of this size right now, but wanted to
open this bug to track the issue and open discussion on it.

David

====================================================================== 

---------------------------------------------------------------------- 
 (0097917) awk (manager) - 2009-01-15 09:47
 http://bugs.digium.com/view.php?id=14156#c97917 
---------------------------------------------------------------------- 
Closing issue as a workaround has been provided and this has been
acknowledged as a feature request. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-01-15 09:47 awk            Note Added: 0097917                          
2009-01-15 09:47 awk            Status                   assigned => closed  
2009-01-15 09:47 awk            Resolution               open => no change
required
======================================================================




More information about the asterisk-bugs mailing list