[Asterisk-Dev] specification for exten => lines anywhere ?

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Wed May 18 09:52:04 MST 2005


On Wednesday 18 May 2005 04:18, Luigi Rizzo wrote:
> On Wed, May 18, 2005 at 01:12:09AM -0500, Russell Bryant wrote:
> > Luigi Rizzo wrote:
> > > + i am not sure how the parsing of application is supposed to
> > > work!
> >
> > exten,prior,app,app_data
> >   or
> > exten,prior,app(app_data)
> >
> > The "app_data" is the set of arguments being passed to the
> > application and are parsed by the application itself.
>
> the above descripction is incomplete.
>
> As i said in my original message, there is a lot more that the
> generic code does in parsing exten and priority, or identifying
> quoted strings in the app_data. See at the bottom a repost of what
> the code does.
>
> Re. the comment on the vim syntax file on the wiki:
> there is basically nothing in there:
>
> 	http://www.voip-info.org/wiki-vim+syntax+highlighting
>
> 	" not sure what type this should be, using String for testing.
> 	  HiLink	asteriskExten	String

You might actually want to load the syntax file... it does a lot more
than just this one line.  Vim syntax is terribly complex, so it tends
to be broken up across multiple lines.  That may not be optimal for
you, trying to understand the syntax, but it does work.

> and even the other poster's vim syntax was only dealing with some
> spaces and digits.
>
> So... does anyone knows more ?
>
> 	thanks
> 	luigi
>
> ---------------------------------------
> CURRENT BEHAVIOUR:
>
> + I see the basic format is
>
>         extension[/cid], priority, application
>
> + I see that you can have variables in extension which are evaluated,
>   but that does not apply to 'cid'

Nothing says it couldn't be, just that it isn't that way now.  Note that
you CAN have patterns in the cid, though.

> + i see that 'priority' can be:
>   - a (label_in_parentheses), in which case everything before '('
>     is silently ignored;

No, that defines a label, but everything before the ( is NOT ignored;
instead, it is evaluated and the label is set to that value.

>   - or the keyword 'hint' (case sensitive), no space allowed;
>   - the keyword 'next' or 'n' (useful for compiling lists of
> increasing priority) or 'same' or 's' (useful for compiling lists
> with different CID numbers and same priority);
>     However, in this case, the 'current' priority is silently
> inherited even if you change extensions;

That's correct.  This allows you to do things like:

exten => _29X,n,DBPut(${ext}/location=${EXTEN:2})
; Continue with message
exten => 290,n,Playback(vcch/ext-closed)
exten => 291,s,Playback(vcch/ext-open)
exten => 293,s,Playback(vcch/ext-fw)
; Nonsense message for unknown location
exten => _29X,s,Playback(tt-iguanas)
; And end
exten => _29X,n,Congestion

>   - something preceded by a '+', in which case everything before the
> '+' is silently skipped and anything after is interpreted as a number
> by atoi() and added to the 'current' priority, e.g. 100+-50 gives
> 'current' - 50, which can cause a clash with PRIORITY_HINT or -2 (the
> initial value) ...

No, the value is evaluated.  You can use n, s, a label, or numbers, so
you can define, for example n+200 to advance 201 priorities or
somelabel+101 to define where an application jumps to on its exceptional
condition.

> + i am not sure how the parsing of application is supposed to work!

The application field may be parsed in one of two ways:  the legacy
method is to end the application name after a literal comma; the modern
way is to end the application name before the first opening parenthesis.
As a variation of the first method, an application name can also end at
end-of-line; in this case, appdata is set to NULL.  (There's also an
open bug on this, #4306.)

-- 
Tilghman



More information about the asterisk-dev mailing list