<!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][16793] </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=16793">16793</a></dd>
<dt>Author</dt> <dd>sathieu</dd>
<dt>Date</dt> <dd>2010-02-24 06:06:25 -0600 (Wed, 24 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Skinny: API commands (autocompletion included!)
skinny profile &lt;profile_name&gt; device &lt;device_name&gt; send SetRingerMessage &lt;ring_type&gt; &lt;ring_mode&gt;
skinny profile &lt;profile_name&gt; device &lt;device_name&gt; send SetLampMessage &lt;stimulus&gt; &lt;instance&gt; &lt;lamp_mode&gt;
skinny profile &lt;profile_name&gt; device &lt;device_name&gt; send SetSpeakerModeMessage &lt;speaker_mode&gt;
skinny profile &lt;profile_name&gt; device &lt;device_name&gt; send CallState &lt;call_state&gt; &lt;line_instance&gt; &lt;call_id&gt;

Also:
- Correct sended line displayname
- Re-use the line on SoftKey
- Handle Answer SoftKey</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcmodendpointsmod_skinnymod_skinnyc">freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_skinnyskinny_protocolc">freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_skinnyskinny_protocolh">freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcmodendpointsmod_skinnymod_skinnyc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c (16792 => 16793)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c        2010-02-24 12:06:16 UTC (rev 16792)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c        2010-02-24 12:06:25 UTC (rev 16793)
</span><span class="lines">@@ -109,6 +109,19 @@
</span><span class="cx">         return (skinny_profile_t *) switch_core_hash_find(globals.profile_hash, profile_name);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static switch_status_t skinny_profile_find_listener_by_device_name(skinny_profile_t *profile, const char *device_name, listener_t **listener)
+{
+        switch_mutex_lock(profile-&gt;listener_mutex);
+        for (listener_t *l = profile-&gt;listeners; l; l = l-&gt;next) {
+                if (!strcmp(l-&gt;device_name, device_name)) {
+                        *listener = l;
+                }
+        }
+        switch_mutex_unlock(profile-&gt;listener_mutex);
+
+        return SWITCH_STATUS_SUCCESS;
+}
+
</ins><span class="cx"> struct skinny_profile_find_listener_helper {
</span><span class="cx">         skinny_profile_t *profile;
</span><span class="cx">         listener_t *listener;
</span><span class="lines">@@ -123,20 +136,15 @@
</span><span class="cx">         /* uint32_t position = atoi(argv[1]); */
</span><span class="cx">         uint32_t relative_position = atoi(argv[2]);
</span><span class="cx"> 
</span><del>-        switch_mutex_lock(profile-&gt;listener_mutex);
-        for (listener_t *l = profile-&gt;listeners; l; l = l-&gt;next) {
-                if (!strcmp(l-&gt;device_name, device_name)) {
-                        helper-&gt;listener = l;
-                }
-        }
-        switch_mutex_unlock(profile-&gt;listener_mutex);
</del><ins>+        skinny_profile_find_listener_by_device_name(profile, device_name, &amp;helper-&gt;listener);
+
</ins><span class="cx">         if(helper-&gt;listener) {
</span><span class="cx">                 helper-&gt;line = relative_position;
</span><span class="cx">         }
</span><span class="cx">         return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static switch_status_t skinny_profile_find_listener(skinny_profile_t *profile, const char *dest, listener_t **l, uint32_t *line)
</del><ins>+static switch_status_t skinny_profile_find_listener_by_dest(skinny_profile_t *profile, const char *dest, listener_t **l, uint32_t *line)
</ins><span class="cx"> {
</span><span class="cx">         char *sql;
</span><span class="cx">         struct skinny_profile_find_listener_helper helper = {0};
</span><span class="lines">@@ -810,7 +818,7 @@
</span><span class="cx">         switch_channel_set_name(channel, name);
</span><span class="cx">         
</span><span class="cx"> 
</span><del>-        if ((skinny_profile_find_listener(profile, dest, &amp;listener, &amp;line) != SWITCH_STATUS_SUCCESS)) {
</del><ins>+        if ((skinny_profile_find_listener_by_dest(profile, dest, &amp;listener, &amp;line) != SWITCH_STATUS_SUCCESS)) {
</ins><span class="cx">                 switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, &quot;Problem while retrieving listener and line for destination %s in profile %s\n&quot;, dest, profile_name);
</span><span class="cx">                 cause = SWITCH_CAUSE_UNALLOCATED_NUMBER;
</span><span class="cx">                 goto error;
</span><span class="lines">@@ -1479,6 +1487,82 @@
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static switch_status_t cmd_profile_device_send_ringer_message(const char *profile_name, const char *device_name, const char *ring_type, const char *ring_mode, switch_stream_handle_t *stream)
+{
+        skinny_profile_t *profile;
+
+        if ((profile = skinny_find_profile(profile_name))) {
+                listener_t *listener = NULL;
+                skinny_profile_find_listener_by_device_name(profile, device_name, &amp;listener);
+                if(listener) {
+                        set_ringer(listener, skinny_str2ring_type(ring_type), skinny_str2ring_mode(ring_mode), 0);
+                } else {
+                        stream-&gt;write_function(stream, &quot;Listener not found!\n&quot;);
+                }
+        } else {
+                stream-&gt;write_function(stream, &quot;Profile not found!\n&quot;);
+        }
+
+        return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t cmd_profile_device_send_lamp_message(const char *profile_name, const char *device_name, const char *stimulus, const char *instance, const char *lamp_mode, switch_stream_handle_t *stream)
+{
+        skinny_profile_t *profile;
+
+        if ((profile = skinny_find_profile(profile_name))) {
+                listener_t *listener = NULL;
+                skinny_profile_find_listener_by_device_name(profile, device_name, &amp;listener);
+                if(listener) {
+                        set_lamp(listener, skinny_str2stimulus(stimulus), atoi(instance), skinny_str2lamp_mode(lamp_mode));
+                } else {
+                        stream-&gt;write_function(stream, &quot;Listener not found!\n&quot;);
+                }
+        } else {
+                stream-&gt;write_function(stream, &quot;Profile not found!\n&quot;);
+        }
+
+        return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t cmd_profile_device_send_speaker_mode_message(const char *profile_name, const char *device_name, const char *speaker_mode, switch_stream_handle_t *stream)
+{
+        skinny_profile_t *profile;
+
+        if ((profile = skinny_find_profile(profile_name))) {
+                listener_t *listener = NULL;
+                skinny_profile_find_listener_by_device_name(profile, device_name, &amp;listener);
+                if(listener) {
+                        set_speaker_mode(listener, skinny_str2speaker_mode(speaker_mode));
+                } else {
+                        stream-&gt;write_function(stream, &quot;Listener not found!\n&quot;);
+                }
+        } else {
+                stream-&gt;write_function(stream, &quot;Profile not found!\n&quot;);
+        }
+
+        return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t cmd_profile_device_send_call_state_message(const char *profile_name, const char *device_name, const char *call_state, const char *line_instance, const char *call_id, switch_stream_handle_t *stream)
+{
+        skinny_profile_t *profile;
+
+        if ((profile = skinny_find_profile(profile_name))) {
+                listener_t *listener = NULL;
+                skinny_profile_find_listener_by_device_name(profile, device_name, &amp;listener);
+                if(listener) {
+                        send_call_state(listener, skinny_str2call_state(call_state), atoi(line_instance), atoi(call_id));
+                } else {
+                        stream-&gt;write_function(stream, &quot;Listener not found!\n&quot;);
+                }
+        } else {
+                stream-&gt;write_function(stream, &quot;Profile not found!\n&quot;);
+        }
+
+        return SWITCH_STATUS_SUCCESS;
+}
+
</ins><span class="cx"> SWITCH_STANDARD_API(skinny_function)
</span><span class="cx"> {
</span><span class="cx">         char *argv[1024] = { 0 };
</span><span class="lines">@@ -1490,6 +1574,10 @@
</span><span class="cx">                 &quot;skinny help\n&quot;
</span><span class="cx">                 &quot;skinny status profile &lt;profile_name&gt;\n&quot;
</span><span class="cx">                 &quot;skinny status profile &lt;profile_name&gt; device &lt;device_name&gt;\n&quot;
</span><ins>+                &quot;skinny profile &lt;profile_name&gt; device &lt;device_name&gt; send SetRingerMessage &lt;ring_type&gt; &lt;ring_mode&gt;\n&quot;
+                &quot;skinny profile &lt;profile_name&gt; device &lt;device_name&gt; send SetLampMessage &lt;stimulus&gt; &lt;instance&gt; &lt;lamp_mode&gt;\n&quot;
+                &quot;skinny profile &lt;profile_name&gt; device &lt;device_name&gt; send SetSpeakerModeMessage &lt;speaker_mode&gt;\n&quot;
+                &quot;skinny profile &lt;profile_name&gt; device &lt;device_name&gt; send CallState &lt;call_state&gt; &lt;line_instance&gt; &lt;call_id&gt;\n&quot;
</ins><span class="cx">                 &quot;--------------------------------------------------------------------------------\n&quot;;
</span><span class="cx">         if (session) {
</span><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><span class="lines">@@ -1510,13 +1598,27 @@
</span><span class="cx">                 goto done;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (argc == 3 &amp;&amp; !strcasecmp(argv[0], &quot;status&quot;) &amp;&amp; !strcasecmp(argv[1], &quot;profile&quot;)) {
</del><ins>+        if (!strcasecmp(argv[0], &quot;help&quot;)) {/* skinny help */
+                stream-&gt;write_function(stream, &quot;%s&quot;, usage_string);
+                goto done;
+        } else if (argc == 3 &amp;&amp; !strcasecmp(argv[0], &quot;status&quot;) &amp;&amp; !strcasecmp(argv[1], &quot;profile&quot;)) {
+                /* skinny status profile &lt;profile_name&gt; */
</ins><span class="cx">                 status = cmd_status_profile(argv[2], stream);
</span><span class="cx">         } else if (argc == 5 &amp;&amp; !strcasecmp(argv[0], &quot;status&quot;) &amp;&amp; !strcasecmp(argv[1], &quot;profile&quot;) &amp;&amp; !strcasecmp(argv[3], &quot;device&quot;)) {
</span><ins>+                /* skinny status profile &lt;profile_name&gt; device &lt;device_name&gt; */
</ins><span class="cx">                 status = cmd_status_profile_device(argv[2], argv[4], stream);
</span><del>-        } else if (!strcasecmp(argv[0], &quot;help&quot;)) {
-                stream-&gt;write_function(stream, &quot;%s&quot;, usage_string);
-                goto done;
</del><ins>+        } else if (argc == 8 &amp;&amp; !strcasecmp(argv[0], &quot;profile&quot;) &amp;&amp; !strcasecmp(argv[2], &quot;device&quot;) &amp;&amp; !strcasecmp(argv[4], &quot;send&quot;) &amp;&amp; !strcasecmp(argv[5], &quot;SetRingerMessage&quot;)) {
+                /* skinny profile &lt;profile_name&gt; device &lt;device_name&gt; send SetRingerMessage &lt;stimulus&gt; &lt;instance&gt; &lt;lamp_mode&gt; */
+                status = cmd_profile_device_send_ringer_message(argv[1], argv[3], argv[6], argv[7], stream);
+        } else if (argc == 9 &amp;&amp; !strcasecmp(argv[0], &quot;profile&quot;) &amp;&amp; !strcasecmp(argv[2], &quot;device&quot;) &amp;&amp; !strcasecmp(argv[4], &quot;send&quot;) &amp;&amp; !strcasecmp(argv[5], &quot;SetLampMessage&quot;)) {
+                /* skinny profile &lt;profile_name&gt; device &lt;device_name&gt; send SetLampMessage &lt;stimulus&gt; &lt;instance&gt; &lt;lamp_mode&gt; */
+                status = cmd_profile_device_send_lamp_message(argv[1], argv[3], argv[6], argv[7], argv[8], stream);
+        } else if (argc == 7 &amp;&amp; !strcasecmp(argv[0], &quot;profile&quot;) &amp;&amp; !strcasecmp(argv[2], &quot;device&quot;) &amp;&amp; !strcasecmp(argv[4], &quot;send&quot;) &amp;&amp; !strcasecmp(argv[5], &quot;SetSpeakerModeMessage&quot;)) {
+                /* skinny profile &lt;profile_name&gt; device &lt;device_name&gt; send SetSpeakerModeMessage &lt;speaker_mode&gt; */
+                status = cmd_profile_device_send_speaker_mode_message(argv[1], argv[3], argv[6], stream);
+        } else if (argc == 9 &amp;&amp; !strcasecmp(argv[0], &quot;profile&quot;) &amp;&amp; !strcasecmp(argv[2], &quot;device&quot;) &amp;&amp; !strcasecmp(argv[4], &quot;send&quot;) &amp;&amp; !strcasecmp(argv[5], &quot;CallState&quot;)) {
+                /* skinny profile &lt;profile_name&gt; device &lt;device_name&gt; send CallState &lt;call_state&gt; &lt;line_instance&gt; &lt;call_id&gt; */
+                status = cmd_profile_device_send_call_state_message(argv[1], argv[3], argv[6], argv[7], argv[8], stream);
</ins><span class="cx">         } else {
</span><span class="cx">                 stream-&gt;write_function(stream, &quot;Unknown Command [%s]\n&quot;, argv[0]);
</span><span class="cx">         }
</span><span class="lines">@@ -1574,7 +1676,7 @@
</span><span class="cx"> {
</span><span class="cx">         struct match_helper h = { 0 };
</span><span class="cx">         switch_status_t status = SWITCH_STATUS_FALSE;
</span><del>-        skinny_profile_t *profile;
</del><ins>+        skinny_profile_t *profile = NULL;
</ins><span class="cx">         char *sql;
</span><span class="cx"> 
</span><span class="cx">         char *myline;
</span><span class="lines">@@ -1589,7 +1691,13 @@
</span><span class="cx">                 return status;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if((profile = skinny_find_profile(argv[3]))) {
</del><ins>+        if(!strcasecmp(argv[1], &quot;profile&quot;)) {/* skinny profile &lt;profile_name&gt; ... */
+                profile = skinny_find_profile(argv[2]);
+        } else if(!strcasecmp(argv[2], &quot;profile&quot;)) {/* skinny status profile &lt;profile_name&gt; ... */
+                profile = skinny_find_profile(argv[3]);
+        }
+
+        if(profile) {
</ins><span class="cx">                 if ((sql = switch_mprintf(&quot;SELECT name FROM skinny_devices&quot;))) {
</span><span class="cx">                         skinny_execute_sql_callback(profile, profile-&gt;listener_mutex, sql, skinny_list_devices_callback, &amp;h);
</span><span class="cx">                         switch_safe_free(sql);
</span><span class="lines">@@ -1604,6 +1712,96 @@
</span><span class="cx">         return status;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static switch_status_t skinny_list_stimuli(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+        switch_status_t status = SWITCH_STATUS_FALSE;
+        SKINNY_PUSH_STIMULI
+        return status;
+}
+
+static switch_status_t skinny_list_ring_type(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+        switch_status_t status = SWITCH_STATUS_FALSE;
+        SKINNY_PUSH_RING_TYPES
+        return status;
+}
+
+static switch_status_t skinny_list_ring_mode(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+        switch_status_t status = SWITCH_STATUS_FALSE;
+        SKINNY_PUSH_RING_MODES
+        return status;
+}
+
+static switch_status_t skinny_list_stimulus_instances(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+        switch_status_t status = SWITCH_STATUS_FALSE;
+        switch_console_callback_match_t *my_matches = NULL;
+        
+        switch_console_push_match(&amp;my_matches, &quot;&lt;stimulus_instance&gt;&quot;);
+        switch_console_push_match(&amp;my_matches, &quot;0&quot;);
+        
+        if (my_matches) {
+                *matches = my_matches;
+                status = SWITCH_STATUS_SUCCESS;
+        }
+        return status;
+}
+
+static switch_status_t skinny_list_stimulus_modes(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+        switch_status_t status = SWITCH_STATUS_FALSE;
+        SKINNY_PUSH_LAMP_MODES
+        return status;
+}
+
+static switch_status_t skinny_list_speaker_mode(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+        switch_status_t status = SWITCH_STATUS_FALSE;
+        SKINNY_PUSH_SPEAKER_MODES
+        return status;
+}
+
+static switch_status_t skinny_list_call_states(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+        switch_status_t status = SWITCH_STATUS_FALSE;
+        SKINNY_PUSH_CALL_STATES
+        return status;
+}
+
+static switch_status_t skinny_list_line_instances(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+        switch_status_t status = SWITCH_STATUS_FALSE;
+        switch_console_callback_match_t *my_matches = NULL;
+        
+        /* TODO */
+        switch_console_push_match(&amp;my_matches, &quot;1&quot;);
+        switch_console_push_match(&amp;my_matches, &quot;&lt;line_instance&gt;&quot;);
+        
+        if (my_matches) {
+                *matches = my_matches;
+                status = SWITCH_STATUS_SUCCESS;
+        }
+        return status;
+}
+
+static switch_status_t skinny_list_call_ids(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+        switch_status_t status = SWITCH_STATUS_FALSE;
+        switch_console_callback_match_t *my_matches = NULL;
+        
+        /* TODO */
+        switch_console_push_match(&amp;my_matches, &quot;1345&quot;);
+        switch_console_push_match(&amp;my_matches, &quot;&lt;call_id&gt;&quot;);
+        
+        if (my_matches) {
+                *matches = my_matches;
+                status = SWITCH_STATUS_SUCCESS;
+        }
+        return status;
+}
+
+/*****************************************************************************/
</ins><span class="cx"> SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load)
</span><span class="cx"> {
</span><span class="cx">         switch_hash_index_t *hi;
</span><span class="lines">@@ -1646,11 +1844,27 @@
</span><span class="cx"> 
</span><span class="cx">         SWITCH_ADD_API(api_interface, &quot;skinny&quot;, &quot;Skinny Controls&quot;, skinny_function, &quot;&lt;cmd&gt; &lt;args&gt;&quot;);
</span><span class="cx">         switch_console_set_complete(&quot;add skinny help&quot;);
</span><ins>+
</ins><span class="cx">         switch_console_set_complete(&quot;add skinny status profile ::skinny::list_profiles&quot;);
</span><span class="cx">         switch_console_set_complete(&quot;add skinny status profile ::skinny::list_profiles device ::skinny::list_devices&quot;);
</span><span class="cx"> 
</span><ins>+        switch_console_set_complete(&quot;add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetRingerMessage ::skinny::list_ring_type ::skinny::list_ring_mode&quot;);
+        switch_console_set_complete(&quot;add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetLampMessage ::skinny::list_stimuli ::skinny::list_stimulus_instances ::skinny::list_stimulus_modes&quot;);
+        switch_console_set_complete(&quot;add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetSpeakerModeMessage ::skinny::list_speaker_mode&quot;);
+        switch_console_set_complete(&quot;add skinny profile ::skinny::list_profiles device ::skinny::list_devices send CallState ::skinny::list_call_states ::skinny::list_line_instances ::skinny::list_call_ids&quot;);
+
</ins><span class="cx">         switch_console_add_complete_func(&quot;::skinny::list_profiles&quot;, skinny_list_profiles);
</span><span class="cx">         switch_console_add_complete_func(&quot;::skinny::list_devices&quot;, skinny_list_devices);
</span><ins>+        switch_console_add_complete_func(&quot;::skinny::list_ring_type&quot;, skinny_list_ring_type);
+        switch_console_add_complete_func(&quot;::skinny::list_ring_mode&quot;, skinny_list_ring_mode);
+        switch_console_add_complete_func(&quot;::skinny::list_stimuli&quot;, skinny_list_stimuli);
+        switch_console_add_complete_func(&quot;::skinny::list_stimulus_instances&quot;, skinny_list_stimulus_instances);
+        switch_console_add_complete_func(&quot;::skinny::list_stimulus_modes&quot;, skinny_list_stimulus_modes);
+        switch_console_add_complete_func(&quot;::skinny::list_speaker_mode&quot;, skinny_list_speaker_mode);
+        switch_console_add_complete_func(&quot;::skinny::list_call_states&quot;, skinny_list_call_states);
+        switch_console_add_complete_func(&quot;::skinny::list_line_instances&quot;, skinny_list_line_instances);
+        switch_console_add_complete_func(&quot;::skinny::list_call_ids&quot;, skinny_list_call_ids);
+
</ins><span class="cx">         /* indicate that the module should continue to be loaded */
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_skinnyskinny_protocolc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c (16792 => 16793)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c        2010-02-24 12:06:16 UTC (rev 16792)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c        2010-02-24 12:06:25 UTC (rev 16793)
</span><span class="lines">@@ -35,12 +35,31 @@
</span><span class="cx"> 
</span><span class="cx"> skinny_globals_t globals;
</span><span class="cx"> 
</span><del>-struct skinny_message_type_table {
-        const char *name;
-        uint32_t type;
</del><ins>+struct soft_key_template_definition soft_key_template_default[] = {
+        { &quot;\200\001&quot;, SOFTKEY_REDIAL },
+        { &quot;\200\002&quot;, SOFTKEY_NEWCALL },
+        { &quot;\200\003&quot;, SOFTKEY_HOLD },
+        { &quot;\200\004&quot;, SOFTKEY_TRANSFER },
+        { &quot;\200\005&quot;, SOFTKEY_CFWDALL },
+        { &quot;\200\006&quot;, SOFTKEY_CFWDBUSY },
+        { &quot;\200\007&quot;, SOFTKEY_CFWDNOANSWER },
+        { &quot;\200\010&quot;, SOFTKEY_BACKSPACE },
+        { &quot;\200\011&quot;, SOFTKEY_ENDCALL },
+        { &quot;\200\012&quot;, SOFTKEY_RESUME },
+        { &quot;\200\013&quot;, SOFTKEY_ANSWER },
+        { &quot;\200\014&quot;, SOFTKEY_INFO },
+        { &quot;\200\015&quot;, SOFTKEY_CONFRM },
+        { &quot;\200\016&quot;, SOFTKEY_PARK },
+        { &quot;\200\017&quot;, SOFTKEY_JOIN },
+        { &quot;\200\020&quot;, SOFTKEY_MEETMECONFRM },
+        { &quot;\200\021&quot;, SOFTKEY_CALLPICKUP },
+        { &quot;\200\022&quot;, SOFTKEY_GRPCALLPICKUP },
+        { &quot;\200\077&quot;, SOFTKEY_DND },
+        { &quot;\200\120&quot;, SOFTKEY_IDIVERT },
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-static struct skinny_message_type_table SKINNY_MESSAGE_TYPES[] = {
</del><ins>+/* Translation tables */
+struct skinny_table SKINNY_MESSAGE_TYPES[] = {
</ins><span class="cx">         {&quot;KEEP_ALIVE_MESSAGE&quot;, KEEP_ALIVE_MESSAGE},
</span><span class="cx">         {&quot;REGISTER_MESSAGE&quot;, REGISTER_MESSAGE},
</span><span class="cx">         {&quot;PORT_MESSAGE&quot;, PORT_MESSAGE},
</span><span class="lines">@@ -94,119 +113,94 @@
</span><span class="cx">         {&quot;SKINNY_MESSAGE_MAXSIZE&quot;, SKINNY_MESSAGE_MAXSIZE},
</span><span class="cx">         {NULL, 0}
</span><span class="cx"> };
</span><ins>+SKINNY_DECLARE_ID2STR(skinny_message_type2str, SKINNY_MESSAGE_TYPES, &quot;UNKNOWN_MESSAGE&quot;)
+SKINNY_DECLARE_STR2ID(skinny_str2message_type, SKINNY_MESSAGE_TYPES, -1)
</ins><span class="cx"> 
</span><del>-struct soft_key_template_definition soft_key_template_default[] = {
-        { &quot;\200\001&quot;, SOFTKEY_REDIAL },
-        { &quot;\200\002&quot;, SOFTKEY_NEWCALL },
-        { &quot;\200\003&quot;, SOFTKEY_HOLD },
-        { &quot;\200\004&quot;, SOFTKEY_TRANSFER },
-        { &quot;\200\005&quot;, SOFTKEY_CFWDALL },
-        { &quot;\200\006&quot;, SOFTKEY_CFWDBUSY },
-        { &quot;\200\007&quot;, SOFTKEY_CFWDNOANSWER },
-        { &quot;\200\010&quot;, SOFTKEY_BACKSPACE },
-        { &quot;\200\011&quot;, SOFTKEY_ENDCALL },
-        { &quot;\200\012&quot;, SOFTKEY_RESUME },
-        { &quot;\200\013&quot;, SOFTKEY_ANSWER },
-        { &quot;\200\014&quot;, SOFTKEY_INFO },
-        { &quot;\200\015&quot;, SOFTKEY_CONFRM },
-        { &quot;\200\016&quot;, SOFTKEY_PARK },
-        { &quot;\200\017&quot;, SOFTKEY_JOIN },
-        { &quot;\200\020&quot;, SOFTKEY_MEETMECONFRM },
-        { &quot;\200\021&quot;, SOFTKEY_CALLPICKUP },
-        { &quot;\200\022&quot;, SOFTKEY_GRPCALLPICKUP },
-        { &quot;\200\077&quot;, SOFTKEY_DND },
-        { &quot;\200\120&quot;, SOFTKEY_IDIVERT },
</del><ins>+struct skinny_table SKINNY_RING_TYPES[] = {
+        {&quot;RingOff&quot;, SKINNY_RING_OFF},
+        {&quot;RingInside&quot;, SKINNY_RING_INSIDE},
+        {&quot;RingOutside&quot;, SKINNY_RING_OUTSIDE},
+        {&quot;RingFeature&quot;, SKINNY_RING_FEATURE},
+        {NULL, 0}
</ins><span class="cx"> };
</span><ins>+SKINNY_DECLARE_ID2STR(skinny_ring_type2str, SKINNY_RING_TYPES, &quot;RingTypeUnknown&quot;)
+SKINNY_DECLARE_STR2ID(skinny_str2ring_type, SKINNY_RING_TYPES, -1)
</ins><span class="cx"> 
</span><del>-struct skinny_key_set_table {
-        const char *name;
-        uint32_t id;
</del><ins>+struct skinny_table SKINNY_RING_MODES[] = {
+        {&quot;RingForever&quot;, SKINNY_RING_FOREVER},
+        {&quot;RingOnce&quot;, SKINNY_RING_ONCE},
+        {NULL, 0}
</ins><span class="cx"> };
</span><ins>+SKINNY_DECLARE_ID2STR(skinny_ring_mode2str, SKINNY_RING_MODES, &quot;RingModeUnknown&quot;)
+SKINNY_DECLARE_STR2ID(skinny_str2ring_mode, SKINNY_RING_MODES, -1)
</ins><span class="cx"> 
</span><del>-static struct skinny_key_set_table SKINNY_KEY_SETS[] = {
-        {&quot;SKINNY_KEY_SET_ON_HOOK&quot;, 0},
-        {&quot;SKINNY_KEY_SET_CONNECTED&quot;, 1},
-        {&quot;SKINNY_KEY_SET_ON_HOLD&quot;, 2},
-        {&quot;SKINNY_KEY_SET_RING_IN&quot;, 3},
-        {&quot;SKINNY_KEY_SET_OFF_HOOK&quot;, 4},
-        {&quot;SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER&quot;, 5},
-        {&quot;SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT&quot;, 6},
-        {&quot;SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE&quot;, 7},
-        {&quot;SKINNY_KEY_SET_RING_OUT&quot;, 8},
-        {&quot;SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES&quot;, 9},
</del><ins>+struct skinny_table SKINNY_STIMULI[] = {
+        {&quot;LastNumberRedial&quot;, SKINNY_BUTTON_LAST_NUMBER_REDIAL},
+        {&quot;SpeedDial&quot;, SKINNY_BUTTON_SPEED_DIAL},
+        {&quot;Line&quot;, SKINNY_BUTTON_LINE},
+        {&quot;Voicemail&quot;, SKINNY_BUTTON_VOICEMAIL},
+        {&quot;Undefined&quot;, SKINNY_BUTTON_UNDEFINED},
</ins><span class="cx">         {NULL, 0}
</span><span class="cx"> };
</span><ins>+SKINNY_DECLARE_ID2STR(skinny_stimulus2str, SKINNY_STIMULI, &quot;Unknown&quot;)
+SKINNY_DECLARE_STR2ID(skinny_str2stimulus, SKINNY_STIMULI, -1)
</ins><span class="cx"> 
</span><del>-/*****************************************************************************/
-/* SKINNY FUNCTIONS */
-/*****************************************************************************/
-const char *skinny_message_type2str(uint32_t type)
-{
-        uint8_t x;
-        const char *str = &quot;UNKNOWN_MESSAGE&quot;;
</del><ins>+struct skinny_table SKINNY_LAMP_MODES[] = {
+        {&quot;Off&quot;, SKINNY_LAMP_OFF},
+        {&quot;On&quot;, SKINNY_LAMP_ON},
+        {&quot;Wink&quot;, SKINNY_LAMP_WINK},
+        {&quot;Flash&quot;, SKINNY_LAMP_FLASH},
+        {&quot;Blink&quot;, SKINNY_LAMP_BLINK},
+        {NULL, 0}
+};
+SKINNY_DECLARE_ID2STR(skinny_lamp_mode2str, SKINNY_LAMP_MODES, &quot;Unknown&quot;)
+SKINNY_DECLARE_STR2ID(skinny_str2lamp_mode, SKINNY_LAMP_MODES, -1)
</ins><span class="cx"> 
</span><del>-        for (x = 0; x &lt; (sizeof(SKINNY_MESSAGE_TYPES) / sizeof(struct skinny_message_type_table)) - 1; x++) {
-                if (SKINNY_MESSAGE_TYPES[x].type == type) {
-                        str = SKINNY_MESSAGE_TYPES[x].name;
-                        break;
-                }
-        }
</del><ins>+struct skinny_table SKINNY_SPEAKER_MODES[] = {
+        {&quot;SpeakerOn&quot;, SKINNY_SPEAKER_ON},
+        {&quot;SpeakerOff&quot;, SKINNY_SPEAKER_OFF},
+        {NULL, 0}
+};
+SKINNY_DECLARE_ID2STR(skinny_speaker_mode2str, SKINNY_SPEAKER_MODES, &quot;Unknown&quot;)
+SKINNY_DECLARE_STR2ID(skinny_str2speaker_mode, SKINNY_SPEAKER_MODES, -1)
</ins><span class="cx"> 
</span><del>-        return str;
-}
</del><ins>+struct skinny_table SKINNY_KEY_SETS[] = {
+        {&quot;KeySetOnHook&quot;, SKINNY_KEY_SET_ON_HOOK},
+        {&quot;KeySetConnected&quot;, SKINNY_KEY_SET_CONNECTED},
+        {&quot;KeySetOnHold&quot;, SKINNY_KEY_SET_ON_HOLD},
+        {&quot;KeySetRingIn&quot;, SKINNY_KEY_SET_RING_IN},
+        {&quot;KeySetOffHook&quot;, SKINNY_KEY_SET_OFF_HOOK},
+        {&quot;KeySetConnectedWithTransfer&quot;, SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER},
+        {&quot;KeySetDigitsAfterDialingFirstDigit&quot;, SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT},
+        {&quot;KeySetConnectedWithConference&quot;, SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE},
+        {&quot;KeySetRingOut&quot;, SKINNY_KEY_SET_RING_OUT},
+        {&quot;KeySetOffHookWithFeatures&quot;, SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES},
+        {NULL, 0}
+};
+SKINNY_DECLARE_ID2STR(skinny_soft_key_set2str, SKINNY_KEY_SETS, &quot;UNKNOWN_SOFT_KEY_SET&quot;)
+SKINNY_DECLARE_STR2ID(skinny_str2soft_key_set, SKINNY_KEY_SETS, -1)
</ins><span class="cx"> 
</span><del>-uint32_t skinny_str2message_type(const char *str)
-{
-        uint8_t x;
-        uint32_t type = -1;
-
-        if (*str &gt; 47 &amp;&amp; *str &lt; 58) {
-                type = atoi(str);
-        } else {
-                for (x = 0; x &lt; (sizeof(SKINNY_MESSAGE_TYPES) / sizeof(struct skinny_message_type_table)) - 1 &amp;&amp; SKINNY_MESSAGE_TYPES[x].name; x++) {
-                        if (!strcasecmp(SKINNY_MESSAGE_TYPES[x].name, str)) {
-                                type = SKINNY_MESSAGE_TYPES[x].type;
-                                break;
-                        }
-                }
-        }
-        return type;
-}
-
</del><ins>+struct skinny_table SKINNY_CALL_STATES[] = {
+        {&quot;OffHook&quot;, SKINNY_OFF_HOOK},
+        {&quot;OnHook&quot;, SKINNY_ON_HOOK},
+        {&quot;RingOut&quot;, SKINNY_RING_OUT},
+        {&quot;RingIn&quot;, SKINNY_RING_IN},
+        {&quot;Connected&quot;, SKINNY_CONNECTED},
+        {&quot;Busy&quot;, SKINNY_BUSY},
+        {&quot;Congestion&quot;, SKINNY_CONGESTION},
+        {&quot;Hold&quot;, SKINNY_HOLD},
+        {&quot;CallWaiting&quot;, SKINNY_CALL_WAITING},
+        {&quot;CallTransfer&quot;, SKINNY_CALL_TRANSFER},
+        {&quot;CallPark&quot;, SKINNY_CALL_PARK},
+        {&quot;Proceed&quot;, SKINNY_PROCEED},
+        {&quot;CallRemoteMultiline&quot;, SKINNY_CALL_REMOTE_MULTILINE},
+        {&quot;InvalidNumber&quot;, SKINNY_INVALID_NUMBER},
+        {NULL, 0}
+};
+SKINNY_DECLARE_ID2STR(skinny_call_state2str, SKINNY_CALL_STATES, &quot;CallStateUnknown&quot;)
+SKINNY_DECLARE_STR2ID(skinny_str2call_state, SKINNY_CALL_STATES, -1)
</ins><span class="cx"> /*****************************************************************************/
</span><del>-const char *skinny_soft_key_set2str(uint32_t id)
-{
-        uint8_t x;
-        const char *str = &quot;UNKNOWN_SOFT_KEY_SET&quot;;
-
-        for (x = 0; x &lt; (sizeof(SKINNY_KEY_SETS) / sizeof(struct skinny_key_set_table)) - 1; x++) {
-                if (SKINNY_KEY_SETS[x].id == id) {
-                        str = SKINNY_KEY_SETS[x].name;
-                        break;
-                }
-        }
-
-        return str;
-}
-
-uint32_t skinny_str2soft_key_set(const char *str)
-{
-        uint8_t x;
-        uint32_t id = -1;
-
-        if (*str &gt; 47 &amp;&amp; *str &lt; 58) {
-                id = atoi(str);
-        } else {
-                for (x = 0; x &lt; (sizeof(SKINNY_KEY_SETS) / sizeof(struct skinny_key_set_table)) - 1 &amp;&amp; SKINNY_KEY_SETS[x].name; x++) {
-                        if (!strcasecmp(SKINNY_KEY_SETS[x].name, str)) {
-                                id = SKINNY_KEY_SETS[x].id;
-                                break;
-                        }
-                }
-        }
-        return id;
-}
-
</del><ins>+/* SKINNY FUNCTIONS */
</ins><span class="cx"> /*****************************************************************************/
</span><span class="cx"> char* skinny_codec2string(enum skinny_codecs skinnycodec)
</span><span class="cx"> {
</span><span class="lines">@@ -644,7 +638,7 @@
</span><span class="cx">                 helper-&gt;button-&gt;number = helper-&gt;pos;
</span><span class="cx">                 strncpy(helper-&gt;button-&gt;name,  argv[2], 24); /* label */
</span><span class="cx">                 strncpy(helper-&gt;button-&gt;shortname,  argv[3], 40); /* value */
</span><del>-                strncpy(helper-&gt;button-&gt;displayname,  argv[2], 44); /* settings */
</del><ins>+                strncpy(helper-&gt;button-&gt;displayname,  argv[4], 44); /* settings */
</ins><span class="cx">         }
</span><span class="cx">         return 0;
</span><span class="cx"> }
</span><span class="lines">@@ -1567,6 +1561,9 @@
</span><span class="cx">         }
</span><span class="cx">         /* Close/Hold busy lines */
</span><span class="cx">         for(int i = 0 ; i &lt; SKINNY_MAX_BUTTON_COUNT ; i++) {
</span><ins>+                if(i == line) {
+                        continue;
+                }
</ins><span class="cx">                 if(listener-&gt;session[i]) {
</span><span class="cx">                         channel = switch_core_session_get_channel(listener-&gt;session[i]);
</span><span class="cx">                         assert(channel != NULL);
</span><span class="lines">@@ -1610,6 +1607,9 @@
</span><span class="cx">                         skinny_unhold_line(listener, line);                        
</span><span class="cx">                 }
</span><span class="cx">                 switch(request-&gt;data.soft_key_event.event) {
</span><ins>+                        case SOFTKEY_ANSWER:
+                                skinny_answer(listener-&gt;session[line]);
+                                break;
</ins><span class="cx">                         case SOFTKEY_ENDCALL:
</span><span class="cx">                                 channel = switch_core_session_get_channel(listener-&gt;session[line]);
</span><span class="cx">                                 assert(channel != NULL);
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_skinnyskinny_protocolh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.h (16792 => 16793)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.h        2010-02-24 12:06:16 UTC (rev 16792)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.h        2010-02-24 12:06:25 UTC (rev 16793)
</span><span class="lines">@@ -190,16 +190,6 @@
</span><span class="cx">         uint32_t call_id;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-enum skinny_tone {
-        SKINNY_TONE_SILENCE = 0x00,
-        SKINNY_TONE_DIALTONE = 0x21,
-        SKINNY_TONE_BUSYTONE = 0x23,
-        SKINNY_TONE_ALERT = 0x24,
-        SKINNY_TONE_REORDER = 0x25,
-        SKINNY_TONE_CALLWAITTONE = 0x2D,
-        SKINNY_TONE_NOTONE = 0x7F,
-};
-
</del><span class="cx"> /* StopToneMessage */
</span><span class="cx"> #define STOP_TONE_MESSAGE 0x0083
</span><span class="cx"> struct stop_tone_message {
</span><span class="lines">@@ -215,18 +205,6 @@
</span><span class="cx">         uint32_t unknown; /* ?? */
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-enum skinny_ring_type {
-        SKINNY_RING_OFF = 1,
-        SKINNY_RING_INSIDE = 2,
-        SKINNY_RING_OUTSIDE = 3,
-        SKINNY_RING_FEATURE = 4
-};
-
-enum skinny_ring_mode {
-        SKINNY_RING_FOREVER = 1,
-        SKINNY_RING_ONCE = 2,
-};
-
</del><span class="cx"> /* SetLampMessage */
</span><span class="cx"> #define SET_LAMP_MESSAGE 0x0086
</span><span class="cx"> struct set_lamp_message {
</span><span class="lines">@@ -235,25 +213,12 @@
</span><span class="cx">         uint32_t mode; /* See enum skinny_lamp_mode */
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-enum skinny_lamp_mode {
-        SKINNY_LAMP_OFF = 1,
-        SKINNY_LAMP_ON = 2,
-        SKINNY_LAMP_WINK = 3,
-        SKINNY_LAMP_FLASH = 4,
-        SKINNY_LAMP_BLINK = 5,
-};
-
</del><span class="cx"> /* SetSpeakerModeMessage */
</span><span class="cx"> #define SET_SPEAKER_MODE_MESSAGE 0x0088
</span><span class="cx"> struct set_speaker_mode_message {
</span><span class="cx">         uint32_t mode; /* See enum skinny_speaker_mode */
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-enum skinny_speaker_mode {
-        SKINNY_SPEAKER_ON = 1,
-        SKINNY_SPEAKER_OFF = 2,
-};
-
</del><span class="cx"> /* StartMediaTransmissionMessage */
</span><span class="cx"> #define START_MEDIA_TRANSMISSION_MESSAGE 0x008A
</span><span class="cx"> struct start_media_transmission_message {
</span><span class="lines">@@ -304,12 +269,6 @@
</span><span class="cx">         uint32_t party_pi_restriction_bits;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-enum skinny_call_type {
-        SKINNY_INBOUND_CALL = 1,
-        SKINNY_OUTBOUND_CALL = 2,
-        SKINNY_FORWARD_CALL = 3,
-};
-
</del><span class="cx"> /* SpeedDialStatMessage */
</span><span class="cx"> #define SPEED_DIAL_STAT_RES_MESSAGE 0x0091
</span><span class="cx"> struct speed_dial_stat_res_message {
</span><span class="lines">@@ -360,14 +319,6 @@
</span><span class="cx">         uint8_t button_definition; /* See enum skinny_button_definition */
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-enum skinny_button_definition {
-        SKINNY_BUTTON_LAST_NUMBER_REDIAL = 0x01,
-        SKINNY_BUTTON_SPEED_DIAL = 0x02,
-        SKINNY_BUTTON_LINE = 0x09,
-        SKINNY_BUTTON_VOICEMAIL = 0x0F,
-        SKINNY_BUTTON_UNDEFINED = 0xFF,
-};
-
</del><span class="cx"> #define SKINNY_MAX_BUTTON_COUNT 42
</span><span class="cx"> struct button_template_message {
</span><span class="cx">         uint32_t button_offset;
</span><span class="lines">@@ -424,29 +375,6 @@
</span><span class="cx">         struct soft_key_template_definition soft_key[32];
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-enum skinny_soft_key_event {
-        SOFTKEY_REDIAL = 0x01,
-        SOFTKEY_NEWCALL = 0x02,
-        SOFTKEY_HOLD = 0x03,
-        SOFTKEY_TRANSFER = 0x04,
-        SOFTKEY_CFWDALL = 0x05,
-        SOFTKEY_CFWDBUSY = 0x06,
-        SOFTKEY_CFWDNOANSWER = 0x07,
-        SOFTKEY_BACKSPACE = 0x08,
-        SOFTKEY_ENDCALL = 0x09,
-        SOFTKEY_RESUME = 0x0A,
-        SOFTKEY_ANSWER = 0x0B,
-        SOFTKEY_INFO = 0x0C,
-        SOFTKEY_CONFRM = 0x0D,
-        SOFTKEY_PARK = 0x0E,
-        SOFTKEY_JOIN = 0x0F,
-        SOFTKEY_MEETMECONFRM = 0x10,
-        SOFTKEY_CALLPICKUP = 0x11,
-        SOFTKEY_GRPCALLPICKUP = 0x12,
-        SOFTKEY_DND = 0x13,
-        SOFTKEY_IDIVERT = 0x14,
-};
-
</del><span class="cx"> /* SoftKeySetResMessage */
</span><span class="cx"> #define SOFT_KEY_SET_RES_MESSAGE 0x0109
</span><span class="cx"> struct soft_key_set_definition {
</span><span class="lines">@@ -471,19 +399,6 @@
</span><span class="cx">         uint32_t valid_key_mask;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-enum skinny_key_set {
-        SKINNY_KEY_SET_ON_HOOK = 0,
-        SKINNY_KEY_SET_CONNECTED = 1,
-        SKINNY_KEY_SET_ON_HOLD = 2,
-        SKINNY_KEY_SET_RING_IN = 3,
-        SKINNY_KEY_SET_OFF_HOOK = 4,
-        SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER = 5,
-        SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT = 6,
-        SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE = 7,
-        SKINNY_KEY_SET_RING_OUT = 8,
-        SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES = 9,
-};
-
</del><span class="cx"> /* CallStateMessage */
</span><span class="cx"> #define CALL_STATE_MESSAGE 0x0111
</span><span class="cx"> struct call_state_message {
</span><span class="lines">@@ -492,23 +407,6 @@
</span><span class="cx">         uint32_t call_id;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-enum skinny_call_state {
-        SKINNY_OFF_HOOK = 1,
-        SKINNY_ON_HOOK = 2,
-        SKINNY_RING_OUT = 3,
-        SKINNY_RING_IN = 4,
-        SKINNY_CONNECTED = 5,
-        SKINNY_BUSY = 6,
-        SKINNY_CONGESTION = 7,
-        SKINNY_HOLD = 8,
-        SKINNY_CALL_WAITING = 9,
-        SKINNY_CALL_TRANSFER = 10,
-        SKINNY_CALL_PARK = 11,
-        SKINNY_PROCEED = 12,
-        SKINNY_CALL_REMOTE_MULTILINE = 13,
-        SKINNY_INVALID_NUMBER = 14
-};
-
</del><span class="cx"> /* DisplayPromptStatusMessage */
</span><span class="cx"> #define DISPLAY_PROMPT_STATUS_MESSAGE 0x0112
</span><span class="cx"> struct display_prompt_status_message {
</span><span class="lines">@@ -646,6 +544,194 @@
</span><span class="cx"> typedef switch_status_t (*skinny_command_t) (char **argv, int argc, switch_stream_handle_t *stream);
</span><span class="cx"> 
</span><span class="cx"> /*****************************************************************************/
</span><ins>+/* SKINNY TABLES */
+/*****************************************************************************/
+struct skinny_table {
+        const char *name;
+        uint32_t id;
+};
+
+#define SKINNY_DECLARE_ID2STR(func, TABLE, DEFAULT_STR) \
+const char *func(uint32_t id) \
+{ \
+        const char *str = DEFAULT_STR; \
+        \
+        for (uint8_t x = 0; x &lt; (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
+                if (TABLE[x].id == id) {\
+                        str = TABLE[x].name;\
+                        break;\
+                }\
+        }\
+        \
+        return str;\
+}
+
+#define SKINNY_DECLARE_STR2ID(func, TABLE, DEFAULT_ID) \
+uint32_t func(const char *str)\
+{\
+        uint32_t id = DEFAULT_ID;\
+        \
+        if (*str &gt; 47 &amp;&amp; *str &lt; 58) {\
+                id = atoi(str);\
+        } else {\
+                for (uint8_t x = 0; x &lt; (sizeof(TABLE) / sizeof(struct skinny_table)) - 1 &amp;&amp; TABLE[x].name; x++) {\
+                        if (!strcasecmp(TABLE[x].name, str)) {\
+                                id = TABLE[x].id;\
+                                break;\
+                        }\
+                }\
+        }\
+        return id;\
+}
+
+#define SKINNY_DECLARE_PUSH_MATCH(TABLE) \
+        switch_console_callback_match_t *my_matches = NULL;\
+        for (uint8_t x = 0; x &lt; (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
+                switch_console_push_match(&amp;my_matches, TABLE[x].name);\
+        }\
+        if (my_matches) {\
+                *matches = my_matches;\
+                status = SWITCH_STATUS_SUCCESS;\
+        }
+        
+struct skinny_table SKINNY_MESSAGE_TYPES[52];
+const char *skinny_message_type2str(uint32_t id);
+uint32_t skinny_str2message_type(const char *str);
+#define SKINNY_PUSH_MESSAGE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_MESSAGE_TYPES)
+
+enum skinny_tone {
+        SKINNY_TONE_SILENCE = 0x00,
+        SKINNY_TONE_DIALTONE = 0x21,
+        SKINNY_TONE_BUSYTONE = 0x23,
+        SKINNY_TONE_ALERT = 0x24,
+        SKINNY_TONE_REORDER = 0x25,
+        SKINNY_TONE_CALLWAITTONE = 0x2D,
+        SKINNY_TONE_NOTONE = 0x7F,
+};
+
+enum skinny_ring_type {
+        SKINNY_RING_OFF = 1,
+        SKINNY_RING_INSIDE = 2,
+        SKINNY_RING_OUTSIDE = 3,
+        SKINNY_RING_FEATURE = 4
+};
+struct skinny_table SKINNY_RING_TYPES[5];
+const char *skinny_ring_type2str(uint32_t id);
+uint32_t skinny_str2ring_type(const char *str);
+#define SKINNY_PUSH_RING_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_RING_TYPES)
+
+enum skinny_ring_mode {
+        SKINNY_RING_FOREVER = 1,
+        SKINNY_RING_ONCE = 2,
+};
+struct skinny_table SKINNY_RING_MODES[3];
+const char *skinny_ring_mode2str(uint32_t id);
+uint32_t skinny_str2ring_mode(const char *str);
+#define SKINNY_PUSH_RING_MODES SKINNY_DECLARE_PUSH_MATCH(SKINNY_RING_MODES)
+
+
+enum skinny_lamp_mode {
+        SKINNY_LAMP_OFF = 1,
+        SKINNY_LAMP_ON = 2,
+        SKINNY_LAMP_WINK = 3,
+        SKINNY_LAMP_FLASH = 4,
+        SKINNY_LAMP_BLINK = 5,
+};
+struct skinny_table SKINNY_LAMP_MODES[6];
+const char *skinny_lamp_mode2str(uint32_t id);
+uint32_t skinny_str2lamp_mode(const char *str);
+#define SKINNY_PUSH_LAMP_MODES SKINNY_DECLARE_PUSH_MATCH(SKINNY_LAMP_MODES)
+
+enum skinny_speaker_mode {
+        SKINNY_SPEAKER_ON = 1,
+        SKINNY_SPEAKER_OFF = 2,
+};
+struct skinny_table SKINNY_SPEAKER_MODES[3];
+const char *skinny_speaker_mode2str(uint32_t id);
+uint32_t skinny_str2speaker_mode(const char *str);
+#define SKINNY_PUSH_SPEAKER_MODES SKINNY_DECLARE_PUSH_MATCH(SKINNY_SPEAKER_MODES)
+
+enum skinny_call_type {
+        SKINNY_INBOUND_CALL = 1,
+        SKINNY_OUTBOUND_CALL = 2,
+        SKINNY_FORWARD_CALL = 3,
+};
+
+enum skinny_button_definition {
+        SKINNY_BUTTON_LAST_NUMBER_REDIAL = 0x01,
+        SKINNY_BUTTON_SPEED_DIAL = 0x02,
+        SKINNY_BUTTON_LINE = 0x09,
+        SKINNY_BUTTON_VOICEMAIL = 0x0F,
+        SKINNY_BUTTON_UNDEFINED = 0xFF,
+};
+struct skinny_table SKINNY_STIMULI[6];
+const char *skinny_stimulus2str(uint32_t id);
+uint32_t skinny_str2stimulus(const char *str);
+#define SKINNY_PUSH_STIMULI SKINNY_DECLARE_PUSH_MATCH(SKINNY_STIMULI)
+
+enum skinny_soft_key_event {
+        SOFTKEY_REDIAL = 0x01,
+        SOFTKEY_NEWCALL = 0x02,
+        SOFTKEY_HOLD = 0x03,
+        SOFTKEY_TRANSFER = 0x04,
+        SOFTKEY_CFWDALL = 0x05,
+        SOFTKEY_CFWDBUSY = 0x06,
+        SOFTKEY_CFWDNOANSWER = 0x07,
+        SOFTKEY_BACKSPACE = 0x08,
+        SOFTKEY_ENDCALL = 0x09,
+        SOFTKEY_RESUME = 0x0A,
+        SOFTKEY_ANSWER = 0x0B,
+        SOFTKEY_INFO = 0x0C,
+        SOFTKEY_CONFRM = 0x0D,
+        SOFTKEY_PARK = 0x0E,
+        SOFTKEY_JOIN = 0x0F,
+        SOFTKEY_MEETMECONFRM = 0x10,
+        SOFTKEY_CALLPICKUP = 0x11,
+        SOFTKEY_GRPCALLPICKUP = 0x12,
+        SOFTKEY_DND = 0x13,
+        SOFTKEY_IDIVERT = 0x14,
+};
+
+enum skinny_key_set {
+        SKINNY_KEY_SET_ON_HOOK = 0,
+        SKINNY_KEY_SET_CONNECTED = 1,
+        SKINNY_KEY_SET_ON_HOLD = 2,
+        SKINNY_KEY_SET_RING_IN = 3,
+        SKINNY_KEY_SET_OFF_HOOK = 4,
+        SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER = 5,
+        SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT = 6,
+        SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE = 7,
+        SKINNY_KEY_SET_RING_OUT = 8,
+        SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES = 9,
+};
+struct skinny_table SKINNY_KEY_SETS[11];
+const char *skinny_soft_key_set2str(uint32_t id);
+uint32_t skinny_str2soft_key_set(const char *str);
+#define SKINNY_PUSH_SOFT_KEY_SETS SKINNY_DECLARE_PUSH_MATCH(SKINNY_KEY_SETS)
+
+
+enum skinny_call_state {
+        SKINNY_OFF_HOOK = 1,
+        SKINNY_ON_HOOK = 2,
+        SKINNY_RING_OUT = 3,
+        SKINNY_RING_IN = 4,
+        SKINNY_CONNECTED = 5,
+        SKINNY_BUSY = 6,
+        SKINNY_CONGESTION = 7,
+        SKINNY_HOLD = 8,
+        SKINNY_CALL_WAITING = 9,
+        SKINNY_CALL_TRANSFER = 10,
+        SKINNY_CALL_PARK = 11,
+        SKINNY_PROCEED = 12,
+        SKINNY_CALL_REMOTE_MULTILINE = 13,
+        SKINNY_INVALID_NUMBER = 14
+};
+struct skinny_table SKINNY_CALL_STATES[15];
+const char *skinny_call_state2str(uint32_t id);
+uint32_t skinny_str2call_state(const char *str);
+#define SKINNY_PUSH_CALL_STATES SKINNY_DECLARE_PUSH_MATCH(SKINNY_CALL_STATES)
+
+/*****************************************************************************/
</ins><span class="cx"> /* SKINNY FUNCTIONS */
</span><span class="cx"> /*****************************************************************************/
</span><span class="cx"> #define skinny_check_data_length(message, len) \
</span><span class="lines">@@ -654,13 +740,6 @@
</span><span class="cx">                 return SWITCH_STATUS_FALSE;\
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-
-const char *skinny_message_type2str(uint32_t type);
-uint32_t skinny_str2message_type(const char *str);
-
-const char *skinny_soft_key_set2str(uint32_t id);
-uint32_t skinny_str2soft_key_set(const char *str);
-
</del><span class="cx"> switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req);
</span><span class="cx"> 
</span><span class="cx"> switch_status_t skinny_device_event(listener_t *listener, switch_event_t **ev, switch_event_types_t event_id, const char *subclass_name);
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>