[asterisk-users] Question on Priorities

Steve Murphy murf at parsetree.com
Mon Apr 2 07:53:31 MST 2007


On Sun, 2007-04-01 at 10:49 +0200, Philipp Kempgen wrote:

> Priority jumping is deprecated anyways. Better use something
> like Goto(s-${DIALSTATUS},1). See extensions.conf for examples.
> 
> Regards,
>   Philipp
> 

I totally agree! While you can get what you want with +101 
jumping, I highly suggest you NOT USE IT. The above 
Goto(s-${DIALSTATUS}|1) can get you where you want to go,
and a few other different ways, too:

In AEL:

Dial(.....)
switch(${DIALSTATUS})
{
   case BUSY:
      whatever;
      break;
   case UNAVAILABLE:
      whatever;
      break;
   case ....
}

would work, as well as:

Dial(...);
if("${DIALSTATUS}" == "BUSY")
 { .... }
else if("${DIALSTATUS}" == "UNAVAILABLE")
 {...}
else ...


would also work.

But I find it awkward that you would use labels (invented to help get
rid of specific priority numbers being used) plus +101 jumping!

You don't need +101 jumping to do what you want to do; they are
DEPRECATED, and will soon disappear; using them can lead to confusion
and bugs; so now is a good time to start writing dialplans that don't
use them, and avoid an expensive rewrite later!

I mentioned confusion and bugs above... I'd like to illustrate...

Here are a few of the apps that offer +101 priority jumping:
voicemail, queue, authenticate, sendtext, dial, playback, transfer,
chanisavail, 
system, and more. The really interesting stuff happens when two or three
of these apps are used in sequence in the dialplan, and you aren't
taking into account what might happen if one of them jumps to +101 and
you weren't thinking it would!

at priority 1: Playback(something)
            2: Chanisavail(...)
            3. Dial( ...)
            4. Playback(somethingelse)
at priority 104: Playback(yetsomethingelse)
            105: Voicemail()
            106: goto somewhereelse

If there's a problem with the 4. playback, you'll end up collecting
voicemail!

In order to avoid this kind of problem, you have to spread out your
priority numbers so one calls' +101 jump won't jump into another's +101
block. To do this, you have to know how big each call's +101 block is.
So you can kiss goodbye to the niceness of using n priorities instead of
specific numbers, and then you also have complications if you have to
add code to a +101 block, and the numbers start
to intrude on some other +101 block. And, on top of that, you have to
stick in some extra goto's to jump to the next priority, because of the
priority spreading!

Using the +101 stuff and doing solid dialplan programming would demand
that you do exactly what I've outlined in the last paragraph! You can't
expect to just IGNORE the possibilities. My first ideas about building a
compiler for asterisk were based on automatically doing all the stuff I
just outlined, so the average user wouldn't fall into the traps and
snares of what can occur when you aren't careful.


There are good reasons they decided to go with result values instead of
+101 jumping, and in my opinion, not using +101 jumping would be a
better path to walk down!

murf

       

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3239 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20070402/eb2b6672/smime.bin


More information about the asterisk-users mailing list