Summary:ASTERISK-17983: Extenstion sort and n priority
Reporter:Jefferson Carlos Machado (jefferson)Labels:
Date Opened:2011-06-08 08:53:19Date Closed:2011-06-13 13:03:42
Versions:1.8.4 Frequency of
Environment:Linux CentOS 5.6 i686Attachments:
Description:Priority is not seted correctely

;#include /var/www/cgi-bin/ripabx/ramais.conf
;#include /var/www/cgi-bin/ripabx/transbordo.conf
;#include /var/www/cgi-bin/ripabx/ramais_fim.conf
exten => 7454,1,Dial(SIP/Luis&IAX2/Luis,90,WwTtRr)
exten => 7454,n,VoiceMail(7454)
exten => 777,1,Dial(SIP/luis&IAX2/luis,90,WwTtRr)
exten => 777,n,VoiceMail(777)
exten => 1234,1,Dial(SIP/Luis Henrique&IAX2/Luis Henrique,90,WwTtRr)
exten => 1234,n,VoiceMail(1234)
exten => 999,1,Dial(SIP/LUIS&IAX2/LUIS,90,WwTtRr)
exten => 999,n,VoiceMail(999)
exten => 999,n,Macro(transbordo,777,${EXTEN})
exten => 7454,n,Hangup
exten => 777,n,Hangup
exten => 1234,n,Hangup
exten => 999,n,Hangup

voip0*CLI> dialplan show teste
[ Context 'teste' created by 'pbx_config' ]
 '1234' =>         1. Dial(SIP/Luis Henrique&IAX2/Luis Henrique,90,WwTtRr) [pbx_config]
                   2. VoiceMail(1234)                            [pbx_config]
                   6. Hangup()                                   [pbx_config]
 '7454' =>         1. Dial(SIP/Luis&IAX2/Luis,90,WwTtRr)         [pbx_config]
                   2. VoiceMail(7454)                            [pbx_config]
                   4. Hangup()                                   [pbx_config]
 '777' =>          1. Dial(SIP/luis&IAX2/luis,90,WwTtRr)         [pbx_config]
                   2. VoiceMail(777)                             [pbx_config]
                   5. Hangup()                                   [pbx_config]
 '999' =>          1. Dial(SIP/LUIS&IAX2/LUIS,90,WwTtRr)         [pbx_config]
                   2. VoiceMail(999)                             [pbx_config]
                   3. Macro(transbordo,777,${EXTEN})             [pbx_config]
                   7. Hangup()                                   [pbx_config]

-= 4 extensions (13 priorities) in 1 context. =-
Comments:By: David Woolley (davidw) 2011-06-08 09:29:52.282-0500

I believe this is how it is supposed to work. n gives the previous line's priority, plus one, not the the priority of the last literal match on the pattern field.

In any case, even if not as intended, it doesn't meet the criteria for "major".

By: Jefferson Carlos Machado (jefferson) 2011-06-08 14:37:34.961-0500

Sure, but it must be done after sort not before.

By: David Woolley (davidw) 2011-06-09 05:25:48.372-0500

Where is this specified?  If it is not specified, then the de facto behaviour is the specification.

Also, if this were a bug, the correct component would be PBX/pbx_config

By: David Woolley (davidw) 2011-06-09 07:20:46.523-0500

This is what extensions.conf.sample says for 1.8.4:

; Each step of an extension is ordered by priority, which must always start
; with 1 to be considered a valid extension.  The priority "next" or "n" means
; the previous priority plus one, regardless of whether the previous priority
; was associated with the current extension or not.  The priority "same" or "s"

Note the bit that says regardless of whether the previous line was for the current extension.

By: Jefferson Carlos Machado (jefferson) 2011-06-09 08:39:04.101-0500

Sorry for my english.
Is mu fist time here.
I open this issue with 2 components, pbx_config and dial.
you can see the priority 1 for each extenstions, but if I am sure, the n priority is replaced before the context be sorted.

By: Leif Madsen (lmadsen) 2011-06-13 13:03:20.719-0500

I'm closing this issue due to the note that specifically states that the extensions and such must all be grouped together.