[TriLUG] Asterisk Question: Pattern Matching

Brian Henning bhenning at pineinst.com
Tue Aug 9 10:54:39 EDT 2011


Hi Folks,

The recent Asterisk thread reminded me that I have a question about my
setup.  I have the following in my extensions.conf:

exten => _5XX,1,Dial(SIP/${EXTEN}&SIP/r${EXTEN},15,tTrg)
exten => _5XX,2,Goto(v${EXTEN}-${DIALSTATUS},1)
exten => _v5XX-ANSWER,1,Hangup
exten => _v5XX-.,1,Voicemail(${EXTEN:1:3},u)
exten => _v5XX-.,2,Hangup

As some of you might already have surmised, this doesn't work the way I want
it to.  If the person called hangs up before the person calling, the person
calling gets shunted into voicemail.  Here's some verbose console output
showing the sequence of events (minus warnings about missing SIP peers):

ps-pbx*CLI> console dial 505 at internal
  == Console is full duplex
    -- Executing [505 at internal:1] Dial("Console/dsp",
"SIP/505&SIP/r505,15,tTrg") in new stack
    -- Called 505
    -- SIP/505-00000260 is ringing
    -- SIP/505-00000260 answered Console/dsp
 << Console call has been answered >>
    -- Executing [505 at internal:2] Goto("Console/dsp", "v505-ANSWER,1") in
new stack
    -- Goto (internal,v505-ANSWER,1)
    -- Executing [v505-ANSWER at internal:1] VoiceMail("Console/dsp", "505,u")
in new stack
    -- <Console/dsp> Playing
'/var/spool/asterisk/voicemail/default/505/unavail.slin' (language 'en')
ps-pbx*CLI> console hangup
  == Spawn extension (internal, v505-ANSWER, 1) exited non-zero on
'Console/dsp'
 << Hangup on console >>

So clearly the _v5XX-. line is matching ahead of the _v5XX-ANSWER line.  I
know that * applies some sorting to the patterns in extensions.conf; what I
need to know is the best way of handling this situation (i.e. "go to voice
mail if the status isn't ANSWER").  

Thanks for any and all suggestions!

Cheers,
~Brian



------------------------------------------------------ 
          Brian Henning, Software Engineer

    /\    Pine Research Instrumentation 
   //\\   5908 Triangle Drive 
  ///\\\  Raleigh, NC 27617 
 ////\\\\ USA 
    || 
    ||    phone: 919.782.8320 
          fax:   919.782.8323 
          email: bhenning at pineinst.com 
------------------------------------------------------ 







More information about the TriLUG mailing list