]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add description and syntax to interface database, add description and syntax headers...
authorMichael Jerris <mike@jerris.com>
Sun, 8 Oct 2006 08:35:27 +0000 (08:35 +0000)
committerMichael Jerris <mike@jerris.com>
Sun, 8 Oct 2006 08:35:27 +0000 (08:35 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3003 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_commands/mod_commands.c
src/switch_core.c
src/switch_loadable_module.c

index 5636d14f11de58a3fa9a6f32f1cd6cf01e33b5af..2d55b721c5d39b793acd7a20802cf1beace2fa5f 100644 (file)
@@ -448,10 +448,12 @@ static switch_status_t show_function(char *cmd, switch_core_session_t *session,
     if (!cmd) {
         sprintf (sql, "select * from interfaces");
     }
-    else if ( !strcmp(cmd,"codec") || !strcmp(cmd,"application") || 
-              !strcmp(cmd,"api") || !strcmp(cmd,"dialplan") || 
+    else if ( !strcmp(cmd,"codec") || !strcmp(cmd,"dialplan") || 
               !strcmp(cmd,"file") || !strcmp(cmd,"timer") 
             ) {
+        sprintf (sql, "select type, name from interfaces where type = '%s'", cmd);
+    }
+    else if (!strcmp(cmd,"application") || !strcmp(cmd,"api")) {
         sprintf (sql, "select * from interfaces where type = '%s'", cmd);
     }
     else if ( !strcmp(cmd,"calls")) {
@@ -466,9 +468,9 @@ static switch_status_t show_function(char *cmd, switch_core_session_t *session,
                holder.print_title = 0;
                if ((cmdname = strchr(cmd, ' ')) != 0) {
                        *cmdname++ = '\0';
-               sprintf (sql, "select name from interfaces where type = 'api' and name = '%s'", cmdname);
+               sprintf (sql, "select name, description, syntax from interfaces where type = 'api' and name = '%s'", cmdname);
                } else {
-               sprintf (sql, "select name from interfaces where type = 'api'");
+               sprintf (sql, "select name, description, syntax from interfaces where type = 'api'");
                }
     }
     else {
@@ -519,7 +521,7 @@ static switch_status_t help_function(char *cmd, switch_core_session_t *session,
                stream->write_function(stream, "\nValid Commands:\n\n");
        show_function(showcmd, session, stream);
        if (all)
-               stream->write_function(stream, "version\n" "help - umm yeah..\n" "shutdown - stop the program\n\n");
+               stream->write_function(stream, "version\n" "shutdown - stop the program\n");
        return SWITCH_STATUS_SUCCESS;
 }
 
index 575653bc0fc0ac79d90ae8d8811729ca1f4e4a89..9c74f4939b14fbb3d45105e5a47eaca7ab8b7139 100644 (file)
@@ -3414,9 +3414,11 @@ static void core_event_handler(switch_event_t *event)
        case SWITCH_EVENT_LOG:
                return;
        case SWITCH_EVENT_MODULE_LOAD:
-               sql = switch_core_db_mprintf("insert into interfaces (type,name) values('%q','%q')",
+               sql = switch_core_db_mprintf("insert into interfaces (type,name,description,syntax) values('%q','%q','%q','%q')",
                                                                         switch_event_get_header(event, "type"),
-                                                                        switch_event_get_header(event, "name")
+                                                                        switch_event_get_header(event, "name"),
+                                                                        switch_event_get_header(event, "description"),
+                                                                        switch_event_get_header(event, "syntax")
                                                                         );
                break;
        default:
@@ -3661,7 +3663,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(char *console, const char **err
                char create_interfaces_sql[] =
                        "CREATE TABLE interfaces (\n"
                        "   type             VARCHAR(255),\n"
-                       "   name             VARCHAR(255)\n"
+                       "   name             VARCHAR(255),\n"
+                       "   description      VARCHAR(255),\n"
+                       "   syntax           VARCHAR(255)\n"
                        ");\n";
 
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening DB\n");
index 2392469ba68e011b65c2992d98e2c5de395290f0..c97483d1f94b2854bd6cec843483583db1924c1e 100644 (file)
@@ -161,6 +161,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
                        if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
                                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "application");
                                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name);
+                               switch_event_add_header(event, SWITCH_STACK_BOTTOM, "description", "%s", ptr->short_desc);
+                               switch_event_add_header(event, SWITCH_STACK_BOTTOM, "syntax", "%s", ptr->syntax);
                                switch_event_fire(&event);
                        }
                        switch_core_hash_insert(loadable_modules.application_hash,
@@ -176,6 +178,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
                        if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
                                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "api");
                                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name);
+                               switch_event_add_header(event, SWITCH_STACK_BOTTOM, "description", "%s", ptr->desc);
+                               switch_event_add_header(event, SWITCH_STACK_BOTTOM, "syntax", "%s", ptr->syntax);
                                switch_event_fire(&event);
                        }
                        switch_core_hash_insert(loadable_modules.api_hash, (char *) ptr->interface_name, (void *) ptr);