[Asterisk-Users] parsing extension name in a command

snacktime snacktime at gmail.com
Sat May 28 20:10:34 MST 2005


I'm working on a multi user database for *, and I'm debating with
myself on something and thought I would throw it out for comment.

I have a design where context names are stored in the database in the
following format:

__username__contextname__

Now, in the web interface it's easy to parse the above string and
display 'contextname' as the context, so the user doesn't have to deal
with the naming convention directly.  The trick is parsing context
names entered by the user and formatting them for the database.  Every
command that can contain a context has a different format, and with
commands like Dial there is a different format for each channel type.

So I'm thinking that for now, I would just require context names to be
entered with a leading and trailing double underscore (ie
__contextname__, and at a later time come up with the regex's to parse
everything correctly.

One factor here is that I don't know for sure which commands could
possibly have a context, and the time to go through them all, then
write a parser for each one could take a while.

Comments?

Chris



More information about the asterisk-users mailing list