Implement a new element in AstXML for AMI actions documentation.
authorEliel C. Sardanons <eliels@gmail.com>
Fri, 22 May 2009 17:52:35 +0000 (17:52 +0000)
committerEliel C. Sardanons <eliels@gmail.com>
Fri, 22 May 2009 17:52:35 +0000 (17:52 +0000)
A new xml element was created to manage the AMI actions documentation,
using AstXML.
To register a manager action using XML documentation it is now possible
using ast_manager_register_xml().
The CLI command 'manager show command' can be used to show the parsed
documentation.

Example manager xml documentation:
<manager name="ami action name" language="en_US">
    <synopsis>
        AMI action synopsis.
    </synopsis>
    <syntax>
        <xi:include xpointer="xpointer(...)" /> <-- for ActionID
        <parameter name="header1" required="true">
    <para>Description</para>
</parameter>
...
    </syntax>
    <description>
        <para>AMI action description</para>
    </description>
    <see-also>
     ...
    </see-also>
</manager>

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196308 65c4cc65-6c06-0410-ace0-fbb531ad65f3

19 files changed:
apps/app_meetme.c
apps/app_queue.c
apps/app_senddtmf.c
apps/app_voicemail.c
channels/chan_agent.c
channels/chan_dahdi.c
channels/chan_iax2.c
channels/chan_sip.c
channels/chan_skinny.c
doc/appdocsxml.dtd
include/asterisk/manager.h
include/asterisk/pbx.h
include/asterisk/xmldoc.h
main/db.c
main/features.c
main/manager.c
main/pbx.c
main/xmldoc.c
res/res_agi.c

index ba278ba..db5c391 100644 (file)
@@ -420,6 +420,46 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        </variablelist>
                </description>
        </application>
+       <manager name="MeetmeMute" language="en_US">
+               <synopsis>
+                       Mute a Meetme user.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Meetme" required="true" />
+                       <parameter name="Usernum" required="true" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="MeetmeUnmute" language="en_US">
+               <synopsis>
+                       Unmute a Meetme user.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Meetme" required="true" />
+                       <parameter name="Usernum" required="true" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="MeetmeList" language="en_US">
+               <synopsis>
+                       List participants in a conference.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Conference" required="true">
+                               <para>Conference number.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Lists all users in a particular MeetMe conference.
+                       MeetmeList will follow as separate events, followed by a final event called
+                       MeetmeListComplete.</para>
+               </description>
+       </manager>
  ***/
 
 #define CONFIG_FILE_NAME "meetme.conf"
@@ -4236,14 +4276,6 @@ static int action_meetmeunmute(struct mansession *s, const struct message *m)
        return meetmemute(s, m, 0);
 }
 
-static const char mandescr_meetmelist[] =
-"Description: Lists all users in a particular MeetMe conference.\n"
-"MeetmeList will follow as separate events, followed by a final event called\n"
-"MeetmeListComplete.\n"
-"Variables:\n"
-"    *ActionId: <id>\n"
-"    *Conference: <confno>\n";
-
 static int action_meetmelist(struct mansession *s, const struct message *m)
 {
        const char *actionid = astman_get_header(m, "ActionID");
@@ -6418,12 +6450,9 @@ static int load_module(void)
        res |= load_config(0);
 
        ast_cli_register_multiple(cli_meetme, ARRAY_LEN(cli_meetme));
-       res |= ast_manager_register("MeetmeMute", EVENT_FLAG_CALL, 
-                                   action_meetmemute, "Mute a Meetme user");
-       res |= ast_manager_register("MeetmeUnmute", EVENT_FLAG_CALL, 
-                                   action_meetmeunmute, "Unmute a Meetme user");
-       res |= ast_manager_register2("MeetmeList", EVENT_FLAG_REPORTING, 
-                                   action_meetmelist, "List participants in a conference", mandescr_meetmelist);
+       res |= ast_manager_register_xml("MeetmeMute", EVENT_FLAG_CALL, action_meetmemute);
+       res |= ast_manager_register_xml("MeetmeUnmute", EVENT_FLAG_CALL, action_meetmeunmute);
+       res |= ast_manager_register_xml("MeetmeList", EVENT_FLAG_REPORTING, action_meetmelist);
        res |= ast_register_application_xml(app4, channel_admin_exec);
        res |= ast_register_application_xml(app3, admin_exec);
        res |= ast_register_application_xml(app2, count_exec);
index d792cdf..9e0519f 100644 (file)
@@ -494,7 +494,160 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        <para>Gets or sets queue members penalty.</para>
                </description>
        </function>
-
+       <manager name="Queues" language="en_US">
+               <synopsis>
+                       Queues.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="QueueStatus" language="en_US">
+               <synopsis>
+                       Show queue status.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Queue" />
+                       <parameter name="Member" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="QueueSummary" language="en_US">
+               <synopsis>
+                       Show queue summary.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Queue" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="QueueAdd" language="en_US">
+               <synopsis>
+                       Add interface to queue.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Queue" required="true" />
+                       <parameter name="Interface" required="true" />
+                       <parameter name="Penalty" />
+                       <parameter name="Paused" />
+                       <parameter name="MemberName" />
+                       <parameter name="StateInterface" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="QueueRemove" language="en_US">
+               <synopsis>
+                       Remove interface from queue.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Queue" required="true" />
+                       <parameter name="Interface" required="true" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="QueuePause" language="en_US">
+               <synopsis>
+                       Makes a queue member temporarily unavailable.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Interface" required="true" />
+                       <parameter name="Paused" required="true" />
+                       <parameter name="Queue" />
+                       <parameter name="Reason" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="QueueLog" language="en_US">
+               <synopsis>
+                       Adds custom entry in queue_log.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Queue" required="true" />
+                       <parameter name="Event" required="true" />
+                       <parameter name="Uniqueid" />
+                       <parameter name="Interface" />
+                       <parameter name="Message" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="QueuePenalty" language="en_US">
+               <synopsis>
+                       Set the penalty for a queue member.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Interface" required="true" />
+                       <parameter name="Penalty" required="true" />
+                       <parameter name="Queue" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="QueueRule" language="en_US">
+               <synopsis>
+                       Queue Rules.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Rule" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="QueueReload" language="en_US">
+               <synopsis>
+                       Reload a queue, queues, or any sub-section of a queue or queues.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Queue" />
+                       <parameter name="Members">
+                               <enumlist>
+                                       <enum name="yes" />
+                                       <enum name="no" />
+                               </enumlist>
+                       </parameter>
+                       <parameter name="Rules">
+                               <enumlist>
+                                       <enum name="yes" />
+                                       <enum name="no" />
+                               </enumlist>
+                       </parameter>
+                       <parameter name="Parameters">
+                               <enumlist>
+                                       <enum name="yes" />
+                                       <enum name="no" />
+                               </enumlist>
+                       </parameter>
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="QueueReset" language="en_US">
+               <synopsis>
+                       Reset queue statistics.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Queue" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
  ***/
 
 enum {
@@ -7299,17 +7452,17 @@ static int load_module(void)
        res |= ast_register_application_xml(app_pqm, pqm_exec);
        res |= ast_register_application_xml(app_upqm, upqm_exec);
        res |= ast_register_application_xml(app_ql, ql_exec);
-       res |= ast_manager_register("Queues", 0, manager_queues_show, "Queues");
-       res |= ast_manager_register("QueueStatus", 0, manager_queues_status, "Queue Status");
-       res |= ast_manager_register("QueueSummary", 0, manager_queues_summary, "Queue Summary");
-       res |= ast_manager_register("QueueAdd", EVENT_FLAG_AGENT, manager_add_queue_member, "Add interface to queue.");
-       res |= ast_manager_register("QueueRemove", EVENT_FLAG_AGENT, manager_remove_queue_member, "Remove interface from queue.");
-       res |= ast_manager_register("QueuePause", EVENT_FLAG_AGENT, manager_pause_queue_member, "Makes a queue member temporarily unavailable");
-       res |= ast_manager_register("QueueLog", EVENT_FLAG_AGENT, manager_queue_log_custom, "Adds custom entry in queue_log");
-       res |= ast_manager_register("QueuePenalty", EVENT_FLAG_AGENT, manager_queue_member_penalty, "Set the penalty for a queue member"); 
-       res |= ast_manager_register("QueueRule", 0, manager_queue_rule_show, "Queue Rules");
-       res |= ast_manager_register("QueueReload", 0, manager_queue_reload, "Reload a queue, queues, or any sub-section of a queue or queues");
-       res |= ast_manager_register("QueueReset", 0, manager_queue_reset, "Reset queue statistics");
+       res |= ast_manager_register_xml("Queues", 0, manager_queues_show);
+       res |= ast_manager_register_xml("QueueStatus", 0, manager_queues_status);
+       res |= ast_manager_register_xml("QueueSummary", 0, manager_queues_summary);
+       res |= ast_manager_register_xml("QueueAdd", EVENT_FLAG_AGENT, manager_add_queue_member);
+       res |= ast_manager_register_xml("QueueRemove", EVENT_FLAG_AGENT, manager_remove_queue_member);
+       res |= ast_manager_register_xml("QueuePause", EVENT_FLAG_AGENT, manager_pause_queue_member);
+       res |= ast_manager_register_xml("QueueLog", EVENT_FLAG_AGENT, manager_queue_log_custom);
+       res |= ast_manager_register_xml("QueuePenalty", EVENT_FLAG_AGENT, manager_queue_member_penalty);
+       res |= ast_manager_register_xml("QueueRule", 0, manager_queue_rule_show);
+       res |= ast_manager_register_xml("QueueReload", 0, manager_queue_reload);
+       res |= ast_manager_register_xml("QueueReset", 0, manager_queue_reset);
        res |= ast_custom_function_register(&queuevar_function);
        res |= ast_custom_function_register(&queuemembercount_function);
        res |= ast_custom_function_register(&queuemembercount_dep);
index 68f2d78..395ae28 100644 (file)
@@ -59,6 +59,23 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        <ref type="application">Read</ref>
                </see-also>
        </application>
+       <manager name="PlayDTMF" language="en_US">
+               <synopsis>
+                       Play DTMF signal on a specific channel.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Channel" required="true">
+                               <para>Channel name to send digit to.</para>
+                       </parameter>
+                       <parameter name="Digit" required="true">
+                               <para>The DTMF digit to play.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Plays a dtmf digit on the specified channel.</para>
+               </description>
+       </manager>
  ***/
 static char *app = "SendDTMF";
 
@@ -90,12 +107,6 @@ static int senddtmf_exec(struct ast_channel *chan, const char *vdata)
        return res;
 }
 
-static const char mandescr_playdtmf[] =
-"Description: Plays a dtmf digit on the specified channel.\n"
-"Variables: (all are required)\n"
-"      Channel: Channel name to send digit to\n"
-"      Digit: The dtmf digit to play\n";
-
 static int manager_play_dtmf(struct mansession *s, const struct message *m)
 {
        const char *channel = astman_get_header(m, "Channel");
@@ -136,7 +147,7 @@ static int load_module(void)
 {
        int res;
 
-       res = ast_manager_register2( "PlayDTMF", EVENT_FLAG_CALL, manager_play_dtmf, "Play DTMF signal on a specific channel.", mandescr_playdtmf );
+       res = ast_manager_register_xml("PlayDTMF", EVENT_FLAG_CALL, manager_play_dtmf);
        res |= ast_register_application_xml(app, senddtmf_exec);
 
        return res;
index 4362dbc..824c425 100644 (file)
@@ -298,6 +298,16 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        context.</para>
                </description>
        </function>
+       <manager name="VoicemailUsersList" language="en_US">
+               <synopsis>
+                       List All Voicemail User Information.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
  ***/
 
 #ifdef IMAP_STORAGE
@@ -11150,7 +11160,7 @@ static int load_module(void)
        res |= ast_register_application_xml(app3, vm_box_exists);
        res |= ast_register_application_xml(app4, vmauthenticate);
        res |= ast_custom_function_register(&mailbox_exists_acf);
-       res |= ast_manager_register("VoicemailUsersList", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, manager_list_voicemail_users, "List All Voicemail User Information");
+       res |= ast_manager_register_xml("VoicemailUsersList", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, manager_list_voicemail_users);
        if (res)
                return res;
 
index d922d49..17b20cd 100644 (file)
@@ -167,6 +167,34 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                </syntax>
                <description />
        </function>
+       <manager name="Agents" language="en_US">
+               <synopsis>
+                       Lists agents and their status.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>Will list info about all possible agents.</para>
+               </description>
+       </manager>
+       <manager name="AgentLogoff" language="en_US">
+               <synopsis>
+                       Sets an agent as no longer logged in.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Agent" required="true">
+                               <para>Agent ID of the agent to log off.</para>
+                       </parameter>
+                       <parameter name="Soft">
+                               <para>Set to <literal>true</literal> to not hangup existing calls.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Sets an agent as no longer logged in.</para>
+               </description>
+       </manager>
  ***/
 
 static const char tdesc[] = "Call Agent Proxy Channel";
@@ -175,16 +203,6 @@ static const char config[] = "agents.conf";
 static const char app[] = "AgentLogin";
 static const char app3[] = "AgentMonitorOutgoing";
 
-static const char mandescr_agents[] =
-"Description: Will list info about all possible agents.\n"
-"Variables: NONE\n";
-
-static const char mandescr_agent_logoff[] =
-"Description: Sets an agent as no longer logged in.\n"
-"Variables: (Names marked with * are required)\n"
-"      *Agent: Agent ID of the agent to log off\n"
-"      Soft: Set to 'true' to not hangup existing calls\n";
-
 static char moh[80] = "default";
 
 #define AST_MAX_AGENT  80                          /*!< Agent ID or Password max length */
@@ -2559,8 +2577,8 @@ static int load_module(void)
        ast_register_application_xml(app3, agentmonitoroutgoing_exec);
 
        /* Manager commands */
-       ast_manager_register2("Agents", EVENT_FLAG_AGENT, action_agents, "Lists agents and their status", mandescr_agents);
-       ast_manager_register2("AgentLogoff", EVENT_FLAG_AGENT, action_agent_logoff, "Sets an agent as no longer logged in", mandescr_agent_logoff);
+       ast_manager_register_xml("Agents", EVENT_FLAG_AGENT, action_agents);
+       ast_manager_register_xml("AgentLogoff", EVENT_FLAG_AGENT, action_agent_logoff);
 
        /* CLI Commands */
        ast_cli_register_multiple(cli_agents, ARRAY_LEN(cli_agents));
index 5971539..f4b6d3a 100644 (file)
@@ -154,6 +154,89 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        <para>This application will Accept the R2 call either with charge or no charge.</para>
                </description>
        </application>
+       <manager name="DAHDITransfer" language="en_US">
+               <synopsis>
+                       Transfer DAHDI Channel.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="DAHDIChannel" required="true">
+                               <para>DAHDI channel name to transfer.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Transfer a DAHDI channel.</para>
+               </description>
+       </manager>
+       <manager name="DAHDIHangup" language="en_US">
+               <synopsis>
+                       Hangup DAHDI Channel.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="DAHDIChannel" required="true">
+                               <para>DAHDI channel name to hangup.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Hangup a DAHDI channel.</para>
+               </description>
+       </manager>
+       <manager name="DAHDIDialOffhook" language="en_US">
+               <synopsis>
+                       Dial over DAHDI channel while offhook.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="DAHDIChannel" required="true" />
+                       <parameter name="Number" required="true" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="DAHDIDNDon" language="en_US">
+               <synopsis>
+                       Toggle DAHDI channel Do Not Disturb status ON.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="DAHDIChannel" required="true" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="DAHDIDNDoff" language="en_US">
+               <synopsis>
+                       Toggle DAHDI channel Do Not Disturb status OFF.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="DAHDIChannel" required="true" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="DAHDIShowChannels" language="en_US">
+               <synopsis>
+                       Show status DAHDI channels.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="DAHDIChannel" required="true" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="DAHDIRestart" language="en_US">
+               <synopsis>
+                       Fully Restart DAHDI channels (terminates calls).
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
  ***/
 
 #define SMDI_MD_WAIT_TIMEOUT 1500 /* 1.5 seconds */
@@ -16193,11 +16276,11 @@ static int __unload_module(void)
 #endif
 
        ast_cli_unregister_multiple(dahdi_cli, ARRAY_LEN(dahdi_cli));
-       ast_manager_unregister( "DAHDIDialOffhook" );
-       ast_manager_unregister( "DAHDIHangup" );
-       ast_manager_unregister( "DAHDITransfer" );
-       ast_manager_unregister( "DAHDIDNDoff" );
-       ast_manager_unregister( "DAHDIDNDon" );
+       ast_manager_unregister("DAHDIDialOffhook");
+       ast_manager_unregister("DAHDIHangup");
+       ast_manager_unregister("DAHDITransfer");
+       ast_manager_unregister("DAHDIDNDoff");
+       ast_manager_unregister("DAHDIDNDon");
        ast_manager_unregister("DAHDIShowChannels");
        ast_manager_unregister("DAHDIRestart");
        ast_channel_unregister(&dahdi_tech);
@@ -17640,13 +17723,13 @@ static int load_module(void)
        ast_cli_register_multiple(dahdi_cli, ARRAY_LEN(dahdi_cli));
 
        memset(round_robin, 0, sizeof(round_robin));
-       ast_manager_register( "DAHDITransfer", 0, action_transfer, "Transfer DAHDI Channel" );
-       ast_manager_register( "DAHDIHangup", 0, action_transferhangup, "Hangup DAHDI Channel" );
-       ast_manager_register( "DAHDIDialOffhook", 0, action_dahdidialoffhook, "Dial over DAHDI channel while offhook" );
-       ast_manager_register( "DAHDIDNDon", 0, action_dahdidndon, "Toggle DAHDI channel Do Not Disturb status ON" );
-       ast_manager_register( "DAHDIDNDoff", 0, action_dahdidndoff, "Toggle DAHDI channel Do Not Disturb status OFF" );
-       ast_manager_register("DAHDIShowChannels", 0, action_dahdishowchannels, "Show status DAHDI channels");
-       ast_manager_register("DAHDIRestart", 0, action_dahdirestart, "Fully Restart DAHDI channels (terminates calls)");
+       ast_manager_register_xml("DAHDITransfer", 0, action_transfer);
+       ast_manager_register_xml("DAHDIHangup", 0, action_transferhangup);
+       ast_manager_register_xml("DAHDIDialOffhook", 0, action_dahdidialoffhook);
+       ast_manager_register_xml("DAHDIDNDon", 0, action_dahdidndon);
+       ast_manager_register_xml("DAHDIDNDoff", 0, action_dahdidndoff);
+       ast_manager_register_xml("DAHDIShowChannels", 0, action_dahdishowchannels);
+       ast_manager_register_xml("DAHDIRestart", 0, action_dahdirestart);
 
        ast_cond_init(&ss_thread_complete, NULL);
 
index 383f97e..e6e1280 100644 (file)
@@ -175,6 +175,47 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                </syntax>
                <description />
        </function>
+       <manager name="IAXpeers" language="en_US">
+               <synopsis>
+                       List IAX peers.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="IAXpeerlist" language="en_US">
+               <synopsis>
+                       List IAX Peers.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>List all the IAX peers.</para>
+               </description>
+       </manager>
+       <manager name="IAXnetstats" language="en_US">
+               <synopsis>
+                       Show IAX Netstats.
+               </synopsis>
+               <syntax />
+               <description>
+                       <para>Show IAX channels network statistics.</para>
+               </description>
+       </manager>
+       <manager name="IAXregistry" language="en_US">
+               <synopsis>
+                       Show IAX registrations.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>Show IAX registrations.</para>
+               </description>
+       </manager>
  ***/
 
 /* Define SCHED_MULTITHREADED to run the scheduler in a special
@@ -12720,10 +12761,10 @@ static int load_module(void)
 
        ast_register_application_xml(papp, iax2_prov_app);
        
-       ast_manager_register( "IAXpeers", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_peers, "List IAX Peers" );
-       ast_manager_register( "IAXpeerlist", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_peer_list, "List IAX Peers" );
-       ast_manager_register( "IAXnetstats", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_netstats, "Show IAX Netstats" );
-       ast_manager_register( "IAXregistry", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_registry, "Show IAX registrations");
+       ast_manager_register_xml("IAXpeers", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_peers);
+       ast_manager_register_xml("IAXpeerlist", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_peer_list);
+       ast_manager_register_xml("IAXnetstats", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_netstats);
+       ast_manager_register_xml("IAXregistry", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_registry);
 
        if ((timer = ast_timer_open())) {
                ast_timer_set_rate(timer, trunkfreq);
index 0276269..35fedb9 100644 (file)
@@ -473,6 +473,79 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        Check the <literal>domain=</literal> configuration in <filename>sip.conf</filename>.</para>
                </description>
        </function>
+       <manager name="SIPpeers" language="en_US">
+               <synopsis>
+                       List SIP peers (text format).
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>Lists SIP peers in text format with details on current status.
+                       Peerlist will follow as separate events, followed by a final event called
+                       PeerlistComplete.</para>
+               </description>
+       </manager>
+       <manager name="SIPshowpeer" language="en_US">
+               <synopsis>
+                       show SIP peer (text format).
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Peer" required="true">
+                               <para>The peer name you want to check.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Show one SIP peer with details on current status.</para>
+               </description>
+       </manager>
+       <manager name="SIPqualifypeer" language="en_US">
+               <synopsis>
+                       Qualify SIP peers.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Peer" required="true">
+                               <para>The peer name you want to qualify.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Qualify a SIP peer.</para>
+               </description>
+       </manager>
+       <manager name="SIPshowregistry" language="en_US">
+               <synopsis>
+                       Show SIP registrations (text format).
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>Lists all registration requests and status. Registrations will follow as separate
+                       events. followed by a final event called RegistrationsComplete.</para>
+               </description>
+       </manager>
+       <manager name="SIPnotify" language="en_US">
+               <synopsis>
+                       Send a SIP notify.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Channel" required="true">
+                               <para>Peer to receive the notify.</para>
+                       </parameter>
+                       <parameter name="Variable" required="true">
+                               <para>At least one variable pair must be specified.
+                               <replaceable>name</replaceable>=<replaceable>value</replaceable></para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Sends a SIP Notify event.</para>
+                       <para>All parameters for this event must be specified in the body of this request
+                       via multiple Variable: name=value sequences.</para>
+               </description>
+       </manager>
  ***/
 
 #ifndef FALSE
@@ -10859,15 +10932,6 @@ static int manager_sipnotify(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_sipnotify[] =
-"Description: Sends a SIP Notify event\n"
-"All parameters for this event must be specified in the body of this request\n"
-"via multiple Variable: name=value sequences.\n"
-"Variables: \n"
-"  *Channel: <peername>       Peer to receive the notify. Required.\n"
-"  *Variable: <name>=<value>  At least one variable pair must be specified.\n"
-"  ActionID: <id>             Action ID for this transaction. Will be returned.\n";
-
 /*! \brief Send a provisional response indicating that a call was redirected
  */
 static void update_redirecting(struct sip_pvt *p, const void *data, size_t datalen)
@@ -14166,14 +14230,6 @@ static char *sip_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
 #undef FORMAT
 }
 
-/*! \brief Manager Action SIPShowRegistry description */
-static const char mandescr_show_registry[] =
-"Description: Lists all registration requests and status\n"
-"Registrations will follow as separate events. followed by a final event called\n"
-"RegistrationsComplete.\n"
-"Variables: \n"
-"  ActionID: <id>       Action ID for this transaction. Will be returned.\n";
-
 /*! \brief Show SIP registrations in the manager API */
 static int manager_show_registry(struct mansession *s, const struct message *m)
 {
@@ -14212,13 +14268,6 @@ static int manager_show_registry(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_show_peers[] = 
-"Description: Lists SIP peers in text format with details on current status.\n"
-"Peerlist will follow as separate events, followed by a final event called\n"
-"PeerlistComplete.\n"
-"Variables: \n"
-"  ActionID: <id>      Action ID for this transaction. Will be returned.\n";
-
 /*! \brief  Show SIP peers in the manager API */
 /*    Inspired from chan_iax2 */
 static int manager_sip_show_peers(struct mansession *s, const struct message *m)
@@ -14837,12 +14886,6 @@ static char *sip_show_domains(struct ast_cli_entry *e, int cmd, struct ast_cli_a
 }
 #undef FORMAT
 
-static const char mandescr_show_peer[] = 
-"Description: Show one SIP peer with details on current status.\n"
-"Variables: \n"
-"  Peer: <name>           The peer name you want to check.\n"
-"  ActionID: <id>        Optional action ID for this AMI transaction.\n";
-
 /*! \brief Show SIP peers in the manager API  */
 static int manager_sip_show_peer(struct mansession *s, const struct message *m)
 {
@@ -25478,16 +25521,11 @@ static int load_module(void)
        ast_custom_function_register(&checksipdomain_function);
 
        /* Register manager commands */
-       ast_manager_register2("SIPpeers", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_sip_show_peers,
-                       "List SIP peers (text format)", mandescr_show_peers);
-       ast_manager_register2("SIPshowpeer", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_sip_show_peer,
-                       "Show SIP peer (text format)", mandescr_show_peer);
-       ast_manager_register2("SIPqualifypeer", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_sip_qualify_peer,
-                       "Show SIP peer (text format)", mandescr_show_peer);     /*! \todo Fix this XXX This must be all wrong XXXX */
-       ast_manager_register2("SIPshowregistry", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_show_registry,
-                       "Show SIP registrations (text format)", mandescr_show_registry);
-       ast_manager_register2("SIPnotify", EVENT_FLAG_SYSTEM, manager_sipnotify,
-                       "Send a SIP notify", mandescr_sipnotify);
+       ast_manager_register_xml("SIPpeers", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_sip_show_peers);
+       ast_manager_register_xml("SIPshowpeer", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_sip_show_peer);
+       ast_manager_register_xml("SIPqualifypeer", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_sip_qualify_peer);
+       ast_manager_register_xml("SIPshowregistry", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_show_registry);
+       ast_manager_register_xml("SIPnotify", EVENT_FLAG_SYSTEM, manager_sipnotify);
        sip_poke_all_peers();   
        sip_send_all_registers();
        sip_send_all_mwi_subscriptions();
index dbb90a5..0aea73b 100644 (file)
@@ -71,6 +71,63 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/indications.h"
 #include "asterisk/linkedlists.h"
 
+/*** DOCUMENTATION
+       <manager name="SKINNYdevices" language="en_US">
+               <synopsis>
+                       List SKINNY devices (text format).
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>Lists Skinny devices in text format with details on current status.
+                       Devicelist will follow as separate events, followed by a final event called
+                       DevicelistComplete.</para>
+               </description>
+       </manager>
+       <manager name="SKINNYshowdevice" language="en_US">
+               <synopsis>
+                       Show SKINNY device (text format).
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Device" required="true">
+                               <para>The device name you want to check.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Show one SKINNY device with details on current status.</para>
+               </description>
+       </manager>
+       <manager name="SKINNYlines" language="en_US">
+               <synopsis>
+                       List SKINNY lines (text format).
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>Lists Skinny lines in text format with details on current status.
+                       Linelist will follow as separate events, followed by a final event called
+                       LinelistComplete.</para>
+               </description>
+       </manager>
+       <manager name="SKINNYshowline" language="en_US">
+               <synopsis>
+                       Show SKINNY line (text format).
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Line" required="true">
+                               <para>The line name you want to check.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Show one SKINNY line with details on current status.</para>
+               </description>
+       </manager>
+ ***/
+
 #ifdef SKINNY_DEVMODE
 #define SKINNY_DEVONLY(code)   \
        code
@@ -3049,13 +3106,6 @@ static char *_skinny_show_devices(int fd, int *total, struct mansession *s, cons
        return CLI_SUCCESS;
 }
 
-static const char mandescr_show_devices[] =
-"Description: Lists Skinny devices in text format with details on current status.\n"
-"Devicelist will follow as separate events, followed by a final event called\n"
-"DevicelistComplete.\n"
-"Variables: \n"
-"  ActionID: <id>      Action ID for this transaction. Will be returned.\n";
-
 /*! \brief  Show SKINNY devices in the manager API */
 /*    Inspired from chan_sip */
 static int manager_skinny_show_devices(struct mansession *s, const struct message *m)
@@ -3194,12 +3244,6 @@ static char *_skinny_show_device(int type, int fd, struct mansession *s, const s
        return CLI_SUCCESS;
 }
 
-static const char mandescr_show_device[] =
-"Description: Show one SKINNY device with details on current status.\n"
-"Variables: \n"
-"  Device: <name>           The device name you want to check.\n"
-"  ActionID: <id>        Optional action ID for this AMI transaction.\n";
-
 static int manager_skinny_show_device(struct mansession *s, const struct message *m)
 {
        const char *a[4];
@@ -3310,13 +3354,6 @@ static char *_skinny_show_lines(int fd, int *total, struct mansession *s, const
        return CLI_SUCCESS;
 }
 
-static const char mandescr_show_lines[] =
-"Description: Lists Skinny lines in text format with details on current status.\n"
-"Linelist will follow as separate events, followed by a final event called\n"
-"LinelistComplete.\n"
-"Variables: \n"
-"  ActionID: <id>      Action ID for this transaction. Will be returned.\n";
-
 /*! \brief  Show Skinny lines in the manager API */
 /*    Inspired from chan_sip */
 static int manager_skinny_show_lines(struct mansession *s, const struct message *m)
@@ -3502,12 +3539,6 @@ static char *_skinny_show_line(int type, int fd, struct mansession *s, const str
        return CLI_SUCCESS;
 }
 
-static const char mandescr_show_line[] =
-"Description: Show one SKINNY line with details on current status.\n"
-"Variables: \n"
-"  Line: <name>           The line name you want to check.\n"
-"  ActionID: <id>        Optional action ID for this AMI transaction.\n";
-
 static int manager_skinny_show_line(struct mansession *s, const struct message *m)
 {
        const char *a[4];
@@ -7347,14 +7378,10 @@ static int load_module(void)
        ast_rtp_glue_register(&skinny_rtp_glue);
        ast_cli_register_multiple(cli_skinny, ARRAY_LEN(cli_skinny));
 
-       ast_manager_register2("SKINNYdevices", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_skinny_show_devices,
-                       "List SKINNY devices (text format)", mandescr_show_devices);
-       ast_manager_register2("SKINNYshowdevice", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_skinny_show_device,
-                       "Show SKINNY device (text format)", mandescr_show_device);
-       ast_manager_register2("SKINNYlines", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_skinny_show_lines,
-                       "List SKINNY lines (text format)", mandescr_show_lines);
-       ast_manager_register2("SKINNYshowline", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_skinny_show_line,
-                       "Show SKINNY line (text format)", mandescr_show_line);
+       ast_manager_register_xml("SKINNYdevices", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_skinny_show_devices);
+       ast_manager_register_xml("SKINNYshowdevice", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_skinny_show_device);
+       ast_manager_register_xml("SKINNYlines", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_skinny_show_lines);
+       ast_manager_register_xml("SKINNYshowline", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_skinny_show_line);
 
        sched = sched_context_create();
        if (!sched) {
index c06f720..1de0ea4 100644 (file)
@@ -1,4 +1,4 @@
-  <!ELEMENT docs (application|function|agi)*>
+  <!ELEMENT docs (application|function|agi|manager)*>
   <!ATTLIST docs xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude">
 
   <!ELEMENT xi:include (xi:fallback?) >
   <!ATTLIST agi name CDATA #REQUIRED>
   <!ATTLIST agi language CDATA #REQUIRED>
 
+  <!ELEMENT manager (synopsis?,syntax?,description?,see-also?)>
+  <!ATTLIST manager name CDATA #REQUIRED>
+  <!ATTLIST manager language CDATA #REQUIRED>
+
   <!ELEMENT see-also (ref|xi:include)*>
 
   <!ELEMENT ref (#PCDATA)>
index d9e33e5..33eb52c 100644 (file)
@@ -22,6 +22,7 @@
 #include "asterisk/network.h"
 #include "asterisk/lock.h"
 #include "asterisk/datastore.h"
+#include "asterisk/xmldoc.h"
 
 /*!
  \file
@@ -116,14 +117,19 @@ struct message {
 struct manager_action {
        /*! Name of the action */
        const char *action;
-       /*! Short description of the action */
-       const char *synopsis;
-       /*! Detailed description of the action */
-       const char *description;
+       AST_DECLARE_STRING_FIELDS(
+               AST_STRING_FIELD(synopsis);     /*!< Synopsis text (short description). */
+               AST_STRING_FIELD(description);  /*!< Description (help text) */
+               AST_STRING_FIELD(syntax);       /*!< Syntax text */
+               AST_STRING_FIELD(arguments);    /*!< Description of each argument. */
+               AST_STRING_FIELD(seealso);      /*!< See also */
+       );
        /*! Permission required for action.  EVENT_FLAG_* */
        int authority;
        /*! Function to be called */
        int (*func)(struct mansession *s, const struct message *m);
+       /*! Where the documentation come from. */
+       enum ast_doc_src docsrc;
        /*! For easy linking */
        AST_RWLIST_ENTRY(manager_action) list;
 };
@@ -132,6 +138,8 @@ struct manager_action {
  * \note  Use ast_manager_register2() to register with help text for new manager commands */
 #define ast_manager_register(a, b, c, d) ast_manager_register2(a, b, c, d, NULL)
 
+/*! \brief Register a manager callback using XML documentation to describe the manager. */
+#define ast_manager_register_xml(a, b, c) ast_manager_register2(a, b, c, NULL, NULL)
 
 /*! \brief Register a manager command with the manager interface 
        \param action Name of the requested Action:
index c2f999e..d086416 100644 (file)
@@ -27,6 +27,7 @@
 #include "asterisk/chanvars.h"
 #include "asterisk/hashtab.h"
 #include "asterisk/stringfields.h"
+#include "asterisk/xmldoc.h"
 
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {
@@ -73,12 +74,6 @@ struct ast_sw;
 /*! \brief Typedef for devicestate and hint callbacks */
 typedef int (*ast_state_cb_type)(char *context, char* id, enum ast_extension_states state, void *data);
 
-/*! \brief From where the documentation come from */
-enum ast_doc_src {
-       AST_XML_DOC,            /*!< From XML documentation */
-       AST_STATIC_DOC          /*!< From application/function registration */
-};
-
 /*! \brief Data structure associated with a custom dialplan function */
 struct ast_custom_function {
        const char *name;                       /*!< Name */
index d781e80..c876b46 100644 (file)
 
 #include "asterisk/xml.h"
 
+/*! \brief From where the documentation come from, this structure is useful for
+ *  use it inside application/functions/manager actions structure. */
+enum ast_doc_src {
+       AST_XML_DOC,            /*!< From XML documentation */
+       AST_STATIC_DOC          /*!< From application/function registration */
+};
+
 #ifdef AST_XML_DOCS
 
 /*!
index 6528aa2..244288a 100644 (file)
--- a/main/db.c
+++ b/main/db.c
@@ -48,6 +48,58 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/manager.h"
 #include "db1-ast/include/db.h"
 
+/*** DOCUMENTATION
+       <manager name="DBGet" language="en_US">
+               <synopsis>
+                       Get DB Entry.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Family" required="true" />
+                       <parameter name="Key" required="true" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="DBPut" language="en_US">
+               <synopsis>
+                       Put DB entry.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Family" required="true" />
+                       <parameter name="Key" required="true" />
+                       <parameter name="Val" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="DBDel" language="en_US">
+               <synopsis>
+                       Delete DB entry.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Family" required="true" />
+                       <parameter name="Key" required="true" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+       <manager name="DBDelTree" language="en_US">
+               <synopsis>
+                       Delete DB Tree.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Family" required="true" />
+                       <parameter name="Key" />
+               </syntax>
+               <description>
+               </description>
+       </manager>
+ ***/
+
 static DB *astdb;
 AST_MUTEX_DEFINE_STATIC(dblock);
 
@@ -666,9 +718,9 @@ int astdb_init(void)
 {
        dbinit();
        ast_cli_register_multiple(cli_database, ARRAY_LEN(cli_database));
-       ast_manager_register("DBGet", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_dbget, "Get DB Entry");
-       ast_manager_register("DBPut", EVENT_FLAG_SYSTEM, manager_dbput, "Put DB Entry");
-       ast_manager_register("DBDel", EVENT_FLAG_SYSTEM, manager_dbdel, "Delete DB Entry");
-       ast_manager_register("DBDelTree", EVENT_FLAG_SYSTEM, manager_dbdeltree, "Delete DB Tree");
+       ast_manager_register_xml("DBGet", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_dbget);
+       ast_manager_register_xml("DBPut", EVENT_FLAG_SYSTEM, manager_dbput);
+       ast_manager_register_xml("DBDel", EVENT_FLAG_SYSTEM, manager_dbdel);
+       ast_manager_register_xml("DBDelTree", EVENT_FLAG_SYSTEM, manager_dbdeltree);
        return 0;
 }
index 8da3c7b..6e3570e 100644 (file)
@@ -154,6 +154,61 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        <ref type="application">ParkedCall</ref>
                </see-also>
        </application>
+       <manager name="ParkedCalls" language="en_US">
+               <synopsis>
+                       List parked calls.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>List parked calls.</para>
+               </description>
+       </manager>
+       <manager name="Park" language="en_US">
+               <synopsis>
+                       Park a channel.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Channel" required="true">
+                               <para>Channel name to park.</para>
+                       </parameter>
+                       <parameter name="Channel2" required="true">
+                               <para>Channel to announce park info to (and return to if timeout).</para>
+                       </parameter>
+                       <parameter name="Timeout">
+                               <para>Number of milliseconds to wait before callback.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Park a channel.</para>
+               </description>
+       </manager>
+       <manager name="Bridge" language="en_US">
+               <synopsis>
+                       Bridge two channels already in the PBX.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Channel1" required="true">
+                               <para>Channel to Bridge to Channel2.</para>
+                       </parameter>
+                       <parameter name="Channel2" required="true">
+                               <para>Channel to Bridge to Channel1.</para>
+                       </parameter>
+                       <parameter name="Tone">
+                               <para>Play courtesy tone to Channel 2.</para>
+                               <enumlist>
+                                       <enum name="yes" />
+                                       <enum name="no" />
+                               </enumlist>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Bridge together two channels already in the PBX.</para>
+               </description>
+       </manager>
  ***/
 
 #define DEFAULT_PARK_TIME 45000
@@ -4109,14 +4164,6 @@ static char *handle_features_reload(struct ast_cli_entry *e, int cmd, struct ast
        return CLI_SUCCESS;
 }
 
-static const char mandescr_bridge[] =
-"Description: Bridge together two channels already in the PBX\n"
-"Variables: ( Headers marked with * are required )\n"
-"   *Channel1: Channel to Bridge to Channel2\n"
-"   *Channel2: Channel to Bridge to Channel1\n"
-"        Tone: (Yes|No) Play courtesy tone to Channel 2\n"
-"\n";
-
 /*!
  * \brief Actual bridge
  * \param chan
@@ -4382,13 +4429,6 @@ static int manager_parking_status(struct mansession *s, const struct message *m)
        return RESULT_SUCCESS;
 }
 
-static const char mandescr_park[] =
-"Description: Park a channel.\n"
-"Variables: (Names marked with * are required)\n"
-"      *Channel: Channel name to park\n"
-"      *Channel2: Channel to announce park info to (and return to if timeout)\n"
-"      Timeout: Number of milliseconds to wait before callback.\n";  
-
 /*!
  * \brief Create manager event for parked calls
  * \param s
@@ -4695,9 +4735,9 @@ int ast_features_init(void)
        if (!res)
                res = ast_register_application2(parkcall, park_call_exec, NULL, NULL, NULL);
        if (!res) {
-               ast_manager_register("ParkedCalls", 0, manager_parking_status, "List parked calls");
-               ast_manager_register2("Park", EVENT_FLAG_CALL, manager_park, "Park a channel", mandescr_park); 
-               ast_manager_register2("Bridge", EVENT_FLAG_CALL, action_bridge, "Bridge two channels already in the PBX", mandescr_bridge);
+               ast_manager_register_xml("ParkedCalls", 0, manager_parking_status);
+               ast_manager_register_xml("Park", EVENT_FLAG_CALL, manager_park);
+               ast_manager_register_xml("Bridge", EVENT_FLAG_CALL, action_bridge);
        }
 
        res |= ast_devstate_prov_add("Park", metermaidstate);
index 7d5ee7a..ba1d2f5 100644 (file)
@@ -75,6 +75,618 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/astobj2.h"
 #include "asterisk/features.h"
 
+/*** DOCUMENTATION
+       <manager name="Ping" language="en_US">
+               <synopsis>
+                       Keepalive command.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>A 'Ping' action will ellicit a 'Pong' response. Used to keep the
+                       manager connection open.</para>
+               </description>
+       </manager>
+       <manager name="Events" language="en_US">
+               <synopsis>
+                       Control Event Flow.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="EventMask" required="true">
+                               <enumlist>
+                                       <enum name="on">
+                                               <para>If all events should be sent.</para>
+                                       </enum>
+                                       <enum name="off">
+                                               <para>If no events should be sent.</para>
+                                       </enum>
+                                       <enum name="system,call,log,...">
+                                               <para>To select which flags events should have to be sent.</para>
+                                       </enum>
+                               </enumlist>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Enable/Disable sending of events to this manager client.</para>
+               </description>
+       </manager>
+       <manager name="Logoff" language="en_US">
+               <synopsis>
+                       Logoff Manager.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>Logoff the current manager session.</para>
+               </description>
+       </manager>
+       <manager name="Login" language="en_US">
+               <synopsis>
+                       Login Manager.
+               </synopsis>
+               <syntax>
+                       <parameter name="ActionID">
+                               <para>ActionID for this transaction. Will be returned.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Login Manager.</para>
+               </description>
+       </manager>
+       <manager name="Challenge" language="en_US">
+               <synopsis>
+                       Generate Challenge for MD5 Auth.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>Generate a challenge for MD5 authentication.</para>
+               </description>
+       </manager>
+       <manager name="Hangup" language="en_US">
+               <synopsis>
+                       Hangup channel.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Channel" required="true">
+                               <para>The channel name to be hangup.</para>
+                       </parameter>
+                       <parameter name="Cause">
+                               <para>Numeric hangup cause.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Hangup a channel.</para>
+               </description>
+       </manager>
+       <manager name="Status" language="en_US">
+               <synopsis>
+                       List channel status.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Channel" required="true">
+                               <para>The name of the channel to query for status.</para>
+                       </parameter>
+                       <parameter name="Variables">
+                               <para>Comma <literal>,</literal> separated list of variable to include.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Will return the status information of each channel along with the
+                       value for the specified channel variables.</para>
+               </description>
+       </manager>
+       <manager name="Setvar" language="en_US">
+               <synopsis>
+                       Set a channel variable.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Channel">
+                               <para>Channel to set variable for.</para>
+                       </parameter>
+                       <parameter name="Variable" required="true">
+                               <para>Variable name.</para>
+                       </parameter>
+                       <parameter name="Value" required="true">
+                               <para>Variable value.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Set a global or local channel variable.</para>
+               </description>
+       </manager>
+       <manager name="Getvar" language="en_US">
+               <synopsis>
+                       Gets a channel variable.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Channel">
+                               <para>Channel to read variable from.</para>
+                       </parameter>
+                       <parameter name="Variable" required="true">
+                               <para>Variable name.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Get the value of a global or local channel variable.</para>
+               </description>
+       </manager>
+       <manager name="GetConfig" language="en_US">
+               <synopsis>
+                       Retrieve configuration.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Filename" required="true">
+                               <para>Configuration filename (e.g. <filename>foo.conf</filename>).</para>
+                       </parameter>
+                       <parameter name="Category">
+                               <para>Category in configuration file.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>This action will dump the contents of a configuration
+                       file by category and contents or optionally by specified category only.</para>
+               </description>
+       </manager>
+       <manager name="GetConfigJSON" language="en_US">
+               <synopsis>
+                       Retrieve configuration (JSON format).
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Filename" required="true">
+                               <para>Configuration filename (e.g. <filename>foo.conf</filename>).</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>This action will dump the contents of a configuration file by category
+                       and contents in JSON format. This only makes sense to be used using rawman over
+                       the HTTP interface.</para>
+               </description>
+       </manager>
+       <manager name="UpdateConfig" language="en_US">
+               <synopsis>
+                       Update basic configuration.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="SrcFilename" required="true">
+                               <para>Configuration filename to read (e.g. <filename>foo.conf</filename>).</para>
+                       </parameter>
+                       <parameter name="DstFilename" required="true">
+                               <para>Configuration filename to write (e.g. <filename>foo.conf</filename>)</para>
+                       </parameter>
+                       <parameter name="Reload">
+                               <para>Whether or not a reload should take place (or name of specific module).</para>
+                       </parameter>
+                       <parameter name="Action-XXXXXX">
+                               <para>Action to take.</para>
+                               <para>X's represent 6 digit number beginning with 000000.</para>
+                               <enumlist>
+                                       <enum name="NewCat" />
+                                       <enum name="RenameCat" />
+                                       <enum name="DelCat" />
+                                       <enum name="EmptyCat" />
+                                       <enum name="Update" />
+                                       <enum name="Delete" />
+                                       <enum name="Append" />
+                                       <enum name="Insert" />
+                               </enumlist>
+                       </parameter>
+                       <parameter name="Cat-XXXXXX">
+                               <para>Category to operate on.</para>
+                               <xi:include xpointer="xpointer(/docs/manager[@name='UpdateConfig']/syntax/parameter[@name='Action-XXXXXX']/para[2])" />
+                       </parameter>
+                       <parameter name="Var-XXXXXX">
+                               <para>Variable to work on.</para>
+                               <xi:include xpointer="xpointer(/docs/manager[@name='UpdateConfig']/syntax/parameter[@name='Action-XXXXXX']/para[2])" />
+                       </parameter>
+                       <parameter name="Value-XXXXXX">
+                               <para>Value to work on.</para>
+                               <xi:include xpointer="xpointer(/docs/manager[@name='UpdateConfig']/syntax/parameter[@name='Action-XXXXXX']/para[2])" />
+                       </parameter>
+                       <parameter name="Match-XXXXXX">
+                               <para>Extra match required to match line.</para>
+                               <xi:include xpointer="xpointer(/docs/manager[@name='UpdateConfig']/syntax/parameter[@name='Action-XXXXXX']/para[2])" />
+                       </parameter>
+                       <parameter name="Line-XXXXXX">
+                               <para>Line in category to operate on (used with delete and insert actions).</para>
+                               <xi:include xpointer="xpointer(/docs/manager[@name='UpdateConfig']/syntax/parameter[@name='Action-XXXXXX']/para[2])" />
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>This action will modify, create, or delete configuration elements
+                       in Asterisk configuration files.</para>
+               </description>
+       </manager>
+       <manager name="CreateConfig" language="en_US">
+               <synopsis>
+                       Creates an empty file in the configuration directory.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Filename" required="true">
+                               <para>The configuration filename to create (e.g. <filename>foo.conf</filename>).</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>This action will create an empty file in the configuration
+                       directory. This action is intended to be used before an UpdateConfig
+                       action.</para>
+               </description>
+       </manager>
+       <manager name="ListCategories" language="en_US">
+               <synopsis>
+                       List categories in configuration file.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Filename" required="true">
+                               <para>Configuration filename (e.g. <filename>foo.conf</filename>).</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>This action will dump the categories in a given file.</para>
+               </description>
+       </manager>
+       <manager name="Redirect" language="en_US">
+               <synopsis>
+                       Redirect (transfer) a call.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Channel" required="true">
+                               <para>Channel to redirect.</para>
+                       </parameter>
+                       <parameter name="ExtraChannel">
+                               <para>Second call leg to transfer (optional).</para>
+                       </parameter>
+                       <parameter name="Exten" required="true">
+                               <para>Extension to transfer to.</para>
+                       </parameter>
+                       <parameter name="Context" required="true">
+                               <para>Context to transfer to.</para>
+                       </parameter>
+                       <parameter name="Priority" required="true">
+                               <para>Priority to transfer to.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Redirect (transfer) a call.</para>
+               </description>
+       </manager>
+       <manager name="Atxfer" language="en_US">
+               <synopsis>
+                       Attended transfer.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Channel" required="true">
+                               <para>Transferer's channel.</para>
+                       </parameter>
+                       <parameter name="Exten" required="true">
+                               <para>Extension to transfer to.</para>
+                       </parameter>
+                       <parameter name="Context" required="true">
+                               <para>Context to transfer to.</para>
+                       </parameter>
+                       <parameter name="Priority" required="true">
+                               <para>Priority to transfer to.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Attended transfer.</para>
+               </description>
+       </manager>
+       <manager name="Originate" language="en_US">
+               <synopsis>
+                       Originate a call.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Channel" required="true">
+                               <para>Channel name to call.</para>
+                       </parameter>
+                       <parameter name="Exten">
+                               <para>Extension to use (requires <literal>Context</literal> and
+                               <literal>Priority</literal>)</para>
+                       </parameter>
+                       <parameter name="Context">
+                               <para>Context to use (requires <literal>Exten</literal> and
+                               <literal>Priority</literal>)</para>
+                       </parameter>
+                       <parameter name="Priority">
+                               <para>Priority to use (requires <literal>Exten</literal> and
+                               <literal>Context</literal>)</para>
+                       </parameter>
+                       <parameter name="Application">
+                               <para>Application to execute.</para>
+                       </parameter>
+                       <parameter name="Data">
+                               <para>Data to use (requires <literal>Application</literal>).</para>
+                       </parameter>
+                       <parameter name="Timeout">
+                               <para>How long to wait for call to be answered (in ms).</para>
+                       </parameter>
+                       <parameter name="CallerID">
+                               <para>Caller ID to be set on the outgoing channel.</para>
+                       </parameter>
+                       <parameter name="Variable">
+                               <para>Channel variable to set, multiple Variable: headers are allowed.</para>
+                       </parameter>
+                       <parameter name="Account">
+                               <para>Account code.</para>
+                       </parameter>
+                       <parameter name="Async">
+                               <para>Set to <literal>true</literal> for fast origination.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Generates an outgoing call to a
+                       <replaceable>Extension</replaceable>/<replaceable>Context</replaceable>/<replaceable>Priority</replaceable>
+                       or <replaceable>Application</replaceable>/<replaceable>Data</replaceable></para>
+               </description>
+       </manager>
+       <manager name="Command" language="en_US">
+               <synopsis>
+                       Execute Asterisk CLI Command.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Command" required="true">
+                               <para>Asterisk CLI command to run.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Run a CLI command.</para>
+               </description>
+       </manager>
+       <manager name="ExtensionState" language="en_US">
+               <synopsis>
+                       Check Extension Status.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Exten" required="true">
+                               <para>Extension to check state on.</para>
+                       </parameter>
+                       <parameter name="Context" required="true">
+                               <para>Context for extension.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Report the extension state for given extension. If the extension has a hint,
+                       will use devicestate to check the status of the device connected to the extension.</para>
+                       <para>Will return an <literal>Extension Status</literal> message. The response will include
+                       the hint for the extension and the status.</para>
+               </description>
+       </manager>
+       <manager name="AbsoluteTimeout" language="en_US">
+               <synopsis>
+                       Set absolute timeout.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Channel" required="true">
+                               <para>Channel name to hangup.</para>
+                       </parameter>
+                       <parameter name="Timeout" required="true">
+                               <para>Maximum duration of the call (sec).</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Hangup a channel after a certain time. Acknowledges set time with
+                       <literal>Timeout Set</literal> message.</para>
+               </description>
+       </manager>
+       <manager name="MailboxStatus" language="en_US">
+               <synopsis>
+                       Check mailbox.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Mailbox" required="true">
+                               <para>Full mailbox ID <replaceable>mailbox</replaceable>@<replaceable>vm-context</replaceable>.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Checks a voicemail account for status.</para>
+                       <para>Returns number of messages.</para>
+                       <para>Message: Mailbox Status.</para>
+                       <para>Mailbox: <replaceable>mailboxid</replaceable>.</para>
+                       <para>Waiting: <replaceable>count</replaceable>.</para>
+               </description>
+       </manager>
+       <manager name="MailboxCount" language="en_US">
+               <synopsis>
+                       Check Mailbox Message Count.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Mailbox" required="true">
+                               <para>Full mailbox ID <replaceable>mailbox</replaceable>@<replaceable>vm-context</replaceable>.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Checks a voicemail account for new messages.</para>
+                       <para>Returns number of urgent, new and old messages.</para>
+                       <para>Message: Mailbox Message Count</para>
+                       <para>Mailbox: <replaceable>mailboxid</replaceable></para>
+                       <para>UrgentMessages: <replaceable>count</replaceable></para>
+                       <para>NewMessages: <replaceable>count</replaceable></para>
+                       <para>OldMessages: <replaceable>count</replaceable></para>
+               </description>
+       </manager>
+       <manager name="ListCommands" language="en_US">
+               <synopsis>
+                       List available manager commands.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>Returns the action name and synopsis for every action that
+                       is available to the user.</para>
+               </description>
+       </manager>
+       <manager name="SendText" language="en_US">
+               <synopsis>
+                       Send text message to channel.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Channel" required="true">
+                               <para>Channel to send message to.</para>
+                       </parameter>
+                       <parameter name="Message" required="true">
+                               <para>Message to send.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Sends A Text Message to a channel while in a call.</para>
+               </description>
+       </manager>
+       <manager name="UserEvent" language="en_US">
+               <synopsis>
+                       Send an arbitrary event.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="UserEvent" required="true">
+                               <para>Event string to send.</para>
+                       </parameter>
+                       <parameter name="Header1">
+                               <para>Content1.</para>
+                       </parameter>
+                       <parameter name="HeaderN">
+                               <para>ContentN.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Send an event to manager sessions.</para>
+               </description>
+       </manager>
+       <manager name="WaitEvent" language="en_US">
+               <synopsis>
+                       Wait for an event to occur.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Timeout" required="true">
+                               <para>Maximum time (in seconds) to wait for events, <literal>-1</literal> means forever.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>This action will ellicit a <literal>Success</literal> response. Whenever
+                       a manager event is queued. Once WaitEvent has been called on an HTTP manager
+                       session, events will be generated and queued.</para>
+               </description>
+       </manager>
+       <manager name="CoreSettings" language="en_US">
+               <synopsis>
+                       Show PBX core settings (version etc).
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>Query for Core PBX settings.</para>
+               </description>
+       </manager>
+       <manager name="CoreStatus" language="en_US">
+               <synopsis>
+                       Show PBX core status variables.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>Query for Core PBX status.</para>
+               </description>
+       </manager>
+       <manager name="Reload" language="en_US">
+               <synopsis>
+                       Send a reload event.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Module">
+                               <para>Name of the module to reload.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Send a reload event.</para>
+               </description>
+       </manager>
+       <manager name="CoreShowChannels" language="en_US">
+               <synopsis>
+                       List currently active channels.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+               </syntax>
+               <description>
+                       <para>List currently defined channels and some information about them.</para>
+               </description>
+       </manager>
+       <manager name="ModuleLoad" language="en_US">
+               <synopsis>
+                       Module management.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Module">
+                               <para>Asterisk module name (including .so extension) or subsystem identifier:</para>
+                               <enumlist>
+                                       <enum name="cdr" />
+                                       <enum name="enum" />
+                                       <enum name="dnsmgr" />
+                                       <enum name="extconfig" />
+                                       <enum name="manager" />
+                                       <enum name="rtp" />
+                                       <enum name="http" />
+                               </enumlist>
+                       </parameter>
+                       <parameter name="LoadType" required="true">
+                               <para>The operation to be done on module.</para>
+                               <enumlist>
+                                       <enum name="load" />
+                                       <enum name="unload" />
+                                       <enum name="reload" />
+                               </enumlist>
+                               <para>If no module is specified for a <literal>reload</literal> loadtype,
+                               all modules are reloaded.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Loads, unloads or reloads an Asterisk module in a running system.</para>
+               </description>
+       </manager>
+       <manager name="ModuleCheck" language="en_US">
+               <synopsis>
+                       Check if module is loaded.
+               </synopsis>
+               <syntax>
+                       <parameter name="Module" required="true">
+                               <para>Asterisk module name (not including extension).</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Checks if Asterisk module is loaded. Will return Success/Failure.
+                       For success returns, the module revision number is included.</para>
+               </description>
+       </manager>
+ ***/
+
 enum error_type {
        UNKNOWN_ACTION = 1,
        UNKNOWN_CATEGORY,
@@ -604,6 +1216,10 @@ static char *handle_showmancmd(struct ast_cli_entry *e, int cmd, struct ast_cli_
        struct ast_str *authority;
        int num, l, which;
        char *ret = NULL;
+#ifdef AST_XML_DOCS
+       char syntax_title[64], description_title[64], synopsis_title[64], seealso_title[64], arguments_title[64];
+#endif
+
        switch (cmd) {
        case CLI_INIT:
                e->command = "manager show command";
@@ -629,14 +1245,41 @@ static char *handle_showmancmd(struct ast_cli_entry *e, int cmd, struct ast_cli_
                return CLI_SHOWUSAGE;
        }
 
+#ifdef AST_XML_DOCS
+       /* setup the titles */
+       term_color(synopsis_title, "[Synopsis]\n", COLOR_MAGENTA, 0, 40);
+       term_color(description_title, "[Description]\n", COLOR_MAGENTA, 0, 40);
+       term_color(syntax_title, "[Syntax]\n", COLOR_MAGENTA, 0, 40);
+       term_color(seealso_title, "[See Also]\n", COLOR_MAGENTA, 0, 40);
+       term_color(arguments_title, "[Arguments]\n", COLOR_MAGENTA, 0, 40);
+#endif
+
        AST_RWLIST_RDLOCK(&actions);
        AST_RWLIST_TRAVERSE(&actions, cur, list) {
                for (num = 3; num < a->argc; num++) {
                        if (!strcasecmp(cur->action, a->argv[num])) {
-                               ast_cli(a->fd, "Action: %s\nSynopsis: %s\nPrivilege: %s\n%s\n",
-                                       cur->action, cur->synopsis,
-                                       authority_to_str(cur->authority, &authority),
-                                       S_OR(cur->description, ""));
+#ifdef AST_XML_DOCS
+                               if (cur->docsrc == AST_XML_DOC) {
+                                       ast_cli(a->fd, "%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n",
+                                               syntax_title,
+                                               ast_xmldoc_printable(S_OR(cur->syntax, "Not available"), 1),
+                                               synopsis_title,
+                                               ast_xmldoc_printable(S_OR(cur->synopsis, "Not available"), 1),
+                                               description_title,
+                                               ast_xmldoc_printable(S_OR(cur->description, "Not available"), 1),
+                                               arguments_title,
+                                               ast_xmldoc_printable(S_OR(cur->arguments, "Not available"), 1),
+                                               seealso_title,
+                                               ast_xmldoc_printable(S_OR(cur->seealso, "Not available"), 1));
+                               } else {
+#endif
+                                       ast_cli(a->fd, "Action: %s\nSynopsis: %s\nPrivilege: %s\n%s\n",
+                                                       cur->action, cur->synopsis,
+                                                       authority_to_str(cur->authority, &authority),
+                                                       S_OR(cur->description, ""));
+#ifdef AST_XML_DOCS
+                               }
+#endif
                        }
                }
        }
@@ -1207,12 +1850,6 @@ static int authenticate(struct mansession *s, const struct message *m)
        return 0;
 }
 
-/*! \brief Manager PING */
-static const char mandescr_ping[] =
-"Description: A 'Ping' action will ellicit a 'Pong' response.  Used to keep the\n"
-"  manager connection open.\n"
-"Variables: NONE\n";
-
 static int action_ping(struct mansession *s, const struct message *m)
 {
        const char *actionid = astman_get_header(m, "ActionID");
@@ -1225,13 +1862,6 @@ static int action_ping(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_getconfig[] =
-"Description: A 'GetConfig' action will dump the contents of a configuration\n"
-"file by category and contents or optionally by specified category only.\n"
-"Variables: (Names marked with * are required)\n"
-"   *Filename: Configuration filename (e.g. foo.conf)\n"
-"   Category: Category in configuration file\n";
-
 static int action_getconfig(struct mansession *s, const struct message *m)
 {
        struct ast_config *cfg;
@@ -1273,12 +1903,6 @@ static int action_getconfig(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_listcategories[] =
-"Description: A 'ListCategories' action will dump the categories in\n"
-"a given file.\n"
-"Variables:\n"
-"   Filename: Configuration filename (e.g. foo.conf)\n";
-
 static int action_listcategories(struct mansession *s, const struct message *m)
 {
        struct ast_config *cfg;
@@ -1324,13 +1948,6 @@ static void json_escape(char *out, const char *in)
        *out = '\0';
 }
 
-static const char mandescr_getconfigjson[] =
-"Description: A 'GetConfigJSON' action will dump the contents of a configuration\n"
-"file by category and contents in JSON format.  This only makes sense to be used\n"
-"using rawman over the HTTP interface.\n"
-"Variables:\n"
-"   Filename: Configuration filename (e.g. foo.conf)\n";
-
 static int action_getconfigjson(struct mansession *s, const struct message *m)
 {
        struct ast_config *cfg;
@@ -1543,20 +2160,6 @@ static enum error_type handle_updates(struct mansession *s, const struct message
        return result;
 }
 
-static const char mandescr_updateconfig[] =
-"Description: A 'UpdateConfig' action will modify, create, or delete\n"
-"configuration elements in Asterisk configuration files.\n"
-"Variables (X's represent 6 digit number beginning with 000000):\n"
-"   SrcFilename:   Configuration filename to read(e.g. foo.conf)\n"
-"   DstFilename:   Configuration filename to write(e.g. foo.conf)\n"
-"   Reload:        Whether or not a reload should take place (or name of specific module)\n"
-"   Action-XXXXXX: Action to Take (NewCat,RenameCat,DelCat,EmptyCat,Update,Delete,Append,Insert)\n"
-"   Cat-XXXXXX:    Category to operate on\n"
-"   Var-XXXXXX:    Variable to work on\n"
-"   Value-XXXXXX:  Value to work on\n"
-"   Match-XXXXXX:  Extra match required to match line\n"
-"   Line-XXXXXX:   Line in category to operate on (used with delete and insert actions)\n";
-
 static int action_updateconfig(struct mansession *s, const struct message *m)
 {
        struct ast_config *cfg;
@@ -1632,13 +2235,6 @@ static int action_updateconfig(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_createconfig[] =
-"Description: A 'CreateConfig' action will create an empty file in the\n"
-"configuration directory. This action is intended to be used before an\n"
-"UpdateConfig action.\n"
-"Variables\n"
-"   Filename:   The configuration filename to create (e.g. foo.conf)\n";
-
 static int action_createconfig(struct mansession *s, const struct message *m)
 {
        int fd;
@@ -1657,14 +2253,6 @@ static int action_createconfig(struct mansession *s, const struct message *m)
        return 0;
 }
 
-/*! \brief Manager WAITEVENT */
-static const char mandescr_waitevent[] =
-"Description: A 'WaitEvent' action will ellicit a 'Success' response.  Whenever\n"
-"a manager event is queued.  Once WaitEvent has been called on an HTTP manager\n"
-"session, events will be generated and queued.\n"
-"Variables: \n"
-"   Timeout: Maximum time (in seconds) to wait for events, -1 means forever.\n";
-
 static int action_waitevent(struct mansession *s, const struct message *m)
 {
        const char *timeouts = astman_get_header(m, "Timeout");
@@ -1771,11 +2359,6 @@ static int action_waitevent(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_listcommands[] =
-"Description: Returns the action name and synopsis for every\n"
-"  action that is available to the user\n"
-"Variables: NONE\n";
-
 /*! \note The actionlock is read-locked by the caller of this function */
 static int action_listcommands(struct mansession *s, const struct message *m)
 {
@@ -1794,14 +2377,6 @@ static int action_listcommands(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_events[] =
-"Description: Enable/Disable sending of events to this manager\n"
-"  client.\n"
-"Variables:\n"
-"      EventMask: 'on' if all events should be sent,\n"
-"              'off' if no events should be sent,\n"
-"              'system,call,log' to select which flags events should have to be sent.\n";
-
 static int action_events(struct mansession *s, const struct message *m)
 {
        const char *mask = astman_get_header(m, "EventMask");
@@ -1817,10 +2392,6 @@ static int action_events(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_logoff[] =
-"Description: Logoff this manager session\n"
-"Variables: NONE\n";
-
 static int action_logoff(struct mansession *s, const struct message *m)
 {
        astman_send_response(s, m, "Goodbye", "Thanks for all the fish.");
@@ -1867,12 +2438,6 @@ static int action_challenge(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_hangup[] =
-"Description: Hangup a channel\n"
-"Variables: \n"
-"      Channel: The channel name to be hungup\n"
-"      Cause: numeric hangup cause\n";
-
 static int action_hangup(struct mansession *s, const struct message *m)
 {
        struct ast_channel *c = NULL;
@@ -1916,13 +2481,6 @@ static int action_hangup(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_setvar[] =
-"Description: Set a global or local channel variable.\n"
-"Variables: (Names marked with * are required)\n"
-"      Channel: Channel to set variable for\n"
-"      *Variable: Variable name\n"
-"      *Value: Value\n";
-
 static int action_setvar(struct mansession *s, const struct message *m)
 {
        struct ast_channel *c = NULL;
@@ -1953,13 +2511,6 @@ static int action_setvar(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_getvar[] =
-"Description: Get the value of a global or local channel variable.\n"
-"Variables: (Names marked with * are required)\n"
-"      Channel: Channel to read variable from\n"
-"      *Variable: Variable name\n"
-"      ActionID: Optional Action id for message matching.\n";
-
 static int action_getvar(struct mansession *s, const struct message *m)
 {
        struct ast_channel *c = NULL;
@@ -2006,16 +2557,6 @@ static int action_getvar(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_status[] =
-"Description: Lists channel status along with requested channel vars.\n"
-"Variables: (Names marked with * are required)\n"
-"      *Channel: Name of the channel to query for status\n"
-"      Variables: Comma ',' separated list of variables to include\n"
-"      ActionID: Optional ID for this transaction\n"
-"Will return the status information of each channel along with the\n"
-"value for the specified channel variables.\n";
-
-
 /*! \brief Manager "status" command to show channels */
 /* Needs documentation... */
 static int action_status(struct mansession *s, const struct message *m)
@@ -2163,13 +2704,6 @@ static int action_status(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_sendtext[] =
-"Description: Sends A Text Message while in a call.\n"
-"Variables: (Names marked with * are required)\n"
-"       *Channel: Channel to send message to\n"
-"       *Message: Message to send\n"
-"       ActionID: Optional Action id for message matching.\n";
-
 static int action_sendtext(struct mansession *s, const struct message *m)
 {
        struct ast_channel *c = NULL;
@@ -2206,16 +2740,6 @@ static int action_sendtext(struct mansession *s, const struct message *m)
        return res;
 }
 
-static const char mandescr_redirect[] =
-"Description: Redirect (transfer) a call.\n"
-"Variables: (Names marked with * are required)\n"
-"      *Channel: Channel to redirect\n"
-"      ExtraChannel: Second call leg to transfer (optional)\n"
-"      *Exten: Extension to transfer to\n"
-"      *Context: Context to transfer to\n"
-"      *Priority: Priority to transfer to\n"
-"      ActionID: Optional Action id for message matching.\n";
-
 /*! \brief  action_redirect: The redirect manager command */
 static int action_redirect(struct mansession *s, const struct message *m)
 {
@@ -2306,15 +2830,6 @@ static int action_redirect(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_atxfer[] =
-"Description: Attended transfer.\n"
-"Variables: (Names marked with * are required)\n"
-"      *Channel: Transferer's channel\n"
-"      *Exten: Extension to transfer to\n"
-"      *Context: Context to transfer to\n"
-"      *Priority: Priority to transfer to\n"
-"      ActionID: Optional Action id for message matching.\n";
-
 static int action_atxfer(struct mansession *s, const struct message *m)
 {
        const char *name = astman_get_header(m, "Channel");
@@ -2399,12 +2914,6 @@ static int check_blacklist(const char *cmd)
        return 0;
 }
 
-static const char mandescr_command[] =
-"Description: Run a CLI command.\n"
-"Variables: (Names marked with * are required)\n"
-"      *Command: Asterisk CLI command to run\n"
-"      ActionID: Optional Action id for message matching.\n";
-
 /*! \brief  Manager command "command" - execute CLI command */
 static int action_command(struct mansession *s, const struct message *m)
 {
@@ -2526,22 +3035,6 @@ static void *fast_originate(void *data)
        return NULL;
 }
 
-static const char mandescr_originate[] =
-"Description: Generates an outgoing call to a Extension/Context/Priority or\n"
-"  Application/Data\n"
-"Variables: (Names marked with * are required)\n"
-"      *Channel: Channel name to call\n"
-"      Exten: Extension to use (requires 'Context' and 'Priority')\n"
-"      Context: Context to use (requires 'Exten' and 'Priority')\n"
-"      Priority: Priority to use (requires 'Exten' and 'Context')\n"
-"      Application: Application to use\n"
-"      Data: Data to use (requires 'Application')\n"
-"      Timeout: How long to wait for call to be answered (in ms)\n"
-"      CallerID: Caller ID to be set on the outgoing channel\n"
-"      Variable: Channel variable to set, multiple Variable: headers are allowed\n"
-"      Account: Account code\n"
-"      Async: Set to 'true' for fast origination\n";
-
 static int action_originate(struct mansession *s, const struct message *m)
 {
        const char *name = astman_get_header(m, "Channel");
@@ -2671,19 +3164,6 @@ static int action_originate(struct mansession *s, const struct message *m)
        return 0;
 }
 
-/*! \brief Help text for manager command mailboxstatus
- */
-static const char mandescr_mailboxstatus[] =
-"Description: Checks a voicemail account for status.\n"
-"Variables: (Names marked with * are required)\n"
-"      *Mailbox: Full mailbox ID <mailbox>@<vm-context>\n"
-"      ActionID: Optional ActionID for message matching.\n"
-"Returns number of messages.\n"
-"      Message: Mailbox Status\n"
-"      Mailbox: <mailboxid>\n"
-"      Waiting: <count>\n"
-"\n";
-
 static int action_mailboxstatus(struct mansession *s, const struct message *m)
 {
        const char *mailbox = astman_get_header(m, "Mailbox");
@@ -2701,18 +3181,6 @@ static int action_mailboxstatus(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_mailboxcount[] =
-"Description: Checks a voicemail account for new messages.\n"
-"Variables: (Names marked with * are required)\n"
-"      *Mailbox: Full mailbox ID <mailbox>@<vm-context>\n"
-"      ActionID: Optional ActionID for message matching.\n"
-"Returns number of urgent, new and old messages.\n"
-"      Message: Mailbox Message Count\n"
-"      Mailbox: <mailboxid>\n"
-"      UrgentMessages: <count>\n"
-"      NewMessages: <count>\n"
-"      OldMessages: <count>\n"
-"\n";
 static int action_mailboxcount(struct mansession *s, const struct message *m)
 {
        const char *mailbox = astman_get_header(m, "Mailbox");
@@ -2734,17 +3202,6 @@ static int action_mailboxcount(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_extensionstate[] =
-"Description: Report the extension state for given extension.\n"
-"  If the extension has a hint, will use devicestate to check\n"
-"  the status of the device connected to the extension.\n"
-"Variables: (Names marked with * are required)\n"
-"      *Exten: Extension to check state on\n"
-"      *Context: Context for extension\n"
-"      ActionId: Optional ID for this transaction\n"
-"Will return an \"Extension Status\" message.\n"
-"The response will include the hint for the extension and the status.\n";
-
 static int action_extensionstate(struct mansession *s, const struct message *m)
 {
        const char *exten = astman_get_header(m, "Exten");
@@ -2770,13 +3227,6 @@ static int action_extensionstate(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_timeout[] =
-"Description: Hangup a channel after a certain time.\n"
-"Variables: (Names marked with * are required)\n"
-"      *Channel: Channel name to hangup\n"
-"      *Timeout: Maximum duration of the call (sec)\n"
-"Acknowledges set time with 'Timeout Set' message\n";
-
 static int action_timeout(struct mansession *s, const struct message *m)
 {
        struct ast_channel *c;
@@ -2839,13 +3289,6 @@ static int process_events(struct mansession *s)
        return ret;
 }
 
-static const char mandescr_userevent[] =
-"Description: Send an event to manager sessions.\n"
-"Variables: (Names marked with * are required)\n"
-"       *UserEvent: EventStringToSend\n"
-"       Header1: Content1\n"
-"       HeaderN: ContentN\n";
-
 static int action_userevent(struct mansession *s, const struct message *m)
 {
        const char *event = astman_get_header(m, "UserEvent");
@@ -2864,11 +3307,6 @@ static int action_userevent(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_coresettings[] =
-"Description: Query for Core PBX settings.\n"
-"Variables: (Names marked with * are optional)\n"
-"       *ActionID: ActionID of this transaction\n";
-
 /*! \brief Show PBX core settings information */
 static int action_coresettings(struct mansession *s, const struct message *m)
 {
@@ -2911,11 +3349,6 @@ static int action_coresettings(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_corestatus[] =
-"Description: Query for Core PBX status.\n"
-"Variables: (Names marked with * are optional)\n"
-"       *ActionID: ActionID of this transaction\n";
-
 /*! \brief Show PBX core status information */
 static int action_corestatus(struct mansession *s, const struct message *m)
 {
@@ -2950,12 +3383,6 @@ static int action_corestatus(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_reload[] =
-"Description: Send a reload event.\n"
-"Variables: (Names marked with * are optional)\n"
-"       *ActionID: ActionID of this transaction\n"
-"       *Module: Name of the module to reload\n";
-
 /*! \brief Send a reload event */
 static int action_reload(struct mansession *s, const struct message *m)
 {
@@ -2970,12 +3397,6 @@ static int action_reload(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_coreshowchannels[] =
-"Description: List currently defined channels and some information\n"
-"             about them.\n"
-"Variables:\n"
-"          ActionID: Optional Action id for message matching.\n";
-
 /*! \brief  Manager command "CoreShowChannels" - List currently defined channels
  *          and some information about them. */
 static int action_coreshowchannels(struct mansession *s, const struct message *m)
@@ -3052,15 +3473,6 @@ static int action_coreshowchannels(struct mansession *s, const struct message *m
        return 0;
 }
 
-static const char mandescr_modulecheck[] =
-"Description: Checks if Asterisk module is loaded\n"
-"Variables: \n"
-"  ActionID: <id>          Action ID for this transaction. Will be returned.\n"
-"  Module: <name>          Asterisk module name (not including extension)\n"
-"\n"
-"Will return Success/Failure\n"
-"For success returns, the module revision number is included.\n";
-
 /* Manager function to check if module is loaded */
 static int manager_modulecheck(struct mansession *s, const struct message *m)
 {
@@ -3105,17 +3517,6 @@ static int manager_modulecheck(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_moduleload[] =
-"Description: Loads, unloads or reloads an Asterisk module in a running system.\n"
-"Variables: \n"
-"  ActionID: <id>          Action ID for this transaction. Will be returned.\n"
-"  Module: <name>          Asterisk module name (including .so extension)\n"
-"                          or subsystem identifier:\n"
-"                              cdr, enum, dnsmgr, extconfig, manager, rtp, http\n"
-"  LoadType: load | unload | reload\n"
-"                          The operation to be done on module\n"
-" If no module is specified for a reload loadtype, all modules are reloaded";
-
 static int manager_moduleload(struct mansession *s, const struct message *m)
 {
        int res;
@@ -3584,6 +3985,7 @@ int ast_manager_unregister(char *action)
        AST_RWLIST_TRAVERSE_SAFE_BEGIN(&actions, cur, list) {
                if (!strcasecmp(action, cur->action)) {
                        AST_RWLIST_REMOVE_CURRENT(list);
+                       ast_string_field_free_memory(cur);
                        ast_free(cur);
                        ast_verb(2, "Manager unregistered action %s\n", action);
                        break;
@@ -3645,17 +4047,53 @@ static int ast_manager_register_struct(struct manager_action *act)
 int ast_manager_register2(const char *action, int auth, int (*func)(struct mansession *s, const struct message *m), const char *synopsis, const char *description)
 {
        struct manager_action *cur = NULL;
+#ifdef AST_XML_DOCS
+       char *tmpxml;
+#endif
 
        if (!(cur = ast_calloc(1, sizeof(*cur)))) {
                return -1;
        }
 
+       if (ast_string_field_init(cur, 128)) {
+               ast_free(cur);
+               return -1;
+       }
+
        cur->action = action;
        cur->authority = auth;
        cur->func = func;
-       cur->synopsis = synopsis;
-       cur->description = description;
+#ifdef AST_XML_DOCS
+       if (ast_strlen_zero(synopsis) && ast_strlen_zero(description)) {
+               tmpxml = ast_xmldoc_build_synopsis("manager", action);
+               ast_string_field_set(cur, synopsis, tmpxml);
+               ast_free(tmpxml);
+
+               tmpxml = ast_xmldoc_build_syntax("manager", action);
+               ast_string_field_set(cur, syntax, tmpxml);
+               ast_free(tmpxml);
+
+               tmpxml = ast_xmldoc_build_description("manager", action);
+               ast_string_field_set(cur, description, tmpxml);
+               ast_free(tmpxml);
 
+               tmpxml = ast_xmldoc_build_seealso("manager", action);
+               ast_string_field_set(cur, seealso, tmpxml);
+               ast_free(tmpxml);
+
+               tmpxml = ast_xmldoc_build_arguments("manager", action);
+               ast_string_field_set(cur, arguments, tmpxml);
+               ast_free(tmpxml);
+
+               cur->docsrc = AST_XML_DOC;
+       } else {
+#endif
+               ast_string_field_set(cur, synopsis, synopsis);
+               ast_string_field_set(cur, description, description);
+#ifdef AST_XML_DOCS
+               cur->docsrc = AST_STATIC_DOC;
+       }
+#endif
        if (ast_manager_register_struct(cur)) {
                ast_free(cur);
                return -1;
@@ -4724,38 +5162,38 @@ static int __init_manager(int reload)
 
        if (!registered) {
                /* Register default actions */
-               ast_manager_register2("Ping", 0, action_ping, "Keepalive command", mandescr_ping);
-               ast_manager_register2("Events", 0, action_events, "Control Event Flow", mandescr_events);
-               ast_manager_register2("Logoff", 0, action_logoff, "Logoff Manager", mandescr_logoff);
-               ast_manager_register2("Login", 0, action_login, "Login Manager", NULL);
-               ast_manager_register2("Challenge", 0, action_challenge, "Generate Challenge for MD5 Auth", NULL);
-               ast_manager_register2("Hangup", EVENT_FLAG_SYSTEM | EVENT_FLAG_CALL, action_hangup, "Hangup Channel", mandescr_hangup);
-               ast_manager_register2("Status", EVENT_FLAG_SYSTEM | EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_status, "Lists channel status", mandescr_status);
-               ast_manager_register2("Setvar", EVENT_FLAG_CALL, action_setvar, "Set Channel Variable", mandescr_setvar);
-               ast_manager_register2("Getvar", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_getvar, "Gets a Channel Variable", mandescr_getvar);
-               ast_manager_register2("GetConfig", EVENT_FLAG_SYSTEM | EVENT_FLAG_CONFIG, action_getconfig, "Retrieve configuration", mandescr_getconfig);
-               ast_manager_register2("GetConfigJSON", EVENT_FLAG_SYSTEM | EVENT_FLAG_CONFIG, action_getconfigjson, "Retrieve configuration (JSON format)", mandescr_getconfigjson);
-               ast_manager_register2("UpdateConfig", EVENT_FLAG_CONFIG, action_updateconfig, "Update basic configuration", mandescr_updateconfig);
-               ast_manager_register2("CreateConfig", EVENT_FLAG_CONFIG, action_createconfig, "Creates an empty file in the configuration directory", mandescr_createconfig);
-               ast_manager_register2("ListCategories", EVENT_FLAG_CONFIG, action_listcategories, "List categories in configuration file", mandescr_listcategories);
-               ast_manager_register2("Redirect", EVENT_FLAG_CALL, action_redirect, "Redirect (transfer) a call", mandescr_redirect );
-               ast_manager_register2("Atxfer", EVENT_FLAG_CALL, action_atxfer, "Attended transfer", mandescr_atxfer);
-               ast_manager_register2("Originate", EVENT_FLAG_ORIGINATE, action_originate, "Originate Call", mandescr_originate);
-               ast_manager_register2("Command", EVENT_FLAG_COMMAND, action_command, "Execute Asterisk CLI Command", mandescr_command );
-               ast_manager_register2("ExtensionState", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_extensionstate, "Check Extension Status", mandescr_extensionstate );
-               ast_manager_register2("AbsoluteTimeout", EVENT_FLAG_SYSTEM | EVENT_FLAG_CALL, action_timeout, "Set Absolute Timeout", mandescr_timeout );
-               ast_manager_register2("MailboxStatus", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_mailboxstatus, "Check Mailbox", mandescr_mailboxstatus );
-               ast_manager_register2("MailboxCount", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_mailboxcount, "Check Mailbox Message Count", mandescr_mailboxcount );
-               ast_manager_register2("ListCommands", 0, action_listcommands, "List available manager commands", mandescr_listcommands);
-               ast_manager_register2("SendText", EVENT_FLAG_CALL, action_sendtext, "Send text message to channel", mandescr_sendtext);
-               ast_manager_register2("UserEvent", EVENT_FLAG_USER, action_userevent, "Send an arbitrary event", mandescr_userevent);
-               ast_manager_register2("WaitEvent", 0, action_waitevent, "Wait for an event to occur", mandescr_waitevent);
-               ast_manager_register2("CoreSettings", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, action_coresettings, "Show PBX core settings (version etc)", mandescr_coresettings);
-               ast_manager_register2("CoreStatus", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, action_corestatus, "Show PBX core status variables", mandescr_corestatus);
-               ast_manager_register2("Reload", EVENT_FLAG_CONFIG | EVENT_FLAG_SYSTEM, action_reload, "Send a reload event", mandescr_reload);
-               ast_manager_register2("CoreShowChannels", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, action_coreshowchannels, "List currently active channels", mandescr_coreshowchannels);
-               ast_manager_register2("ModuleLoad", EVENT_FLAG_SYSTEM, manager_moduleload, "Module management", mandescr_moduleload);
-               ast_manager_register2("ModuleCheck", EVENT_FLAG_SYSTEM, manager_modulecheck, "Check if module is loaded", mandescr_modulecheck);
+               ast_manager_register_xml("Ping", 0, action_ping);
+               ast_manager_register_xml("Events", 0, action_events);
+               ast_manager_register_xml("Logoff", 0, action_logoff);
+               ast_manager_register_xml("Login", 0, action_login);
+               ast_manager_register_xml("Challenge", 0, action_challenge);
+               ast_manager_register_xml("Hangup", EVENT_FLAG_SYSTEM | EVENT_FLAG_CALL, action_hangup);
+               ast_manager_register_xml("Status", EVENT_FLAG_SYSTEM | EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_status);
+               ast_manager_register_xml("Setvar", EVENT_FLAG_CALL, action_setvar);
+               ast_manager_register_xml("Getvar", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_getvar);
+               ast_manager_register_xml("GetConfig", EVENT_FLAG_SYSTEM | EVENT_FLAG_CONFIG, action_getconfig);
+               ast_manager_register_xml("GetConfigJSON", EVENT_FLAG_SYSTEM | EVENT_FLAG_CONFIG, action_getconfigjson);
+               ast_manager_register_xml("UpdateConfig", EVENT_FLAG_CONFIG, action_updateconfig);
+               ast_manager_register_xml("CreateConfig", EVENT_FLAG_CONFIG, action_createconfig);
+               ast_manager_register_xml("ListCategories", EVENT_FLAG_CONFIG, action_listcategories);
+               ast_manager_register_xml("Redirect", EVENT_FLAG_CALL, action_redirect);
+               ast_manager_register_xml("Atxfer", EVENT_FLAG_CALL, action_atxfer);
+               ast_manager_register_xml("Originate", EVENT_FLAG_ORIGINATE, action_originate);
+               ast_manager_register_xml("Command", EVENT_FLAG_COMMAND, action_command);
+               ast_manager_register_xml("ExtensionState", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_extensionstate);
+               ast_manager_register_xml("AbsoluteTimeout", EVENT_FLAG_SYSTEM | EVENT_FLAG_CALL, action_timeout);
+               ast_manager_register_xml("MailboxStatus", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_mailboxstatus);
+               ast_manager_register_xml("MailboxCount", EVENT_FLAG_CALL | EVENT_FLAG_REPORTING, action_mailboxcount);
+               ast_manager_register_xml("ListCommands", 0, action_listcommands);
+               ast_manager_register_xml("SendText", EVENT_FLAG_CALL, action_sendtext);
+               ast_manager_register_xml("UserEvent", EVENT_FLAG_USER, action_userevent);
+               ast_manager_register_xml("WaitEvent", 0, action_waitevent);
+               ast_manager_register_xml("CoreSettings", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, action_coresettings);
+               ast_manager_register_xml("CoreStatus", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, action_corestatus);
+               ast_manager_register_xml("Reload", EVENT_FLAG_CONFIG | EVENT_FLAG_SYSTEM, action_reload);
+               ast_manager_register_xml("CoreShowChannels", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, action_coreshowchannels);
+               ast_manager_register_xml("ModuleLoad", EVENT_FLAG_SYSTEM, manager_moduleload);
+               ast_manager_register_xml("ModuleCheck", EVENT_FLAG_SYSTEM, manager_modulecheck);
 
                ast_cli_register_multiple(cli_manager, ARRAY_LEN(cli_manager));
                ast_extension_state_add(NULL, NULL, manager_state_cb, NULL);
index f64810e..4e4b1c6 100644 (file)
@@ -717,6 +717,24 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        <ref type="application">RaiseException</ref>
                </see-also>
        </function>
+       <manager name="ShowDialPlan" language="en_US">
+               <synopsis>
+                       La merde se produit.
+               </synopsis>
+               <syntax>
+                       <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+                       <parameter name="Extension">
+                               <para>Show a specific extension.</para>
+                       </parameter>
+                       <parameter name="Context">
+                               <para>Show a specific context.</para>
+                       </parameter>
+               </syntax>
+               <description>
+                       <para>Show dialplan contexts and extensions. Be aware that showing the full dialplan
+                       may take a lot of capacity.</para>
+               </description>
+       </manager>
  ***/
 
 #ifdef LOW_MEMORY
@@ -863,7 +881,9 @@ struct ast_app {
                AST_STRING_FIELD(arguments);    /*!< Arguments description */
                AST_STRING_FIELD(seealso);      /*!< See also */
        );
-       enum ast_doc_src docsrc;/*!< Where the documentation come from. */
+#ifdef AST_XML_DOCS
+       enum ast_doc_src docsrc;                /*!< Where the documentation come from. */
+#endif
        AST_RWLIST_ENTRY(ast_app) list;         /*!< Next app in list */
        struct ast_module *module;              /*!< Module this app belongs to */
        char name[0];                           /*!< Name of the application */
@@ -3267,9 +3287,11 @@ int ast_custom_function_unregister(struct ast_custom_function *acf)
 
        AST_RWLIST_WRLOCK(&acf_root);
        if ((cur = AST_RWLIST_REMOVE(&acf_root, acf, acflist))) {
+#ifdef AST_XML_DOCS
                if (cur->docsrc == AST_XML_DOC) {
                        ast_string_field_free_memory(acf);
                }
+#endif
                ast_verb(2, "Unregistered custom function %s\n", cur->name);
        }
        AST_RWLIST_UNLOCK(&acf_root);
@@ -3340,7 +3362,9 @@ int __ast_custom_function_register(struct ast_custom_function *acf, struct ast_m
        }
 
        acf->mod = mod;
+#ifdef AST_XML_DOCS
        acf->docsrc = AST_STATIC_DOC;
+#endif
 
        if (acf_retrieve_docs(acf)) {
                return -1;
@@ -5395,8 +5419,8 @@ int ast_register_application2(const char *app, int (*execute)(struct ast_channel
 #endif
                ast_string_field_set(tmp, synopsis, synopsis);
                ast_string_field_set(tmp, description, description);
-               tmp->docsrc = AST_STATIC_DOC;
 #ifdef AST_XML_DOCS
+               tmp->docsrc = AST_STATIC_DOC;
        }
 #endif
 
@@ -6416,15 +6440,6 @@ static int manager_show_dialplan(struct mansession *s, const struct message *m)
        return 0;
 }
 
-static const char mandescr_show_dialplan[] =
-"Description: Show dialplan contexts and extensions.\n"
-"Be aware that showing the full dialplan may take a lot of capacity\n"
-"Variables: \n"
-" ActionID: <id>               Action ID for this AMI transaction (optional)\n"
-" Extension: <extension>       Extension (Optional)\n"
-" Context: <context>           Context (Optional)\n"
-"\n";
-
 /*! \brief CLI support for listing global variables in a parseable way */
 static char *handle_show_globals(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
@@ -9546,7 +9561,7 @@ int load_pbx(void)
        }
 
        /* Register manager application */
-       ast_manager_register2("ShowDialPlan", EVENT_FLAG_CONFIG | EVENT_FLAG_REPORTING, manager_show_dialplan, "List dialplan", mandescr_show_dialplan);
+       ast_manager_register_xml("ShowDialPlan", EVENT_FLAG_CONFIG | EVENT_FLAG_REPORTING, manager_show_dialplan);
 
        if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, NULL,
                        AST_EVENT_IE_END))) {
index 29d951a..3f9b607 100644 (file)
@@ -986,9 +986,66 @@ static char *xmldoc_get_syntax_cmd(struct ast_xml_node *fixnode, const char *nam
        return ret;
 }
 
+/*! \internal
+ *  \brief Generate an AMI action syntax.
+ *  \param fixnode The manager action node pointer.
+ *  \param name The name of the manager action.
+ *  \retval The generated syntax.
+ *  \retval NULL on error.
+ */
+static char *xmldoc_get_syntax_manager(struct ast_xml_node *fixnode, const char *name)
+{
+       struct ast_str *syntax;
+       struct ast_xml_node *node = fixnode;
+       const char *paramtype, *attrname;
+       int required;
+       char *ret;
+
+       syntax = ast_str_create(128);
+       if (!syntax) {
+               return ast_strdup(name);
+       }
+
+       ast_str_append(&syntax, 0, "Action: %s", name);
+
+       for (node = ast_xml_node_get_children(node); node; node = ast_xml_node_get_next(node)) {
+               if (strcasecmp(ast_xml_node_get_name(node), "parameter")) {
+                       continue;
+               }
+
+               /* Is this parameter required? */
+               required = 0;
+               paramtype = ast_xml_get_attribute(node, "required");
+               if (paramtype) {
+                       required = ast_true(paramtype);
+                       ast_xml_free_attr(paramtype);
+               }
+
+               attrname = ast_xml_get_attribute(node, "name");
+               if (!attrname) {
+                       /* ignore this bogus parameter and continue. */
+                       continue;
+               }
+
+               ast_str_append(&syntax, 0, "\n%s%s:%s <value>",
+                       (required ? "" : "["),
+                       attrname,
+                       (required ? "" : "]"));
+
+               ast_xml_free_attr(attrname);
+       }
+
+       /* return a common string. */
+       ret = ast_strdup(ast_str_buffer(syntax));
+       ast_free(syntax);
+
+       return ret;
+}
+
 /*! \brief Types of syntax that we are able to generate. */
 enum syntaxtype {
        FUNCTION_SYNTAX,
+       MANAGER_SYNTAX,
        COMMAND_SYNTAX
 };
 
@@ -999,6 +1056,7 @@ struct strsyntaxtype {
 } stxtype[] = {
        { "function",           FUNCTION_SYNTAX },
        { "application",        FUNCTION_SYNTAX },
+       { "manager",            MANAGER_SYNTAX  },
        { "agi",                COMMAND_SYNTAX  }
 };
 
@@ -1036,10 +1094,18 @@ char *ast_xmldoc_build_syntax(const char *type, const char *name)
        }
 
        if (node) {
-               if (xmldoc_get_syntax_type(type) == FUNCTION_SYNTAX) {
+               switch (xmldoc_get_syntax_type(type)) {
+               case FUNCTION_SYNTAX:
                        syntax = xmldoc_get_syntax_fun(node, name, "parameter", 1, 1);
-               } else {
+                       break;
+               case COMMAND_SYNTAX:
                        syntax = xmldoc_get_syntax_cmd(node, name, 1);
+                       break;
+               case MANAGER_SYNTAX:
+                       syntax = xmldoc_get_syntax_manager(node, name);
+                       break;
+               default:
+                       syntax = xmldoc_get_syntax_fun(node, name, "parameter", 1, 1);
                }
        }
        return syntax;
index 9d312b8..fea5780 100644 (file)
@@ -2609,8 +2609,8 @@ int ast_agi_register(struct ast_module *mod, agi_command *cmd)
        ast_join(fullcmd, sizeof(fullcmd), cmd->cmda);
 
        if (!find_command(cmd->cmda, 1)) {
-               *((enum ast_doc_src *) &cmd->docsrc) = AST_STATIC_DOC;
 #ifdef AST_XML_DOCS
+               *((enum ast_doc_src *) &cmd->docsrc) = AST_STATIC_DOC;
                if (ast_strlen_zero(cmd->summary) && ast_strlen_zero(cmd->usage)) {
                        *((char **) &cmd->summary) = ast_xmldoc_build_synopsis("agi", fullcmd);
                        *((char **) &cmd->usage) = ast_xmldoc_build_description("agi", fullcmd);