[asterisk-dev] Strange behaviour of Incomplete() application

Pavel Troller patrol at sinus.cz
Thu Sep 10 22:35:11 CDT 2009


> On Thursday 10 September 2009 15:56:33 Pavel Troller wrote:
> >   I'm trying to create universal dialplan, capable of handling any
> > combination of en-bloc/overlapped dialling (for channels, which support it,
> > like DAHDI/PRI or SS7). I'm trying to utilize the Incomplete() application,
> > but I cannot find, how it's exactly working.
> >   In a context, I have a "last choice catcher", in principle like this:
> > exten => _!,1,Incomplete(n). It triggers for every digit string, which is
> > not matched by more specific match.
> >   A part of my dialplan looks like this:
> > [ Context 'subscribers_22' created by 'pbx_config' ]
> >   '2200' =>         1. Answer()                                  
> > [pbx_config] 2. Disa(no-password,default-ovlp)             [pbx_config]
> > '2220' =>         1. Macro(stdext,SIP/2220)                    
> > [pbx_config] '2229' =>         1. Macro(faxext)                            
> >  [pbx_config] '2234' =>         1. Progress()                              
> >   [pbx_config] 2. Set(VOLUME(TX)=6)                          [pbx_config]
> > 3. MP3Player(/opt/asterisk/var/mp3/sacred_spirit_11.mp3) [pbx_config] 4.
> > Hangup()                                   [pbx_config] '2244' =>        
> > 1. System(/opt/asterisk/bin/callback LOCAL/${CALLERID(num)}) [pbx_config]
> > 2. Hangup(17)                                 [pbx_config] '2252' =>       
> >  1. Macro(stdext,IAX2/testomt/2252)            [pbx_config] '2290' =>      
> >   1. Goto(volmet,s,1)                           [pbx_config] '_220[2-9]' =>
> >    1. Macro(stdext,SIP/pcsoft/${EXTEN:2})        [pbx_config] '_222[1-8]'
> > =>    1. Macro(answer_with_star,Local/aws${EXTEN})  [pbx_config] '_22XX' =>
> >        1. Macro(stdext,DAHDI/g1/${EXTEN})            [pbx_config]
> >
> >   This subcontext is included to the context containing the "last choice
> > catcher". And now, finally, my question:
> >
> > When the dialplan is entered with dial string of 224, the following occurs:
> >     -- Executing [224 at default-ovlp:1] Incomplete("SIP/2112-086b4d60", "n")
> > in new stack == Spawn extension (default-ovlp, 224, 1) exited INCOMPLETE on
> > 'SIP/2112-086b4d60' == CDR updated on SIP/2112-086b4d60
> >     -- Executing [2244 at default-ovlp:1] System("SIP/2112-086b4d60",
> > "/opt/asterisk/bin/callback LOCAL/2112") in new stack You can see that the
> > digit 4 was dialed in overlap mode and that the extension 2244 was properly
> > executed.
> >
> > And now, let's try it with the initial string of 225:
> >     -- Executing [225 at default-ovlp:1] Incomplete("SIP/2112-086b4d60", "n")
> > in new stack == Spawn extension (default-ovlp, 225, 1) exited INCOMPLETE on
> > 'SIP/2112-086b4d60' -- Sent into invalid extension '225' in context
> > 'default-ovlp' on SIP/2112-086b4d60 -- Executing [i at default-ovlp:1]
> > Goto("SIP/2112-086b4d60", "default,225,1") in new stack
> >
> >   As you can see, Incomplete() is called exactly as in the previous
> > example, but it immediately terminates processing, stating that extension
> > 225 is invalid and activating the "i" extension. There is no possibility to
> > enter any digits, the Incomplete() app immediately quits.
> >   I really cannot find, where is the difference. In both cases, exactly one
> > 4-digit extension exists (2244, 2252) but the first case works and the
> > second doesn't.
> >   Any help ? Or is it a bug ? It's on asterisk-1.6.1.6.
> 
> I have a suspicion that you aren't showing us your entire dialplan, given that
> your dialplan output doesn't match your dialplan.  In any case, if the
> dialplan detects that there's only one extension that could match (i.e. that
> matchmore returns false), then the invalid extension "i" is triggered.  That's
> probably what is happening here, although with your incomplete dialplan, we
> cannot show you why it is the case.
> 
Hi!
  You're right that it's not my complete dialplan, but I'm sure that there are
no other entries starting with 22 in the context I'm talking about (in our
case, default-ovlp).
  I also think that there are always more extensions that could match in my
example, because there is a general entry _22XX, which should match for example
2250, 2251 etc., so, 2252 is not the only one possible. BTW, if my initial
dial string is
1) 2, and the rest in overlap is 2,5,X
2) 22, and the rest in overlap is 5,X
3) 225X and there is no overlap,
  in all these cases it works, it matches either the fully qualified 2252, or
the pattern _22XX. Just the case 225-X is not working at all. 
For the reference, I'm dumping all the default-ovlp dialplan here (the entries
are cut at column 70 to prevent wrapping, but the digit map should be clear
from it).
hyper*CLI> dialplan show default-ovlp
[ Context 'default-ovlp' created by 'pbx_config' ]
  '900' =>          1. Goto(default-ovlp,s,1)                     [pb
... more entries here, in the range 900 - 999
  '999' =>          1. Macro(stddest,.*,,IAX2/testomt,,o,5,20,0,,0,,P
  'i' =>            1. Goto(default,${INVALID_EXTEN},1)           [pb
  's' =>            1. GotoIf($["${ACHAN}" != "" ]?nocli)         [pb
                    2. Set(ACHAN=${CUT(CHANNEL,,1)})              [pb
                    3. GotoIf($["${CUT(DB(TGRP/CAT/${ACHAN}),:,1)}" !
                    4. GotoIf($["${CALLERID(num)}" = "" ]?nocli)  [pb
                    5. Set(ACHAN=${ACHAN}/${CALLERID(num)})       [pb
     [nocli]        6. GotoIf($["${DB(EXT/FEAT/CODEC/${ACHAN})}" = ""
                    7. Set(_SIP_CODEC=${DB(EXT/FEAT/CODEC/${ACHAN})})
     [nocodec]      8. GotoIf($["${DB(EXT/FEAT/HOTI/${ACHAN})}" != ""
                    9. GotoIf($["${DB(EXT/FEAT/HOTD/${ACHAN})}" != ""
                    10. GotoIf($["${DB(EXT/FEAT/CFIM/${ACHAN})}" = ""
                    11. MorseCode( w)                             [pb
     [norm]         12. WaitExten(15,d)                           [pb
                    13. Macro(incept,102)                         [pb
     [hoti]         14. Progress()                                [pb
                    15. PlayTones(ring)                           [pb
                    16. Read(break,,1,n,,1)                       [pb
                    17. StopPlayTones()                           [pb
                    18. GotoIf($["${break}" = "*"]?norm)          [pb
                    19. Goto(${DB(EXT/FEAT/HOTI/${ACHAN})},1)     [pb
     [hotd]         20. WaitExten(4,d)                            [pb
                    21. Goto(${DB(EXT/FEAT/HOTD/${ACHAN})},1)     [pb
  '_0!' =>          1. Set(ORIG_EXTEN=${EXTEN:1})                 [pb
                    2. Goto(pubdial,s,1)                          [pb
  '_9[3-7]XXX' =>   1. Macro(stddest,.*,,IAX2/testomt,,5,5,5,0,,0,,PR
  Include =>        'default-extensions'                          [pb
  Include =>        'local_services'                              [pb
  Include =>        'features-ovlp'                               [pb
  Include =>        'subscribers_21'                              [pb
  Include =>        'subscribers_22'                              [pb
  Include =>        'nonexistent-ovlp'                            [pb

Only in the subcontext "subscribers_22", there are numbers starting with 22,
for sure, and this context was already published. Context "nonexistent-ovlp"
contains only the "last choice catcher" _!.

With regards, Pavel Troller



More information about the asterisk-dev mailing list