[asterisk-dev] Command Syntax -- weird?

Peter Beckman beckman at purplecow.com
Fri Apr 21 20:34:31 MST 2006


Hi folks --

I have *not* been involved in any development of Asterisk, so I feel
sheepish questioning your methods.  Of course, this has never stopped me
before, and not about to change. :-)

Is there any reason why Asterisk has chosen such strange and inconsistent
methods of passing variables to functions?

     VoiceMail([flags]boxnumber[@context][&boxnumber2[@context]][&boxnumber3])

     Goto([[context|]extension|]priority)

     RetryDial(announce|sleep|loops|Technology/resource[&Technology2/resource2...[|timeout[|options[|URL]]]])

Coming from programming in other languages, I'm flummoxed by the syntax of
many Asterisk commands.

For example, I would expect the functions above to look more like this:

     Goto( priority [, extension [, context]] )

     RetryDial( Dial( ... ) , announce [, sleep [, loops ]] )

     Voicemail( boxnum[@context] [ & boxnumber & boxnumber & ... ] [, flags ] )

Something where every time I specify the first parameter, I always know
what it is.  Currently if I add on things to Goto, the first parameter
could be a priority, an extension or a context.  Who knows!  Sure,
obviously you can tell, but I guess I'm asking why!

BTW, the only reason this really has become clear is because I'm working on
PHP-like documentation for Asterisk.  OK, I just stole what PHP did and
made it for Asterisk.  I'm not nearly done, but the framework is there for
review:

     http://mph.gotdns.com:82/manual/en/index.php

The lack of consistency in function attributes makes it more difficult to
document!

Beckman
---------------------------------------------------------------------------
Peter Beckman                                                  Internet Guy
beckman at purplecow.com                             http://www.purplecow.com/
---------------------------------------------------------------------------



More information about the asterisk-dev mailing list