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

<h3>Log Message</h3>
<pre>Skinny: config cleaning and refactorisation
- removed unused globals: codec?\195?\168prefs, codec_master, codec_rates
- moved global debug to profile
- store button type as id in DB (avoid case-sensitivity problem)
-</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_skinnymod_skinnyh">freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.h</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 (16793 => 16794)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c        2010-02-24 12:06:25 UTC (rev 16793)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c        2010-02-24 12:06:36 UTC (rev 16794)
</span><span class="lines">@@ -44,9 +44,6 @@
</span><span class="cx"> 
</span><span class="cx"> skinny_globals_t globals;
</span><span class="cx"> 
</span><del>-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string);
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string);
-
</del><span class="cx"> /*****************************************************************************/
</span><span class="cx"> /* SQL TABLES */
</span><span class="cx"> /*****************************************************************************/
</span><span class="lines">@@ -66,7 +63,7 @@
</span><span class="cx">         &quot;CREATE TABLE skinny_buttons (\n&quot;
</span><span class="cx">         &quot;   device_name      VARCHAR(16),\n&quot;
</span><span class="cx">         &quot;   position         INTEGER,\n&quot;
</span><del>-        &quot;   type             VARCHAR(10),\n&quot;
</del><ins>+        &quot;   type         INTEGER,\n&quot;
</ins><span class="cx">         &quot;   label            VARCHAR(40),\n&quot;
</span><span class="cx">         &quot;   value            VARCHAR(24),\n&quot;
</span><span class="cx">         &quot;   settings         VARCHAR(44)\n&quot;
</span><span class="lines">@@ -89,8 +86,8 @@
</span><span class="cx">         stream-&gt;write_function(stream, &quot;Context          \t%s\n&quot;, profile-&gt;context);
</span><span class="cx">         stream-&gt;write_function(stream, &quot;Keep-Alive       \t%d\n&quot;, profile-&gt;keep_alive);
</span><span class="cx">         stream-&gt;write_function(stream, &quot;Date-Format      \t%s\n&quot;, profile-&gt;date_format);
</span><del>-        /* db */
</del><span class="cx">         stream-&gt;write_function(stream, &quot;DBName           \t%s\n&quot;, profile-&gt;dbname ? profile-&gt;dbname : switch_str_nil(profile-&gt;odbc_dsn));
</span><ins>+        stream-&gt;write_function(stream, &quot;Debug            \t%d\n&quot;, profile-&gt;debug);
</ins><span class="cx">         /* stats */
</span><span class="cx">         stream-&gt;write_function(stream, &quot;CALLS-IN         \t%d\n&quot;, profile-&gt;ib_calls);
</span><span class="cx">         stream-&gt;write_function(stream, &quot;FAILED-CALLS-IN  \t%d\n&quot;, profile-&gt;ib_failed_calls);
</span><span class="lines">@@ -1102,7 +1099,7 @@
</span><span class="cx">         switch_socket_opt_set(listener-&gt;sock, SWITCH_SO_TCP_NODELAY, TRUE);
</span><span class="cx">         switch_socket_opt_set(listener-&gt;sock, SWITCH_SO_NONBLOCK, TRUE);
</span><span class="cx"> 
</span><del>-        if (globals.debug &gt; 0) {
</del><ins>+        if (listener-&gt;profile-&gt;debug &gt; 0) {
</ins><span class="cx">                 if (zstr(listener-&gt;remote_ip)) {
</span><span class="cx">                         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, &quot;Connection Open\n&quot;);
</span><span class="cx">                 } else {
</span><span class="lines">@@ -1138,7 +1135,7 @@
</span><span class="cx"> 
</span><span class="cx">         remove_listener(listener);
</span><span class="cx"> 
</span><del>-        if (globals.debug &gt; 0) {
</del><ins>+        if (listener-&gt;profile-&gt;debug &gt; 0) {
</ins><span class="cx">                 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, &quot;Session complete, waiting for children\n&quot;);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -1151,7 +1148,7 @@
</span><span class="cx"> 
</span><span class="cx">         switch_thread_rwlock_unlock(listener-&gt;rwlock);
</span><span class="cx"> 
</span><del>-        if (globals.debug &gt; 0) {
</del><ins>+        if (listener-&gt;profile-&gt;debug &gt; 0) {
</ins><span class="cx">                 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, &quot;Connection Closed\n&quot;);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -1315,6 +1312,8 @@
</span><span class="cx">                 profile-&gt;dialplan = switch_core_strdup(module_pool, val);
</span><span class="cx">         } else if (!strcasecmp(var, &quot;context&quot;)) {
</span><span class="cx">                 profile-&gt;context = switch_core_strdup(module_pool, val);
</span><ins>+        } else if (!strcasecmp(var, &quot;date-format&quot;)) {
+                strncpy(profile-&gt;date_format, val, 6);
</ins><span class="cx">         } else if (!strcasecmp(var, &quot;odbc-dsn&quot;) &amp;&amp; !zstr(val)) {
</span><span class="cx">                 if (switch_odbc_available()) {
</span><span class="cx">                         profile-&gt;odbc_dsn = switch_core_strdup(module_pool, val);
</span><span class="lines">@@ -1333,7 +1332,7 @@
</span><span class="cx"> static switch_status_t load_skinny_config(void)
</span><span class="cx"> {
</span><span class="cx">         char *cf = &quot;skinny.conf&quot;;
</span><del>-        switch_xml_t xcfg, xml, xsettings, xprofiles, xprofile, xparam;
</del><ins>+        switch_xml_t xcfg, xml, xprofiles, xprofile;
</ins><span class="cx"> 
</span><span class="cx">         memset(&amp;globals, 0, sizeof(globals));
</span><span class="cx">         globals.running = 1;
</span><span class="lines">@@ -1347,27 +1346,6 @@
</span><span class="cx">                 return SWITCH_STATUS_TERM;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ((xsettings = switch_xml_child(xcfg, &quot;settings&quot;))) {
-                for (xparam = switch_xml_child(xsettings, &quot;param&quot;); xparam; xparam = xparam-&gt;next) {
-                        char *var = (char *) switch_xml_attr_soft(xparam, &quot;name&quot;);
-                        char *val = (char *) switch_xml_attr_soft(xparam, &quot;value&quot;);
-
-                        if (!strcmp(var, &quot;debug&quot;)) {
-                                globals.debug = atoi(val);
-                        } else if (!strcmp(var, &quot;codec-prefs&quot;)) {
-                                set_global_codec_string(val);
-                                globals.codec_order_last = switch_separate_string(globals.codec_string, ',', globals.codec_order, SWITCH_MAX_CODECS);
-                        } else if (!strcmp(var, &quot;codec-master&quot;)) {
-                                if (!strcasecmp(val, &quot;us&quot;)) {
-                                        switch_set_flag(&amp;globals, GFLAG_MY_CODEC_PREFS);
-                                }
-                        } else if (!strcmp(var, &quot;codec-rates&quot;)) {
-                                set_global_codec_rates_string(val);
-                                globals.codec_rates_last = switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS);
-                        }
-                } /* param */
-        } /* settings */
-
</del><span class="cx">         if ((xprofiles = switch_xml_child(xcfg, &quot;profiles&quot;))) {
</span><span class="cx">                 for (xprofile = switch_xml_child(xprofiles, &quot;profile&quot;); xprofile; xprofile = xprofile-&gt;next) {
</span><span class="cx">                         char *profile_name = (char *) switch_xml_attr_soft(xprofile, &quot;name&quot;);
</span><span class="lines">@@ -1403,7 +1381,11 @@
</span><span class="cx">                                         } else if (!strcmp(var, &quot;keep-alive&quot;)) {
</span><span class="cx">                                                 profile-&gt;keep_alive = atoi(val);
</span><span class="cx">                                         } else if (!strcmp(var, &quot;date-format&quot;)) {
</span><del>-                                                memcpy(profile-&gt;date_format, val, 6);
</del><ins>+                                                skinny_profile_set(profile, &quot;date-format&quot;, val);
+                                        } else if (!strcmp(var, &quot;odbc-dsn&quot;)) {
+                                                skinny_profile_set(profile, &quot;odbc-dsn&quot;, val);
+                                        } else if (!strcmp(var, &quot;debug&quot;)) {
+                                                profile-&gt;debug = atoi(val);
</ins><span class="cx">                                         }
</span><span class="cx">                                 } /* param */
</span><span class="cx">                                 
</span><span class="lines">@@ -1415,7 +1397,7 @@
</span><span class="cx">                                         skinny_profile_set(profile, &quot;context&quot;,&quot;public&quot;);
</span><span class="cx">                                 }
</span><span class="cx"> 
</span><del>-                                if (!profile-&gt;port) {
</del><ins>+                                if (profile-&gt;port == 0) {
</ins><span class="cx">                                         profile-&gt;port = 2000;
</span><span class="cx">                                 }
</span><span class="cx"> 
</span><span class="lines">@@ -1514,7 +1496,7 @@
</span><span class="cx">                 listener_t *listener = NULL;
</span><span class="cx">                 skinny_profile_find_listener_by_device_name(profile, device_name, &amp;listener);
</span><span class="cx">                 if(listener) {
</span><del>-                        set_lamp(listener, skinny_str2stimulus(stimulus), atoi(instance), skinny_str2lamp_mode(lamp_mode));
</del><ins>+                        set_lamp(listener, skinny_str2button(stimulus), atoi(instance), skinny_str2lamp_mode(lamp_mode));
</ins><span class="cx">                 } else {
</span><span class="cx">                         stream-&gt;write_function(stream, &quot;Listener not found!\n&quot;);
</span><span class="cx">                 }
</span><span class="lines">@@ -1920,9 +1902,6 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        switch_safe_free(globals.codec_string);
-        switch_safe_free(globals.codec_rates_string);
-        
</del><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_skinnymod_skinnyh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.h (16793 => 16794)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.h        2010-02-24 12:06:25 UTC (rev 16793)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.h        2010-02-24 12:06:36 UTC (rev 16794)
</span><span class="lines">@@ -44,15 +44,6 @@
</span><span class="cx"> #define SKINNY_EVENT_ALARM &quot;skinny::alarm&quot;
</span><span class="cx"> 
</span><span class="cx"> struct skinny_globals {
</span><del>-        /* prefs */
-        int debug;
-        char *codec_string;
-        char *codec_order[SWITCH_MAX_CODECS];
-        int codec_order_last;
-        char *codec_rates_string;
-        char *codec_rates[SWITCH_MAX_CODECS];
-        int codec_rates_last;
-        unsigned int flags;
</del><span class="cx">         /* data */
</span><span class="cx">         int calls;
</span><span class="cx">         switch_mutex_t *calls_mutex;
</span><span class="lines">@@ -74,6 +65,7 @@
</span><span class="cx">         char *context;
</span><span class="cx">         uint32_t keep_alive;
</span><span class="cx">         char date_format[6];
</span><ins>+        int debug;
</ins><span class="cx">         /* db */
</span><span class="cx">         char *dbname;
</span><span class="cx">         char *odbc_dsn;
</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 (16793 => 16794)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c        2010-02-24 12:06:25 UTC (rev 16793)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c        2010-02-24 12:06:36 UTC (rev 16794)
</span><span class="lines">@@ -134,7 +134,7 @@
</span><span class="cx"> SKINNY_DECLARE_ID2STR(skinny_ring_mode2str, SKINNY_RING_MODES, &quot;RingModeUnknown&quot;)
</span><span class="cx"> SKINNY_DECLARE_STR2ID(skinny_str2ring_mode, SKINNY_RING_MODES, -1)
</span><span class="cx"> 
</span><del>-struct skinny_table SKINNY_STIMULI[] = {
</del><ins>+struct skinny_table SKINNY_BUTTONS[] = {
</ins><span class="cx">         {&quot;LastNumberRedial&quot;, SKINNY_BUTTON_LAST_NUMBER_REDIAL},
</span><span class="cx">         {&quot;SpeedDial&quot;, SKINNY_BUTTON_SPEED_DIAL},
</span><span class="cx">         {&quot;Line&quot;, SKINNY_BUTTON_LINE},
</span><span class="lines">@@ -142,8 +142,8 @@
</span><span class="cx">         {&quot;Undefined&quot;, SKINNY_BUTTON_UNDEFINED},
</span><span class="cx">         {NULL, 0}
</span><span class="cx"> };
</span><del>-SKINNY_DECLARE_ID2STR(skinny_stimulus2str, SKINNY_STIMULI, &quot;Unknown&quot;)
-SKINNY_DECLARE_STR2ID(skinny_str2stimulus, SKINNY_STIMULI, -1)
</del><ins>+SKINNY_DECLARE_ID2STR(skinny_button2str, SKINNY_BUTTONS, &quot;Unknown&quot;)
+SKINNY_DECLARE_STR2ID(skinny_str2button, SKINNY_BUTTONS, -1)
</ins><span class="cx"> 
</span><span class="cx"> struct skinny_table SKINNY_LAMP_MODES[] = {
</span><span class="cx">         {&quot;Off&quot;, SKINNY_LAMP_OFF},
</span><span class="lines">@@ -656,10 +656,11 @@
</span><span class="cx">         
</span><span class="cx">         if ((sql = switch_mprintf(
</span><span class="cx">                         &quot;SELECT '%d' AS wanted_position, position, label, value, settings &quot;
</span><del>-                                &quot;FROM skinny_buttons WHERE device_name='%s' AND type='line' &quot;
</del><ins>+                                &quot;FROM skinny_buttons WHERE device_name='%s' AND type=%d &quot;
</ins><span class="cx">                                 &quot;ORDER BY position&quot;,
</span><span class="cx">                         instance,
</span><del>-                        listener-&gt;device_name
</del><ins>+                        listener-&gt;device_name,
+                        SKINNY_BUTTON_LINE
</ins><span class="cx">                         ))) {
</span><span class="cx">                 skinny_execute_sql_callback(listener-&gt;profile, listener-&gt;profile-&gt;listener_mutex, sql, skinny_line_get_callback, &amp;helper);
</span><span class="cx">                 switch_safe_free(sql);
</span><span class="lines">@@ -698,10 +699,11 @@
</span><span class="cx">         
</span><span class="cx">         if ((sql = switch_mprintf(
</span><span class="cx">                         &quot;SELECT '%d' AS wanted_position, position, label, value, settings &quot;
</span><del>-                                &quot;FROM skinny_buttons WHERE device_name='%s' AND type='speed-dial' &quot;
</del><ins>+                                &quot;FROM skinny_buttons WHERE device_name='%s' AND type=%d &quot;
</ins><span class="cx">                                 &quot;ORDER BY position&quot;,
</span><span class="cx">                         instance,
</span><del>-                        listener-&gt;device_name
</del><ins>+                        listener-&gt;device_name,
+                        SKINNY_BUTTON_SPEED_DIAL
</ins><span class="cx">                         ))) {
</span><span class="cx">                 skinny_execute_sql_callback(listener-&gt;profile, listener-&gt;profile-&gt;listener_mutex, sql, skinny_speed_dial_get_callback, &amp;helper);
</span><span class="cx">                 switch_safe_free(sql);
</span><span class="lines">@@ -1121,15 +1123,15 @@
</span><span class="cx">                 xbuttons = switch_xml_child(xskinny, &quot;buttons&quot;);
</span><span class="cx">                 if (xbuttons) {
</span><span class="cx">                         for (xbutton = switch_xml_child(xbuttons, &quot;button&quot;); xbutton; xbutton = xbutton-&gt;next) {
</span><del>-                                const char *position = switch_xml_attr_soft(xbutton, &quot;position&quot;);
-                                const char *type = switch_xml_attr_soft(xbutton, &quot;type&quot;);
</del><ins>+                                uint32_t position = atoi(switch_xml_attr_soft(xbutton, &quot;position&quot;));
+                                uint32_t type = skinny_str2button(switch_xml_attr_soft(xbutton, &quot;type&quot;));
</ins><span class="cx">                                 const char *label = switch_xml_attr_soft(xbutton, &quot;label&quot;);
</span><span class="cx">                                 const char *value = switch_xml_attr_soft(xbutton, &quot;value&quot;);
</span><span class="cx">                                 const char *settings = switch_xml_attr_soft(xbutton, &quot;settings&quot;);
</span><span class="cx">                                 if ((sql = switch_mprintf(
</span><span class="cx">                                                 &quot;INSERT INTO skinny_buttons &quot;
</span><span class="cx">                                                         &quot;(device_name, position, type, label, value, settings) &quot;
</span><del>-                                                        &quot;VALUES('%s', '%s', '%s', '%s', '%s', '%s')&quot;,
</del><ins>+                                                        &quot;VALUES('%s', %d, %d, '%s', '%s', '%s')&quot;,
</ins><span class="cx">                                                 request-&gt;data.reg.device_name,
</span><span class="cx">                                                 position,
</span><span class="cx">                                                 type,
</span><span class="lines">@@ -1221,11 +1223,13 @@
</span><span class="cx"> 
</span><span class="cx">         if ((sql = switch_mprintf(
</span><span class="cx">                         &quot;SELECT name, user_id, instance, '' AS user_name, '' AS server_name, &quot;
</span><del>-                                &quot;(SELECT COUNT(*) FROM skinny_buttons WHERE device_name='%s' AND type='line') AS number_lines, &quot;
-                                &quot;(SELECT COUNT(*) FROM skinny_buttons WHERE device_name='%s' AND type='speed-dial') AS number_speed_dials &quot;
</del><ins>+                                &quot;(SELECT COUNT(*) FROM skinny_buttons WHERE device_name='%s' AND type='%s') AS number_lines, &quot;
+                                &quot;(SELECT COUNT(*) FROM skinny_buttons WHERE device_name='%s' AND type='%s') AS number_speed_dials &quot;
</ins><span class="cx">                                 &quot;FROM skinny_devices WHERE name='%s' &quot;,
</span><span class="cx">                         listener-&gt;device_name,
</span><ins>+                        skinny_button2str(SKINNY_BUTTON_LINE),
</ins><span class="cx">                         listener-&gt;device_name,
</span><ins>+                        skinny_button2str(SKINNY_BUTTON_SPEED_DIAL),
</ins><span class="cx">                         listener-&gt;device_name
</span><span class="cx">                         ))) {
</span><span class="cx">                 skinny_execute_sql_callback(profile, profile-&gt;listener_mutex, sql, skinny_config_stat_res_callback, message);
</span><span class="lines">@@ -1321,16 +1325,16 @@
</span><span class="cx"> 
</span><span class="cx"> struct button_template_helper {
</span><span class="cx">         skinny_message_t *message;
</span><del>-        int count[0xff+1];
</del><ins>+        int count[0xffff+1];
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> int skinny_handle_button_template_request_callback(void *pArg, int argc, char **argv, char **columnNames)
</span><span class="cx"> {
</span><span class="cx">         struct button_template_helper *helper = pArg;
</span><span class="cx">         skinny_message_t *message = helper-&gt;message;
</span><del>-        char *device_name = argv[0];
</del><ins>+        /* char *device_name = argv[0]; */
</ins><span class="cx">         int position = atoi(argv[1]);
</span><del>-        char *type = argv[2];
</del><ins>+        uint32_t type = atoi(argv[2]);
</ins><span class="cx">         int i;
</span><span class="cx">         
</span><span class="cx">         /* fill buttons between previous one and current one */
</span><span class="lines">@@ -1341,17 +1345,9 @@
</span><span class="cx">                 message-&gt;data.button_template.total_button_count++;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        message-&gt;data.button_template.btn[i].instance_number = ++helper-&gt;count[type];
+        message-&gt;data.button_template.btn[position-1].button_definition = type;
</ins><span class="cx"> 
</span><del>-        if (!strcasecmp(type, &quot;line&quot;)) {
-                message-&gt;data.button_template.btn[i].instance_number = ++helper-&gt;count[SKINNY_BUTTON_LINE];
-                message-&gt;data.button_template.btn[position-1].button_definition = SKINNY_BUTTON_LINE;
-        } else if (!strcasecmp(type, &quot;speed-dial&quot;)) {
-                message-&gt;data.button_template.btn[i].instance_number = ++helper-&gt;count[SKINNY_BUTTON_SPEED_DIAL];
-                message-&gt;data.button_template.btn[position-1].button_definition = SKINNY_BUTTON_SPEED_DIAL;
-        } else {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
-                        &quot;Unknown button type %s for device %s.\n&quot;, type, device_name);
-        }
</del><span class="cx">         message-&gt;data.button_template.button_count++;
</span><span class="cx">         message-&gt;data.button_template.total_button_count++;
</span><span class="cx"> 
</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 (16793 => 16794)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.h        2010-02-24 12:06:25 UTC (rev 16793)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.h        2010-02-24 12:06:36 UTC (rev 16794)
</span><span class="lines">@@ -664,10 +664,10 @@
</span><span class="cx">         SKINNY_BUTTON_VOICEMAIL = 0x0F,
</span><span class="cx">         SKINNY_BUTTON_UNDEFINED = 0xFF,
</span><span class="cx"> };
</span><del>-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)
</del><ins>+struct skinny_table SKINNY_BUTTONS[6];
+const char *skinny_button2str(uint32_t id);
+uint32_t skinny_str2button(const char *str);
+#define SKINNY_PUSH_STIMULI SKINNY_DECLARE_PUSH_MATCH(SKINNY_BUTTONS)
</ins><span class="cx"> 
</span><span class="cx"> enum skinny_soft_key_event {
</span><span class="cx">         SOFTKEY_REDIAL = 0x01,
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>