<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][15952] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=15952">15952</a></dd>
<dt>Author</dt> <dd>anthm</dd>
<dt>Date</dt> <dd>2009-12-14 14:10:06 -0600 (Mon, 14 Dec 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>cleanup tab completion more and introduce new callback based expansion functions to do real time tab completion in some areas, needs people to add more funcs etc </pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcincludeswitch_consoleh">freeswitch/trunk/src/include/switch_console.h</a></li>
<li><a href="#freeswitchtrunksrcincludeswitch_typesh">freeswitch/trunk/src/include/switch_types.h</a></li>
<li><a href="#freeswitchtrunksrcincludeswitch_utilsh">freeswitch/trunk/src/include/switch_utils.h</a></li>
<li><a href="#freeswitchtrunksrcmodapplicationsmod_commandsmod_commandsc">freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_sofiamod_sofiac">freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_sofiasofiac">freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_sofiasofia_gluec">freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c</a></li>
<li><a href="#freeswitchtrunksrcswitch_consolec">freeswitch/trunk/src/switch_console.c</a></li>
<li><a href="#freeswitchtrunksrcswitch_corec">freeswitch/trunk/src/switch_core.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcincludeswitch_consoleh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/include/switch_console.h (15951 => 15952)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/include/switch_console.h        2009-12-14 20:10:01 UTC (rev 15951)
+++ freeswitch/trunk/src/include/switch_console.h        2009-12-14 20:10:06 UTC (rev 15952)
</span><span class="lines">@@ -76,6 +76,16 @@
</span><span class="cx"> 
</span><span class="cx"> SWITCH_DECLARE(switch_status_t) switch_stream_write_file_contents(switch_stream_handle_t *stream, const char *path);
</span><span class="cx"> 
</span><ins>+
+SWITCH_DECLARE(switch_status_t) switch_console_init(switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_console_shutdown(void);
+SWITCH_DECLARE(switch_status_t) switch_console_add_complete_func(const char *name, switch_console_complete_callback_t cb);
+SWITCH_DECLARE(switch_status_t) switch_console_del_complete_func(const char *name);
+SWITCH_DECLARE(switch_status_t) switch_console_run_complete_func(const char *func, const char *line, 
+                                                                                                                                 const char *cursor, switch_console_callback_match_t **matches);
+SWITCH_DECLARE(void) switch_console_push_match(switch_console_callback_match_t **matches, const char *new_val);
+SWITCH_DECLARE(void) switch_console_free_matches(switch_console_callback_match_t **matches);
+
</ins><span class="cx"> SWITCH_END_EXTERN_C
</span><span class="cx"> #endif
</span><span class="cx"> /* For Emacs:
</span></span></pre></div>
<a id="freeswitchtrunksrcincludeswitch_typesh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/include/switch_types.h (15951 => 15952)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/include/switch_types.h        2009-12-14 20:10:01 UTC (rev 15951)
+++ freeswitch/trunk/src/include/switch_types.h        2009-12-14 20:10:06 UTC (rev 15952)
</span><span class="lines">@@ -1484,6 +1484,21 @@
</span><span class="cx"> typedef struct switch_management_interface switch_management_interface_t;
</span><span class="cx"> typedef struct switch_core_port_allocator switch_core_port_allocator_t;
</span><span class="cx"> typedef struct switch_media_bug switch_media_bug_t;
</span><ins>+
+struct switch_console_callback_match_node {
+        char *val;
+        struct switch_console_callback_match_node *next;
+};
+typedef struct switch_console_callback_match_node switch_console_callback_match_node_t;
+
+struct switch_console_callback_match {
+        struct switch_console_callback_match_node *head;
+        struct switch_console_callback_match_node *end;
+        switch_memory_pool_t *pool;
+};
+typedef struct switch_console_callback_match switch_console_callback_match_t;
+
+typedef switch_status_t (*switch_console_complete_callback_t) (const char *, const char *, switch_console_callback_match_t **matches);
</ins><span class="cx"> typedef switch_bool_t (*switch_media_bug_callback_t) (switch_media_bug_t *, void *, switch_abc_type_t);
</span><span class="cx"> typedef switch_bool_t (*switch_tone_detect_callback_t) (switch_core_session_t *, const char *, const char *);
</span><span class="cx"> typedef struct switch_xml_binding switch_xml_binding_t;
</span></span></pre></div>
<a id="freeswitchtrunksrcincludeswitch_utilsh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/include/switch_utils.h (15951 => 15952)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/include/switch_utils.h        2009-12-14 20:10:01 UTC (rev 15951)
+++ freeswitch/trunk/src/include/switch_utils.h        2009-12-14 20:10:06 UTC (rev 15952)
</span><span class="lines">@@ -89,8 +89,12 @@
</span><span class="cx">         return SWITCH_TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#define switch_arraylen(_a) (sizeof(_a) / sizeof(_a[0]))
+#define switch_split(_data, _delim, _array) switch_separate_string(_data, _delim, _array, switch_arraylen(_array))
+
</ins><span class="cx"> #define switch_is_valid_rate(_tmp) (_tmp == 8000 || _tmp == 16000 || _tmp == 32000 || _tmp == 11025 || _tmp == 22050 || _tmp == 44100 || _tmp == 48000)
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> static inline int switch_string_has_escaped_data(const char *in)
</span><span class="cx"> {
</span><span class="cx">         const char *i = strchr(in, '\\');
</span></span></pre></div>
<a id="freeswitchtrunksrcmodapplicationsmod_commandsmod_commandsc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (15951 => 15952)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c        2009-12-14 20:10:01 UTC (rev 15951)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c        2009-12-14 20:10:06 UTC (rev 15952)
</span><span class="lines">@@ -3784,140 +3784,163 @@
</span><span class="cx"> 
</span><span class="cx">         switch_thread_rwlock_create(&amp;bgapi_rwlock, pool);
</span><span class="cx"> 
</span><ins>+        SWITCH_ADD_API(commands_api_interface, &quot;acl&quot;, &quot;compare an ip to an acl list&quot;, acl_function, &quot;&lt;ip&gt; &lt;list_name&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;alias&quot;, &quot;Alias&quot;, alias_function, ALIAS_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;bgapi&quot;, &quot;Execute an api command in a thread&quot;, bgapi_function, &quot;&lt;command&gt;[ &lt;arg&gt;]&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;bg_system&quot;, &quot;Execute a system command in the background&quot;, bg_system_function, SYSTEM_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;break&quot;, &quot;Break&quot;, break_function, BREAK_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;complete&quot;, &quot;Complete&quot;, complete_function, COMPLETE_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;cond&quot;, &quot;Eval a conditional&quot;, cond_function, &quot;&lt;expr&gt; ? &lt;true val&gt; : &lt;false val&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;create_uuid&quot;, &quot;Create a uuid&quot;, uuid_function, UUID_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;db_cache&quot;, &quot;db cache management&quot;, db_cache_function, &quot;status&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;domain_exists&quot;, &quot;check if a domain exists&quot;, domain_exists_function, &quot;&lt;domain&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;echo&quot;, &quot;echo&quot;, echo_function, &quot;&lt;data&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;escape&quot;, &quot;escape a string&quot;, escape_function, &quot;&lt;data&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;eval&quot;, &quot;eval (noop)&quot;, eval_function, &quot;[uuid:&lt;uuid&gt; ]&lt;expression&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;expand&quot;, &quot;expand vars and execute&quot;, expand_function, &quot;[uuid:&lt;uuid&gt; ]&lt;cmd&gt; &lt;args&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;find_user_xml&quot;, &quot;find a user&quot;, find_user_function, &quot;&lt;key&gt; &lt;user&gt; &lt;domain&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;fsctl&quot;, &quot;control messages&quot;, ctl_function, CTL_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;global_getvar&quot;, &quot;global_getvar&quot;, global_getvar_function, GLOBAL_GETVAR_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;global_setvar&quot;, &quot;global_setvar&quot;, global_setvar_function, GLOBAL_SETVAR_SYNTAX);
</ins><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;group_call&quot;, &quot;Generate a dial string to call a group&quot;, group_call_function, &quot;&lt;group&gt;[@&lt;domain&gt;]&quot;);
</span><ins>+        SWITCH_ADD_API(commands_api_interface, &quot;help&quot;, &quot;Show help for all the api commands&quot;, help_function, &quot;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;host_lookup&quot;, &quot;host_lookup&quot;, host_lookup_function, &quot;&lt;hostname&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;hostname&quot;, &quot;Returns the system hostname&quot;, hostname_api_function, &quot;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;hupall&quot;, &quot;hupall&quot;, hupall_api_function, &quot;&lt;cause&gt; [&lt;var&gt; &lt;value&gt;]&quot;);
</ins><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;in_group&quot;, &quot;determine if a user is in a group&quot;, in_group_function, &quot;&lt;user&gt;[@&lt;domain&gt;] &lt;group_name&gt;&quot;);
</span><del>-
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_flush_dtmf&quot;, &quot;Flush dtmf on a given uuid&quot;, uuid_flush_dtmf_function, &quot;&lt;uuid&gt;&quot;);
</del><ins>+        SWITCH_ADD_API(commands_api_interface, &quot;is_lan_addr&quot;, &quot;see if an ip is a lan addr&quot;, lan_addr_function, &quot;&lt;ip&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;load&quot;, &quot;Load Module&quot;, load_function, LOAD_SYNTAX);
</ins><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;md5&quot;, &quot;md5&quot;, md5_function, &quot;&lt;data&gt;&quot;);
</span><del>-        SWITCH_ADD_API(commands_api_interface, &quot;hupall&quot;, &quot;hupall&quot;, hupall_api_function, &quot;&lt;cause&gt; [&lt;var&gt; &lt;value&gt;]&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;strftime_tz&quot;, &quot;strftime_tz&quot;, strftime_tz_api_function, &quot;&lt;Timezone_name&gt; [format string]&quot;);
</del><ins>+        SWITCH_ADD_API(commands_api_interface, &quot;module_exists&quot;, &quot;check if module exists&quot;, module_exists_function, &quot;&lt;module&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;nat_map&quot;, &quot;nat_map&quot;, nat_map_function, &quot;[status|republish|reinit] | [add|del] &lt;port&gt; [tcp|udp] [static]&quot;);
</ins><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;originate&quot;, &quot;Originate a Call&quot;, originate_function, ORIGINATE_SYNTAX);
</span><del>-        SWITCH_ADD_API(commands_api_interface, &quot;tone_detect&quot;, &quot;Start Tone Detection on a channel&quot;, tone_detect_session_function, TONE_DETECT_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_kill&quot;, &quot;Kill Channel&quot;, kill_function, KILL_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_preprocess&quot;, &quot;Pre-process Channel&quot;, preprocess_function, PREPROCESS_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_park&quot;, &quot;Park Channel&quot;, park_function, PARK_SYNTAX);
</del><ins>+        SWITCH_ADD_API(commands_api_interface, &quot;pause&quot;, &quot;Pause&quot;, pause_function, PAUSE_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;regex&quot;, &quot;Eval a regex&quot;, regex_function, &quot;&lt;data&gt;|&lt;pattern&gt;[|&lt;subst string&gt;]&quot;);
</ins><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;reloadacl&quot;, &quot;Reload ACL&quot;, reload_acl_function, &quot;[reloadxml]&quot;);
</span><del>-        switch_console_set_complete(&quot;add reloadacl reloadxml&quot;);
</del><ins>+        SWITCH_ADD_API(commands_api_interface, &quot;reload&quot;, &quot;Reload Module&quot;, reload_function, UNLOAD_SYNTAX);
</ins><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;reloadxml&quot;, &quot;Reload XML&quot;, reload_xml_function, &quot;&quot;);
</span><del>-        SWITCH_ADD_API(commands_api_interface, &quot;unload&quot;, &quot;Unload Module&quot;, unload_function, UNLOAD_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;reload&quot;, &quot;Reload Module&quot;, reload_function, UNLOAD_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;load&quot;, &quot;Load Module&quot;, load_function, LOAD_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_transfer&quot;, &quot;Transfer a session&quot;, transfer_function, TRANSFER_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;pause&quot;, &quot;Pause&quot;, pause_function, PAUSE_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;break&quot;, &quot;Break&quot;, break_function, BREAK_SYNTAX);
</del><ins>+        SWITCH_ADD_API(commands_api_interface, &quot;sched_api&quot;, &quot;Schedule an api command&quot;, sched_api_function, SCHED_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;sched_broadcast&quot;, &quot;Schedule a broadcast event to a running call&quot;, sched_broadcast_function, SCHED_BROADCAST_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;sched_del&quot;, &quot;Delete a Scheduled task&quot;, sched_del_function, &quot;&lt;task_id&gt;|&lt;group_id&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;sched_hangup&quot;, &quot;Schedule a running call to hangup&quot;, sched_hangup_function, SCHED_HANGUP_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;sched_transfer&quot;, &quot;Schedule a transfer for a running call&quot;, sched_transfer_function, SCHED_TRANSFER_SYNTAX);
</ins><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;show&quot;, &quot;Show&quot;, show_function, SHOW_SYNTAX);
</span><del>-        switch_console_set_complete(&quot;add show channels&quot;);
-        switch_console_set_complete(&quot;add show codec&quot;);
-        switch_console_set_complete(&quot;add show application&quot;);
-        switch_console_set_complete(&quot;add show api&quot;);
-        switch_console_set_complete(&quot;add show dialplan&quot;);
-        switch_console_set_complete(&quot;add show file&quot;);
-        switch_console_set_complete(&quot;add show timer&quot;);
-        switch_console_set_complete(&quot;add show calls&quot;);
-        switch_console_set_complete(&quot;add show channels&quot;);
-        switch_console_set_complete(&quot;add show aliases&quot;);
-        switch_console_set_complete(&quot;add show complete&quot;);
-        switch_console_set_complete(&quot;add show distinct_channels&quot;);
-        switch_console_set_complete(&quot;add show chat&quot;);
-        switch_console_set_complete(&quot;add show endpoint&quot;);
-        switch_console_set_complete(&quot;add show management&quot;);
-        switch_console_set_complete(&quot;add show modules&quot;);
-        switch_console_set_complete(&quot;add show nat_map&quot;);
-        switch_console_set_complete(&quot;add nat_map status&quot;);
-        switch_console_set_complete(&quot;add nat_map republish&quot;);
-        switch_console_set_complete(&quot;add nat_map reinit&quot;);
-        switch_console_set_complete(&quot;add show say&quot;);
-        switch_console_set_complete(&quot;add show interfaces&quot;);
-        switch_console_set_complete(&quot;add show interface_types&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;complete&quot;, &quot;Complete&quot;, complete_function, COMPLETE_SYNTAX);
-        switch_console_set_complete(&quot;add complete add&quot;);
-        switch_console_set_complete(&quot;add complete del&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;alias&quot;, &quot;Alias&quot;, alias_function, ALIAS_SYNTAX);
-        switch_console_set_complete(&quot;add alias add&quot;);
-        switch_console_set_complete(&quot;add alias del&quot;);
</del><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;status&quot;, &quot;status&quot;, status_function, &quot;&quot;);
</span><del>-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_session_heartbeat&quot;, &quot;uuid_session_heartbeat&quot;, uuid_session_heartbeat_function, HEARTBEAT_SYNTAX);
</del><ins>+        SWITCH_ADD_API(commands_api_interface, &quot;strftime_tz&quot;, &quot;strftime_tz&quot;, strftime_tz_api_function, &quot;&lt;Timezone_name&gt; [format string]&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;stun&quot;, &quot;stun&quot;, stun_function, &quot;&lt;stun_server&gt;[:port]&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;system&quot;, &quot;Execute a system command&quot;, system_function, SYSTEM_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;time_test&quot;, &quot;time_test&quot;, time_test_function, &quot;&lt;mss&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;tone_detect&quot;, &quot;Start Tone Detection on a channel&quot;, tone_detect_session_function, TONE_DETECT_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;unload&quot;, &quot;Unload Module&quot;, unload_function, UNLOAD_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;unsched_api&quot;, &quot;Unschedule an api command&quot;, unsched_api_function, UNSCHED_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;url_decode&quot;, &quot;url decode a string&quot;, url_decode_function, &quot;&lt;string&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;url_encode&quot;, &quot;url encode a string&quot;, url_encode_function, &quot;&lt;string&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;user_data&quot;, &quot;find user data&quot;, user_data_function, &quot;&lt;user&gt;@&lt;domain&gt; [var|param|attr] &lt;name&gt;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;user_exists&quot;, &quot;find a user&quot;, user_exists_function, &quot;&lt;key&gt; &lt;user&gt; &lt;domain&gt;&quot;);
</ins><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;uuid_bridge&quot;, &quot;uuid_bridge&quot;, uuid_bridge_function, &quot;&quot;);
</span><del>-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_setvar&quot;, &quot;uuid_setvar&quot;, uuid_setvar_function, SETVAR_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_setvar_multi&quot;, &quot;uuid_setvar_multi&quot;, uuid_setvar_multi_function, SETVAR_MULTI_SYNTAX);
</del><ins>+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_broadcast&quot;, &quot;broadcast&quot;, uuid_broadcast_function, BROADCAST_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_chat&quot;, &quot;Send a chat message&quot;, uuid_chat, UUID_CHAT_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_debug_audio&quot;, &quot;debug audio&quot;, uuid_debug_audio_function, DEBUG_AUDIO_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_deflect&quot;, &quot;Send a deflect&quot;, uuid_deflect, UUID_DEFLECT_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_displace&quot;, &quot;session displace&quot;, session_displace_function, &quot;&lt;uuid&gt; [start|stop] &lt;path&gt; [&lt;limit&gt;] [mux]&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_display&quot;, &quot;change display&quot;, uuid_display_function, DISPLAY_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_dump&quot;, &quot;uuid_dump&quot;, uuid_dump_function, DUMP_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_exists&quot;, &quot;see if a uuid exists&quot;, uuid_exists_function, EXISTS_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_flush_dtmf&quot;, &quot;Flush dtmf on a given uuid&quot;, uuid_flush_dtmf_function, &quot;&lt;uuid&gt;&quot;);
</ins><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;uuid_getvar&quot;, &quot;uuid_getvar&quot;, uuid_getvar_function, GETVAR_SYNTAX);
</span><del>-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_exists&quot;, &quot;see if a uuid exists&quot;, uuid_exists_function, EXISTS_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_dump&quot;, &quot;uuid_dump&quot;, uuid_dump_function, DUMP_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;global_setvar&quot;, &quot;global_setvar&quot;, global_setvar_function, GLOBAL_SETVAR_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;global_getvar&quot;, &quot;global_getvar&quot;, global_getvar_function, GLOBAL_GETVAR_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_displace&quot;, &quot;session displace&quot;, session_displace_function, &quot;&lt;uuid&gt; [start|stop] &lt;path&gt; [&lt;limit&gt;] [mux]&quot;);
</del><ins>+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_hold&quot;, &quot;hold&quot;, uuid_hold_function, HOLD_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_kill&quot;, &quot;Kill Channel&quot;, kill_function, KILL_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_media&quot;, &quot;media&quot;, uuid_media_function, MEDIA_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_park&quot;, &quot;Park Channel&quot;, park_function, PARK_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_preprocess&quot;, &quot;Pre-process Channel&quot;, preprocess_function, PREPROCESS_SYNTAX);
</ins><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;uuid_record&quot;, &quot;session record&quot;, session_record_function, SESS_REC_SYNTAX);
</span><del>-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_broadcast&quot;, &quot;broadcast&quot;, uuid_broadcast_function, BROADCAST_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_hold&quot;, &quot;hold&quot;, uuid_hold_function, HOLD_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_display&quot;, &quot;change display&quot;, uuid_display_function, DISPLAY_SYNTAX);
</del><ins>+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_recv_dtmf&quot;, &quot;receive dtmf digits&quot;, uuid_recv_dtmf_function, UUID_RECV_DTMF_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_send_dtmf&quot;, &quot;send dtmf digits&quot;, uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_session_heartbeat&quot;, &quot;uuid_session_heartbeat&quot;, uuid_session_heartbeat_function, HEARTBEAT_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_setvar_multi&quot;, &quot;uuid_setvar_multi&quot;, uuid_setvar_multi_function, SETVAR_MULTI_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_setvar&quot;, &quot;uuid_setvar&quot;, uuid_setvar_function, SETVAR_SYNTAX);
+        SWITCH_ADD_API(commands_api_interface, &quot;uuid_transfer&quot;, &quot;Transfer a session&quot;, transfer_function, TRANSFER_SYNTAX);
</ins><span class="cx">         SWITCH_ADD_API(commands_api_interface, &quot;uuid_warning&quot;, &quot;send popup&quot;, uuid_warning_function, WARNING_SYNTAX);
</span><del>-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_debug_audio&quot;, &quot;debug audio&quot;, uuid_debug_audio_function, DEBUG_AUDIO_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_media&quot;, &quot;media&quot;, uuid_media_function, MEDIA_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;fsctl&quot;, &quot;control messages&quot;, ctl_function, CTL_SYNTAX);
</del><ins>+        SWITCH_ADD_API(commands_api_interface, &quot;version&quot;, &quot;Show version of the switch&quot;, version_function, &quot;&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;xml_locate&quot;, &quot;find some xml&quot;, xml_locate_function, &quot;[root | &lt;section&gt; &lt;tag&gt; &lt;tag_attr_name&gt; &lt;tag_attr_val&gt;]&quot;);
+        SWITCH_ADD_API(commands_api_interface, &quot;xml_wrap&quot;, &quot;Wrap another api command in xml&quot;, xml_wrap_api_function, &quot;&lt;command&gt; &lt;args&gt;&quot;);
+        switch_console_set_complete(&quot;add alias add&quot;);
+        switch_console_set_complete(&quot;add alias del&quot;);
+        switch_console_set_complete(&quot;add complete add&quot;);
+        switch_console_set_complete(&quot;add complete del&quot;);
+        switch_console_set_complete(&quot;add fsctl debug_level&quot;);
+        switch_console_set_complete(&quot;add fsctl default_dtmf_duration&quot;);
</ins><span class="cx">         switch_console_set_complete(&quot;add fsctl hupall&quot;);
</span><span class="cx">         switch_console_set_complete(&quot;add fsctl loglevel&quot;);
</span><del>-        switch_console_set_complete(&quot;add fsctl debug_level&quot;);
</del><ins>+        switch_console_set_complete(&quot;add fsctl max_dtmf_duration&quot;);
+        switch_console_set_complete(&quot;add fsctl max_sessions&quot;);
+        switch_console_set_complete(&quot;add fsctl min_dtmf_duration&quot;);
</ins><span class="cx">         switch_console_set_complete(&quot;add fsctl pause&quot;);
</span><ins>+        switch_console_set_complete(&quot;add fsctl reclaim_mem&quot;);
</ins><span class="cx">         switch_console_set_complete(&quot;add fsctl resume&quot;);
</span><span class="cx">         switch_console_set_complete(&quot;add fsctl shutdown&quot;);
</span><del>-        switch_console_set_complete(&quot;add fsctl shutdown restart&quot;);
</del><ins>+        switch_console_set_complete(&quot;add fsctl shutdown asap&quot;);
+        switch_console_set_complete(&quot;add fsctl shutdown asap restart&quot;);
+        switch_console_set_complete(&quot;add fsctl shutdown cancel&quot;);
</ins><span class="cx">         switch_console_set_complete(&quot;add fsctl shutdown elegant&quot;);
</span><del>-        switch_console_set_complete(&quot;add fsctl shutdown asap&quot;);
</del><span class="cx">         switch_console_set_complete(&quot;add fsctl shutdown elegant restart&quot;);
</span><ins>+        switch_console_set_complete(&quot;add fsctl shutdown restart&quot;);
+        switch_console_set_complete(&quot;add fsctl shutdown restart asap&quot;);
</ins><span class="cx">         switch_console_set_complete(&quot;add fsctl shutdown restart elegant&quot;);
</span><del>-        switch_console_set_complete(&quot;add fsctl shutdown asap restart&quot;);
-        switch_console_set_complete(&quot;add fsctl shutdown restart asap&quot;);
-        switch_console_set_complete(&quot;add fsctl shutdown cancel&quot;);
</del><span class="cx">         switch_console_set_complete(&quot;add fsctl sps&quot;);
</span><span class="cx">          switch_console_set_complete(&quot;add fsctl sync_clock&quot;);
</span><del>-        switch_console_set_complete(&quot;add fsctl reclaim_mem&quot;);
-        switch_console_set_complete(&quot;add fsctl max_sessions&quot;);
-        switch_console_set_complete(&quot;add fsctl max_dtmf_duration&quot;);
-        switch_console_set_complete(&quot;add fsctl min_dtmf_duration&quot;);
-        switch_console_set_complete(&quot;add fsctl default_dtmf_duration&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;help&quot;, &quot;Show help for all the api commands&quot;, help_function, &quot;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;version&quot;, &quot;Show version of the switch&quot;, version_function, &quot;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;sched_hangup&quot;, &quot;Schedule a running call to hangup&quot;, sched_hangup_function, SCHED_HANGUP_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;sched_broadcast&quot;, &quot;Schedule a broadcast event to a running call&quot;, sched_broadcast_function,
-                                   SCHED_BROADCAST_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;sched_transfer&quot;, &quot;Schedule a transfer for a running call&quot;, sched_transfer_function,
-                                   SCHED_TRANSFER_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;create_uuid&quot;, &quot;Create a uuid&quot;, uuid_function, UUID_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;sched_api&quot;, &quot;Schedule an api command&quot;, sched_api_function, SCHED_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;unsched_api&quot;, &quot;Unschedule an api command&quot;, unsched_api_function, UNSCHED_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;bgapi&quot;, &quot;Execute an api command in a thread&quot;, bgapi_function, &quot;&lt;command&gt;[ &lt;arg&gt;]&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;sched_del&quot;, &quot;Delete a Scheduled task&quot;, sched_del_function, &quot;&lt;task_id&gt;|&lt;group_id&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;xml_wrap&quot;, &quot;Wrap another api command in xml&quot;, xml_wrap_api_function, &quot;&lt;command&gt; &lt;args&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;is_lan_addr&quot;, &quot;see if an ip is a lan addr&quot;, lan_addr_function, &quot;&lt;ip&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;cond&quot;, &quot;Eval a conditional&quot;, cond_function, &quot;&lt;expr&gt; ? &lt;true val&gt; : &lt;false val&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;regex&quot;, &quot;Eval a regex&quot;, regex_function, &quot;&lt;data&gt;|&lt;pattern&gt;[|&lt;subst string&gt;]&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;acl&quot;, &quot;compare an ip to an acl list&quot;, acl_function, &quot;&lt;ip&gt; &lt;list_name&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_chat&quot;, &quot;Send a chat message&quot;, uuid_chat, UUID_CHAT_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_deflect&quot;, &quot;Send a deflect&quot;, uuid_deflect, UUID_DEFLECT_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;find_user_xml&quot;, &quot;find a user&quot;, find_user_function, &quot;&lt;key&gt; &lt;user&gt; &lt;domain&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;user_exists&quot;, &quot;find a user&quot;, user_exists_function, &quot;&lt;key&gt; &lt;user&gt; &lt;domain&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;xml_locate&quot;, &quot;find some xml&quot;, xml_locate_function, &quot;[root | &lt;section&gt; &lt;tag&gt; &lt;tag_attr_name&gt; &lt;tag_attr_val&gt;]&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;user_data&quot;, &quot;find user data&quot;, user_data_function, &quot;&lt;user&gt;@&lt;domain&gt; [var|param|attr] &lt;name&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;url_encode&quot;, &quot;url encode a string&quot;, url_encode_function, &quot;&lt;string&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;url_decode&quot;, &quot;url decode a string&quot;, url_decode_function, &quot;&lt;string&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;module_exists&quot;, &quot;check if module exists&quot;, module_exists_function, &quot;&lt;module&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;domain_exists&quot;, &quot;check if a domain exists&quot;, domain_exists_function, &quot;&lt;domain&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_send_dtmf&quot;, &quot;send dtmf digits&quot;, uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;uuid_recv_dtmf&quot;, &quot;receive dtmf digits&quot;, uuid_recv_dtmf_function, UUID_RECV_DTMF_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;eval&quot;, &quot;eval (noop)&quot;, eval_function, &quot;[uuid:&lt;uuid&gt; ]&lt;expression&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;expand&quot;, &quot;expand vars and execute&quot;, expand_function, &quot;[uuid:&lt;uuid&gt; ]&lt;cmd&gt; &lt;args&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;echo&quot;, &quot;echo&quot;, echo_function, &quot;&lt;data&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;stun&quot;, &quot;stun&quot;, stun_function, &quot;&lt;stun_server&gt;[:port]&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;system&quot;, &quot;Execute a system command&quot;, system_function, SYSTEM_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;bg_system&quot;, &quot;Execute a system command in the background&quot;, bg_system_function, SYSTEM_SYNTAX);
-        SWITCH_ADD_API(commands_api_interface, &quot;time_test&quot;, &quot;time_test&quot;, time_test_function, &quot;&lt;mss&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;nat_map&quot;, &quot;nat_map&quot;, nat_map_function, &quot;[status|republish|reinit] | [add|del] &lt;port&gt; [tcp|udp] [static]&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;host_lookup&quot;, &quot;host_lookup&quot;, host_lookup_function, &quot;&lt;hostname&gt;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;hostname&quot;, &quot;Returns the system hostname&quot;, hostname_api_function, &quot;&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;db_cache&quot;, &quot;db cache management&quot;, db_cache_function, &quot;status&quot;);
-        SWITCH_ADD_API(commands_api_interface, &quot;escape&quot;, &quot;escape a string&quot;, escape_function, &quot;&lt;data&gt;&quot;);
</del><ins>+        switch_console_set_complete(&quot;add nat_map reinit&quot;);
+        switch_console_set_complete(&quot;add nat_map republish&quot;);
+        switch_console_set_complete(&quot;add nat_map status&quot;);
+        switch_console_set_complete(&quot;add reloadacl reloadxml&quot;);
+        switch_console_set_complete(&quot;add show aliases&quot;);
+        switch_console_set_complete(&quot;add show api&quot;);
+        switch_console_set_complete(&quot;add show application&quot;);
+        switch_console_set_complete(&quot;add show calls&quot;);
+        switch_console_set_complete(&quot;add show channels&quot;);
+        switch_console_set_complete(&quot;add show channels&quot;);
+        switch_console_set_complete(&quot;add show chat&quot;);
+        switch_console_set_complete(&quot;add show codec&quot;);
+        switch_console_set_complete(&quot;add show complete&quot;);
+        switch_console_set_complete(&quot;add show dialplan&quot;);
+        switch_console_set_complete(&quot;add show distinct_channels&quot;);
+        switch_console_set_complete(&quot;add show endpoint&quot;);
+        switch_console_set_complete(&quot;add show file&quot;);
+        switch_console_set_complete(&quot;add show interfaces&quot;);
+        switch_console_set_complete(&quot;add show interface_types&quot;);
+        switch_console_set_complete(&quot;add show management&quot;);
+        switch_console_set_complete(&quot;add show modules&quot;);
+        switch_console_set_complete(&quot;add show nat_map&quot;);
+        switch_console_set_complete(&quot;add show say&quot;);
+        switch_console_set_complete(&quot;add show timer&quot;);
+        switch_console_set_complete(&quot;add uuid_bridge ::console::list_uuid ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_broadcast ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_chat ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_debug_audio ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_deflect ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_displace ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_display ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_dump ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_exists ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_flush_dtmf ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_getvar ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_hold ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_kill ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_media ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_park ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_preprocess ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_record ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_recv_dtmf ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_send_dtmf ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_session_heartbeat ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_setvar_multi ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_setvar ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_transfer ::console::list_uuid&quot;);
+        switch_console_set_complete(&quot;add uuid_warning ::console::list_uuid&quot;);
</ins><span class="cx">         switch_console_set_complete(&quot;db_cache status&quot;);
</span><span class="cx"> 
</span><ins>+
+
</ins><span class="cx">         /* indicate that the module should continue to be loaded */
</span><span class="cx">         return SWITCH_STATUS_NOUNLOAD;
</span><span class="cx"> }
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiamod_sofiac"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (15951 => 15952)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c        2009-12-14 20:10:01 UTC (rev 15951)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c        2009-12-14 20:10:06 UTC (rev 15952)
</span><span class="lines">@@ -3623,6 +3623,105 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+        sofia_profile_t *profile = NULL;
+        switch_hash_index_t *hi;
+        void *val;
+        const void *vvar;
+        switch_console_callback_match_t *my_matches = NULL;
+        switch_status_t status = SWITCH_STATUS_FALSE;
+
+        switch_mutex_lock(mod_sofia_globals.hash_mutex);
+        for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+                switch_hash_this(hi, &amp;vvar, NULL, &amp;val);
+                profile = (sofia_profile_t *) val;
+                if (sofia_test_pflag(profile, PFLAG_RUNNING)) {
+                        switch_console_push_match(&amp;my_matches, (const char *)vvar);
+                }
+        }
+        switch_mutex_unlock(mod_sofia_globals.hash_mutex);
+
+        if (my_matches) {
+                *matches = my_matches;
+                status = SWITCH_STATUS_SUCCESS;
+        }
+
+
+        return status;
+}
+
+static switch_status_t list_gateways(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+        sofia_profile_t *profile = NULL;
+        switch_hash_index_t *hi;
+        void *val;
+        const void *vvar;
+        switch_console_callback_match_t *my_matches = NULL;
+        switch_status_t status = SWITCH_STATUS_FALSE;
+
+        switch_mutex_lock(mod_sofia_globals.hash_mutex);
+        for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+                switch_hash_this(hi, &amp;vvar, NULL, &amp;val);
+                profile = (sofia_profile_t *) val;
+                if (sofia_test_pflag(profile, PFLAG_RUNNING)) {
+                        sofia_gateway_t *gp;
+                        for (gp = profile-&gt;gateways; gp; gp = gp-&gt;next) {
+                                switch_console_push_match(&amp;my_matches, gp-&gt;name);
+                        }
+                }
+        }
+        switch_mutex_unlock(mod_sofia_globals.hash_mutex);
+
+        if (my_matches) {
+                *matches = my_matches;
+                status = SWITCH_STATUS_SUCCESS;
+        }
+        
+        return status;
+}
+
+
+static switch_status_t list_profile_gateway(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+        sofia_profile_t *profile = NULL;
+        switch_console_callback_match_t *my_matches = NULL;
+        switch_status_t status = SWITCH_STATUS_FALSE;
+        char *dup = NULL;
+        int argc;
+        char *argv[4] = { 0 };
+
+        if (zstr(line)) {
+                return SWITCH_STATUS_FALSE;
+        }
+
+        dup = strdup(line);
+        argc = switch_split(dup, ' ', argv);
+        
+        if (!argv[2]) {
+                goto end;
+        }
+
+        if ((profile = sofia_glue_find_profile(argv[2]))) {
+                sofia_gateway_t *gp;
+                for (gp = profile-&gt;gateways; gp; gp = gp-&gt;next) {
+                        switch_console_push_match(&amp;my_matches, gp-&gt;name);
+                }
+                sofia_glue_release_profile(profile);
+        }
+
+        if (my_matches) {
+                *matches = my_matches;
+                status = SWITCH_STATUS_SUCCESS;
+        }
+        
+ end:
+
+        switch_safe_free(dup);
+
+        return status;
+}
+
</ins><span class="cx"> SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
</span><span class="cx"> {
</span><span class="cx">         switch_chat_interface_t *chat_interface;
</span><span class="lines">@@ -3744,18 +3843,26 @@
</span><span class="cx">         switch_console_set_complete(&quot;add sofia profile&quot;);
</span><span class="cx">         switch_console_set_complete(&quot;add sofia profile restart all&quot;);
</span><span class="cx"> 
</span><del>-        switch_console_set_complete(&quot;add sofia profile _any_ start reloadxml&quot;);
-        switch_console_set_complete(&quot;add sofia profile _any_ stop reloadxml&quot;);
-        switch_console_set_complete(&quot;add sofia profile _any_ rescan reloadxml&quot;);
-        switch_console_set_complete(&quot;add sofia profile _any_ restart reloadxml&quot;);
</del><ins>+        switch_console_set_complete(&quot;add sofia profile ::sofia::list_profiles start reloadxml&quot;);
+        switch_console_set_complete(&quot;add sofia profile ::sofia::list_profiles stop reloadxml&quot;);
+        switch_console_set_complete(&quot;add sofia profile ::sofia::list_profiles rescan reloadxml&quot;);
+        switch_console_set_complete(&quot;add sofia profile ::sofia::list_profiles restart reloadxml&quot;);
</ins><span class="cx"> 
</span><del>-        switch_console_set_complete(&quot;add sofia profile _any_ flush_inbound_reg&quot;);
-        switch_console_set_complete(&quot;add sofia profile _any_ register&quot;);
-        switch_console_set_complete(&quot;add sofia profile _any_ killgw&quot;);
-        switch_console_set_complete(&quot;add sofia profile _any_ siptrace on&quot;);
-        switch_console_set_complete(&quot;add sofia profile _any_ siptrace off&quot;);
</del><ins>+        switch_console_set_complete(&quot;add sofia profile ::sofia::list_profiles flush_inbound_reg&quot;);
+        switch_console_set_complete(&quot;add sofia profile ::sofia::list_profiles register ::sofia::list_profile_gateway&quot;);
+        switch_console_set_complete(&quot;add sofia profile ::sofia::list_profiles unregister ::sofia::list_profile_gateway&quot;);
+        switch_console_set_complete(&quot;add sofia profile ::sofia::list_profiles killgw ::sofia::list_profile_gateway&quot;);
+        switch_console_set_complete(&quot;add sofia profile ::sofia::list_profiles siptrace on&quot;);
+        switch_console_set_complete(&quot;add sofia profile ::sofia::list_profiles siptrace off&quot;);
</ins><span class="cx"> 
</span><ins>+        switch_console_set_complete(&quot;add sofia status profile ::sofia::list_profiles&quot;);
+        switch_console_set_complete(&quot;add sofia status gateway ::sofia::list_gateways&quot;);
</ins><span class="cx"> 
</span><ins>+        switch_console_add_complete_func(&quot;::sofia::list_profiles&quot;, list_profiles);
+        switch_console_add_complete_func(&quot;::sofia::list_gateways&quot;, list_gateways);
+        switch_console_add_complete_func(&quot;::sofia::list_profile_gateway&quot;, list_profile_gateway);
+
+
</ins><span class="cx">         SWITCH_ADD_API(api_interface, &quot;sofia_contact&quot;, &quot;Sofia Contacts&quot;, sofia_contact_function, &quot;[profile/]&lt;user&gt;@&lt;domain&gt;&quot;);
</span><span class="cx">         SWITCH_ADD_CHAT(chat_interface, SOFIA_CHAT_PROTO, sofia_presence_chat_send);
</span><span class="cx"> 
</span><span class="lines">@@ -3767,6 +3874,7 @@
</span><span class="cx"> {
</span><span class="cx">         int sanity = 0;
</span><span class="cx"> 
</span><ins>+        switch_console_del_complete_func(&quot;::sofia::list_profiles&quot;);
</ins><span class="cx">         switch_console_set_complete(&quot;del sofia&quot;);
</span><span class="cx"> 
</span><span class="cx">         switch_mutex_lock(mod_sofia_globals.mutex);
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiasofiac"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (15951 => 15952)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c        2009-12-14 20:10:01 UTC (rev 15951)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c        2009-12-14 20:10:06 UTC (rev 15952)
</span><span class="lines">@@ -1063,8 +1063,6 @@
</span><span class="cx">         int sanity;
</span><span class="cx">         switch_thread_t *worker_thread;
</span><span class="cx">         switch_status_t st;
</span><del>-        char cbuf[512] = &quot;&quot;;
-        
</del><span class="cx"> 
</span><span class="cx">         switch_mutex_lock(mod_sofia_globals.mutex);
</span><span class="cx">         mod_sofia_globals.threads++;
</span><span class="lines">@@ -1229,17 +1227,11 @@
</span><span class="cx"> 
</span><span class="cx">         switch_yield(1000000);
</span><span class="cx"> 
</span><del>-        switch_snprintf(cbuf, sizeof(cbuf), &quot;add sofia profile %s&quot;, profile-&gt;name);
-        switch_console_set_complete(cbuf);
</del><span class="cx"> 
</span><del>-
</del><span class="cx">         while (mod_sofia_globals.running == 1 &amp;&amp; sofia_test_pflag(profile, PFLAG_RUNNING) &amp;&amp; sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
</span><span class="cx">                 su_root_step(profile-&gt;s_root, 1000);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        switch_snprintf(cbuf, sizeof(cbuf), &quot;del sofia profile %s&quot;, profile-&gt;name);
-        switch_console_set_complete(cbuf);
-
</del><span class="cx">         sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
</span><span class="cx"> 
</span><span class="cx">         switch_core_session_hupall_matching_var(&quot;sofia_profile_name&quot;, profile-&gt;name, SWITCH_CAUSE_MANAGER_REQUEST);
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_sofiasofia_gluec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (15951 => 15952)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c        2009-12-14 20:10:01 UTC (rev 15951)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c        2009-12-14 20:10:06 UTC (rev 15952)
</span><span class="lines">@@ -3647,12 +3647,10 @@
</span><span class="cx"> switch_status_t sofia_glue_add_profile(char *key, sofia_profile_t *profile)
</span><span class="cx"> {
</span><span class="cx">         switch_status_t status = SWITCH_STATUS_FALSE;
</span><del>-        char cbuf[512] = &quot;&quot;;
</del><ins>+
</ins><span class="cx">         switch_mutex_lock(mod_sofia_globals.hash_mutex);
</span><span class="cx">         if (!switch_core_hash_find(mod_sofia_globals.profile_hash, key)) {
</span><span class="cx">                 status = switch_core_hash_insert(mod_sofia_globals.profile_hash, key, profile);
</span><del>-                switch_snprintf(cbuf, sizeof(cbuf), &quot;add sofia profile %s&quot;, key);
-                switch_console_set_complete(cbuf);
</del><span class="cx">         }
</span><span class="cx">         switch_mutex_unlock(mod_sofia_globals.hash_mutex);
</span><span class="cx"> 
</span><span class="lines">@@ -3721,7 +3719,6 @@
</span><span class="cx">         const void *var;
</span><span class="cx">         void *val;
</span><span class="cx">         sofia_profile_t *pptr;
</span><del>-        char cbuf[512] = &quot;&quot;;
</del><span class="cx">         
</span><span class="cx">         switch_mutex_lock(mod_sofia_globals.hash_mutex);
</span><span class="cx">         if (mod_sofia_globals.profile_hash) {
</span><span class="lines">@@ -3729,8 +3726,6 @@
</span><span class="cx">                         switch_hash_this(hi, &amp;var, NULL, &amp;val);
</span><span class="cx">                         if ((pptr = (sofia_profile_t *) val) &amp;&amp; pptr == profile) {
</span><span class="cx">                                 aliases[i++] = strdup((char *) var);
</span><del>-                                switch_snprintf(cbuf, sizeof(cbuf), &quot;del sofia profile %s&quot;, var);
-                                switch_console_set_complete(cbuf);
</del><span class="cx">                                 if (i == 512) {
</span><span class="cx">                                         abort();
</span><span class="cx">                                 }
</span></span></pre></div>
<a id="freeswitchtrunksrcswitch_consolec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/switch_console.c (15951 => 15952)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_console.c        2009-12-14 20:10:01 UTC (rev 15951)
+++ freeswitch/trunk/src/switch_console.c        2009-12-14 20:10:06 UTC (rev 15952)
</span><span class="lines">@@ -518,16 +518,42 @@
</span><span class="cx"> static int comp_callback(void *pArg, int argc, char **argv, char **columnNames)
</span><span class="cx"> {
</span><span class="cx">         struct helper *h = (struct helper *) pArg;
</span><del>-        char *target = NULL;
</del><ins>+        char *target = NULL, *str = NULL, *cur = NULL;
</ins><span class="cx">         switch_size_t x, y;
</span><span class="cx">         int i;
</span><span class="cx">         
</span><del>-        target = argv[0];
</del><ins>+        if (argc &gt; 0) target = argv[0];
+        if (argc &gt; 1) str = argv[1];
+        if (argc &gt; 2) cur = argv[2];
</ins><span class="cx"> 
</span><ins>+        if (cur) {
+                while (*cur == ' ') cur++;
+        }
+
+        if (zstr(cur)) cur = NULL;
+        if (zstr(str)) str = NULL;
+
</ins><span class="cx">         if (!target) {
</span><span class="cx">                 return -1;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        if (!zstr(target) &amp;&amp; *target == ':' &amp;&amp; *(target+1) == ':') {
+                char *r_argv[3] = { 0 }, *r_cols[3] = { 0 };
+                switch_console_callback_match_t *matches;
+                r_cols[0] = &quot;match&quot;;
+                if (switch_console_run_complete_func(target, str, cur, &amp;matches) == SWITCH_STATUS_SUCCESS) {
+                        switch_console_callback_match_node_t *m;
+                        for (m = matches-&gt;head; m; m = m-&gt;next) {
+                                if (!cur || !strncmp(m-&gt;val, cur, strlen(cur))) {
+                                        r_argv[0] = m-&gt;val;
+                                        comp_callback(h, 1, r_argv, r_cols);
+                                }
+                        }
+                        switch_console_free_matches(&amp;matches);
+                }
+                return 0;
+        }
+
</ins><span class="cx">         if (!zstr(target)) {
</span><span class="cx">                 fprintf(h-&gt;out, &quot;[%20s]\t&quot;, target);
</span><span class="cx">                 switch_copy_string(h-&gt;last, target, sizeof(h-&gt;last));
</span><span class="lines">@@ -557,6 +583,54 @@
</span><span class="cx">         return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+
+
+struct match_helper {
+        switch_console_callback_match_t *my_matches;
+};
+
+static int uuid_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+        struct match_helper *h = (struct match_helper *) pArg;
+
+        switch_console_push_match(&amp;h-&gt;my_matches, argv[0]);
+        return 0;
+
+}
+
+SWITCH_DECLARE(switch_status_t) switch_console_list_uuid(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+        char *sql;
+        struct match_helper h = { 0 };
+        switch_cache_db_handle_t *db = NULL;
+        switch_status_t status = SWITCH_STATUS_FALSE;
+        char *errmsg;
+        
+        switch_core_db_handle(&amp;db);
+
+        if (!zstr(cursor)) {
+                sql = switch_mprintf(&quot;select distinct uuid from channels where uuid like '%q%%' and hostname='%q' order by uuid&quot;, 
+                                                         cursor, switch_core_get_variable(&quot;hostname&quot;));
+        } else {
+                sql = switch_mprintf(&quot;select distinct uuid from channels where hostname='%q' order by uuid&quot;, 
+                                                         switch_core_get_variable(&quot;hostname&quot;));
+        }
+
+        switch_cache_db_execute_sql_callback(db, sql, uuid_callback, &amp;h, &amp;errmsg);
+        free(sql);
+
+        switch_cache_db_release_db_handle(&amp;db);
+
+        if (h.my_matches) {
+                *matches = h.my_matches;
+                status = SWITCH_STATUS_SUCCESS;
+        }
+
+
+        return status;
+}
+
+
</ins><span class="cx"> static unsigned char complete(EditLine * el, int ch)
</span><span class="cx"> {
</span><span class="cx">         switch_cache_db_handle_t *db = NULL;
</span><span class="lines">@@ -608,11 +682,8 @@
</span><span class="cx">         if (h.words == 0) {
</span><span class="cx">                 sql = switch_mprintf(&quot;select distinct name from interfaces where type='api' and name like '%q%%' and hostname='%q' order by name&quot;, 
</span><span class="cx">                                                          buf, switch_core_get_variable(&quot;hostname&quot;));
</span><del>-        } else if (h.words == 1) {
-                sql = switch_mprintf(&quot;select distinct uuid from channels where uuid like '%q%%' and hostname='%q' order by uuid&quot;, 
-                                                         buf, switch_core_get_variable(&quot;hostname&quot;));
</del><span class="cx">         }
</span><del>-
</del><ins>+        
</ins><span class="cx">         if (sql) {
</span><span class="cx">                 switch_cache_db_execute_sql_callback(db, sql, comp_callback, &amp;h, &amp;errmsg);
</span><span class="cx"> 
</span><span class="lines">@@ -640,22 +711,29 @@
</span><span class="cx">                         stream.write_function(&amp;stream, &quot;select distinct a1 from complete where &quot; &quot;a1 not in (select name from interfaces where hostname='%s') %s &quot;, 
</span><span class="cx">                                                                   switch_core_get_variable(&quot;hostname&quot;), argc ? &quot;and&quot; : &quot;&quot;);
</span><span class="cx">                 } else {
</span><del>-                        stream.write_function(&amp;stream, &quot;select distinct a%d from complete where &quot;, h.words + 1);
-
</del><ins>+                        if (db-&gt;type == SCDB_TYPE_CORE_DB) {
+                                stream.write_function(&amp;stream, &quot;select distinct a%d,'%q','%q' from complete where &quot;, h.words + 1, switch_str_nil(dup), switch_str_nil(lp));
+                        } else {
+                                stream.write_function(&amp;stream, &quot;select distinct a%d,'%q','%w' from complete where &quot;, h.words + 1, switch_str_nil(dup), switch_str_nil(lp));
+                        }
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 for (x = 0; x &lt; argc &amp;&amp; x &lt; 11; x++) {
</span><span class="cx">                         if (h.words + 1 &gt; argc) {
</span><span class="cx">                                 if (db-&gt;type == SCDB_TYPE_CORE_DB) {
</span><del>-                                        stream.write_function(&amp;stream, &quot;(a%d = '' or a%d = '%q')%q&quot;, x + 1, x + 1, switch_str_nil(argv[x]), x == argc - 1 ? &quot;&quot; : &quot; and &quot;);
</del><ins>+                                        stream.write_function(&amp;stream, &quot;(a%d like '::%%' or a%d = '' or a%d = '%q')%q&quot;, 
+                                                                                  x + 1, x + 1, x + 1, switch_str_nil(argv[x]), x == argc - 1 ? &quot;&quot; : &quot; and &quot;);
</ins><span class="cx">                                 } else {
</span><del>-                                        stream.write_function(&amp;stream, &quot;(a%d = '' or a%d = '%w')%w&quot;, x + 1, x + 1, switch_str_nil(argv[x]), x == argc - 1 ? &quot;&quot; : &quot; and &quot;);
</del><ins>+                                        stream.write_function(&amp;stream, &quot;(a%d like '::%%' or a%d = '' or a%d = '%w')%w&quot;, 
+                                                                                  x + 1, x + 1, x + 1, switch_str_nil(argv[x]), x == argc - 1 ? &quot;&quot; : &quot; and &quot;);
</ins><span class="cx">                                 }
</span><span class="cx">                         } else {
</span><span class="cx">                                 if (db-&gt;type == SCDB_TYPE_CORE_DB) {
</span><del>-                                        stream.write_function(&amp;stream, &quot;(a%d = '' or a%d like '%q%%')%q&quot;, x + 1, x + 1, switch_str_nil(argv[x]), x == argc - 1 ? &quot;&quot; : &quot; and &quot;);
</del><ins>+                                        stream.write_function(&amp;stream, &quot;(a%d like '::%%' or a%d = '' or a%d like '%q%%')%q&quot;,
+                                                                                  x + 1, x + 1, x + 1, switch_str_nil(argv[x]), x == argc - 1 ? &quot;&quot; : &quot; and &quot;);
</ins><span class="cx">                                 } else {
</span><del>-                                        stream.write_function(&amp;stream, &quot;(a%d = '' or a%d like '%w%%')%w&quot;, x + 1, x + 1, switch_str_nil(argv[x]), x == argc - 1 ? &quot;&quot; : &quot; and &quot;);
</del><ins>+                                        stream.write_function(&amp;stream, &quot;(a%d like '::%%' or a%d = '' or a%d like '%w%%')%w&quot;,
+                                                                                  x + 1, x + 1, x + 1, switch_str_nil(argv[x]), x == argc - 1 ? &quot;&quot; : &quot; and &quot;);
</ins><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="lines">@@ -700,7 +778,99 @@
</span><span class="cx">         return (ret);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static struct {
+        switch_hash_t *func_hash;
+        switch_mutex_t *func_mutex;
+} globals;
</ins><span class="cx"> 
</span><ins>+SWITCH_DECLARE(switch_status_t) switch_console_init(switch_memory_pool_t *pool)
+{
+        switch_mutex_init(&amp;globals.func_mutex, SWITCH_MUTEX_NESTED, pool);
+        switch_core_hash_init(&amp;globals.func_hash, pool);
+        switch_console_add_complete_func(&quot;::console::list_uuid&quot;, switch_console_list_uuid);
+        return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_console_shutdown(void)
+{
+        return switch_core_hash_destroy(&amp;globals.func_hash);
+}
+
+SWITCH_DECLARE(switch_status_t) switch_console_add_complete_func(const char *name, switch_console_complete_callback_t cb)
+{
+        switch_status_t status;
+        
+        switch_mutex_lock(globals.func_mutex);
+        status = switch_core_hash_insert(globals.func_hash, name, (void *)(intptr_t)cb);
+        switch_mutex_unlock(globals.func_mutex);
+
+        return status;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_console_del_complete_func(const char *name)
+{
+        switch_status_t status;
+        
+        switch_mutex_lock(globals.func_mutex);
+        status = switch_core_hash_insert(globals.func_hash, name, NULL);
+        switch_mutex_unlock(globals.func_mutex);
+
+    return status;
+}
+
+SWITCH_DECLARE(void) switch_console_free_matches(switch_console_callback_match_t **matches)
+{
+        switch_console_callback_match_t *my_match = *matches;
+        switch_console_callback_match_node_t *m, *cur;
+
+        /* Don't play with matches */
+        *matches = NULL;
+
+        m = my_match-&gt;head;
+        while(m) {
+                cur = m;
+                m = m-&gt;next;
+                free(cur-&gt;val);
+                free(cur);
+        }
+}
+
+SWITCH_DECLARE(void) switch_console_push_match(switch_console_callback_match_t **matches, const char *new_val)
+{
+        switch_console_callback_match_node_t *match;
+
+        if (!*matches) {
+                switch_zmalloc(*matches, sizeof(**matches));
+        }
+
+        switch_zmalloc(match, sizeof(*match));
+        match-&gt;val = strdup(new_val);
+
+        if ((*matches)-&gt;head) {
+                (*matches)-&gt;end-&gt;next = match;
+        } else {
+                (*matches)-&gt;head = match;
+        }
+
+        (*matches)-&gt;end = match;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_console_run_complete_func(const char *func, const char *line, const char *cursor,
+                                                                                                                                 switch_console_callback_match_t **matches)
+{
+        switch_console_complete_callback_t cb;
+        switch_status_t status = SWITCH_STATUS_FALSE;
+
+        switch_mutex_lock(globals.func_mutex);
+        if ((cb = (switch_console_complete_callback_t)(intptr_t)switch_core_hash_find(globals.func_hash, func))) {
+                status = cb(line, cursor, matches);
+        }
+        switch_mutex_unlock(globals.func_mutex);
+
+        return status;
+}
+
+
</ins><span class="cx"> SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)
</span><span class="cx"> {
</span><span class="cx">         char *mydata = NULL, *argv[11] = { 0 };
</span></span></pre></div>
<a id="freeswitchtrunksrcswitch_corec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/switch_core.c (15951 => 15952)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_core.c        2009-12-14 20:10:01 UTC (rev 15951)
+++ freeswitch/trunk/src/switch_core.c        2009-12-14 20:10:06 UTC (rev 15952)
</span><span class="lines">@@ -1249,6 +1249,7 @@
</span><span class="cx">         switch_core_set_variable(&quot;base_dir&quot;, SWITCH_GLOBAL_dirs.base_dir);
</span><span class="cx">         switch_core_set_serial();
</span><span class="cx"> 
</span><ins>+        switch_console_init(runtime.memory_pool);
</ins><span class="cx">         switch_event_init(runtime.memory_pool);
</span><span class="cx"> 
</span><span class="cx">         if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) {
</span><span class="lines">@@ -1741,6 +1742,8 @@
</span><span class="cx">         }
</span><span class="cx">         switch_xml_destroy();
</span><span class="cx"> 
</span><ins>+        switch_console_shutdown();
+
</ins><span class="cx">         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, &quot;Closing Event Engine.\n&quot;);
</span><span class="cx">         switch_event_shutdown();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>