[Kamailio-Devel] Syntax for mi commands

Johansson Olle E oej at edvina.net
Fri Jan 30 13:57:48 CET 2009


30 jan 2009 kl. 13.06 skrev Daniel-Constantin Mierla:

> Hello,
>
> I agree, we should get some guidelines/recommendation about naming  
> of MI commands. I started a wiki page for it:
> http://www.kamailio.org/dokuwiki/doku.php/development:mi-commands
>
> Please contribute there with suggestions and discuss them here. I am  
> for "module-identifier - underscore - command name".
>
> For the upcoming release we can leave as they are now and maybe add  
> aliases to same command with a new name that follows the rules.
I don't seem to be able to edit. I would like to add the following:

For labels on replies, don't use spaces, use

Bad:

pappa mamma:: data

Good:

daddy_mommy:: data

If we do some work after release on cleanup, I would also like to  
suggest that we add something like

"The MI interface is primarily meant for application to application  
communication. Data should be easy to parse, separated if needed by  
newlines.

Bad:

sister_brother:: data this and that, 50% uptime and I feel good about it

Good:

cousin_uncle:: data
cousin_uncle_uptime:: 50%
cousin_uncle_mood:: Good

Structure is good and makes it easier to write clients!

Signed
/TheCampaignForCleaningUpAPIs
>
>
> Cheers,
> Daniel
>
>
> On 01/27/2009 11:47 PM, Johansson Olle E wrote:
>> While digging around the mi interface, I've discovered that there  
>> is a  few different syntaxes around and would like to suggest that  
>> we  implement some sort of guidelines for the future.
>>
>> * Examples of mi commands
>>    ------------------------------------
>> 	rl_stats
>> 	regex_reload
>> 	ul_rm
>>
>> Syntax: Module identifier - underscore - command
>>
>> * Wrong syntax according to above rule:
>>   ----------------------------------------------------
>> 	reload_blacklist
>>
>> Should propably be "blacklist_reload" or "bl_reload" to follow  
>> above  syntax
>>
>> * Totally different syntax:
>>    ------------------------------
>> 	refreshXcapDoc   - note UpperCaseLikeJava
>>
>> Should propably be something like "xc_refresh_xcapdoc"
>>
>> * Other examples
>>   ----------------------
>> - The dialog module use both dlg_ and profile_ prefixes, which is   
>> confusing
>> - cpl-c has REMOVE_CPL and GET_CPL in upper case
>> - cfgutils has a lot of different commands without a clear prefix  
>> system
>> - For command arguments, carrierroute use a command-line syntax,  
>> which  no other module does. Instead of multiple arguments, it has  
>> one  argument with whitespace and dash syntax, like no other module.
>>
>> ------------------------
>>
>> I don't judge what's right or wrong here, just document that this  
>> is a  bit confusing and not very logical. It raises a few questions:
>>
>> - Do we need guidelines for this, so we don't get yet another  
>> syntax  in the next new module?
>> - Is it possible to change existing commands for a new release?
>>
>> We just did an overhaul of the Asterisk manager interface in 1.6.0  
>> to  make it a tiny bit more logical than before. In that work, we  
>> changed  the version number of the AMI api so that clients could  
>> adopt to the  changes.
>>
>>
>> Cheers,
>> /O
>>
>> _______________________________________________
>> Kamailio (OpenSER) - Devel mailing list
>> Devel at lists.kamailio.org
>> http://lists.kamailio.org/cgi-bin/mailman/listinfo/devel
>> http://lists.openser-project.org/cgi-bin/mailman/listinfo/devel
>>
>>
>
> -- 
> Daniel-Constantin Mierla
> http://www.asipto.com

---
* Olle E Johansson - oej at edvina.net
* Cell phone +46 70 593 68 51, Office +46 8 96 40 20, Sweden






More information about the Devel mailing list