]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Skinny: reindent using vim's =G
authorMathieu Parent <math.parent@gmail.com>
Thu, 12 May 2011 22:32:57 +0000 (00:32 +0200)
committerMathieu Parent <math.parent@gmail.com>
Thu, 26 May 2011 19:43:53 +0000 (21:43 +0200)
src/mod/endpoints/mod_skinny/mod_skinny.c
src/mod/endpoints/mod_skinny/mod_skinny.h
src/mod/endpoints/mod_skinny/skinny_api.c
src/mod/endpoints/mod_skinny/skinny_protocol.c
src/mod/endpoints/mod_skinny/skinny_protocol.h
src/mod/endpoints/mod_skinny/skinny_server.c
src/mod/endpoints/mod_skinny/skinny_tables.c
src/mod/endpoints/mod_skinny/skinny_tables.h

index d9e2b822c03d580669e91fa62a360dacc869e760..3b07472e7ed08313c083429770d5c3f365e30510 100644 (file)
@@ -50,58 +50,58 @@ skinny_globals_t globals;
 /* SQL TABLES */
 /*****************************************************************************/
 static char devices_sql[] =
-       "CREATE TABLE skinny_devices (\n"
-       "   name             VARCHAR(16),\n"
-       "   user_id          INTEGER,\n"
-       "   instance         INTEGER,\n"
-       "   ip               VARCHAR(15),\n"
-       "   type             INTEGER,\n"
-       "   max_streams      INTEGER,\n"
-       "   port             INTEGER,\n"
-       "   codec_string     VARCHAR(255),\n"
-       "   headset          INTEGER,\n"
-       "   handset          INTEGER,\n"
-       "   speaker          INTEGER\n"
-       ");\n";
+"CREATE TABLE skinny_devices (\n"
+"   name             VARCHAR(16),\n"
+"   user_id          INTEGER,\n"
+"   instance         INTEGER,\n"
+"   ip               VARCHAR(15),\n"
+"   type             INTEGER,\n"
+"   max_streams      INTEGER,\n"
+"   port             INTEGER,\n"
+"   codec_string     VARCHAR(255),\n"
+"   headset          INTEGER,\n"
+"   handset          INTEGER,\n"
+"   speaker          INTEGER\n"
+");\n";
 
 static char lines_sql[] =
-       "CREATE TABLE skinny_lines (\n"
-       "   device_name          VARCHAR(16),\n"
-       "   device_instance      INTEGER,\n"
-       "   position             INTEGER,\n"
-       "   line_instance        INTEGER,\n"
-       "   label                VARCHAR(40),\n"
-       "   value                VARCHAR(24),\n"
-       "   caller_name          VARCHAR(44),\n"
-       "   ring_on_idle         INTEGER,\n"
-       "   ring_on_active       INTEGER,\n"
-       "   busy_trigger         INTEGER,\n"
-       "   forward_all          VARCHAR(255),\n"
-       "   forward_busy         VARCHAR(255),\n"
-       "   forward_noanswer     VARCHAR(255),\n"
-       "   noanswer_duration    INTEGER\n"
-       ");\n";
+"CREATE TABLE skinny_lines (\n"
+"   device_name          VARCHAR(16),\n"
+"   device_instance      INTEGER,\n"
+"   position             INTEGER,\n"
+"   line_instance        INTEGER,\n"
+"   label                VARCHAR(40),\n"
+"   value                VARCHAR(24),\n"
+"   caller_name          VARCHAR(44),\n"
+"   ring_on_idle         INTEGER,\n"
+"   ring_on_active       INTEGER,\n"
+"   busy_trigger         INTEGER,\n"
+"   forward_all          VARCHAR(255),\n"
+"   forward_busy         VARCHAR(255),\n"
+"   forward_noanswer     VARCHAR(255),\n"
+"   noanswer_duration    INTEGER\n"
+");\n";
 
 static char buttons_sql[] =
-       "CREATE TABLE skinny_buttons (\n"
-       "   device_name      VARCHAR(16),\n"
-       "   device_instance  INTEGER,\n"
-       "   position         INTEGER,\n"
-       "   type             INTEGER,\n"
-       "   label            VARCHAR(40),\n"
-       "   value            VARCHAR(255),\n"
-       "   settings         VARCHAR(44)\n"
-       ");\n";
+"CREATE TABLE skinny_buttons (\n"
+"   device_name      VARCHAR(16),\n"
+"   device_instance  INTEGER,\n"
+"   position         INTEGER,\n"
+"   type             INTEGER,\n"
+"   label            VARCHAR(40),\n"
+"   value            VARCHAR(255),\n"
+"   settings         VARCHAR(44)\n"
+");\n";
 
 static char active_lines_sql[] =
-       "CREATE TABLE skinny_active_lines (\n"
-       "   device_name      VARCHAR(16),\n"
-       "   device_instance  INTEGER,\n"
-       "   line_instance    INTEGER,\n"
-       "   channel_uuid     VARCHAR(256),\n"
-       "   call_id          INTEGER,\n"
-       "   call_state       INTEGER\n"
-       ");\n";
+"CREATE TABLE skinny_active_lines (\n"
+"   device_name      VARCHAR(16),\n"
+"   device_instance  INTEGER,\n"
+"   line_instance    INTEGER,\n"
+"   channel_uuid     VARCHAR(256),\n"
+"   call_id          INTEGER,\n"
+"   call_state       INTEGER\n"
+");\n";
 
 /*****************************************************************************/
 /* PROFILES FUNCTIONS */
@@ -238,7 +238,7 @@ char * skinny_profile_find_session_uuid(skinny_profile_t *profile, listener_t *l
 
        if(listener) {
                device_condition = switch_mprintf("device_name='%s' AND device_instance=%d",
-                       listener->device_name, listener->device_instance);
+                               listener->device_name, listener->device_instance);
        } else {
                device_condition = switch_mprintf("1=1");
        }
@@ -256,14 +256,14 @@ char * skinny_profile_find_session_uuid(skinny_profile_t *profile, listener_t *l
        }
        switch_assert(call_id_condition);
        if((sql = switch_mprintf(
-                       "SELECT channel_uuid, line_instance "
-                               "FROM skinny_active_lines "
-                               "WHERE %s AND %s AND %s "
-                               "ORDER BY call_state, channel_uuid", /* off hook first */
-                       device_condition, line_instance_condition, call_id_condition
-                       ))) {
+                                       "SELECT channel_uuid, line_instance "
+                                       "FROM skinny_active_lines "
+                                       "WHERE %s AND %s AND %s "
+                                       "ORDER BY call_state, channel_uuid", /* off hook first */
+                                       device_condition, line_instance_condition, call_id_condition
+                               ))) {
                skinny_execute_sql_callback(profile, profile->sql_mutex, sql,
-                       skinny_profile_find_session_uuid_callback, &helper);
+                               skinny_profile_find_session_uuid_callback, &helper);
                switch_safe_free(sql);
        }
        switch_safe_free(device_condition);
@@ -291,8 +291,8 @@ switch_core_session_t * skinny_profile_find_session(skinny_profile_t *profile, l
 #endif
                if(!result) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
-                               "Unable to find session %s on %s:%d, line %d\n",
-                               uuid, listener->device_name, listener->device_instance, *line_instance_p);
+                                       "Unable to find session %s on %s:%d, line %d\n",
+                                       uuid, listener->device_name, listener->device_instance, *line_instance_p);
                }
                switch_safe_free(uuid);
        }
@@ -340,7 +340,7 @@ switch_status_t skinny_execute_sql(skinny_profile_t *profile, char *sql, switch_
 
        status = switch_cache_db_execute_sql(dbh, sql, NULL);
 
-  end:
+end:
 
        switch_cache_db_release_db_handle(&dbh);
 
@@ -352,7 +352,7 @@ switch_status_t skinny_execute_sql(skinny_profile_t *profile, char *sql, switch_
 }
 
 switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback,
-                                                                                        void *pdata)
+               void *pdata)
 {
        switch_bool_t ret = SWITCH_FALSE;
        char *errmsg = NULL;
@@ -374,7 +374,7 @@ switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile, switch_mute
                free(errmsg);
        }
 
-  end:
+end:
 
        switch_cache_db_release_db_handle(&dbh);
 
@@ -400,9 +400,9 @@ void skinny_line_perform_set_state(const char *file, const char *func, int line,
        switch_event_fire(&event);
        send_call_state(listener, call_state, line_instance, call_id);
        switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG,
-               "Device %s:%d, Line %d, Call %d Change State to %s (%d)\n",
-               listener->device_name, listener->device_instance, line_instance, call_id,
-               skinny_call_state2str(call_state), call_state); 
+                       "Device %s:%d, Line %d, Call %d Change State to %s (%d)\n",
+                       listener->device_name, listener->device_instance, line_instance, call_id,
+                       skinny_call_state2str(call_state), call_state); 
 }
 
 
@@ -443,13 +443,13 @@ uint32_t skinny_line_get_state(listener_t *listener, uint32_t line_instance, uin
 
        helper.call_state = -1;
        if ((sql = switch_mprintf(
-                       "SELECT call_state FROM skinny_active_lines "
-                       "WHERE device_name='%s' AND device_instance=%d "
-                       "AND %s AND %s "
-                       "ORDER BY call_state, channel_uuid", /* off hook first */
-                       listener->device_name, listener->device_instance,
-                       line_instance_condition, call_id_condition
-                       ))) {
+                                       "SELECT call_state FROM skinny_active_lines "
+                                       "WHERE device_name='%s' AND device_instance=%d "
+                                       "AND %s AND %s "
+                                       "ORDER BY call_state, channel_uuid", /* off hook first */
+                                       listener->device_name, listener->device_instance,
+                                       line_instance_condition, call_id_condition
+                                ))) {
                skinny_execute_sql_callback(listener->profile, listener->profile->sql_mutex, sql, skinny_line_get_state_callback, &helper);
                switch_safe_free(sql);
        }
@@ -475,13 +475,13 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
                        switch_goto_status(SWITCH_STATUS_SUCCESS, end);
                }
                if (strcasecmp(tech_pvt->read_impl.iananame, tech_pvt->iananame) ||
-                       tech_pvt->read_impl.samples_per_second != tech_pvt->rm_rate ||
-                       tech_pvt->codec_ms != (uint32_t)tech_pvt->read_impl.microseconds_per_packet / 1000) {
-       
+                               tech_pvt->read_impl.samples_per_second != tech_pvt->rm_rate ||
+                               tech_pvt->codec_ms != (uint32_t)tech_pvt->read_impl.microseconds_per_packet / 1000) {
+
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Changing Codec from %s@%dms to %s@%dms\n",
-                                                         tech_pvt->read_impl.iananame, tech_pvt->read_impl.microseconds_per_packet / 1000, 
-                                                         tech_pvt->rm_encoding, tech_pvt->codec_ms);
-       
+                                       tech_pvt->read_impl.iananame, tech_pvt->read_impl.microseconds_per_packet / 1000, 
+                                       tech_pvt->rm_encoding, tech_pvt->codec_ms);
+
                        switch_core_session_lock_codec_write(tech_pvt->session);
                        switch_core_session_lock_codec_read(tech_pvt->session);
                        resetting = 1;
@@ -494,25 +494,25 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
        }
 
        if (switch_core_codec_init(&tech_pvt->read_codec,
-                                                          tech_pvt->iananame,
-                                                          tech_pvt->rm_fmtp,
-                                                          tech_pvt->rm_rate,
-                                                          tech_pvt->codec_ms,
-                                                          1,
-                                                          SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | 0 /* TODO tech_pvt->profile->codec_flags */,
-                                                          NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
+                               tech_pvt->iananame,
+                               tech_pvt->rm_fmtp,
+                               tech_pvt->rm_rate,
+                               tech_pvt->codec_ms,
+                               1,
+                               SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | 0 /* TODO tech_pvt->profile->codec_flags */,
+                               NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n");
                switch_goto_status(SWITCH_STATUS_FALSE, end);
        }
 
        if (switch_core_codec_init(&tech_pvt->write_codec,
-                                                          tech_pvt->iananame,
-                                                          tech_pvt->rm_fmtp,
-                                                          tech_pvt->rm_rate,
-                                                          tech_pvt->codec_ms,
-                                                          1,
-                                                          SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | 0 /* TODO tech_pvt->profile->codec_flags */,
-                                                          NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
+                               tech_pvt->iananame,
+                               tech_pvt->rm_fmtp,
+                               tech_pvt->rm_rate,
+                               tech_pvt->codec_ms,
+                               1,
+                               SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | 0 /* TODO tech_pvt->profile->codec_flags */,
+                               NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n");
                switch_goto_status(SWITCH_STATUS_FALSE, end);
        }
@@ -530,9 +530,9 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
                switch_assert(tech_pvt->read_codec.implementation);
 
                if (switch_rtp_change_interval(tech_pvt->rtp_session, 
-                                                                          tech_pvt->read_impl.microseconds_per_packet,
-                                                                          tech_pvt->read_impl.samples_per_packet
-                                                                          ) != SWITCH_STATUS_SUCCESS) {
+                                       tech_pvt->read_impl.microseconds_per_packet,
+                                       tech_pvt->read_impl.samples_per_packet
+                                       ) != SWITCH_STATUS_SUCCESS) {
                        switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session);
 
                        switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -549,8 +549,8 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
        }
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Codec %s %s/%ld %d ms %d samples\n",
-                                         "" /* TODO switch_channel_get_name(tech_pvt->channel)*/, tech_pvt->iananame, tech_pvt->rm_rate, tech_pvt->codec_ms,
-                                         tech_pvt->read_impl.samples_per_packet);
+                       "" /* TODO switch_channel_get_name(tech_pvt->channel)*/, tech_pvt->iananame, tech_pvt->rm_rate, tech_pvt->codec_ms,
+                       tech_pvt->read_impl.samples_per_packet);
        tech_pvt->read_frame.codec = &tech_pvt->read_codec;
 
        tech_pvt->write_codec.agreed_pt = tech_pvt->agreed_pt;
@@ -562,16 +562,16 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
        }
 
        /* TODO
-       tech_pvt->fmtp_out = switch_core_session_strdup(tech_pvt->session, tech_pvt->write_codec.fmtp_out);
-       */
+          tech_pvt->fmtp_out = switch_core_session_strdup(tech_pvt->session, tech_pvt->write_codec.fmtp_out);
+        */
 
        /* TODO
-       if (switch_rtp_ready(tech_pvt->rtp_session)) {
-               switch_rtp_set_default_payload(tech_pvt->rtp_session, tech_pvt->pt);
-       }
-       */
+          if (switch_rtp_ready(tech_pvt->rtp_session)) {
+          switch_rtp_set_default_payload(tech_pvt->rtp_session, tech_pvt->pt);
+          }
+        */
 
- end:
+end:
        if (resetting) {
                switch_core_session_unlock_codec_write(tech_pvt->session);
                switch_core_session_unlock_codec_read(tech_pvt->session);
@@ -600,7 +600,7 @@ void tech_init(private_t *tech_pvt, skinny_profile_t *profile, switch_core_sessi
    State methods they get called when the state changes to the specific state 
    returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
    so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
-*/
+ */
 switch_status_t channel_on_init(switch_core_session_t *session)
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -641,23 +641,23 @@ int channel_on_routing_callback(void *pArg, int argc, char **argv, char **column
 
        skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, device_name, device_instance, &listener);
        if(listener) {
-           if(!strcmp(device_name, helper->listener->device_name) 
-                   && (device_instance == helper->listener->device_instance)
-                   && (line_instance == helper->line_instance)) {/* the calling line */
+               if(!strcmp(device_name, helper->listener->device_name) 
+                               && (device_instance == helper->listener->device_instance)
+                               && (line_instance == helper->line_instance)) {/* the calling line */
                        helper->tech_pvt->caller_profile->dialplan = switch_core_strdup(helper->tech_pvt->caller_profile->pool, listener->profile->dialplan);
                        helper->tech_pvt->caller_profile->context = switch_core_strdup(helper->tech_pvt->caller_profile->pool, listener->profile->context);
                        send_dialed_number(listener, helper->tech_pvt->caller_profile->destination_number, line_instance, helper->tech_pvt->call_id);
                        skinny_line_set_state(listener, line_instance, helper->tech_pvt->call_id, SKINNY_PROCEED);
                        skinny_session_send_call_info(helper->tech_pvt->session, listener, line_instance);
                        skinny_session_ring_out(helper->tech_pvt->session, listener, line_instance);
-           } else {
+               } else {
                        send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_ON);
                        skinny_line_set_state(listener, line_instance, helper->tech_pvt->call_id, SKINNY_IN_USE_REMOTELY);
                        send_select_soft_keys(listener, line_instance, helper->tech_pvt->call_id, SKINNY_KEY_SET_IN_USE_HINT, 0xffff);
                        send_display_prompt_status(listener, 0, SKINNY_DISP_IN_USE_REMOTE,
-                               line_instance, helper->tech_pvt->call_id);
+                                       line_instance, helper->tech_pvt->call_id);
                        skinny_session_send_call_info(helper->tech_pvt->session, listener, line_instance);
-           }
+               }
        }
        return 0;
 }
@@ -680,8 +680,8 @@ switch_status_t channel_on_routing(switch_core_session_t *session)
                switch(action) {
                        case SKINNY_ACTION_PROCESS:
                                skinny_profile_find_listener_by_device_name_and_instance(tech_pvt->profile,
-                                       switch_channel_get_variable(channel, "skinny_device_name"),
-                                       atoi(switch_channel_get_variable(channel, "skinny_device_instance")), &listener);
+                                               switch_channel_get_variable(channel, "skinny_device_name"),
+                                               atoi(switch_channel_get_variable(channel, "skinny_device_instance")), &listener);
                                if (listener) {
                                        helper.tech_pvt = tech_pvt;
                                        helper.listener = listener;
@@ -689,8 +689,8 @@ switch_status_t channel_on_routing(switch_core_session_t *session)
                                        skinny_session_walk_lines(tech_pvt->profile, switch_core_session_get_uuid(session), channel_on_routing_callback, &helper);
                                } else {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Could not find listener %s:%s for Channel %s\n",
-                                               switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"),
-                                               switch_channel_get_name(channel));
+                                                       switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"),
+                                                       switch_channel_get_name(channel));
                                }
                                /* Future bridge should go straight */
                                switch_set_flag_locked(tech_pvt, TFLAG_FORCE_ROUTE);
@@ -777,16 +777,16 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN
                send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_OFF);
                switch (helper->cause) {
                        case SWITCH_CAUSE_UNALLOCATED_NUMBER:
-                           send_start_tone(listener, SKINNY_TONE_REORDER, 0, line_instance, call_id);
+                               send_start_tone(listener, SKINNY_TONE_REORDER, 0, line_instance, call_id);
                                skinny_session_send_call_info(helper->tech_pvt->session, listener, line_instance);
                                send_display_prompt_status(listener, 0, SKINNY_DISP_UNKNOWN_NUMBER, line_instance, call_id);
                                break;
                        case SWITCH_CAUSE_USER_BUSY:
-                           send_start_tone(listener, SKINNY_TONE_BUSYTONE, 0, line_instance, call_id);
+                               send_start_tone(listener, SKINNY_TONE_BUSYTONE, 0, line_instance, call_id);
                                send_display_prompt_status(listener, 0, SKINNY_DISP_BUSY, line_instance, call_id);
-                                       break;
+                               break;
                        case SWITCH_CAUSE_NORMAL_CLEARING:
-                               send_clear_prompt_status(listener, line_instance, call_id);
+                               send_clear_prompt_status(listener, line_instance, call_id);
                                break;
                        default:
                                send_display_prompt_status(listener, 0, switch_channel_cause2str(helper->cause), line_instance, call_id);
@@ -821,9 +821,9 @@ switch_status_t channel_on_hangup(switch_core_session_t *session)
 
        skinny_session_walk_lines(tech_pvt->profile, switch_core_session_get_uuid(session), channel_on_hangup_callback, &helper);
        if ((sql = switch_mprintf(
-                       "DELETE FROM skinny_active_lines WHERE channel_uuid='%s'",
-                       switch_core_session_get_uuid(session)
-                       ))) {
+                                       "DELETE FROM skinny_active_lines WHERE channel_uuid='%s'",
+                                       switch_core_session_get_uuid(session)
+                                ))) {
                skinny_execute_sql(tech_pvt->profile, sql, tech_pvt->profile->sql_mutex);
                switch_safe_free(sql);
        }
@@ -836,16 +836,16 @@ switch_status_t channel_kill_channel(switch_core_session_t *session, int sig)
        private_t *tech_pvt = switch_core_session_get_private(session);
 
        switch (sig) {
-       case SWITCH_SIG_KILL:
-               switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
-               break;
-       case SWITCH_SIG_BREAK:
-               if (switch_rtp_ready(tech_pvt->rtp_session)) {
-                       switch_rtp_break(tech_pvt->rtp_session);
-               }
-               break;
-       default:
-               break;
+               case SWITCH_SIG_KILL:
+                       switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+                       break;
+               case SWITCH_SIG_BREAK:
+                       if (switch_rtp_ready(tech_pvt->rtp_session)) {
+                               switch_rtp_break(tech_pvt->rtp_session);
+                       }
+                       break;
+               default:
+                       break;
        }
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL KILL %d\n", switch_channel_get_name(channel), sig);
@@ -968,8 +968,8 @@ switch_status_t channel_answer_channel(switch_core_session_t *session)
        listener_t *listener = NULL;
 
        skinny_profile_find_listener_by_device_name_and_instance(tech_pvt->profile,
-               switch_channel_get_variable(channel, "skinny_device_name"),
-               atoi(switch_channel_get_variable(channel, "skinny_device_instance")), &listener);
+                       switch_channel_get_variable(channel, "skinny_device_name"),
+                       atoi(switch_channel_get_variable(channel, "skinny_device_instance")), &listener);
        if (listener) {
                int x = 0;
                skinny_session_start_media(session, listener, atoi(switch_channel_get_variable(channel, "skinny_line_instance")));
@@ -978,13 +978,13 @@ switch_status_t channel_answer_channel(switch_core_session_t *session)
                        switch_cond_next();
                        if (++x > 1000) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Wait tooo long to answer %s:%s\n",
-                                       switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"));
+                                               switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"));
                                return SWITCH_STATUS_FALSE;
                        }
                }
        } else {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unable to find listener to answer %s:%s\n",
-                       switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"));
+                               switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"));
        }
        return SWITCH_STATUS_SUCCESS;
 }
@@ -995,24 +995,24 @@ switch_status_t channel_receive_message(switch_core_session_t *session, switch_c
        private_t *tech_pvt = switch_core_session_get_private(session);
 
        switch (msg->message_id) {
-       case SWITCH_MESSAGE_INDICATE_ANSWER:
-               switch_clear_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
-               return channel_answer_channel(session);
-
-       case SWITCH_MESSAGE_INDICATE_DISPLAY:
-               skinny_session_send_call_info_all(session);
-               return SWITCH_STATUS_SUCCESS;
-
-       case SWITCH_MESSAGE_INDICATE_PROGRESS:
-               if (!switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
-                       /* early media */
-                       switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
+               case SWITCH_MESSAGE_INDICATE_ANSWER:
+                       switch_clear_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
                        return channel_answer_channel(session);
-               }
-               return SWITCH_STATUS_SUCCESS;
 
-       default:
-               return SWITCH_STATUS_SUCCESS;
+               case SWITCH_MESSAGE_INDICATE_DISPLAY:
+                       skinny_session_send_call_info_all(session);
+                       return SWITCH_STATUS_SUCCESS;
+
+               case SWITCH_MESSAGE_INDICATE_PROGRESS:
+                       if (!switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
+                               /* early media */
+                               switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
+                               return channel_answer_channel(session);
+                       }
+                       return SWITCH_STATUS_SUCCESS;
+
+               default:
+                       return SWITCH_STATUS_SUCCESS;
 
        }
 
@@ -1020,10 +1020,10 @@ switch_status_t channel_receive_message(switch_core_session_t *session, switch_c
 
 /* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
    that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
-*/
+ */
 switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
-                                                                                                       switch_caller_profile_t *outbound_profile,
-                                                                                                       switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
+               switch_caller_profile_t *outbound_profile,
+               switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
 {
        switch_call_cause_t cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
        switch_core_session_t *nsession = NULL;
@@ -1082,13 +1082,13 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi
        tech_pvt->caller_profile = caller_profile;
 
        if ((sql = switch_mprintf(
-                       "INSERT INTO skinny_active_lines "
-                               "(device_name, device_instance, line_instance, channel_uuid, call_id, call_state) "
-                               "SELECT device_name, device_instance, line_instance, '%s', %d, %d "
-                               "FROM skinny_lines "
-                               "WHERE value='%s'",
-                       switch_core_session_get_uuid(nsession), tech_pvt->call_id, SKINNY_ON_HOOK, dest
-                       ))) {
+                                       "INSERT INTO skinny_active_lines "
+                                       "(device_name, device_instance, line_instance, channel_uuid, call_id, call_state) "
+                                       "SELECT device_name, device_instance, line_instance, '%s', %d, %d "
+                                       "FROM skinny_lines "
+                                       "WHERE value='%s'",
+                                       switch_core_session_get_uuid(nsession), tech_pvt->call_id, SKINNY_ON_HOOK, dest
+                                ))) {
                skinny_execute_sql(profile, sql, profile->sql_mutex);
                switch_safe_free(sql);
        }
@@ -1098,7 +1098,7 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi
                switch_channel_set_variable(switch_core_session_get_channel(session), SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(nsession));
                switch_channel_set_variable(nchannel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(session));
        }
-       
+
        cause = skinny_ring_lines(tech_pvt, session);
 
        if(cause != SWITCH_CAUSE_SUCCESS) {
@@ -1116,7 +1116,7 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi
        cause = SWITCH_CAUSE_SUCCESS;
        goto done;
 
-  error:
+error:
        if (nsession) {
                switch_core_session_destroy(&nsession);
        }
@@ -1126,7 +1126,7 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi
        }
 
 
-  done:
+done:
 
        if (profile) {
                if (cause == SWITCH_CAUSE_SUCCESS) {
@@ -1267,37 +1267,37 @@ static void flush_listener(listener_t *listener)
                char *sql;
 
                if ((sql = switch_mprintf(
-                               "SELECT '%q', value, '%q', '%q', '%d' "
-                                       "FROM skinny_lines "
-                                       "WHERE device_name='%s' AND device_instance=%d "
-                                       "ORDER BY position",
-                               profile->name, profile->domain, listener->device_name, listener->device_instance,
-                               listener->device_name, listener->device_instance
-                               ))) {
+                                               "SELECT '%q', value, '%q', '%q', '%d' "
+                                               "FROM skinny_lines "
+                                               "WHERE device_name='%s' AND device_instance=%d "
+                                               "ORDER BY position",
+                                               profile->name, profile->domain, listener->device_name, listener->device_instance,
+                                               listener->device_name, listener->device_instance
+                                        ))) {
                        skinny_execute_sql_callback(profile, profile->sql_mutex, sql, flush_listener_callback, NULL);
                        switch_safe_free(sql);
                }
 
                if ((sql = switch_mprintf(
-                               "DELETE FROM skinny_devices "
-                                       "WHERE name='%s' and instance=%d",
-                               listener->device_name, listener->device_instance))) {
+                                               "DELETE FROM skinny_devices "
+                                               "WHERE name='%s' and instance=%d",
+                                               listener->device_name, listener->device_instance))) {
                        skinny_execute_sql(profile, sql, profile->sql_mutex);
                        switch_safe_free(sql);
                }
 
                if ((sql = switch_mprintf(
-                               "DELETE FROM skinny_lines "
-                                       "WHERE device_name='%s' and device_instance=%d",
-                               listener->device_name, listener->device_instance))) {
+                                               "DELETE FROM skinny_lines "
+                                               "WHERE device_name='%s' and device_instance=%d",
+                                               listener->device_name, listener->device_instance))) {
                        skinny_execute_sql(profile, sql, profile->sql_mutex);
                        switch_safe_free(sql);
                }
 
                if ((sql = switch_mprintf(
-                               "DELETE FROM skinny_buttons "
-                                       "WHERE device_name='%s' and device_instance=%d",
-                               listener->device_name, listener->device_instance))) {
+                                               "DELETE FROM skinny_buttons "
+                                               "WHERE device_name='%s' and device_instance=%d",
+                                               listener->device_name, listener->device_instance))) {
                        skinny_execute_sql(profile, sql, profile->sql_mutex);
                        switch_safe_free(sql);
                }
@@ -1348,8 +1348,8 @@ switch_status_t dump_device(skinny_profile_t *profile, const char *device_name,
 {
        char *sql;
        if ((sql = switch_mprintf("SELECT name, user_id, instance, ip, type, max_streams, port, codec_string, headset, handset, speaker "
-                       "FROM skinny_devices WHERE name='%s'",
-                       device_name))) {
+                                       "FROM skinny_devices WHERE name='%s'",
+                                       device_name))) {
                skinny_execute_sql_callback(profile, profile->sql_mutex, sql, dump_device_callback, stream);
                switch_safe_free(sql);
        }
@@ -1372,7 +1372,7 @@ static void close_socket(switch_socket_t **sock, skinny_profile_t *profile)
 static switch_status_t kill_listener(listener_t *listener, void *pvt)
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Killing listener %s:%d.\n",
-               listener->device_name, listener->device_instance);
+                       listener->device_name, listener->device_instance);
        switch_clear_flag(listener, LFLAG_RUNNING);
        close_socket(&listener->sock, listener->profile);
        return SWITCH_STATUS_SUCCESS;
@@ -1435,7 +1435,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
                        switch(status) {
                                case SWITCH_STATUS_TIMEOUT:
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Communication Time Out with %s:%d.\n",
-                                               listener->remote_ip, listener->remote_port);
+                                                       listener->remote_ip, listener->remote_port);
 
                                        if(listener->expire_time < switch_epoch_time_now(NULL)) {
                                                switch_event_t *event = NULL;
@@ -1446,7 +1446,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
                                        break;
                                default: 
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Communication Error with %s:%d.\n",
-                                               listener->remote_ip, listener->remote_port);
+                                                       listener->remote_ip, listener->remote_port);
                        }
                        switch_clear_flag_locked(listener, LFLAG_RUNNING);
                        break;
@@ -1470,7 +1470,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
 
        if (listener->profile->debug > 0) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Communication Complete with %s:%d.\n",
-                       listener->remote_ip, listener->remote_port);
+                               listener->remote_ip, listener->remote_port);
        }
 
        switch_thread_rwlock_wrlock(listener->rwlock);
@@ -1484,7 +1484,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
 
        if (listener->profile->debug > 0) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Communication Closed with %s:%d.\n",
-                       listener->remote_ip, listener->remote_port);
+                               listener->remote_ip, listener->remote_port);
        }
 
        if(destroy_pool == 0) {
@@ -1559,7 +1559,7 @@ new_socket:
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Socket up listening on %s:%u\n", profile->ip, profile->port);
 
                break;
-         sock_fail:
+sock_fail:
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error! Could not listen on %s:%u\n", profile->ip, profile->port);
                switch_yield(100000);
        }
@@ -1622,7 +1622,7 @@ new_socket:
 
        }
 
- end:
+end:
 
        close_socket(&profile->sock, profile);
 
@@ -1635,7 +1635,7 @@ new_socket:
        }
 
 
-  fail:
+fail:
        return NULL;
 }
 
@@ -1677,7 +1677,7 @@ switch_status_t skinny_profile_set(skinny_profile_t *profile, const char *var, c
 
        if (profile->sock && !strcasecmp(var, "odbc-dsn")) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-                       "Skinny profile setting 'odbc-dsn' can't be changed while running\n");
+                               "Skinny profile setting 'odbc-dsn' can't be changed while running\n");
                return SWITCH_STATUS_FALSE;
        }
 
@@ -1758,7 +1758,7 @@ static switch_status_t load_skinny_config(void)
                        switch_xml_t xsettings, xdevice_types, xsoft_key_set_sets;
                        if (zstr(profile_name)) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-                                       "<profile> is missing name attribute\n");
+                                               "<profile> is missing name attribute\n");
                                continue;
                        }
                        if ((xsettings = switch_xml_child(xprofile, "settings"))) {
@@ -1767,11 +1767,11 @@ static switch_status_t load_skinny_config(void)
                                switch_core_db_t *db;
                                skinny_profile_t *profile = NULL;
                                switch_xml_t param;
-               
-                           if (switch_core_new_memory_pool(&profile_pool) != SWITCH_STATUS_SUCCESS) {
-                                   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
-                                   return SWITCH_STATUS_TERM;
-                           }
+
+                               if (switch_core_new_memory_pool(&profile_pool) != SWITCH_STATUS_SUCCESS) {
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
+                                       return SWITCH_STATUS_TERM;
+                               }
                                profile = switch_core_alloc(profile_pool, sizeof(skinny_profile_t));
                                profile->pool = profile_pool;
                                profile->name = switch_core_strdup(profile->pool, profile_name);
@@ -1780,17 +1780,17 @@ static switch_status_t load_skinny_config(void)
                                switch_mutex_init(&profile->listener_mutex, SWITCH_MUTEX_NESTED, profile->pool);
                                switch_mutex_init(&profile->sock_mutex, SWITCH_MUTEX_NESTED, profile->pool);
                                switch_mutex_init(&profile->flag_mutex, SWITCH_MUTEX_NESTED, profile->pool);
-               
+
                                for (param = switch_xml_child(xsettings, "param"); param; param = param->next) {
                                        char *var = (char *) switch_xml_attr_soft(param, "name");
                                        char *val = (char *) switch_xml_attr_soft(param, "value");
 
                                        if (skinny_profile_set(profile, var, val) != SWITCH_STATUS_SUCCESS) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                                                       "Unable to set skinny setting '%s'. Does it exists?\n", var);
+                                                               "Unable to set skinny setting '%s'. Does it exists?\n", var);
                                        }
                                } /* param */
-               
+
                                if (!profile->dialplan) {
                                        skinny_profile_set(profile, "dialplan","XML");
                                }
@@ -1838,8 +1838,8 @@ static switch_status_t load_skinny_config(void)
                                                                        }
                                                                        if (soft_key_set_id > 15) {
                                                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                                                                                       "soft-key-set name '%s' is greater than 15 in soft-key-set-set '%s' in profile %s.\n",
-                                                                                       switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name);
+                                                                                               "soft-key-set name '%s' is greater than 15 in soft-key-set-set '%s' in profile %s.\n",
+                                                                                               switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name);
                                                                                continue;
                                                                        }
                                                                        for (string_pos = 0; string_pos <= string_len; string_pos++) {
@@ -1847,8 +1847,8 @@ static switch_status_t load_skinny_config(void)
                                                                                        val[string_pos] = '\0';
                                                                                        if (field_no > 15) {
                                                                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                                                                                                       "soft-key-set name '%s' is limited to 16 buttons in soft-key-set-set '%s' in profile %s.\n",
-                                                                                                       switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name);
+                                                                                                               "soft-key-set name '%s' is limited to 16 buttons in soft-key-set-set '%s' in profile %s.\n",
+                                                                                                               switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name);
                                                                                                break;
                                                                                        }
                                                                                        message->data.soft_key_set.soft_key_set[soft_key_set_id].soft_key_template_index[field_no++] = skinny_str2soft_key_event(&val[start]);
@@ -1857,28 +1857,28 @@ static switch_status_t load_skinny_config(void)
                                                                        }
                                                                } else {
                                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                                                                               "Unknown soft-key-set name '%s' in soft-key-set-set '%s' in profile %s.\n",
-                                                                               switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name);
+                                                                                       "Unknown soft-key-set name '%s' in soft-key-set-set '%s' in profile %s.\n",
+                                                                                       switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name);
                                                                }
                                                        } /* soft-key-set */
-                                                   switch_core_hash_insert(profile->soft_key_set_sets_hash, soft_key_set_set_name, message);
+                                                       switch_core_hash_insert(profile->soft_key_set_sets_hash, soft_key_set_set_name, message);
                                                } else {
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                                                               "<soft-key-set-set> is missing a name attribute in profile %s.\n", profile->name);
+                                                                       "<soft-key-set-set> is missing a name attribute in profile %s.\n", profile->name);
                                                }
                                        } /* soft-key-set-set */
                                } else {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                                               "<soft-key-set-sets> is missing in profile %s.\n", profile->name);
+                                                       "<soft-key-set-sets> is missing in profile %s.\n", profile->name);
                                } /* soft-key-set-sets */
                                if (!switch_core_hash_find(profile->soft_key_set_sets_hash, "default")) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-                                               "Profile %s doesn't have a default <soft-key-set-set>. Profile ignored.\n", profile->name);
+                                                       "Profile %s doesn't have a default <soft-key-set-set>. Profile ignored.\n", profile->name);
                                        switch_core_destroy_memory_pool(&profile_pool);
                                        continue;
                                }
-                               
-                               
+
+
                                /* Device types */
                                switch_core_hash_init(&profile->device_type_params_hash, profile->pool);
                                if ((xdevice_types = switch_xml_child(xprofile, "device-types"))) {
@@ -1893,13 +1893,13 @@ static switch_status_t load_skinny_config(void)
                                                                char *val = (char *) switch_xml_attr_soft(param, "value");
 
                                                                if (!strcasecmp(var, "firmware-version")) {
-                                                                   strncpy(params->firmware_version, val, 16);
+                                                                       strncpy(params->firmware_version, val, 16);
                                                                }
                                                        } /* param */
-                                                   switch_core_hash_insert(profile->device_type_params_hash, id_str, params);
+                                                       switch_core_hash_insert(profile->device_type_params_hash, id_str, params);
                                                } else {
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                                                               "Unknow device type %s in profile %s.\n", switch_xml_attr_soft(xdevice_type, "id"), profile->name);
+                                                                       "Unknow device type %s in profile %s.\n", switch_xml_attr_soft(xdevice_type, "id"), profile->name);
                                                }
                                        }
                                }
@@ -1936,7 +1936,7 @@ static switch_status_t load_skinny_config(void)
                                        }
                                        switch_core_db_close(db);
                                }
-               
+
                                skinny_execute_sql_callback(profile, profile->sql_mutex, "DELETE FROM skinny_devices", NULL, NULL);
                                skinny_execute_sql_callback(profile, profile->sql_mutex, "DELETE FROM skinny_lines", NULL, NULL);
                                skinny_execute_sql_callback(profile, profile->sql_mutex, "DELETE FROM skinny_buttons", NULL, NULL);
@@ -1945,13 +1945,13 @@ static switch_status_t load_skinny_config(void)
                                skinny_profile_respawn(profile, 0);
 
                                /* Register profile */
-                           switch_mutex_lock(globals.mutex);
-                           switch_core_hash_insert(globals.profile_hash, profile->name, profile);
-                           switch_mutex_unlock(globals.mutex);
+                               switch_mutex_lock(globals.mutex);
+                               switch_core_hash_insert(globals.profile_hash, profile->name, profile);
+                               switch_mutex_unlock(globals.mutex);
                                profile = NULL;
                        } else {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-                                       "Settings are missing from profile %s.\n", profile_name);
+                                               "Settings are missing from profile %s.\n", profile_name);
                        } /* settings */
                } /* profile */
        }
@@ -1991,26 +1991,26 @@ static void skinny_user_to_device_event_handler(switch_event_t *event)
                                case USER_TO_DEVICE_DATA_MESSAGE:
                                        data_length = strlen(data); /* we ignore data_length sent */
                                        send_data(listener, message_type,
-                                               application_id, line_instance, call_id, transaction_id, data_length,
-                                               data);
+                                                       application_id, line_instance, call_id, transaction_id, data_length,
+                                                       data);
                                case USER_TO_DEVICE_DATA_VERSION1_MESSAGE:
                                        data_length = strlen(data); /* we ignore data_length sent */
                                        send_extended_data(listener, message_type,
-                                               application_id, line_instance, call_id, transaction_id, data_length,
-                                               sequence_flag, display_priority, conference_id, app_instance_id, routing_id,
-                                               data);
+                                                       application_id, line_instance, call_id, transaction_id, data_length,
+                                                       sequence_flag, display_priority, conference_id, app_instance_id, routing_id,
+                                                       data);
                                        break;
                                default:
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                                               "Incorrect message type %s (%d).\n", skinny_message_type2str(message_type), message_type);
+                                                       "Incorrect message type %s (%d).\n", skinny_message_type2str(message_type), message_type);
                        }
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                               "Device %s:%d in profile '%s' not found.\n", device_name, device_instance, profile_name);
+                                       "Device %s:%d in profile '%s' not found.\n", device_name, device_instance, profile_name);
                }
        } else {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                       "Profile '%s' not found.\n", profile_name);
+                               "Profile '%s' not found.\n", profile_name);
        }
 }
 
@@ -2032,41 +2032,41 @@ static void skinny_call_state_event_handler(switch_event_t *event)
 
                if ((profile = skinny_find_profile(profile_name))) {
                        skinny_profile_find_listener_by_device_name_and_instance(profile, device_name, device_instance, &listener);
-                   if(listener) {
-                       if(line_instance > 0) {
-                           line_instance_condition = switch_mprintf("line_instance=%d", line_instance);
-                       } else {
-                           line_instance_condition = switch_mprintf("1=1");
-                       }
-                       switch_assert(line_instance_condition);
-                       if(call_id > 0) {
-                           call_id_condition = switch_mprintf("call_id=%d", call_id);
-                       } else {
-                           call_id_condition = switch_mprintf("1=1");
-                       }
-                       switch_assert(call_id_condition);
-
-                           if ((sql = switch_mprintf(
-                                           "UPDATE skinny_active_lines "
-                                           "SET call_state=%d "
-                                           "WHERE device_name='%s' AND device_instance=%d "
-                                           "AND %s AND %s",
-                                           call_state,
-                                           listener->device_name, listener->device_instance,
-                                           line_instance_condition, call_id_condition
-                                           ))) {
-                                   skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex);
-                                   switch_safe_free(sql);
-                           }
-                           switch_safe_free(line_instance_condition);
-                           switch_safe_free(call_id_condition);
+                       if(listener) {
+                               if(line_instance > 0) {
+                                       line_instance_condition = switch_mprintf("line_instance=%d", line_instance);
+                               } else {
+                                       line_instance_condition = switch_mprintf("1=1");
+                               }
+                               switch_assert(line_instance_condition);
+                               if(call_id > 0) {
+                                       call_id_condition = switch_mprintf("call_id=%d", call_id);
+                               } else {
+                                       call_id_condition = switch_mprintf("1=1");
+                               }
+                               switch_assert(call_id_condition);
+
+                               if ((sql = switch_mprintf(
+                                                               "UPDATE skinny_active_lines "
+                                                               "SET call_state=%d "
+                                                               "WHERE device_name='%s' AND device_instance=%d "
+                                                               "AND %s AND %s",
+                                                               call_state,
+                                                               listener->device_name, listener->device_instance,
+                                                               line_instance_condition, call_id_condition
+                                                        ))) {
+                                       skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex);
+                                       switch_safe_free(sql);
+                               }
+                               switch_safe_free(line_instance_condition);
+                               switch_safe_free(call_id_condition);
                        } else {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                                       "Device %s:%d in profile '%s' not found.\n", device_name, device_instance, profile_name);
+                                               "Device %s:%d in profile '%s' not found.\n", device_name, device_instance, profile_name);
                        }
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                               "Profile '%s' not found.\n", profile_name);
+                                       "Profile '%s' not found.\n", profile_name);
                }
        }
 }
@@ -2089,7 +2089,7 @@ int skinny_message_waiting_event_handler_callback(void *pArg, int argc, char **a
        listener_t *listener = NULL;
 
        skinny_profile_find_listener_by_device_name_and_instance(helper->profile,
-               device_name, device_instance, &listener);
+                       device_name, device_instance, &listener);
 
        if (listener) {
                if (helper->yn == SWITCH_TRUE) {
@@ -2143,15 +2143,15 @@ static void skinny_message_waiting_event_handler(switch_event_t *event)
        count_str = switch_event_get_header(event, "mwi-voice-message");
 
        if ((sql = switch_mprintf(
-                       "SELECT device_name, device_instance FROM skinny_lines "
-                               "WHERE value='%s' AND line_instance=1", user))) {
+                                       "SELECT device_name, device_instance FROM skinny_lines "
+                                       "WHERE value='%s' AND line_instance=1", user))) {
                struct skinny_message_waiting_event_handler_helper helper = {0};
                helper.profile = profile;
                helper.yn = switch_true(yn);
                if (count_str) {
                        sscanf(count_str,"%d/%d (%d/%d)",
-                               &helper.total_new_messages, &helper.total_saved_messages,
-                               &helper.total_new_urgent_messages, &helper.total_saved_urgent_messages);
+                                       &helper.total_new_messages, &helper.total_saved_messages,
+                                       &helper.total_new_urgent_messages, &helper.total_saved_urgent_messages);
                }
                skinny_execute_sql_callback(profile, profile->sql_mutex, sql,  skinny_message_waiting_event_handler_callback, &helper);
                switch_safe_free(sql);
@@ -2285,7 +2285,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load)
 
                switch_hash_this(hi, NULL, NULL, &val);
                profile = (skinny_profile_t *) val;
-               
+
                launch_skinny_profile_thread(profile);
        }
        switch_mutex_unlock(globals.mutex);
@@ -2303,7 +2303,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skinny_shutdown)
        int sanity = 0;
 
        skinny_api_unregister();
-       
+
        /* release events */
        switch_event_unbind(&globals.user_to_device_node);
        switch_event_unbind(&globals.call_state_node);
index c124fce4e2344fa4e8c4d2aeee9ea6d983089a2a..2e4ec1c30a63df7939d1c01875f3f774af632d2f 100644 (file)
 #define SKINNY_EVENT_DEVICE_TO_USER "skinny::device_to_user"
 
 struct skinny_globals {
-    int running;
-    switch_memory_pool_t *pool;
-    switch_mutex_t *mutex;
-    switch_hash_t *profile_hash;
-    switch_event_node_t *user_to_device_node;
-    switch_event_node_t *call_state_node;
-    switch_event_node_t *message_waiting_node;
-    switch_event_node_t *trap_node;
-    int auto_restart;
+       int running;
+       switch_memory_pool_t *pool;
+       switch_mutex_t *mutex;
+       switch_hash_t *profile_hash;
+       switch_event_node_t *user_to_device_node;
+       switch_event_node_t *call_state_node;
+       switch_event_node_t *message_waiting_node;
+       switch_event_node_t *trap_node;
+       int auto_restart;
 };
 typedef struct skinny_globals skinny_globals_t;
 
 extern skinny_globals_t globals;
 
 typedef enum {
-    PFLAG_LISTENER_READY = (1 << 0),
-    PFLAG_SHOULD_RESPAWN = (1 << 1),
-    PFLAG_RESPAWN = (1 << 2),
+       PFLAG_LISTENER_READY = (1 << 0),
+       PFLAG_SHOULD_RESPAWN = (1 << 1),
+       PFLAG_RESPAWN = (1 << 2),
 } profile_flag_t;
 
 struct skinny_profile {
-    /* prefs */
-    char *name;
-    char *domain;
-    char *ip;
-    unsigned int port;
-    char *dialplan;
-    char *context;
-    char *patterns_dialplan;
-    char *patterns_context;
-    uint32_t keep_alive;
-    char date_format[6];
-    int debug;
+       /* prefs */
+       char *name;
+       char *domain;
+       char *ip;
+       unsigned int port;
+       char *dialplan;
+       char *context;
+       char *patterns_dialplan;
+       char *patterns_context;
+       uint32_t keep_alive;
+       char date_format[6];
+       int debug;
        int auto_restart;
-    switch_hash_t *soft_key_set_sets_hash;
-    switch_hash_t *device_type_params_hash;
-    /* db */
-    char *dbname;
-    char *odbc_dsn;
-    char *odbc_user;
-    char *odbc_pass;
-    switch_odbc_handle_t *master_odbc;
-    switch_mutex_t *sql_mutex; 
-    /* stats */
-    uint32_t ib_calls;
-    uint32_t ob_calls;
-    uint32_t ib_failed_calls;
-    uint32_t ob_failed_calls;  
-    /* listener */
-    int listener_threads;
-    switch_mutex_t *listener_mutex;    
-    switch_socket_t *sock;
-    switch_mutex_t *sock_mutex;
-    struct listener *listeners;
-    int flags;
-    switch_mutex_t *flag_mutex;
-    /* call id */
-    uint32_t next_call_id;
-    /* others */
-    switch_memory_pool_t *pool;
+       switch_hash_t *soft_key_set_sets_hash;
+       switch_hash_t *device_type_params_hash;
+       /* db */
+       char *dbname;
+       char *odbc_dsn;
+       char *odbc_user;
+       char *odbc_pass;
+       switch_odbc_handle_t *master_odbc;
+       switch_mutex_t *sql_mutex;      
+       /* stats */
+       uint32_t ib_calls;
+       uint32_t ob_calls;
+       uint32_t ib_failed_calls;
+       uint32_t ob_failed_calls;       
+       /* listener */
+       int listener_threads;
+       switch_mutex_t *listener_mutex; 
+       switch_socket_t *sock;
+       switch_mutex_t *sock_mutex;
+       struct listener *listeners;
+       int flags;
+       switch_mutex_t *flag_mutex;
+       /* call id */
+       uint32_t next_call_id;
+       /* others */
+       switch_memory_pool_t *pool;
 };
 typedef struct skinny_profile skinny_profile_t;
 
@@ -127,7 +127,7 @@ typedef enum {
 /*****************************************************************************/
 
 typedef enum {
-    LFLAG_RUNNING = (1 << 0),
+       LFLAG_RUNNING = (1 << 0),
 } listener_flag_t;
 
 #define SKINNY_MAX_LINES 42
@@ -161,15 +161,15 @@ typedef switch_status_t (*skinny_listener_callback_func_t) (listener_t *listener
 /* CHANNEL TYPES */
 /*****************************************************************************/
 typedef enum {
-    TFLAG_FORCE_ROUTE = (1 << 0),
-    TFLAG_EARLY_MEDIA = (1 << 1),
-    TFLAG_IO = (1 << 2),
-    TFLAG_READING = (1 << 3),
-    TFLAG_WRITING = (1 << 4)
+       TFLAG_FORCE_ROUTE = (1 << 0),
+       TFLAG_EARLY_MEDIA = (1 << 1),
+       TFLAG_IO = (1 << 2),
+       TFLAG_READING = (1 << 3),
+       TFLAG_WRITING = (1 << 4)
 } TFLAGS;
 
 typedef enum {
-    GFLAG_MY_CODEC_PREFS = (1 << 0)
+       GFLAG_MY_CODEC_PREFS = (1 << 0)
 } GFLAGS;
 
 struct private_object {
@@ -236,7 +236,7 @@ void profile_walk_listeners(skinny_profile_t *profile, skinny_listener_callback_
 switch_cache_db_handle_t *skinny_get_db_handle(skinny_profile_t *profile);
 switch_status_t skinny_execute_sql(skinny_profile_t *profile, char *sql, switch_mutex_t *mutex);
 switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile,
-                                                                                     switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata);
+               switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata);
 
 /*****************************************************************************/
 /* LISTENER FUNCTIONS */
@@ -261,8 +261,8 @@ switch_status_t channel_on_routing(switch_core_session_t *session);
 switch_status_t channel_on_exchange_media(switch_core_session_t *session);
 switch_status_t channel_on_soft_execute(switch_core_session_t *session);
 switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
-                                                                                                   switch_caller_profile_t *outbound_profile,
-                                                                                                   switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
+               switch_caller_profile_t *outbound_profile,
+               switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
 switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
 switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
 switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
index 7bbb27afd334f0a51c14ea5db3c4b4bf9a3697ea..1b2c1413419c4804c6dc372321ab4ce215b6fd3a 100644 (file)
 
 static switch_status_t skinny_api_list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches)
 {
-    switch_console_callback_match_t *my_matches = NULL;
-    switch_status_t status = SWITCH_STATUS_FALSE;
-    switch_hash_index_t *hi;
-    void *val;
-    skinny_profile_t *profile;
-
-    /* walk profiles */
-    switch_mutex_lock(globals.mutex);
-    for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
-           switch_hash_this(hi, NULL, NULL, &val);
-           profile = (skinny_profile_t *) val;
-
-           switch_console_push_match(&my_matches, profile->name);
-    }
-    switch_mutex_unlock(globals.mutex);
-
-    if (my_matches) {
-           *matches = my_matches;
-           status = SWITCH_STATUS_SUCCESS;
-    }
-
-    return status;
+       switch_console_callback_match_t *my_matches = NULL;
+       switch_status_t status = SWITCH_STATUS_FALSE;
+       switch_hash_index_t *hi;
+       void *val;
+       skinny_profile_t *profile;
+
+       /* walk profiles */
+       switch_mutex_lock(globals.mutex);
+       for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+               switch_hash_this(hi, NULL, NULL, &val);
+               profile = (skinny_profile_t *) val;
+
+               switch_console_push_match(&my_matches, profile->name);
+       }
+       switch_mutex_unlock(globals.mutex);
+
+       if (my_matches) {
+               *matches = my_matches;
+               status = SWITCH_STATUS_SUCCESS;
+       }
+
+       return status;
 }
 
 struct match_helper {
-    switch_console_callback_match_t *my_matches;
+       switch_console_callback_match_t *my_matches;
 };
 
 static int skinny_api_list_devices_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
-    struct match_helper *h = (struct match_helper *) pArg;
-    char *device_name = argv[0];
+       struct match_helper *h = (struct match_helper *) pArg;
+       char *device_name = argv[0];
 
-    switch_console_push_match(&h->my_matches, device_name);
-    return 0;
+       switch_console_push_match(&h->my_matches, device_name);
+       return 0;
 }
 
 static switch_status_t skinny_api_list_devices(const char *line, const char *cursor, switch_console_callback_match_t **matches)
 {
-    struct match_helper h = { 0 };
-    switch_status_t status = SWITCH_STATUS_FALSE;
-    skinny_profile_t *profile = NULL;
-    char *sql;
-
-    char *myline;
-    char *argv[1024] = { 0 };
-    int argc = 0;
-
-    if (!(myline = strdup(line))) {
-           status = SWITCH_STATUS_MEMERR;
-           return status;
-    }
-    if (!(argc = switch_separate_string(myline, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || argc < 4) {
-           return status;
-    }
-
-    if(!strcasecmp(argv[1], "profile")) {/* skinny profile <profile_name> ... */
-           profile = skinny_find_profile(argv[2]);
-    } else if(!strcasecmp(argv[2], "profile")) {/* skinny status profile <profile_name> ... */
-           profile = skinny_find_profile(argv[3]);
-    }
-
-    if(profile) {
-           if ((sql = switch_mprintf("SELECT name FROM skinny_devices"))) {
-                   skinny_execute_sql_callback(profile, profile->sql_mutex, sql, skinny_api_list_devices_callback, &h);
-                   switch_safe_free(sql);
-           }
-    }
-
-    if (h.my_matches) {
-           *matches = h.my_matches;
-           status = SWITCH_STATUS_SUCCESS;
-    }
-
-    return status;
+       struct match_helper h = { 0 };
+       switch_status_t status = SWITCH_STATUS_FALSE;
+       skinny_profile_t *profile = NULL;
+       char *sql;
+
+       char *myline;
+       char *argv[1024] = { 0 };
+       int argc = 0;
+
+       if (!(myline = strdup(line))) {
+               status = SWITCH_STATUS_MEMERR;
+               return status;
+       }
+       if (!(argc = switch_separate_string(myline, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || argc < 4) {
+               return status;
+       }
+
+       if(!strcasecmp(argv[1], "profile")) {/* skinny profile <profile_name> ... */
+               profile = skinny_find_profile(argv[2]);
+       } else if(!strcasecmp(argv[2], "profile")) {/* skinny status profile <profile_name> ... */
+               profile = skinny_find_profile(argv[3]);
+       }
+
+       if(profile) {
+               if ((sql = switch_mprintf("SELECT name FROM skinny_devices"))) {
+                       skinny_execute_sql_callback(profile, profile->sql_mutex, sql, skinny_api_list_devices_callback, &h);
+                       switch_safe_free(sql);
+               }
+       }
+
+       if (h.my_matches) {
+               *matches = h.my_matches;
+               status = SWITCH_STATUS_SUCCESS;
+       }
+
+       return status;
 }
 
 static switch_status_t skinny_api_list_reset_types(const char *line, const char *cursor, switch_console_callback_match_t **matches)
 {
-    switch_status_t status = SWITCH_STATUS_FALSE;
-    SKINNY_PUSH_DEVICE_RESET_TYPES
-    return status;
+       switch_status_t status = SWITCH_STATUS_FALSE;
+       SKINNY_PUSH_DEVICE_RESET_TYPES
+               return status;
 }
 
 static switch_status_t skinny_api_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;
+       switch_status_t status = SWITCH_STATUS_FALSE;
+       SKINNY_PUSH_STIMULI
+               return status;
 }
 
 static switch_status_t skinny_api_list_ring_types(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;
+       switch_status_t status = SWITCH_STATUS_FALSE;
+       SKINNY_PUSH_RING_TYPES
+               return status;
 }
 
 static switch_status_t skinny_api_list_ring_modes(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;
+       switch_status_t status = SWITCH_STATUS_FALSE;
+       SKINNY_PUSH_RING_MODES
+               return status;
 }
 
 static switch_status_t skinny_api_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_status_t status = SWITCH_STATUS_FALSE;
+       switch_console_callback_match_t *my_matches = NULL;
 
-    switch_console_push_match(&my_matches, "<stimulus_instance>");
-    switch_console_push_match(&my_matches, "0");
+       switch_console_push_match(&my_matches, "<stimulus_instance>");
+       switch_console_push_match(&my_matches, "0");
 
-    if (my_matches) {
-           *matches = my_matches;
-           status = SWITCH_STATUS_SUCCESS;
-    }
-    return status;
+       if (my_matches) {
+               *matches = my_matches;
+               status = SWITCH_STATUS_SUCCESS;
+       }
+       return status;
 }
 
 static switch_status_t skinny_api_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;
+       switch_status_t status = SWITCH_STATUS_FALSE;
+       SKINNY_PUSH_LAMP_MODES
+               return status;
 }
 
 static switch_status_t skinny_api_list_speaker_modes(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;
+       switch_status_t status = SWITCH_STATUS_FALSE;
+       SKINNY_PUSH_SPEAKER_MODES
+               return status;
 }
 
 static switch_status_t skinny_api_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;
+       switch_status_t status = SWITCH_STATUS_FALSE;
+       SKINNY_PUSH_CALL_STATES
+               return status;
 }
 
 static switch_status_t skinny_api_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(&my_matches, "1");
-    switch_console_push_match(&my_matches, "<line_instance>");
-
-    if (my_matches) {
-           *matches = my_matches;
-           status = SWITCH_STATUS_SUCCESS;
-    }
-    return status;
+       switch_status_t status = SWITCH_STATUS_FALSE;
+       switch_console_callback_match_t *my_matches = NULL;
+
+       /* TODO */
+       switch_console_push_match(&my_matches, "1");
+       switch_console_push_match(&my_matches, "<line_instance>");
+
+       if (my_matches) {
+               *matches = my_matches;
+               status = SWITCH_STATUS_SUCCESS;
+       }
+       return status;
 }
 
 static switch_status_t skinny_api_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(&my_matches, "1345");
-    switch_console_push_match(&my_matches, "<call_id>");
-
-    if (my_matches) {
-           *matches = my_matches;
-           status = SWITCH_STATUS_SUCCESS;
-    }
-    return status;
+       switch_status_t status = SWITCH_STATUS_FALSE;
+       switch_console_callback_match_t *my_matches = NULL;
+
+       /* TODO */
+       switch_console_push_match(&my_matches, "1345");
+       switch_console_push_match(&my_matches, "<call_id>");
+
+       if (my_matches) {
+               *matches = my_matches;
+               status = SWITCH_STATUS_SUCCESS;
+       }
+       return status;
 }
 
 static switch_status_t skinny_api_list_settings(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(&my_matches, "domain");
-    switch_console_push_match(&my_matches, "ip");
-    switch_console_push_match(&my_matches, "port");
-    switch_console_push_match(&my_matches, "patterns-dialplan");
-    switch_console_push_match(&my_matches, "patterns-context");
-    switch_console_push_match(&my_matches, "dialplan");
-    switch_console_push_match(&my_matches, "context");
-    switch_console_push_match(&my_matches, "keep-alive");
-    switch_console_push_match(&my_matches, "date-format");
-    switch_console_push_match(&my_matches, "odbc-dsn");
-    switch_console_push_match(&my_matches, "debug");
-    switch_console_push_match(&my_matches, "auto-restart");
-
-    if (my_matches) {
-           *matches = my_matches;
-           status = SWITCH_STATUS_SUCCESS;
-    }
-    return status;
+       switch_status_t status = SWITCH_STATUS_FALSE;
+       switch_console_callback_match_t *my_matches = NULL;
+
+       switch_console_push_match(&my_matches, "domain");
+       switch_console_push_match(&my_matches, "ip");
+       switch_console_push_match(&my_matches, "port");
+       switch_console_push_match(&my_matches, "patterns-dialplan");
+       switch_console_push_match(&my_matches, "patterns-context");
+       switch_console_push_match(&my_matches, "dialplan");
+       switch_console_push_match(&my_matches, "context");
+       switch_console_push_match(&my_matches, "keep-alive");
+       switch_console_push_match(&my_matches, "date-format");
+       switch_console_push_match(&my_matches, "odbc-dsn");
+       switch_console_push_match(&my_matches, "debug");
+       switch_console_push_match(&my_matches, "auto-restart");
+
+       if (my_matches) {
+               *matches = my_matches;
+               status = SWITCH_STATUS_SUCCESS;
+       }
+       return status;
 }
 
 /*****************************************************************************/
@@ -244,136 +244,136 @@ static switch_status_t skinny_api_list_settings(const char *line, const char *cu
 /*****************************************************************************/
 static switch_status_t skinny_api_cmd_status_profile(const char *profile_name, switch_stream_handle_t *stream)
 {
-    skinny_profile_t *profile;
-    if ((profile = skinny_find_profile(profile_name))) {
-           skinny_profile_dump(profile, stream);
-    } else {
-           stream->write_function(stream, "Profile not found!\n");
-    }
-
-    return SWITCH_STATUS_SUCCESS;
+       skinny_profile_t *profile;
+       if ((profile = skinny_find_profile(profile_name))) {
+               skinny_profile_dump(profile, stream);
+       } else {
+               stream->write_function(stream, "Profile not found!\n");
+       }
+
+       return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t skinny_api_cmd_status_profile_device(const char *profile_name, const char *device_name, switch_stream_handle_t *stream)
 {
-    skinny_profile_t *profile;
-    if ((profile = skinny_find_profile(profile_name))) {
-           dump_device(profile, device_name, stream);
-    } else {
-           stream->write_function(stream, "Profile not found!\n");
-    }
-
-    return SWITCH_STATUS_SUCCESS;
+       skinny_profile_t *profile;
+       if ((profile = skinny_find_profile(profile_name))) {
+               dump_device(profile, device_name, stream);
+       } else {
+               stream->write_function(stream, "Profile not found!\n");
+       }
+
+       return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t skinny_api_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;
+       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, &listener);
-           if(listener) {
-                   send_set_ringer(listener, skinny_str2ring_type(ring_type), skinny_str2ring_mode(ring_mode), 0, 0);
+       if ((profile = skinny_find_profile(profile_name))) {
+               listener_t *listener = NULL;
+               skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
+               if(listener) {
+                       send_set_ringer(listener, skinny_str2ring_type(ring_type), skinny_str2ring_mode(ring_mode), 0, 0);
                        stream->write_function(stream, "+OK\n");
-           } else {
-                   stream->write_function(stream, "Listener not found!\n");
-           }
-    } else {
-           stream->write_function(stream, "Profile not found!\n");
-    }
-
-    return SWITCH_STATUS_SUCCESS;
+               } else {
+                       stream->write_function(stream, "Listener not found!\n");
+               }
+       } else {
+               stream->write_function(stream, "Profile not found!\n");
+       }
+
+       return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t skinny_api_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;
+       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, &listener);
-           if(listener) {
-                   send_set_lamp(listener, skinny_str2button(stimulus), atoi(instance), skinny_str2lamp_mode(lamp_mode));
+       if ((profile = skinny_find_profile(profile_name))) {
+               listener_t *listener = NULL;
+               skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
+               if(listener) {
+                       send_set_lamp(listener, skinny_str2button(stimulus), atoi(instance), skinny_str2lamp_mode(lamp_mode));
                        stream->write_function(stream, "+OK\n");
-           } else {
-                   stream->write_function(stream, "Listener not found!\n");
-           }
-    } else {
-           stream->write_function(stream, "Profile not found!\n");
-    }
-
-    return SWITCH_STATUS_SUCCESS;
+               } else {
+                       stream->write_function(stream, "Listener not found!\n");
+               }
+       } else {
+               stream->write_function(stream, "Profile not found!\n");
+       }
+
+       return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t skinny_api_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;
+       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, &listener);
-           if(listener) {
-                   send_set_speaker_mode(listener, skinny_str2speaker_mode(speaker_mode));
+       if ((profile = skinny_find_profile(profile_name))) {
+               listener_t *listener = NULL;
+               skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
+               if(listener) {
+                       send_set_speaker_mode(listener, skinny_str2speaker_mode(speaker_mode));
                        stream->write_function(stream, "+OK\n");
-           } else {
-                   stream->write_function(stream, "Listener not found!\n");
-           }
-    } else {
-           stream->write_function(stream, "Profile not found!\n");
-    }
-
-    return SWITCH_STATUS_SUCCESS;
+               } else {
+                       stream->write_function(stream, "Listener not found!\n");
+               }
+       } else {
+               stream->write_function(stream, "Profile not found!\n");
+       }
+
+       return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t skinny_api_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;
+       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, &listener);
-           if(listener) {
-                   send_call_state(listener, skinny_str2call_state(call_state), atoi(line_instance), atoi(call_id));
+       if ((profile = skinny_find_profile(profile_name))) {
+               listener_t *listener = NULL;
+               skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
+               if(listener) {
+                       send_call_state(listener, skinny_str2call_state(call_state), atoi(line_instance), atoi(call_id));
                        stream->write_function(stream, "+OK\n");
-           } else {
-                   stream->write_function(stream, "Listener not found!\n");
-           }
-    } else {
-           stream->write_function(stream, "Profile not found!\n");
-    }
-
-    return SWITCH_STATUS_SUCCESS;
+               } else {
+                       stream->write_function(stream, "Listener not found!\n");
+               }
+       } else {
+               stream->write_function(stream, "Profile not found!\n");
+       }
+
+       return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t skinny_api_cmd_profile_device_send_reset_message(const char *profile_name, const char *device_name, const char *reset_type, switch_stream_handle_t *stream)
 {
-    skinny_profile_t *profile;
+       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, &listener);
-           if(listener) {
-                   send_reset(listener, skinny_str2device_reset_type(reset_type));
+       if ((profile = skinny_find_profile(profile_name))) {
+               listener_t *listener = NULL;
+               skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
+               if(listener) {
+                       send_reset(listener, skinny_str2device_reset_type(reset_type));
                        stream->write_function(stream, "+OK\n");
-           } else {
-                   stream->write_function(stream, "Listener not found!\n");
-           }
-    } else {
-           stream->write_function(stream, "Profile not found!\n");
-    }
-
-    return SWITCH_STATUS_SUCCESS;
+               } else {
+                       stream->write_function(stream, "Listener not found!\n");
+               }
+       } else {
+               stream->write_function(stream, "Profile not found!\n");
+       }
+
+       return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t skinny_api_cmd_profile_device_send_data(const char *profile_name, const char *device_name, const char *message_type, char *params, const char *body, switch_stream_handle_t *stream)
 {
-    skinny_profile_t *profile;
+       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, &listener);
-           if(listener) {
+       if ((profile = skinny_find_profile(profile_name))) {
+               listener_t *listener = NULL;
+               skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
+               if(listener) {
                        switch_event_t *event = NULL;
                        char *argv[64] = { 0 };
                        int argc = 0;
@@ -395,49 +395,49 @@ static switch_status_t skinny_api_cmd_profile_device_send_data(const char *profi
                                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, tmp, "%s", var_value);
                                        switch_safe_free(tmp);
                                        /*
-                                       switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Application-Id", "%d", request->data.extended_data.application_id);
-                                       switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Line-Instance", "%d", request->data.extended_data.line_instance);
-                                       switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Call-Id", "%d", request->data.extended_data.call_id);
-                                       switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Transaction-Id", "%d", request->data.extended_data.transaction_id);
-                                       switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Data-Length", "%d", request->data.extended_data.data_length);
-                                       switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Sequence-Flag", "%d", request->data.extended_data.sequence_flag);
-                                       switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Display-Priority", "%d", request->data.extended_data.display_priority);
-                                       switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Conference-Id", "%d", request->data.extended_data.conference_id);
-                                       switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-App-Instance-Id", "%d", request->data.extended_data.app_instance_id);
-                                       switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Routing-Id", "%d", request->data.extended_data.routing_id);
-                                       */
+                                          switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Application-Id", "%d", request->data.extended_data.application_id);
+                                          switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Line-Instance", "%d", request->data.extended_data.line_instance);
+                                          switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Call-Id", "%d", request->data.extended_data.call_id);
+                                          switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Transaction-Id", "%d", request->data.extended_data.transaction_id);
+                                          switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Data-Length", "%d", request->data.extended_data.data_length);
+                                          switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Sequence-Flag", "%d", request->data.extended_data.sequence_flag);
+                                          switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Display-Priority", "%d", request->data.extended_data.display_priority);
+                                          switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Conference-Id", "%d", request->data.extended_data.conference_id);
+                                          switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-App-Instance-Id", "%d", request->data.extended_data.app_instance_id);
+                                          switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Routing-Id", "%d", request->data.extended_data.routing_id);
+                                        */
                                }
                        }
                        switch_event_add_body(event, "%s", body);
                        switch_event_fire(&event);
                        stream->write_function(stream, "+OK\n");
-           } else {
-                   stream->write_function(stream, "Listener not found!\n");
-           }
-    } else {
-           stream->write_function(stream, "Profile not found!\n");
-    }
-
-    return SWITCH_STATUS_SUCCESS;
+               } else {
+                       stream->write_function(stream, "Listener not found!\n");
+               }
+       } else {
+               stream->write_function(stream, "Profile not found!\n");
+       }
+
+       return SWITCH_STATUS_SUCCESS;
 }
 
 
 static switch_status_t skinny_api_cmd_profile_set(const char *profile_name, const char *name, const char *value, switch_stream_handle_t *stream)
 {
-    skinny_profile_t *profile;
+       skinny_profile_t *profile;
 
-    if ((profile = skinny_find_profile(profile_name))) {
-           if (skinny_profile_set(profile, name, value) == SWITCH_STATUS_SUCCESS) {
+       if ((profile = skinny_find_profile(profile_name))) {
+               if (skinny_profile_set(profile, name, value) == SWITCH_STATUS_SUCCESS) {
                        skinny_profile_respawn(profile, 0);
                        stream->write_function(stream, "+OK\n");
-           } else {
-                   stream->write_function(stream, "Unable to set skinny setting '%s'. Does it exists?\n", name);
-           }
-    } else {
-           stream->write_function(stream, "Profile not found!\n");
-    }
-
-    return SWITCH_STATUS_SUCCESS;
+               } else {
+                       stream->write_function(stream, "Unable to set skinny setting '%s'. Does it exists?\n", name);
+               }
+       } else {
+               stream->write_function(stream, "Profile not found!\n");
+       }
+
+       return SWITCH_STATUS_SUCCESS;
 }
 
 /*****************************************************************************/
@@ -445,148 +445,148 @@ static switch_status_t skinny_api_cmd_profile_set(const char *profile_name, cons
 /*****************************************************************************/
 SWITCH_STANDARD_API(skinny_function)
 {
-    char *argv[1024] = { 0 };
-    int argc = 0;
-    char *mycmd = NULL;
-    switch_status_t status = SWITCH_STATUS_SUCCESS;
-    const char *usage_string = "USAGE:\n"
-           "--------------------------------------------------------------------------------\n"
-           "skinny help\n"
-           "skinny status profile <profile_name>\n"
-           "skinny status profile <profile_name> device <device_name>\n"
-           "skinny profile <profile_name> device <device_name> send ResetMessage [DeviceReset|DeviceRestart]\n"
-           "skinny profile <profile_name> device <device_name> send SetRingerMessage <ring_type> <ring_mode>\n"
-           "skinny profile <profile_name> device <device_name> send SetLampMessage <stimulus> <instance> <lamp_mode>\n"
-           "skinny profile <profile_name> device <device_name> send SetSpeakerModeMessage <speaker_mode>\n"
-           "skinny profile <profile_name> device <device_name> send CallStateMessage <call_state> <line_instance> <call_id>\n"
-           "skinny profile <profile_name> device <device_name> send <UserToDeviceDataMessage|UserToDeviceDataVersion1Message> [ <param>=<value>;... ] <data>\n"
-           "skinny profile <profile_name> set <name> <value>\n"
-           "--------------------------------------------------------------------------------\n";
-    if (session) {
-           return SWITCH_STATUS_FALSE;
-    }
-
-    if (zstr(cmd)) {
-           stream->write_function(stream, "%s", usage_string);
-           goto done;
-    }
-
-    if (!(mycmd = strdup(cmd))) {
-           status = SWITCH_STATUS_MEMERR;
-           goto done;
-    }
-
-    if (!(argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || !argv[0]) {
-           stream->write_function(stream, "%s", usage_string);
-           goto done;
-    }
-
-    if (!strcasecmp(argv[0], "help")) {/* skinny help */
-           stream->write_function(stream, "%s", usage_string);
-    } else if (argc == 3 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile")) {
-           /* skinny status profile <profile_name> */
-           status = skinny_api_cmd_status_profile(argv[2], stream);
-    } else if (argc == 5 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile") && !strcasecmp(argv[3], "device")) {
-           /* skinny status profile <profile_name> device <device_name> */
-           status = skinny_api_cmd_status_profile_device(argv[2], argv[4], stream);
-    } else if (argc >= 6 && !strcasecmp(argv[0], "profile") && !strcasecmp(argv[2], "device") && !strcasecmp(argv[4], "send")) {
-           /* skinny profile <profile_name> device <device_name> send ... */
-           switch(skinny_str2message_type(argv[5])) {
-                   case SET_RINGER_MESSAGE:
-                           if(argc == 8) {
-                                   /* SetRingerMessage <ring_type> <ring_mode> */
-                                   status = skinny_api_cmd_profile_device_send_ringer_message(argv[1], argv[3], argv[6], argv[7], stream);
-                           }
-                           break;
-                   case SET_LAMP_MESSAGE:
-                           if (argc == 9) {
-                                   /* SetLampMessage <stimulus> <instance> <lamp_mode> */
-                                   status = skinny_api_cmd_profile_device_send_lamp_message(argv[1], argv[3], argv[6], argv[7], argv[8], stream);
-                           }
-                           break;
-                   case SET_SPEAKER_MODE_MESSAGE:
-                           if (argc == 7) {
-                                   /* SetSpeakerModeMessage <speaker_mode> */
-                                   status = skinny_api_cmd_profile_device_send_speaker_mode_message(argv[1], argv[3], argv[6], stream);
-                           }
-                           break;
-                   case CALL_STATE_MESSAGE:
-                           if (argc == 9) {
-                                   /* CallStateMessage <call_state> <line_instance> <call_id> */
-                                   status = skinny_api_cmd_profile_device_send_call_state_message(argv[1], argv[3], argv[6], argv[7], argv[8], stream);
-                           }
-                           break;
-                   case RESET_MESSAGE:
-                           if (argc == 7) {
-                                   /* ResetMessage <reset_type> */
-                                   status = skinny_api_cmd_profile_device_send_reset_message(argv[1], argv[3], argv[6], stream);
-                           }
-                           break;
+       char *argv[1024] = { 0 };
+       int argc = 0;
+       char *mycmd = NULL;
+       switch_status_t status = SWITCH_STATUS_SUCCESS;
+       const char *usage_string = "USAGE:\n"
+               "--------------------------------------------------------------------------------\n"
+               "skinny help\n"
+               "skinny status profile <profile_name>\n"
+               "skinny status profile <profile_name> device <device_name>\n"
+               "skinny profile <profile_name> device <device_name> send ResetMessage [DeviceReset|DeviceRestart]\n"
+               "skinny profile <profile_name> device <device_name> send SetRingerMessage <ring_type> <ring_mode>\n"
+               "skinny profile <profile_name> device <device_name> send SetLampMessage <stimulus> <instance> <lamp_mode>\n"
+               "skinny profile <profile_name> device <device_name> send SetSpeakerModeMessage <speaker_mode>\n"
+               "skinny profile <profile_name> device <device_name> send CallStateMessage <call_state> <line_instance> <call_id>\n"
+               "skinny profile <profile_name> device <device_name> send <UserToDeviceDataMessage|UserToDeviceDataVersion1Message> [ <param>=<value>;... ] <data>\n"
+               "skinny profile <profile_name> set <name> <value>\n"
+               "--------------------------------------------------------------------------------\n";
+       if (session) {
+               return SWITCH_STATUS_FALSE;
+       }
+
+       if (zstr(cmd)) {
+               stream->write_function(stream, "%s", usage_string);
+               goto done;
+       }
+
+       if (!(mycmd = strdup(cmd))) {
+               status = SWITCH_STATUS_MEMERR;
+               goto done;
+       }
+
+       if (!(argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || !argv[0]) {
+               stream->write_function(stream, "%s", usage_string);
+               goto done;
+       }
+
+       if (!strcasecmp(argv[0], "help")) {/* skinny help */
+               stream->write_function(stream, "%s", usage_string);
+       } else if (argc == 3 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile")) {
+               /* skinny status profile <profile_name> */
+               status = skinny_api_cmd_status_profile(argv[2], stream);
+       } else if (argc == 5 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile") && !strcasecmp(argv[3], "device")) {
+               /* skinny status profile <profile_name> device <device_name> */
+               status = skinny_api_cmd_status_profile_device(argv[2], argv[4], stream);
+       } else if (argc >= 6 && !strcasecmp(argv[0], "profile") && !strcasecmp(argv[2], "device") && !strcasecmp(argv[4], "send")) {
+               /* skinny profile <profile_name> device <device_name> send ... */
+               switch(skinny_str2message_type(argv[5])) {
+                       case SET_RINGER_MESSAGE:
+                               if(argc == 8) {
+                                       /* SetRingerMessage <ring_type> <ring_mode> */
+                                       status = skinny_api_cmd_profile_device_send_ringer_message(argv[1], argv[3], argv[6], argv[7], stream);
+                               }
+                               break;
+                       case SET_LAMP_MESSAGE:
+                               if (argc == 9) {
+                                       /* SetLampMessage <stimulus> <instance> <lamp_mode> */
+                                       status = skinny_api_cmd_profile_device_send_lamp_message(argv[1], argv[3], argv[6], argv[7], argv[8], stream);
+                               }
+                               break;
+                       case SET_SPEAKER_MODE_MESSAGE:
+                               if (argc == 7) {
+                                       /* SetSpeakerModeMessage <speaker_mode> */
+                                       status = skinny_api_cmd_profile_device_send_speaker_mode_message(argv[1], argv[3], argv[6], stream);
+                               }
+                               break;
+                       case CALL_STATE_MESSAGE:
+                               if (argc == 9) {
+                                       /* CallStateMessage <call_state> <line_instance> <call_id> */
+                                       status = skinny_api_cmd_profile_device_send_call_state_message(argv[1], argv[3], argv[6], argv[7], argv[8], stream);
+                               }
+                               break;
+                       case RESET_MESSAGE:
+                               if (argc == 7) {
+                                       /* ResetMessage <reset_type> */
+                                       status = skinny_api_cmd_profile_device_send_reset_message(argv[1], argv[3], argv[6], stream);
+                               }
+                               break;
                        case USER_TO_DEVICE_DATA_MESSAGE:
                        case USER_TO_DEVICE_DATA_VERSION1_MESSAGE:
-                           if(argc == 8) {
+                               if(argc == 8) {
                                        /* <UserToDeviceDataMessage|UserToDeviceDataVersion1Message> [ <param>=<value>;... ] <data> */
                                        status = skinny_api_cmd_profile_device_send_data(argv[1], argv[3], argv[5], argv[6], argv[7], stream);
-                           } else if(argc == 7) {
+                               } else if(argc == 7) {
                                        /* <UserToDeviceDataMessage|UserToDeviceDataVersion1Message> <data> */
                                        status = skinny_api_cmd_profile_device_send_data(argv[1], argv[3], argv[5], "", argv[6], stream);
                                }
-                           break;
-                   default:
-                           stream->write_function(stream, "Unhandled message %s\n", argv[5]);
-           }
-    } else if (argc == 5 && !strcasecmp(argv[0], "profile") && !strcasecmp(argv[2], "set")) {
-           /* skinny profile <profile_name> set <name> <value> */
-           status = skinny_api_cmd_profile_set(argv[1], argv[3], argv[4], stream);
-    } else {
-           stream->write_function(stream, "%s", usage_string);
-    }
+                               break;
+                       default:
+                               stream->write_function(stream, "Unhandled message %s\n", argv[5]);
+               }
+       } else if (argc == 5 && !strcasecmp(argv[0], "profile") && !strcasecmp(argv[2], "set")) {
+               /* skinny profile <profile_name> set <name> <value> */
+               status = skinny_api_cmd_profile_set(argv[1], argv[3], argv[4], stream);
+       } else {
+               stream->write_function(stream, "%s", usage_string);
+       }
 
 done:
-    switch_safe_free(mycmd);
-    return status;
+       switch_safe_free(mycmd);
+       return status;
 }
 
 switch_status_t skinny_api_register(switch_loadable_module_interface_t **module_interface)
 {
-    switch_api_interface_t *api_interface;
-
-    SWITCH_ADD_API(api_interface, "skinny", "Skinny Controls", skinny_function, "<cmd> <args>");
-    switch_console_set_complete("add skinny help");
-
-    switch_console_set_complete("add skinny status profile ::skinny::list_profiles");
-    switch_console_set_complete("add skinny status profile ::skinny::list_profiles device ::skinny::list_devices");
-
-    switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send ResetMessage ::skinny::list_reset_types");
-    switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetRingerMessage ::skinny::list_ring_types ::skinny::list_ring_modes");
-    switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetLampMessage ::skinny::list_stimuli ::skinny::list_stimulus_instances ::skinny::list_stimulus_modes");
-    switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetSpeakerModeMessage ::skinny::list_speaker_modes");
-    switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send CallStateMessage ::skinny::list_call_states ::skinny::list_line_instances ::skinny::list_call_ids");
-    switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send UserToDeviceDataMessage");
-    switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send UserToDeviceDataVersion1Message");
-    switch_console_set_complete("add skinny profile ::skinny::list_profiles set ::skinny::list_settings");
-
-    switch_console_add_complete_func("::skinny::list_profiles", skinny_api_list_profiles);
-    switch_console_add_complete_func("::skinny::list_devices", skinny_api_list_devices);
-    switch_console_add_complete_func("::skinny::list_reset_types", skinny_api_list_reset_types);
-    switch_console_add_complete_func("::skinny::list_ring_types", skinny_api_list_ring_types);
-    switch_console_add_complete_func("::skinny::list_ring_modes", skinny_api_list_ring_modes);
-    switch_console_add_complete_func("::skinny::list_stimuli", skinny_api_list_stimuli);
-    switch_console_add_complete_func("::skinny::list_stimulus_instances", skinny_api_list_stimulus_instances);
-    switch_console_add_complete_func("::skinny::list_stimulus_modes", skinny_api_list_stimulus_modes);
-    switch_console_add_complete_func("::skinny::list_speaker_modes", skinny_api_list_speaker_modes);
-    switch_console_add_complete_func("::skinny::list_call_states", skinny_api_list_call_states);
-    switch_console_add_complete_func("::skinny::list_line_instances", skinny_api_list_line_instances);
-    switch_console_add_complete_func("::skinny::list_call_ids", skinny_api_list_call_ids);
-    switch_console_add_complete_func("::skinny::list_settings", skinny_api_list_settings);
-    return SWITCH_STATUS_SUCCESS;
+       switch_api_interface_t *api_interface;
+
+       SWITCH_ADD_API(api_interface, "skinny", "Skinny Controls", skinny_function, "<cmd> <args>");
+       switch_console_set_complete("add skinny help");
+
+       switch_console_set_complete("add skinny status profile ::skinny::list_profiles");
+       switch_console_set_complete("add skinny status profile ::skinny::list_profiles device ::skinny::list_devices");
+
+       switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send ResetMessage ::skinny::list_reset_types");
+       switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetRingerMessage ::skinny::list_ring_types ::skinny::list_ring_modes");
+       switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetLampMessage ::skinny::list_stimuli ::skinny::list_stimulus_instances ::skinny::list_stimulus_modes");
+       switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetSpeakerModeMessage ::skinny::list_speaker_modes");
+       switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send CallStateMessage ::skinny::list_call_states ::skinny::list_line_instances ::skinny::list_call_ids");
+       switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send UserToDeviceDataMessage");
+       switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send UserToDeviceDataVersion1Message");
+       switch_console_set_complete("add skinny profile ::skinny::list_profiles set ::skinny::list_settings");
+
+       switch_console_add_complete_func("::skinny::list_profiles", skinny_api_list_profiles);
+       switch_console_add_complete_func("::skinny::list_devices", skinny_api_list_devices);
+       switch_console_add_complete_func("::skinny::list_reset_types", skinny_api_list_reset_types);
+       switch_console_add_complete_func("::skinny::list_ring_types", skinny_api_list_ring_types);
+       switch_console_add_complete_func("::skinny::list_ring_modes", skinny_api_list_ring_modes);
+       switch_console_add_complete_func("::skinny::list_stimuli", skinny_api_list_stimuli);
+       switch_console_add_complete_func("::skinny::list_stimulus_instances", skinny_api_list_stimulus_instances);
+       switch_console_add_complete_func("::skinny::list_stimulus_modes", skinny_api_list_stimulus_modes);
+       switch_console_add_complete_func("::skinny::list_speaker_modes", skinny_api_list_speaker_modes);
+       switch_console_add_complete_func("::skinny::list_call_states", skinny_api_list_call_states);
+       switch_console_add_complete_func("::skinny::list_line_instances", skinny_api_list_line_instances);
+       switch_console_add_complete_func("::skinny::list_call_ids", skinny_api_list_call_ids);
+       switch_console_add_complete_func("::skinny::list_settings", skinny_api_list_settings);
+       return SWITCH_STATUS_SUCCESS;
 }
 
 switch_status_t skinny_api_unregister()
 {
        switch_console_set_complete("del skinny");
 
-    return SWITCH_STATUS_SUCCESS;
+       return SWITCH_STATUS_SUCCESS;
 }
 
 /* For Emacs:
index 4c09c70176f028f006f748ef99ed9cb8ab47ecb1..da642c1cfabad2ba0c909f7296d45b305c97f5cd 100644 (file)
@@ -149,26 +149,26 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req)
 
                if(mlen) {
                        bytes += mlen;
-       
+
                        if(bytes >= SKINNY_MESSAGE_FIELD_SIZE) {
                                do_sleep = 0;
                                ptr += mlen;
                                memcpy(request, mbuf, bytes);
 #ifdef SKINNY_MEGA_DEBUG
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
-                                       "Got request: length=%d,reserved=%x,type=%x\n",
-                                       request->length,request->reserved,request->type);
+                                               "Got request: length=%d,reserved=%x,type=%x\n",
+                                               request->length,request->reserved,request->type);
 #endif
                                if(request->length < SKINNY_MESSAGE_FIELD_SIZE) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-                                               "Skinny client sent invalid data. Length should be greater than 4 but got %d.\n",
-                                               request->length);
+                                                       "Skinny client sent invalid data. Length should be greater than 4 but got %d.\n",
+                                                       request->length);
                                        return SWITCH_STATUS_FALSE;
                                }
                                if(request->length + 2*SKINNY_MESSAGE_FIELD_SIZE > SKINNY_MESSAGE_MAXSIZE) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-                                               "Skinny client sent too huge data. Got %d which is above threshold %d.\n",
-                                               request->length, SKINNY_MESSAGE_MAXSIZE - 2*SKINNY_MESSAGE_FIELD_SIZE);
+                                                       "Skinny client sent too huge data. Got %d which is above threshold %d.\n",
+                                                       request->length, SKINNY_MESSAGE_MAXSIZE - 2*SKINNY_MESSAGE_FIELD_SIZE);
                                        return SWITCH_STATUS_FALSE;
                                }
                                if(bytes >= request->length + 2*SKINNY_MESSAGE_FIELD_SIZE) {
@@ -224,10 +224,10 @@ switch_status_t skinny_device_event(listener_t *listener, switch_event_t **ev, s
        switch_event_create_subclass(&event, event_id, subclass_name);
        switch_assert(event);
        if ((sql = switch_mprintf("SELECT '%s', name, user_id, instance, ip, type, max_streams, port, codec_string "
-               "FROM skinny_devices "
-                       "WHERE name='%s' AND instance=%d",
-                       listener->profile->name,
-                       listener->device_name, listener->device_instance))) {
+                                       "FROM skinny_devices "
+                                       "WHERE name='%s' AND instance=%d",
+                                       listener->profile->name,
+                                       listener->device_name, listener->device_instance))) {
                skinny_execute_sql_callback(profile, profile->sql_mutex, sql, skinny_device_event_callback, event);
                switch_safe_free(sql);
        }
@@ -243,14 +243,14 @@ switch_status_t skinny_session_walk_lines(skinny_profile_t *profile, char *chann
 {
        char *sql;
        if ((sql = switch_mprintf(
-                       "SELECT skinny_lines.*, channel_uuid, call_id, call_state "
-                       "FROM skinny_active_lines "
-                       "INNER JOIN skinny_lines "
-                               "ON skinny_active_lines.device_name = skinny_lines.device_name "
-                               "AND skinny_active_lines.device_instance = skinny_lines.device_instance "
-                               "AND skinny_active_lines.line_instance = skinny_lines.line_instance "
-                       "WHERE channel_uuid='%s'",
-                       channel_uuid))) {
+                                       "SELECT skinny_lines.*, channel_uuid, call_id, call_state "
+                                       "FROM skinny_active_lines "
+                                       "INNER JOIN skinny_lines "
+                                       "ON skinny_active_lines.device_name = skinny_lines.device_name "
+                                       "AND skinny_active_lines.device_instance = skinny_lines.device_instance "
+                                       "AND skinny_active_lines.line_instance = skinny_lines.line_instance "
+                                       "WHERE channel_uuid='%s'",
+                                       channel_uuid))) {
                skinny_execute_sql_callback(profile, profile->sql_mutex, sql, callback, data);
                switch_safe_free(sql);
        }
@@ -261,14 +261,14 @@ switch_status_t skinny_session_walk_lines_by_call_id(skinny_profile_t *profile,
 {
        char *sql;
        if ((sql = switch_mprintf(
-                       "SELECT skinny_lines.*, channel_uuid, call_id, call_state "
-                       "FROM skinny_active_lines "
-                       "INNER JOIN skinny_lines "
-                               "ON skinny_active_lines.device_name = skinny_lines.device_name "
-                               "AND skinny_active_lines.device_instance = skinny_lines.device_instance "
-                               "AND skinny_active_lines.line_instance = skinny_lines.line_instance "
-                       "WHERE call_id='%d'",
-                       call_id))) {
+                                       "SELECT skinny_lines.*, channel_uuid, call_id, call_state "
+                                       "FROM skinny_active_lines "
+                                       "INNER JOIN skinny_lines "
+                                       "ON skinny_active_lines.device_name = skinny_lines.device_name "
+                                       "AND skinny_active_lines.device_instance = skinny_lines.device_instance "
+                                       "AND skinny_active_lines.line_instance = skinny_lines.line_instance "
+                                       "WHERE call_id='%d'",
+                                       call_id))) {
                skinny_execute_sql_callback(profile, profile->sql_mutex, sql, callback, data);
                switch_safe_free(sql);
        }
@@ -309,13 +309,13 @@ void skinny_line_get(listener_t *listener, uint32_t instance, struct line_stat_r
        helper.button = switch_core_alloc(listener->pool, sizeof(struct line_stat_res_message));
 
        if ((sql = switch_mprintf(
-                       "SELECT '%d' AS wanted_position, position, label, value, caller_name "
-                               "FROM skinny_lines "
-                               "WHERE device_name='%s' AND device_instance=%d "
-                               "ORDER BY position",
-                       instance,
-                       listener->device_name, listener->device_instance
-                       ))) {
+                                       "SELECT '%d' AS wanted_position, position, label, value, caller_name "
+                                       "FROM skinny_lines "
+                                       "WHERE device_name='%s' AND device_instance=%d "
+                                       "ORDER BY position",
+                                       instance,
+                                       listener->device_name, listener->device_instance
+                                ))) {
                skinny_execute_sql_callback(listener->profile, listener->profile->sql_mutex, sql, skinny_line_get_callback, &helper);
                switch_safe_free(sql);
        }
@@ -352,14 +352,14 @@ void skinny_speed_dial_get(listener_t *listener, uint32_t instance, struct speed
        helper.button = switch_core_alloc(listener->pool, sizeof(struct speed_dial_stat_res_message));
 
        if ((sql = switch_mprintf(
-                       "SELECT '%d' AS wanted_position, position, label, value, settings "
-                               "FROM skinny_buttons "
-                               "WHERE device_name='%s' AND device_instance=%d AND type=%d "
-                               "ORDER BY position",
-                       instance,
-                       listener->device_name, listener->device_instance,
-                       SKINNY_BUTTON_SPEED_DIAL
-                       ))) {
+                                       "SELECT '%d' AS wanted_position, position, label, value, settings "
+                                       "FROM skinny_buttons "
+                                       "WHERE device_name='%s' AND device_instance=%d AND type=%d "
+                                       "ORDER BY position",
+                                       instance,
+                                       listener->device_name, listener->device_instance,
+                                       SKINNY_BUTTON_SPEED_DIAL
+                                ))) {
                skinny_execute_sql_callback(listener->profile, listener->profile->sql_mutex, sql, skinny_speed_dial_get_callback, &helper);
                switch_safe_free(sql);
        }
@@ -396,15 +396,15 @@ void skinny_service_url_get(listener_t *listener, uint32_t instance, struct serv
        helper.button = switch_core_alloc(listener->pool, sizeof(struct service_url_stat_res_message));
 
        if ((sql = switch_mprintf(
-                       "SELECT '%d' AS wanted_position, position, label, value, settings "
-                               "FROM skinny_buttons "
-                               "WHERE device_name='%s' AND device_instance=%d AND type=%d "
-                               "ORDER BY position",
-                       instance,
-                       listener->device_name,
-                       listener->device_instance,
-                       SKINNY_BUTTON_SERVICE_URL
-                       ))) {
+                                       "SELECT '%d' AS wanted_position, position, label, value, settings "
+                                       "FROM skinny_buttons "
+                                       "WHERE device_name='%s' AND device_instance=%d AND type=%d "
+                                       "ORDER BY position",
+                                       instance,
+                                       listener->device_name,
+                                       listener->device_instance,
+                                       SKINNY_BUTTON_SERVICE_URL
+                                ))) {
                skinny_execute_sql_callback(listener->profile, listener->profile->sql_mutex, sql, skinny_service_url_get_callback, &helper);
                switch_safe_free(sql);
        }
@@ -442,15 +442,15 @@ void skinny_feature_get(listener_t *listener, uint32_t instance, struct feature_
        helper.button = switch_core_alloc(listener->pool, sizeof(struct feature_stat_res_message));
 
        if ((sql = switch_mprintf(
-                       "SELECT '%d' AS wanted_position, position, label, value, settings "
-                               "FROM skinny_buttons "
-                               "WHERE device_name='%s' AND device_instance=%d AND NOT (type=%d OR type=%d) "
-                               "ORDER BY position",
-                       instance,
-                       listener->device_name,
-                       listener->device_instance,
-                       SKINNY_BUTTON_SPEED_DIAL, SKINNY_BUTTON_SERVICE_URL
-                       ))) {
+                                       "SELECT '%d' AS wanted_position, position, label, value, settings "
+                                       "FROM skinny_buttons "
+                                       "WHERE device_name='%s' AND device_instance=%d AND NOT (type=%d OR type=%d) "
+                                       "ORDER BY position",
+                                       instance,
+                                       listener->device_name,
+                                       listener->device_instance,
+                                       SKINNY_BUTTON_SPEED_DIAL, SKINNY_BUTTON_SERVICE_URL
+                                ))) {
                skinny_execute_sql_callback(listener->profile, listener->profile->sql_mutex, sql, skinny_feature_get_callback, &helper);
                switch_safe_free(sql);
        }
@@ -461,11 +461,11 @@ void skinny_feature_get(listener_t *listener, uint32_t instance, struct feature_
 /* SKINNY MESSAGE SENDER */
 /*****************************************************************************/
 switch_status_t send_register_ack(listener_t *listener,
-       uint32_t keep_alive,
-       char *date_format,
-       char *reserved,
-       uint32_t secondary_keep_alive,
-       char *reserved2)
+               uint32_t keep_alive,
+               char *date_format,
+               char *reserved,
+               uint32_t secondary_keep_alive,
+               char *reserved2)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.reg_ack));
@@ -480,10 +480,10 @@ switch_status_t send_register_ack(listener_t *listener,
 }
 
 switch_status_t send_start_tone(listener_t *listener,
-       uint32_t tone,
-       uint32_t reserved,
-       uint32_t line_instance,
-       uint32_t call_id)
+               uint32_t tone,
+               uint32_t reserved,
+               uint32_t line_instance,
+               uint32_t call_id)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.start_tone));
@@ -497,8 +497,8 @@ switch_status_t send_start_tone(listener_t *listener,
 }
 
 switch_status_t send_stop_tone(listener_t *listener,
-       uint32_t line_instance,
-       uint32_t call_id)
+               uint32_t line_instance,
+               uint32_t call_id)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.stop_tone));
@@ -510,10 +510,10 @@ switch_status_t send_stop_tone(listener_t *listener,
 }
 
 switch_status_t send_set_ringer(listener_t *listener,
-       uint32_t ring_type,
-       uint32_t ring_mode,
-       uint32_t line_instance,
-       uint32_t call_id)
+               uint32_t ring_type,
+               uint32_t ring_mode,
+               uint32_t line_instance,
+               uint32_t call_id)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.ringer));
@@ -527,9 +527,9 @@ switch_status_t send_set_ringer(listener_t *listener,
 }
 
 switch_status_t send_set_lamp(listener_t *listener,
-       uint32_t stimulus,
-       uint32_t stimulus_instance,
-       uint32_t mode)
+               uint32_t stimulus,
+               uint32_t stimulus_instance,
+               uint32_t mode)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.lamp));
@@ -542,7 +542,7 @@ switch_status_t send_set_lamp(listener_t *listener,
 }
 
 switch_status_t send_set_speaker_mode(listener_t *listener,
-       uint32_t mode)
+               uint32_t mode)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.speaker_mode));
@@ -553,16 +553,16 @@ switch_status_t send_set_speaker_mode(listener_t *listener,
 }
 
 switch_status_t send_start_media_transmission(listener_t *listener,
-       uint32_t conference_id,
-       uint32_t pass_thru_party_id,
-       uint32_t remote_ip,
-       uint32_t remote_port,
-       uint32_t ms_per_packet,
-       uint32_t payload_capacity,
-       uint32_t precedence,
-       uint32_t silence_suppression,
-       uint16_t max_frames_per_packet,
-       uint32_t g723_bitrate)
+               uint32_t conference_id,
+               uint32_t pass_thru_party_id,
+               uint32_t remote_ip,
+               uint32_t remote_port,
+               uint32_t ms_per_packet,
+               uint32_t payload_capacity,
+               uint32_t precedence,
+               uint32_t silence_suppression,
+               uint16_t max_frames_per_packet,
+               uint32_t g723_bitrate)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.start_media));
@@ -583,9 +583,9 @@ switch_status_t send_start_media_transmission(listener_t *listener,
 }
 
 switch_status_t send_stop_media_transmission(listener_t *listener,
-       uint32_t conference_id,
-       uint32_t pass_thru_party_id,
-       uint32_t conference_id2)
+               uint32_t conference_id,
+               uint32_t pass_thru_party_id,
+               uint32_t conference_id2)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.stop_media));
@@ -599,26 +599,26 @@ switch_status_t send_stop_media_transmission(listener_t *listener,
 }
 
 switch_status_t skinny_send_call_info(listener_t *listener,
-       const char *calling_party_name,
-       const char *calling_party,
-       const char *called_party_name,
-       const char *called_party,
-       uint32_t line_instance,
-       uint32_t call_id,
-       uint32_t call_type,
-       const char *original_called_party_name,
-       const char *original_called_party,
-       const char *last_redirecting_party_name,
-       const char *last_redirecting_party,
-       uint32_t original_called_party_redirect_reason,
-       uint32_t last_redirecting_reason,
-       const char *calling_party_voice_mailbox,
-       const char *called_party_voice_mailbox,
-       const char *original_called_party_voice_mailbox,
-       const char *last_redirecting_voice_mailbox,
-       uint32_t call_instance,
-       uint32_t call_security_status,
-       uint32_t party_pi_restriction_bits)
+               const char *calling_party_name,
+               const char *calling_party,
+               const char *called_party_name,
+               const char *called_party,
+               uint32_t line_instance,
+               uint32_t call_id,
+               uint32_t call_type,
+               const char *original_called_party_name,
+               const char *original_called_party,
+               const char *last_redirecting_party_name,
+               const char *last_redirecting_party,
+               uint32_t original_called_party_redirect_reason,
+               uint32_t last_redirecting_reason,
+               const char *calling_party_voice_mailbox,
+               const char *called_party_voice_mailbox,
+               const char *original_called_party_voice_mailbox,
+               const char *last_redirecting_voice_mailbox,
+               uint32_t call_instance,
+               uint32_t call_security_status,
+               uint32_t party_pi_restriction_bits)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.call_info));
@@ -648,15 +648,15 @@ switch_status_t skinny_send_call_info(listener_t *listener,
 }
 
 switch_status_t send_define_time_date(listener_t *listener,
-       uint32_t year,
-       uint32_t month,
-       uint32_t day_of_week, /* monday = 1 */
-       uint32_t day,
-       uint32_t hour,
-       uint32_t minute,
-       uint32_t seconds,
-       uint32_t milliseconds,
-       uint32_t timestamp)
+               uint32_t year,
+               uint32_t month,
+               uint32_t day_of_week, /* monday = 1 */
+               uint32_t day,
+               uint32_t hour,
+               uint32_t minute,
+               uint32_t seconds,
+               uint32_t milliseconds,
+               uint32_t timestamp)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.define_time_date));
@@ -681,15 +681,15 @@ switch_status_t send_define_current_time_date(listener_t *listener)
        ts = switch_micro_time_now();
        switch_time_exp_lt(&tm, ts);
        return send_define_time_date(listener,
-           tm.tm_year + 1900,
-           tm.tm_mon + 1,
-           tm.tm_wday,
-           tm.tm_mday,
-           tm.tm_hour,
-           tm.tm_min,
-           tm.tm_sec,
-           tm.tm_usec / 1000,
-           ts / 1000000);
+                       tm.tm_year + 1900,
+                       tm.tm_mon + 1,
+                       tm.tm_wday,
+                       tm.tm_mday,
+                       tm.tm_hour,
+                       tm.tm_min,
+                       tm.tm_sec,
+                       tm.tm_usec / 1000,
+                       ts / 1000000);
 }
 
 switch_status_t send_capabilities_req(listener_t *listener)
@@ -702,7 +702,7 @@ switch_status_t send_capabilities_req(listener_t *listener)
 }
 
 switch_status_t send_version(listener_t *listener,
-       char *version)
+               char *version)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.version));
@@ -713,7 +713,7 @@ switch_status_t send_version(listener_t *listener,
 }
 
 switch_status_t send_register_reject(listener_t *listener,
-    char *error)
+               char *error)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.reg_rej));
@@ -724,14 +724,14 @@ switch_status_t send_register_reject(listener_t *listener,
 }
 
 switch_status_t send_open_receive_channel(listener_t *listener,
-       uint32_t conference_id,
-       uint32_t pass_thru_party_id,
-       uint32_t packets,
-       uint32_t payload_capacity,
-       uint32_t echo_cancel_type,
-       uint32_t g723_bitrate,
-       uint32_t conference_id2,
-       uint32_t reserved[10])
+               uint32_t conference_id,
+               uint32_t pass_thru_party_id,
+               uint32_t packets,
+               uint32_t payload_capacity,
+               uint32_t echo_cancel_type,
+               uint32_t g723_bitrate,
+               uint32_t conference_id2,
+               uint32_t reserved[10])
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.open_receive_channel));
@@ -745,24 +745,24 @@ switch_status_t send_open_receive_channel(listener_t *listener,
        message->data.open_receive_channel.g723_bitrate = g723_bitrate;
        message->data.open_receive_channel.conference_id2 = conference_id2;
        /*
-       message->data.open_receive_channel.reserved[0] = reserved[0];
-       message->data.open_receive_channel.reserved[1] = reserved[1];
-       message->data.open_receive_channel.reserved[2] = reserved[2];
-       message->data.open_receive_channel.reserved[3] = reserved[3];
-       message->data.open_receive_channel.reserved[4] = reserved[4];
-       message->data.open_receive_channel.reserved[5] = reserved[5];
-       message->data.open_receive_channel.reserved[6] = reserved[6];
-       message->data.open_receive_channel.reserved[7] = reserved[7];
-       message->data.open_receive_channel.reserved[8] = reserved[8];
-       message->data.open_receive_channel.reserved[9] = reserved[9];
-       */
+          message->data.open_receive_channel.reserved[0] = reserved[0];
+          message->data.open_receive_channel.reserved[1] = reserved[1];
+          message->data.open_receive_channel.reserved[2] = reserved[2];
+          message->data.open_receive_channel.reserved[3] = reserved[3];
+          message->data.open_receive_channel.reserved[4] = reserved[4];
+          message->data.open_receive_channel.reserved[5] = reserved[5];
+          message->data.open_receive_channel.reserved[6] = reserved[6];
+          message->data.open_receive_channel.reserved[7] = reserved[7];
+          message->data.open_receive_channel.reserved[8] = reserved[8];
+          message->data.open_receive_channel.reserved[9] = reserved[9];
+        */
        return skinny_send_reply(listener, message);
 }
 
 switch_status_t send_close_receive_channel(listener_t *listener,
-       uint32_t conference_id,
-       uint32_t pass_thru_party_id,
-       uint32_t conference_id2)
+               uint32_t conference_id,
+               uint32_t pass_thru_party_id,
+               uint32_t conference_id2)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.close_receive_channel));
@@ -775,10 +775,10 @@ switch_status_t send_close_receive_channel(listener_t *listener,
 }
 
 switch_status_t send_select_soft_keys(listener_t *listener,
-       uint32_t line_instance,
-       uint32_t call_id,
-       uint32_t soft_key_set,
-       uint32_t valid_key_mask)
+               uint32_t line_instance,
+               uint32_t call_id,
+               uint32_t soft_key_set,
+               uint32_t valid_key_mask)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.select_soft_keys));
@@ -792,9 +792,9 @@ switch_status_t send_select_soft_keys(listener_t *listener,
 }
 
 switch_status_t send_call_state(listener_t *listener,
-       uint32_t call_state,
-       uint32_t line_instance,
-       uint32_t call_id)
+               uint32_t call_state,
+               uint32_t line_instance,
+               uint32_t call_id)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.call_state));
@@ -807,10 +807,10 @@ switch_status_t send_call_state(listener_t *listener,
 }
 
 switch_status_t send_display_prompt_status(listener_t *listener,
-       uint32_t timeout,
-       const char *display,
-       uint32_t line_instance,
-       uint32_t call_id)
+               uint32_t timeout,
+               const char *display,
+               uint32_t line_instance,
+               uint32_t call_id)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.display_prompt_status));
@@ -824,8 +824,8 @@ switch_status_t send_display_prompt_status(listener_t *listener,
 }
 
 switch_status_t send_clear_prompt_status(listener_t *listener,
-       uint32_t line_instance,
-       uint32_t call_id)
+               uint32_t line_instance,
+               uint32_t call_id)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.clear_prompt_status));
@@ -837,7 +837,7 @@ switch_status_t send_clear_prompt_status(listener_t *listener,
 }
 
 switch_status_t send_activate_call_plane(listener_t *listener,
-       uint32_t line_instance)
+               uint32_t line_instance)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.activate_call_plane));
@@ -848,8 +848,8 @@ switch_status_t send_activate_call_plane(listener_t *listener,
 }
 
 switch_status_t send_back_space_request(listener_t *listener,
-    uint32_t line_instance,
-    uint32_t call_id)
+               uint32_t line_instance,
+               uint32_t call_id)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.back_space_req));
@@ -862,9 +862,9 @@ switch_status_t send_back_space_request(listener_t *listener,
 }
 
 switch_status_t send_dialed_number(listener_t *listener,
-       char called_party[24],
-       uint32_t line_instance,
-       uint32_t call_id)
+               char called_party[24],
+               uint32_t line_instance,
+               uint32_t call_id)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.dialed_number));
@@ -877,9 +877,9 @@ switch_status_t send_dialed_number(listener_t *listener,
 }
 
 switch_status_t send_display_pri_notify(listener_t *listener,
-       uint32_t message_timeout,
-       uint32_t priority,
-       char *notify)
+               uint32_t message_timeout,
+               uint32_t priority,
+               char *notify)
 {
        skinny_message_t *message;
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.display_pri_notify));
@@ -903,12 +903,12 @@ switch_status_t send_reset(listener_t *listener, uint32_t reset_type)
 }
 
 switch_status_t send_data(listener_t *listener, uint32_t message_type,
-       uint32_t application_id,
-       uint32_t line_instance,
-       uint32_t call_id,
-       uint32_t transaction_id,
-       uint32_t data_length,
-       const char *data)
+               uint32_t application_id,
+               uint32_t line_instance,
+               uint32_t call_id,
+               uint32_t transaction_id,
+               uint32_t data_length,
+               const char *data)
 {
        skinny_message_t *message;
        switch_assert(data_length == strlen(data));
@@ -929,17 +929,17 @@ switch_status_t send_data(listener_t *listener, uint32_t message_type,
 }
 
 switch_status_t send_extended_data(listener_t *listener, uint32_t message_type,
-       uint32_t application_id,
-       uint32_t line_instance,
-       uint32_t call_id,
-       uint32_t transaction_id,
-       uint32_t data_length,
-       uint32_t sequence_flag,
-       uint32_t display_priority,
-       uint32_t conference_id,
-       uint32_t app_instance_id,
-       uint32_t routing_id,
-       const char *data)
+               uint32_t application_id,
+               uint32_t line_instance,
+               uint32_t call_id,
+               uint32_t transaction_id,
+               uint32_t data_length,
+               uint32_t sequence_flag,
+               uint32_t display_priority,
+               uint32_t conference_id,
+               uint32_t app_instance_id,
+               uint32_t routing_id,
+               const char *data)
 {
        skinny_message_t *message;
        switch_assert(data_length == strlen(data));
@@ -975,16 +975,16 @@ switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file
        if (listener_is_ready(listener)) {
                if (listener->profile->debug >= 10 || reply->type != KEEP_ALIVE_ACK_MESSAGE) {
                        switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG,
-                               "Sending %s (type=%x,length=%d) to %s:%d.\n",
-                               skinny_message_type2str(reply->type), reply->type, reply->length,
-                               listener->device_name, listener->device_instance);
+                                       "Sending %s (type=%x,length=%d) to %s:%d.\n",
+                                       skinny_message_type2str(reply->type), reply->type, reply->length,
+                                       listener->device_name, listener->device_instance);
                }
                return switch_socket_send(listener->sock, ptr, &len);
        } else {
                switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_WARNING,
-                       "Not sending %s (type=%x,length=%d) to %s:%d while not ready.\n",
-                       skinny_message_type2str(reply->type), reply->type, reply->length,
-                       listener->device_name, listener->device_instance);
+                               "Not sending %s (type=%x,length=%d) to %s:%d while not ready.\n",
+                               skinny_message_type2str(reply->type), reply->type, reply->length,
+                               listener->device_name, listener->device_instance);
                return SWITCH_STATUS_FALSE;
        }
 }
index 1eed6921576468605c99a8008f2edf7eb3a16f0e..de5c8b6a8b20d2d87e2bf0902d6d128660ce3edb 100644 (file)
 /* RegisterMessage */
 #define REGISTER_MESSAGE 0x0001
 struct PACKED register_message {
-    char device_name[16];
-    uint32_t user_id;
-    uint32_t instance;
-    struct in_addr ip;
-    uint32_t device_type;
-    uint32_t max_streams;
+       char device_name[16];
+       uint32_t user_id;
+       uint32_t instance;
+       struct in_addr ip;
+       uint32_t device_type;
+       uint32_t max_streams;
 };
 
 /* PortMessage */
 #define PORT_MESSAGE 0x0002
 struct PACKED port_message {
-    uint16_t port;
+       uint16_t port;
 };
 
 /* KeypadButtonMessage */
 #define KEYPAD_BUTTON_MESSAGE 0x0003
 struct PACKED keypad_button_message {
-    uint32_t button;
-    uint32_t line_instance;
-    uint32_t call_id;
+       uint32_t button;
+       uint32_t line_instance;
+       uint32_t call_id;
 };
 
 /* EnblocCallMessage */
 #define ENBLOC_CALL_MESSAGE 0x0004
 struct PACKED enbloc_call_message {
-    char called_party[24];
-    uint32_t line_instance;
+       char called_party[24];
+       uint32_t line_instance;
 };
 
 /* StimulusMessage */
 #define STIMULUS_MESSAGE 0x0005
 struct PACKED stimulus_message {
-    uint32_t instance_type; /* See enum skinny_button_definition */
-    uint32_t instance;
-    uint32_t call_id;
+       uint32_t instance_type; /* See enum skinny_button_definition */
+       uint32_t instance;
+       uint32_t call_id;
 };
 
 /* OffHookMessage */
 #define OFF_HOOK_MESSAGE 0x0006
 struct PACKED off_hook_message {
-    uint32_t line_instance;
-    uint32_t call_id;
+       uint32_t line_instance;
+       uint32_t call_id;
 };
 
 /* OnHookMessage */
 #define ON_HOOK_MESSAGE 0x0007
 struct PACKED on_hook_message {
-    uint32_t line_instance;
-    uint32_t call_id;
+       uint32_t line_instance;
+       uint32_t call_id;
 };
 
 /* ForwardStatReqMessage */
 #define FORWARD_STAT_REQ_MESSAGE 0x0009
 struct PACKED forward_stat_req_message {
-    uint32_t line_instance;
+       uint32_t line_instance;
 };
 
 /* SpeedDialStatReqMessage */
 #define SPEED_DIAL_STAT_REQ_MESSAGE 0x000A
 struct PACKED speed_dial_stat_req_message {
-    uint32_t number;
+       uint32_t number;
 };
 
 /* LineStatReqMessage */
 #define LINE_STAT_REQ_MESSAGE 0x000B
 struct PACKED line_stat_req_message {
-    uint32_t number;
+       uint32_t number;
 };
 
 /* ConfigStatReqMessage */
@@ -130,32 +130,32 @@ struct PACKED line_stat_req_message {
 /* CapabilitiesResMessage */
 #define CAPABILITIES_RES_MESSAGE 0x0010
 struct PACKED station_capabilities {
-    uint32_t codec;
-    uint16_t max_frames_per_packet;
-    char reserved[10];
+       uint32_t codec;
+       uint16_t max_frames_per_packet;
+       char reserved[10];
 };
 
 struct PACKED capabilities_res_message {
-    uint32_t count;
-    struct station_capabilities caps[SWITCH_MAX_CODECS];
+       uint32_t count;
+       struct station_capabilities caps[SWITCH_MAX_CODECS];
 };
 
 /* AlarmMessage */
 #define ALARM_MESSAGE 0x0020
 struct PACKED alarm_message {
-    uint32_t alarm_severity;
-    char display_message[80];
-    uint32_t alarm_param1;
-    uint32_t alarm_param2;
+       uint32_t alarm_severity;
+       char display_message[80];
+       uint32_t alarm_param1;
+       uint32_t alarm_param2;
 };
 
 /* OpenReceiveChannelAck */
 #define OPEN_RECEIVE_CHANNEL_ACK_MESSAGE 0x0022
 struct PACKED open_receive_channel_ack_message {
-    uint32_t status;
-    struct in_addr ip;
-    uint32_t port;
-    uint32_t pass_thru_party_id;
+       uint32_t status;
+       struct in_addr ip;
+       uint32_t port;
+       uint32_t pass_thru_party_id;
 };
 
 /* SoftKeySetReqMessage */
@@ -164,9 +164,9 @@ struct PACKED open_receive_channel_ack_message {
 /* SoftKeyEventMessage */
 #define SOFT_KEY_EVENT_MESSAGE 0x0026
 struct PACKED soft_key_event_message {
-    uint32_t event; /* See enum skinny_soft_key_event */
-    uint32_t line_instance;
-    uint32_t call_id;
+       uint32_t event; /* See enum skinny_soft_key_event */
+       uint32_t line_instance;
+       uint32_t call_id;
 };
 
 /* UnregisterMessage */
@@ -178,13 +178,13 @@ struct PACKED soft_key_event_message {
 /* HeadsetStatusMessage */
 #define HEADSET_STATUS_MESSAGE 0x002B
 struct PACKED headset_status_message {
-    uint32_t mode; /* 1=HeadsetOn; 2=HeadsetOff */
+       uint32_t mode; /* 1=HeadsetOn; 2=HeadsetOff */
 };
 
 /* RegisterAvailableLinesMessage */
 #define REGISTER_AVAILABLE_LINES_MESSAGE 0x002D
 struct PACKED register_available_lines_message {
-    uint32_t count;
+       uint32_t count;
 };
 
 /* DeviceToUserDataMessage */
@@ -205,13 +205,13 @@ struct PACKED data_message {
 /* ServiceUrlStatReqMessage */
 #define SERVICE_URL_STAT_REQ_MESSAGE 0x0033
 struct PACKED service_url_stat_req_message {
-    uint32_t service_url_index;
+       uint32_t service_url_index;
 };
 
 /* FeatureStatReqMessage */
 #define FEATURE_STAT_REQ_MESSAGE 0x0034
 struct PACKED feature_stat_req_message {
-    uint32_t feature_index;
+       uint32_t feature_index;
 };
 
 /* DeviceToUserDataVersion1Message */
@@ -254,178 +254,178 @@ struct PACKED accessory_status_message {
 /* RegisterAckMessage */
 #define REGISTER_ACK_MESSAGE 0x0081
 struct PACKED register_ack_message {
-    uint32_t keep_alive;
-    char date_format[6];
-    char reserved[2];
-    uint32_t secondary_keep_alive;
-    char reserved2[4];
+       uint32_t keep_alive;
+       char date_format[6];
+       char reserved[2];
+       uint32_t secondary_keep_alive;
+       char reserved2[4];
 };
 
 /* StartToneMessage */
 #define START_TONE_MESSAGE 0x0082
 struct PACKED start_tone_message {
-    uint32_t tone; /* see enum skinny_tone */
-    uint32_t reserved;
-    uint32_t line_instance;
-    uint32_t call_id;
+       uint32_t tone; /* see enum skinny_tone */
+       uint32_t reserved;
+       uint32_t line_instance;
+       uint32_t call_id;
 };
 
 /* StopToneMessage */
 #define STOP_TONE_MESSAGE 0x0083
 struct PACKED stop_tone_message {
-    uint32_t line_instance;
-    uint32_t call_id;
+       uint32_t line_instance;
+       uint32_t call_id;
 };
 
 /* SetRingerMessage */
 #define SET_RINGER_MESSAGE 0x0085
 struct PACKED set_ringer_message {
-    uint32_t ring_type; /* See enum skinny_ring_type */
-    uint32_t ring_mode; /* See enum skinny_ring_mode */
-    uint32_t line_instance;
-    uint32_t call_id;
+       uint32_t ring_type; /* See enum skinny_ring_type */
+       uint32_t ring_mode; /* See enum skinny_ring_mode */
+       uint32_t line_instance;
+       uint32_t call_id;
 };
 
 /* SetLampMessage */
 #define SET_LAMP_MESSAGE 0x0086
 struct PACKED set_lamp_message {
-    uint32_t stimulus; /* See enum skinny_button_definition */
-    uint32_t stimulus_instance;
-    uint32_t mode; /* See enum skinny_lamp_mode */
+       uint32_t stimulus; /* See enum skinny_button_definition */
+       uint32_t stimulus_instance;
+       uint32_t mode; /* See enum skinny_lamp_mode */
 };
 
 /* SetSpeakerModeMessage */
 #define SET_SPEAKER_MODE_MESSAGE 0x0088
 struct PACKED set_speaker_mode_message {
-    uint32_t mode; /* See enum skinny_speaker_mode */
+       uint32_t mode; /* See enum skinny_speaker_mode */
 };
 
 /* StartMediaTransmissionMessage */
 #define START_MEDIA_TRANSMISSION_MESSAGE 0x008A
 struct PACKED start_media_transmission_message {
-    uint32_t conference_id;
-    uint32_t pass_thru_party_id;
-    uint32_t remote_ip;
-    uint32_t remote_port;
-    uint32_t ms_per_packet;
-    uint32_t payload_capacity;
-    uint32_t precedence;
-    uint32_t silence_suppression;
-    uint16_t max_frames_per_packet;
-    uint16_t unknown1;
-    uint32_t g723_bitrate;
-    /* ... */
+       uint32_t conference_id;
+       uint32_t pass_thru_party_id;
+       uint32_t remote_ip;
+       uint32_t remote_port;
+       uint32_t ms_per_packet;
+       uint32_t payload_capacity;
+       uint32_t precedence;
+       uint32_t silence_suppression;
+       uint16_t max_frames_per_packet;
+       uint16_t unknown1;
+       uint32_t g723_bitrate;
+       /* ... */
 };
 
 /* StopMediaTransmissionMessage */
 #define STOP_MEDIA_TRANSMISSION_MESSAGE 0x008B
 struct PACKED stop_media_transmission_message {
-    uint32_t conference_id;
-    uint32_t pass_thru_party_id;
-    uint32_t conference_id2;
-    /* ... */
+       uint32_t conference_id;
+       uint32_t pass_thru_party_id;
+       uint32_t conference_id2;
+       /* ... */
 };
 
 /* CallInfoMessage */
 #define CALL_INFO_MESSAGE 0x008F
 struct PACKED call_info_message {
-    char calling_party_name[40];
-    char calling_party[24];
-    char called_party_name[40];
-    char called_party[24];
-    uint32_t line_instance;
-    uint32_t call_id;
-    uint32_t call_type; /* See enum skinny_call_type */
-    char original_called_party_name[40];
-    char original_called_party[24];
-    char last_redirecting_party_name[40];
-    char last_redirecting_party[24];
-    uint32_t original_called_party_redirect_reason;
-    uint32_t last_redirecting_reason;
-    char calling_party_voice_mailbox[24];
-    char called_party_voice_mailbox[24];
-    char original_called_party_voice_mailbox[24];
-    char last_redirecting_voice_mailbox[24];
-    uint32_t call_instance;
-    uint32_t call_security_status;
-    uint32_t party_pi_restriction_bits;
+       char calling_party_name[40];
+       char calling_party[24];
+       char called_party_name[40];
+       char called_party[24];
+       uint32_t line_instance;
+       uint32_t call_id;
+       uint32_t call_type; /* See enum skinny_call_type */
+       char original_called_party_name[40];
+       char original_called_party[24];
+       char last_redirecting_party_name[40];
+       char last_redirecting_party[24];
+       uint32_t original_called_party_redirect_reason;
+       uint32_t last_redirecting_reason;
+       char calling_party_voice_mailbox[24];
+       char called_party_voice_mailbox[24];
+       char original_called_party_voice_mailbox[24];
+       char last_redirecting_voice_mailbox[24];
+       uint32_t call_instance;
+       uint32_t call_security_status;
+       uint32_t party_pi_restriction_bits;
 };
 
 /* ForwardStatMessage */
 #define FORWARD_STAT_MESSAGE 0x0090
 struct PACKED forward_stat_message {
-    uint32_t active_forward;
-    uint32_t line_instance;
-    uint32_t forward_all_active;
-    char forward_all_number[24];
-    uint32_t forward_busy_active;
-    char forward_busy_number[24];
-    uint32_t forward_noanswer_active;
-    char forward_noanswer_number[24];
+       uint32_t active_forward;
+       uint32_t line_instance;
+       uint32_t forward_all_active;
+       char forward_all_number[24];
+       uint32_t forward_busy_active;
+       char forward_busy_number[24];
+       uint32_t forward_noanswer_active;
+       char forward_noanswer_number[24];
 };
 
 /* SpeedDialStatMessage */
 #define SPEED_DIAL_STAT_RES_MESSAGE 0x0091
 struct PACKED speed_dial_stat_res_message {
-    uint32_t number;
-    char line[24];
-    char label[40];
+       uint32_t number;
+       char line[24];
+       char label[40];
 };
 
 /* LineStatMessage */
 #define LINE_STAT_RES_MESSAGE 0x0092
 struct PACKED line_stat_res_message {
-    uint32_t number;
-    char name[24];
-    char shortname[40];
-    char displayname[44];
+       uint32_t number;
+       char name[24];
+       char shortname[40];
+       char displayname[44];
 };
 
 /* ConfigStatMessage */
 #define CONFIG_STAT_RES_MESSAGE 0x0093
 struct PACKED config_stat_res_message {
-    char device_name[16];
-    uint32_t user_id;
-    uint32_t instance;
-    char user_name[40];
-    char server_name[40];
-    uint32_t number_lines;
-    uint32_t number_speed_dials;
+       char device_name[16];
+       uint32_t user_id;
+       uint32_t instance;
+       char user_name[40];
+       char server_name[40];
+       uint32_t number_lines;
+       uint32_t number_speed_dials;
 };
 
 /* DefineTimeDate */
 #define DEFINE_TIME_DATE_MESSAGE 0x0094
 struct PACKED define_time_date_message {
-    uint32_t year;
-    uint32_t month;
-    uint32_t day_of_week; /* monday = 1 */
-    uint32_t day;
-    uint32_t hour;
-    uint32_t minute;
-    uint32_t seconds;
-    uint32_t milliseconds;
-    uint32_t timestamp;
+       uint32_t year;
+       uint32_t month;
+       uint32_t day_of_week; /* monday = 1 */
+       uint32_t day;
+       uint32_t hour;
+       uint32_t minute;
+       uint32_t seconds;
+       uint32_t milliseconds;
+       uint32_t timestamp;
 };
 
 /* ButtonTemplateMessage */
 #define BUTTON_TEMPLATE_RES_MESSAGE 0x0097
 struct PACKED button_definition {
-    uint8_t instance_number;
-    uint8_t button_definition; /* See enum skinny_button_definition */
+       uint8_t instance_number;
+       uint8_t button_definition; /* See enum skinny_button_definition */
 };
 
 #define SKINNY_MAX_BUTTON_COUNT 42
 struct PACKED button_template_message {
-    uint32_t button_offset;
-    uint32_t button_count;
-    uint32_t total_button_count;
-    struct button_definition btn[SKINNY_MAX_BUTTON_COUNT];
+       uint32_t button_offset;
+       uint32_t button_count;
+       uint32_t total_button_count;
+       struct button_definition btn[SKINNY_MAX_BUTTON_COUNT];
 };
 
 /* VersionMessage */
 #define VERSION_MESSAGE 0x0098
 struct PACKED version_message {
-    char version[16];
+       char version[16];
 };
 
 /* CapabilitiesReqMessage */
@@ -434,13 +434,13 @@ struct PACKED version_message {
 /* RegisterRejectMessage */
 #define REGISTER_REJECT_MESSAGE 0x009D
 struct PACKED register_reject_message {
-    char error[33];
+       char error[33];
 };
 
 /* ResetMessage */
 #define RESET_MESSAGE 0x009F
 struct PACKED reset_message {
-    uint32_t reset_type; /* See enum skinny_device_reset_types */
+       uint32_t reset_type; /* See enum skinny_device_reset_types */
 };
 
 /* KeepAliveAckMessage */
@@ -449,112 +449,112 @@ struct PACKED reset_message {
 /* OpenReceiveChannelMessage */
 #define OPEN_RECEIVE_CHANNEL_MESSAGE 0x0105
 struct PACKED open_receive_channel_message {
-    uint32_t conference_id;
-    uint32_t pass_thru_party_id;
-    uint32_t packets;
-    uint32_t payload_capacity;
-    uint32_t echo_cancel_type;
-    uint32_t g723_bitrate;
-    uint32_t conference_id2;
-    uint32_t reserved[10];
+       uint32_t conference_id;
+       uint32_t pass_thru_party_id;
+       uint32_t packets;
+       uint32_t payload_capacity;
+       uint32_t echo_cancel_type;
+       uint32_t g723_bitrate;
+       uint32_t conference_id2;
+       uint32_t reserved[10];
 };
 
 /* CloseReceiveChannelMessage */
 #define CLOSE_RECEIVE_CHANNEL_MESSAGE 0x0106
 struct PACKED close_receive_channel_message {
-    uint32_t conference_id;
-    uint32_t pass_thru_party_id;
-    uint32_t conference_id2;
+       uint32_t conference_id;
+       uint32_t pass_thru_party_id;
+       uint32_t conference_id2;
 };
 
 /* SoftKeyTemplateResMessage */
 #define SOFT_KEY_TEMPLATE_RES_MESSAGE 0x0108
 
 struct PACKED soft_key_template_definition {
-    char soft_key_label[16];
-    uint32_t soft_key_event;
+       char soft_key_label[16];
+       uint32_t soft_key_event;
 };
 
 struct PACKED soft_key_template_res_message {
-    uint32_t soft_key_offset;
-    uint32_t soft_key_count;
-    uint32_t total_soft_key_count;
-    struct soft_key_template_definition soft_key[32];
+       uint32_t soft_key_offset;
+       uint32_t soft_key_count;
+       uint32_t total_soft_key_count;
+       struct soft_key_template_definition soft_key[32];
 };
 
 /* SoftKeySetResMessage */
 #define SOFT_KEY_SET_RES_MESSAGE 0x0109
 struct PACKED soft_key_set_definition {
-    uint8_t soft_key_template_index[16]; /* See enum skinny_soft_key_event */
-    uint16_t soft_key_info_index[16];
+       uint8_t soft_key_template_index[16]; /* See enum skinny_soft_key_event */
+       uint16_t soft_key_info_index[16];
 };
 
 struct PACKED soft_key_set_res_message {
-    uint32_t soft_key_set_offset;
-    uint32_t soft_key_set_count;
-    uint32_t total_soft_key_set_count;
-    struct soft_key_set_definition soft_key_set[16];
-    uint32_t res;
+       uint32_t soft_key_set_offset;
+       uint32_t soft_key_set_count;
+       uint32_t total_soft_key_set_count;
+       struct soft_key_set_definition soft_key_set[16];
+       uint32_t res;
 };
 
 /* SelectSoftKeysMessage */
 #define SELECT_SOFT_KEYS_MESSAGE 0x0110
 struct PACKED select_soft_keys_message {
-    uint32_t line_instance;
-    uint32_t call_id;
-    uint32_t soft_key_set; /* See enum skinny_key_set */
-    uint32_t valid_key_mask;
+       uint32_t line_instance;
+       uint32_t call_id;
+       uint32_t soft_key_set; /* See enum skinny_key_set */
+       uint32_t valid_key_mask;
 };
 
 /* CallStateMessage */
 #define CALL_STATE_MESSAGE 0x0111
 struct PACKED call_state_message {
-    uint32_t call_state; /* See enum skinny_call_state */
-    uint32_t line_instance;
-    uint32_t call_id;
+       uint32_t call_state; /* See enum skinny_call_state */
+       uint32_t line_instance;
+       uint32_t call_id;
 };
 
 /* DisplayPromptStatusMessage */
 #define DISPLAY_PROMPT_STATUS_MESSAGE 0x0112
 struct PACKED display_prompt_status_message {
-    uint32_t timeout;
-    char display[32];
-    uint32_t line_instance;
-    uint32_t call_id;
+       uint32_t timeout;
+       char display[32];
+       uint32_t line_instance;
+       uint32_t call_id;
 };
 
 /* ClearPromptStatusMessage */
 #define CLEAR_PROMPT_STATUS_MESSAGE 0x0113
 struct PACKED clear_prompt_status_message {
-    uint32_t line_instance;
-    uint32_t call_id;
+       uint32_t line_instance;
+       uint32_t call_id;
 };
 
 /* ActivateCallPlaneMessage */
 #define ACTIVATE_CALL_PLANE_MESSAGE 0x0116
 struct PACKED activate_call_plane_message {
-    uint32_t line_instance;
+       uint32_t line_instance;
 };
 
 /* UnregisterAckMessage */
 #define UNREGISTER_ACK_MESSAGE 0x0118
 struct PACKED unregister_ack_message {
-    uint32_t unregister_status;
+       uint32_t unregister_status;
 };
 
 /* BackSpaceReqMessage */
 #define BACK_SPACE_REQ_MESSAGE 0x0119
 struct PACKED back_space_req_message {
-    uint32_t line_instance;
-    uint32_t call_id;
+       uint32_t line_instance;
+       uint32_t call_id;
 };
 
 /* DialedNumberMessage */
 #define DIALED_NUMBER_MESSAGE 0x011D
 struct PACKED dialed_number_message {
-    char called_party[24];
-    uint32_t line_instance;
-    uint32_t call_id;
+       char called_party[24];
+       uint32_t line_instance;
+       uint32_t call_id;
 };
 
 /* UserToDeviceDataMessage */
@@ -564,26 +564,26 @@ struct PACKED dialed_number_message {
 /* FeatureStatMessage */
 #define FEATURE_STAT_RES_MESSAGE 0x011F
 struct PACKED feature_stat_res_message {
-    uint32_t index;
-    uint32_t id;
-    char text_label[40];
-    uint32_t status;
+       uint32_t index;
+       uint32_t id;
+       char text_label[40];
+       uint32_t status;
 };
 
 /* DisplayPriNotifyMessage */
 #define DISPLAY_PRI_NOTIFY_MESSAGE 0x0120
 struct PACKED display_pri_notify_message {
-    uint32_t message_timeout;
-    uint32_t priority;
-    char notify[32];
+       uint32_t message_timeout;
+       uint32_t priority;
+       char notify[32];
 };
 
 /* ServiceUrlStatMessage */
 #define SERVICE_URL_STAT_RES_MESSAGE 0x012F
 struct PACKED service_url_stat_res_message {
-    uint32_t index;
-    char url[256];
-    char display_name[40];
+       uint32_t index;
+       char url[256];
+       char display_name[40];
 };
 
 /* UserToDeviceDataVersion1Message */
@@ -694,10 +694,10 @@ union skinny_data {
  * length is length of body
  */
 struct PACKED skinny_message {
-    uint32_t length;
-    uint32_t version;
-    uint32_t type;
-    union skinny_data data;
+       uint32_t length;
+       uint32_t version;
+       uint32_t type;
+       union skinny_data data;
 };
 typedef struct skinny_message skinny_message_t;
 
@@ -705,40 +705,40 @@ typedef struct skinny_message skinny_message_t;
 /* SKINNY TYPES */
 /*****************************************************************************/
 enum skinny_codecs {
-    SKINNY_CODEC_ALAW_64K = 2,
-    SKINNY_CODEC_ALAW_56K = 3,
-    SKINNY_CODEC_ULAW_64K = 4,
-    SKINNY_CODEC_ULAW_56K = 5,
-    SKINNY_CODEC_G722_64K = 6,
-    SKINNY_CODEC_G722_56K = 7,
-    SKINNY_CODEC_G722_48K = 8,
-    SKINNY_CODEC_G723_1 = 9,
-    SKINNY_CODEC_G728 = 10,
-    SKINNY_CODEC_G729 = 11,
-    SKINNY_CODEC_G729A = 12,
-    SKINNY_CODEC_IS11172 = 13,
-    SKINNY_CODEC_IS13818 = 14,
-    SKINNY_CODEC_G729B = 15,
-    SKINNY_CODEC_G729AB = 16,
-    SKINNY_CODEC_GSM_FULL = 18,
-    SKINNY_CODEC_GSM_HALF = 19,
-    SKINNY_CODEC_GSM_EFULL = 20,
-    SKINNY_CODEC_WIDEBAND_256K = 25,
-    SKINNY_CODEC_DATA_64K = 32,
-    SKINNY_CODEC_DATA_56K = 33,
-    SKINNY_CODEC_GSM = 80,
-    SKINNY_CODEC_ACTIVEVOICE = 81,
-    SKINNY_CODEC_G726_32K = 82,
-    SKINNY_CODEC_G726_24K = 83,
-    SKINNY_CODEC_G726_16K = 84,
-    SKINNY_CODEC_G729B_BIS = 85,
-    SKINNY_CODEC_G729B_LOW = 86,
-    SKINNY_CODEC_H261 = 100,
-    SKINNY_CODEC_H263 = 101,
-    SKINNY_CODEC_VIDEO = 102,
-    SKINNY_CODEC_T120 = 105,
-    SKINNY_CODEC_H224 = 106,
-    SKINNY_CODEC_RFC2833_DYNPAYLOAD = 257
+       SKINNY_CODEC_ALAW_64K = 2,
+       SKINNY_CODEC_ALAW_56K = 3,
+       SKINNY_CODEC_ULAW_64K = 4,
+       SKINNY_CODEC_ULAW_56K = 5,
+       SKINNY_CODEC_G722_64K = 6,
+       SKINNY_CODEC_G722_56K = 7,
+       SKINNY_CODEC_G722_48K = 8,
+       SKINNY_CODEC_G723_1 = 9,
+       SKINNY_CODEC_G728 = 10,
+       SKINNY_CODEC_G729 = 11,
+       SKINNY_CODEC_G729A = 12,
+       SKINNY_CODEC_IS11172 = 13,
+       SKINNY_CODEC_IS13818 = 14,
+       SKINNY_CODEC_G729B = 15,
+       SKINNY_CODEC_G729AB = 16,
+       SKINNY_CODEC_GSM_FULL = 18,
+       SKINNY_CODEC_GSM_HALF = 19,
+       SKINNY_CODEC_GSM_EFULL = 20,
+       SKINNY_CODEC_WIDEBAND_256K = 25,
+       SKINNY_CODEC_DATA_64K = 32,
+       SKINNY_CODEC_DATA_56K = 33,
+       SKINNY_CODEC_GSM = 80,
+       SKINNY_CODEC_ACTIVEVOICE = 81,
+       SKINNY_CODEC_G726_32K = 82,
+       SKINNY_CODEC_G726_24K = 83,
+       SKINNY_CODEC_G726_16K = 84,
+       SKINNY_CODEC_G729B_BIS = 85,
+       SKINNY_CODEC_G729B_LOW = 86,
+       SKINNY_CODEC_H261 = 100,
+       SKINNY_CODEC_H263 = 101,
+       SKINNY_CODEC_VIDEO = 102,
+       SKINNY_CODEC_T120 = 105,
+       SKINNY_CODEC_H224 = 106,
+       SKINNY_CODEC_RFC2833_DYNPAYLOAD = 257
 };
 
 char* skinny_codec2string(enum skinny_codecs skinnycodec);
@@ -747,15 +747,15 @@ char* skinny_codec2string(enum skinny_codecs skinnycodec);
 /* SKINNY FUNCTIONS */
 /*****************************************************************************/
 #define skinny_check_data_length(message, len) \
-    if (message->length < len+4) {\
+       if (message->length < len+4) {\
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,\
-                       "Received Too Short Skinny Message %s (type=%x,length=%d), expected %" SWITCH_SIZE_T_FMT ".\n",\
-                       skinny_message_type2str(request->type), request->type, request->length,\
-               len+4);\
-           return SWITCH_STATUS_FALSE;\
-    }
+                               "Received Too Short Skinny Message %s (type=%x,length=%d), expected %" SWITCH_SIZE_T_FMT ".\n",\
+                               skinny_message_type2str(request->type), request->type, request->length,\
+                               len+4);\
+               return SWITCH_STATUS_FALSE;\
+       }
 #define skinny_check_data_length_soft(message, len) \
-    (message->length >= len+4)
+       (message->length >= len+4)
 
 switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req);
 
@@ -777,148 +777,148 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re
 /* SKINNY MESSAGE HELPER */
 /*****************************************************************************/
 switch_status_t send_register_ack(listener_t *listener,
-    uint32_t keep_alive,
-    char *date_format,
-    char *reserved,
-    uint32_t secondary_keep_alive,
-    char *reserved2);
+               uint32_t keep_alive,
+               char *date_format,
+               char *reserved,
+               uint32_t secondary_keep_alive,
+               char *reserved2);
 switch_status_t send_start_tone(listener_t *listener,
-    uint32_t tone,
-    uint32_t reserved,
-    uint32_t line_instance,
-    uint32_t call_id);
+               uint32_t tone,
+               uint32_t reserved,
+               uint32_t line_instance,
+               uint32_t call_id);
 switch_status_t send_stop_tone(listener_t *listener,
-    uint32_t line_instance,
-    uint32_t call_id);
+               uint32_t line_instance,
+               uint32_t call_id);
 switch_status_t send_set_ringer(listener_t *listener,
-    uint32_t ring_type,
-    uint32_t ring_mode,
-    uint32_t line_instance,
-    uint32_t call_id);
+               uint32_t ring_type,
+               uint32_t ring_mode,
+               uint32_t line_instance,
+               uint32_t call_id);
 switch_status_t send_set_lamp(listener_t *listener,
-    uint32_t stimulus,
-    uint32_t stimulus_instance,
-    uint32_t mode);
+               uint32_t stimulus,
+               uint32_t stimulus_instance,
+               uint32_t mode);
 switch_status_t send_set_speaker_mode(listener_t *listener,
-    uint32_t mode);
+               uint32_t mode);
 switch_status_t send_start_media_transmission(listener_t *listener,
-    uint32_t conference_id,
-    uint32_t pass_thru_party_id,
-    uint32_t remote_ip,
-    uint32_t remote_port,
-    uint32_t ms_per_packet,
-    uint32_t payload_capacity,
-    uint32_t precedence,
-    uint32_t silence_suppression,
-    uint16_t max_frames_per_packet,
-    uint32_t g723_bitrate);
+               uint32_t conference_id,
+               uint32_t pass_thru_party_id,
+               uint32_t remote_ip,
+               uint32_t remote_port,
+               uint32_t ms_per_packet,
+               uint32_t payload_capacity,
+               uint32_t precedence,
+               uint32_t silence_suppression,
+               uint16_t max_frames_per_packet,
+               uint32_t g723_bitrate);
 switch_status_t send_stop_media_transmission(listener_t *listener,
-    uint32_t conference_id,
-    uint32_t pass_thru_party_id,
-    uint32_t conference_id2);
+               uint32_t conference_id,
+               uint32_t pass_thru_party_id,
+               uint32_t conference_id2);
 switch_status_t skinny_send_call_info(listener_t *listener,
-        const char *calling_party_name,
-        const char *calling_party,
-        const char *called_party_name,
-        const char *called_party,
-        uint32_t line_instance,
-        uint32_t call_id,
-        uint32_t call_type,
-        const char *original_called_party_name,
-        const char *original_called_party,
-        const char *last_redirecting_party_name,
-        const char *last_redirecting_party,
-        uint32_t original_called_party_redirect_reason,
-        uint32_t last_redirecting_reason,
-        const char *calling_party_voice_mailbox,
-        const char *called_party_voice_mailbox,
-        const char *original_called_party_voice_mailbox,
-        const char *last_redirecting_voice_mailbox,
-        uint32_t call_instance,
-        uint32_t call_security_status,
-        uint32_t party_pi_restriction_bits);
+               const char *calling_party_name,
+               const char *calling_party,
+               const char *called_party_name,
+               const char *called_party,
+               uint32_t line_instance,
+               uint32_t call_id,
+               uint32_t call_type,
+               const char *original_called_party_name,
+               const char *original_called_party,
+               const char *last_redirecting_party_name,
+               const char *last_redirecting_party,
+               uint32_t original_called_party_redirect_reason,
+               uint32_t last_redirecting_reason,
+               const char *calling_party_voice_mailbox,
+               const char *called_party_voice_mailbox,
+               const char *original_called_party_voice_mailbox,
+               const char *last_redirecting_voice_mailbox,
+               uint32_t call_instance,
+               uint32_t call_security_status,
+               uint32_t party_pi_restriction_bits);
 switch_status_t send_define_time_date(listener_t *listener,
-       uint32_t year,
-       uint32_t month,
-       uint32_t day_of_week, /* monday = 1 */
-       uint32_t day,
-       uint32_t hour,
-       uint32_t minute,
-       uint32_t seconds,
-       uint32_t milliseconds,
-       uint32_t timestamp);
+               uint32_t year,
+               uint32_t month,
+               uint32_t day_of_week, /* monday = 1 */
+               uint32_t day,
+               uint32_t hour,
+               uint32_t minute,
+               uint32_t seconds,
+               uint32_t milliseconds,
+               uint32_t timestamp);
 switch_status_t send_define_current_time_date(listener_t *listener);
 switch_status_t send_version(listener_t *listener,
-    char *version);
+               char *version);
 switch_status_t send_capabilities_req(listener_t *listener);
 switch_status_t send_register_reject(listener_t *listener,
-    char *error);
+               char *error);
 switch_status_t send_open_receive_channel(listener_t *listener,
-    uint32_t conference_id,
-    uint32_t pass_thru_party_id,
-    uint32_t packets,
-    uint32_t payload_capacity,
-    uint32_t echo_cancel_type,
-    uint32_t g723_bitrate,
-    uint32_t conference_id2,
-    uint32_t reserved[10]);
+               uint32_t conference_id,
+               uint32_t pass_thru_party_id,
+               uint32_t packets,
+               uint32_t payload_capacity,
+               uint32_t echo_cancel_type,
+               uint32_t g723_bitrate,
+               uint32_t conference_id2,
+               uint32_t reserved[10]);
 switch_status_t send_close_receive_channel(listener_t *listener,
-    uint32_t conference_id,
-    uint32_t pass_thru_party_id,
-    uint32_t conference_id2);
+               uint32_t conference_id,
+               uint32_t pass_thru_party_id,
+               uint32_t conference_id2);
 switch_status_t send_select_soft_keys(listener_t *listener,
-    uint32_t line_instance,
-    uint32_t call_id,
-    uint32_t soft_key_set,
-    uint32_t valid_key_mask);
+               uint32_t line_instance,
+               uint32_t call_id,
+               uint32_t soft_key_set,
+               uint32_t valid_key_mask);
 switch_status_t send_call_state(listener_t *listener,
-    uint32_t call_state,
-    uint32_t line_instance,
-    uint32_t call_id);
+               uint32_t call_state,
+               uint32_t line_instance,
+               uint32_t call_id);
 switch_status_t send_display_prompt_status(listener_t *listener,
-    uint32_t timeout,
-    const char *display,
-    uint32_t line_instance,
-    uint32_t call_id);
+               uint32_t timeout,
+               const char *display,
+               uint32_t line_instance,
+               uint32_t call_id);
 switch_status_t send_clear_prompt_status(listener_t *listener,
-    uint32_t line_instance,
-    uint32_t call_id);
+               uint32_t line_instance,
+               uint32_t call_id);
 switch_status_t send_activate_call_plane(listener_t *listener,
-    uint32_t line_instance);
+               uint32_t line_instance);
 switch_status_t send_back_space_request(listener_t *listener,
-    uint32_t line_instance,
-    uint32_t call_id);
+               uint32_t line_instance,
+               uint32_t call_id);
 switch_status_t send_dialed_number(listener_t *listener,
-    char called_party[24],
-    uint32_t line_instance,
-    uint32_t call_id);
+               char called_party[24],
+               uint32_t line_instance,
+               uint32_t call_id);
 switch_status_t send_display_pri_notify(listener_t *listener,
-    uint32_t message_timeout,
-    uint32_t priority,
-    char *notify);
+               uint32_t message_timeout,
+               uint32_t priority,
+               char *notify);
 switch_status_t send_reset(listener_t *listener,
-    uint32_t reset_type);
+               uint32_t reset_type);
 
 switch_status_t send_data(listener_t *listener, uint32_t message_type,
-       uint32_t application_id,
-       uint32_t line_instance,
-       uint32_t call_id,
-       uint32_t transaction_id,
-       uint32_t data_length,
-       const char *data);
+               uint32_t application_id,
+               uint32_t line_instance,
+               uint32_t call_id,
+               uint32_t transaction_id,
+               uint32_t data_length,
+               const char *data);
 
 switch_status_t send_extended_data(listener_t *listener, uint32_t message_type,
-       uint32_t application_id,
-       uint32_t line_instance,
-       uint32_t call_id,
-       uint32_t transaction_id,
-       uint32_t data_length,
-       uint32_t sequence_flag,
-       uint32_t display_priority,
-       uint32_t conference_id,
-       uint32_t app_instance_id,
-       uint32_t routing_id,
-       const char *data);
+               uint32_t application_id,
+               uint32_t line_instance,
+               uint32_t call_id,
+               uint32_t transaction_id,
+               uint32_t data_length,
+               uint32_t sequence_flag,
+               uint32_t display_priority,
+               uint32_t conference_id,
+               uint32_t app_instance_id,
+               uint32_t routing_id,
+               const char *data);
 
 #endif /* _SKINNY_PROTOCOL_H */
 
index a7445a1b18c0bb2baafa2fb78491aef237b048ba..00ec6fa56b49b6a47cba1e1a272d26713258fb74 100644 (file)
@@ -74,37 +74,37 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l
 
        line_instance = *line_instance_p;
        if((nsession = skinny_profile_find_session(listener->profile, listener, line_instance_p, 0))) {
-           if(skinny_line_get_state(listener, *line_instance_p, 0) == SKINNY_OFF_HOOK) {
-               /* Reuse existing session */
-               *session = nsession;
-               return SWITCH_STATUS_SUCCESS;
-           }
-           switch_core_session_rwunlock(nsession);
+               if(skinny_line_get_state(listener, *line_instance_p, 0) == SKINNY_OFF_HOOK) {
+                       /* Reuse existing session */
+                       *session = nsession;
+                       return SWITCH_STATUS_SUCCESS;
+               }
+               switch_core_session_rwunlock(nsession);
        }
        *line_instance_p = line_instance;
        if(*line_instance_p == 0) {
-           *line_instance_p = 1;
+               *line_instance_p = 1;
        }
 
-    skinny_hold_active_calls(listener);
-    
+       skinny_hold_active_calls(listener);
+
        skinny_line_get(listener, *line_instance_p, &button);
 
        if (!button || !button->shortname) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Line %d not found on device %s %d\n",
-                   *line_instance_p, listener->device_name, listener->device_instance);
+                               *line_instance_p, listener->device_name, listener->device_instance);
                goto error;
        }
 
        if (!(nsession = switch_core_session_request(skinny_get_endpoint_interface(),
-               SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL))) {
+                                       SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n");
                goto error;
        }
 
        if (!(tech_pvt = (struct private_object *) switch_core_session_alloc(nsession, sizeof(*tech_pvt)))) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(nsession), SWITCH_LOG_CRIT, 
-                   "Error Creating Session private object\n");
+                               "Error Creating Session private object\n");
                goto error;
        }
 
@@ -115,42 +115,42 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l
        channel = switch_core_session_get_channel(nsession);
 
        snprintf(name, sizeof(name), "SKINNY/%s/%s:%d/%d", listener->profile->name, 
-           listener->device_name, listener->device_instance, *line_instance_p);
+                       listener->device_name, listener->device_instance, *line_instance_p);
        switch_channel_set_name(channel, name);
 
        if (switch_core_session_thread_launch(nsession) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(nsession), SWITCH_LOG_CRIT, 
-                   "Error Creating Session thread\n");
+                               "Error Creating Session thread\n");
                goto error;
        }
        if (switch_core_session_read_lock(nsession) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(nsession), SWITCH_LOG_CRIT, 
-                   "Error Locking Session\n");
+                               "Error Locking Session\n");
                goto error;
        }
        /* First create the caller profile in the patterns Dialplan */
        if (!(tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(nsession),
-                                                                                                                 NULL, listener->profile->patterns_dialplan, 
-                                                                                                                 button->displayname, button->shortname, 
-                                                                                                                 listener->remote_ip, NULL, NULL, NULL,
-                                                                                                                 "skinny" /* modname */,
-                                                                                                                 listener->profile->patterns_context, 
-                                                                                                                 "")) != 0) {
-           switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(nsession), SWITCH_LOG_CRIT, 
-                               "Error Creating Session caller profile\n");
+                                       NULL, listener->profile->patterns_dialplan, 
+                                       button->displayname, button->shortname, 
+                                       listener->remote_ip, NULL, NULL, NULL,
+                                       "skinny" /* modname */,
+                                       listener->profile->patterns_context, 
+                                       "")) != 0) {
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(nsession), SWITCH_LOG_CRIT,
+                               "Error Creating Session caller profile\n");
                goto error;
        }
 
        switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
 
        if ((sql = switch_mprintf(
-                       "INSERT INTO skinny_active_lines "
-                               "(device_name, device_instance, line_instance, channel_uuid, call_id, call_state) "
-                               "SELECT device_name, device_instance, line_instance, '%s', %d, %d "
-                               "FROM skinny_lines "
-                               "WHERE value='%s'",
-                       switch_core_session_get_uuid(nsession), tech_pvt->call_id, SKINNY_ON_HOOK, button->shortname
-                       ))) {
+                                       "INSERT INTO skinny_active_lines "
+                                       "(device_name, device_instance, line_instance, channel_uuid, call_id, call_state) "
+                                       "SELECT device_name, device_instance, line_instance, '%s', %d, %d "
+                                       "FROM skinny_lines "
+                                       "WHERE value='%s'",
+                                       switch_core_session_get_uuid(nsession), tech_pvt->call_id, SKINNY_ON_HOOK, button->shortname
+                                ))) {
                skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex);
                switch_safe_free(sql);
        }
@@ -162,13 +162,13 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l
        skinny_line_set_state(listener, *line_instance_p, tech_pvt->call_id, SKINNY_OFF_HOOK);
        send_select_soft_keys(listener, *line_instance_p, tech_pvt->call_id, SKINNY_KEY_SET_OFF_HOOK, 0xffff);
        send_display_prompt_status(listener, 0, "\200\000",
-               *line_instance_p, tech_pvt->call_id);
+                       *line_instance_p, tech_pvt->call_id);
        send_activate_call_plane(listener, *line_instance_p);
        if (switch_channel_get_state(channel) == CS_NEW) {
                switch_channel_set_state(channel, CS_HIBERNATE);
        } else {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(nsession), SWITCH_LOG_CRIT, 
-                   "Wow! this channel should be in CS_NEW state, but it is not!\n");
+                               "Wow! this channel should be in CS_NEW state, but it is not!\n");
        }
 
        goto done;
@@ -193,7 +193,7 @@ skinny_action_t skinny_session_dest_match_pattern(switch_core_session_t *session
        private_t *tech_pvt = NULL;
 
        switch_assert(session);
-       
+
        channel = switch_core_session_get_channel(session);
        tech_pvt = switch_core_session_get_private(session);
 
@@ -247,7 +247,7 @@ found:
                                *data = switch_core_session_strdup(session, current_application->application_data);
                        } else {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
-                                                       "Unknown skinny dialplan application %s\n", current_application->application_name);
+                                               "Unknown skinny dialplan application %s\n", current_application->application_name);
                        }
                }
        }
@@ -263,13 +263,13 @@ switch_status_t skinny_session_process_dest(switch_core_session_t *session, list
        switch_assert(session);
        switch_assert(listener);
        switch_assert(listener->profile);
-       
+
        channel = switch_core_session_get_channel(session);
        tech_pvt = switch_core_session_get_private(session);
 
        if (!dest) {
-        if (strlen(tech_pvt->caller_profile->destination_number) == 0) {/* no digit yet */
-                   send_start_tone(listener, SKINNY_TONE_DIALTONE, 0, line_instance, tech_pvt->call_id);
+               if (strlen(tech_pvt->caller_profile->destination_number) == 0) {/* no digit yet */
+                       send_start_tone(listener, SKINNY_TONE_DIALTONE, 0, line_instance, tech_pvt->call_id);
                }
                if (backspace) { /* backspace */
                        tech_pvt->caller_profile->destination_number[strlen(tech_pvt->caller_profile->destination_number)-1] = '\0';
@@ -278,23 +278,22 @@ switch_status_t skinny_session_process_dest(switch_core_session_t *session, list
                        }
                        send_back_space_request(listener, line_instance, tech_pvt->call_id);
                }
-           if (append_dest != '\0') {/* append digit */
-               tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool,
-                   "%s%c", tech_pvt->caller_profile->destination_number, append_dest);
-           }
+               if (append_dest != '\0') {/* append digit */
+                       tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool,
+                                       "%s%c", tech_pvt->caller_profile->destination_number, append_dest);
+               }
                if (strlen(tech_pvt->caller_profile->destination_number) == 1) {/* first digit */
                        if(!backspace) {
-                       send_stop_tone(listener, line_instance, tech_pvt->call_id);
-               }
-            send_select_soft_keys(listener, line_instance, tech_pvt->call_id,
-                SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT, 0xffff);
-        }
+                               send_stop_tone(listener, line_instance, tech_pvt->call_id);
+                       }
+                       send_select_soft_keys(listener, line_instance, tech_pvt->call_id,
+                                       SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT, 0xffff);
+               }
        } else {
-           tech_pvt->caller_profile->destination_number = switch_core_strdup(tech_pvt->caller_profile->pool,
-               dest);
+               tech_pvt->caller_profile->destination_number = switch_core_strdup(tech_pvt->caller_profile->pool, dest);
                switch_set_flag_locked(tech_pvt, TFLAG_FORCE_ROUTE);
        }
-       
+
        switch_channel_set_state(channel, CS_ROUTING);
 
        return SWITCH_STATUS_SUCCESS;
@@ -318,29 +317,29 @@ switch_status_t skinny_session_send_call_info(switch_core_session_t *session, li
 
        /* Calling party */
        if (zstr((caller_party_name = switch_channel_get_variable(channel, "effective_caller_id_name"))) &&
-               zstr((caller_party_name = switch_channel_get_variable(channel, "caller_id_name"))) &&
-               zstr((caller_party_name = switch_channel_get_variable_partner(channel, "effective_caller_id_name"))) &&
-               zstr((caller_party_name = switch_channel_get_variable_partner(channel, "caller_id_name")))) {
+                       zstr((caller_party_name = switch_channel_get_variable(channel, "caller_id_name"))) &&
+                       zstr((caller_party_name = switch_channel_get_variable_partner(channel, "effective_caller_id_name"))) &&
+                       zstr((caller_party_name = switch_channel_get_variable_partner(channel, "caller_id_name")))) {
                caller_party_name = SWITCH_DEFAULT_CLID_NAME;
        }
        if (zstr((caller_party_number = switch_channel_get_variable(channel, "effective_caller_id_number"))) &&
-               zstr((caller_party_number = switch_channel_get_variable(channel, "caller_id_number"))) &&
-               zstr((caller_party_number = switch_channel_get_variable_partner(channel, "effective_caller_id_number"))) &&
-               zstr((caller_party_number = switch_channel_get_variable_partner(channel, "caller_id_number")))) {
+                       zstr((caller_party_number = switch_channel_get_variable(channel, "caller_id_number"))) &&
+                       zstr((caller_party_number = switch_channel_get_variable_partner(channel, "effective_caller_id_number"))) &&
+                       zstr((caller_party_number = switch_channel_get_variable_partner(channel, "caller_id_number")))) {
                caller_party_number = "0000000000";
        }
        /* Called party */
        if (zstr((called_party_name = switch_channel_get_variable(channel, "effective_callee_id_name"))) &&
-               zstr((called_party_name = switch_channel_get_variable(channel, "callee_id_name"))) &&
-               zstr((called_party_name = switch_channel_get_variable_partner(channel, "effective_callee_id_name"))) &&
-               zstr((called_party_name = switch_channel_get_variable_partner(channel, "callee_id_name")))) {
+                       zstr((called_party_name = switch_channel_get_variable(channel, "callee_id_name"))) &&
+                       zstr((called_party_name = switch_channel_get_variable_partner(channel, "effective_callee_id_name"))) &&
+                       zstr((called_party_name = switch_channel_get_variable_partner(channel, "callee_id_name")))) {
                called_party_name = SWITCH_DEFAULT_CLID_NAME;
        }
        if (zstr((called_party_number = switch_channel_get_variable(channel, "effective_callee_id_number"))) &&
-               zstr((called_party_number = switch_channel_get_variable(channel, "callee_id_number"))) &&
-               zstr((called_party_number = switch_channel_get_variable_partner(channel, "effective_callee_id_number"))) &&
-               zstr((called_party_number = switch_channel_get_variable_partner(channel, "callee_id_number"))) &&
-               zstr((called_party_number = switch_channel_get_variable(channel, "destination_number")))) {
+                       zstr((called_party_number = switch_channel_get_variable(channel, "callee_id_number"))) &&
+                       zstr((called_party_number = switch_channel_get_variable_partner(channel, "effective_callee_id_number"))) &&
+                       zstr((called_party_number = switch_channel_get_variable_partner(channel, "callee_id_number"))) &&
+                       zstr((called_party_number = switch_channel_get_variable(channel, "destination_number")))) {
                called_party_number = "0000000000";
        }
        if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
@@ -349,27 +348,27 @@ switch_status_t skinny_session_send_call_info(switch_core_session_t *session, li
                call_type = SKINNY_OUTBOUND_CALL;
        }
        skinny_send_call_info(listener,
-               caller_party_name, /* char calling_party_name[40], */
-               caller_party_number, /* char calling_party[24], */
-               called_party_name, /* char called_party_name[40], */
-               called_party_number, /* char called_party[24], */
-               line_instance, /* uint32_t line_instance, */
-               tech_pvt->call_id, /* uint32_t call_id, */
-               call_type, /* uint32_t call_type, */
-               "", /* TODO char original_called_party_name[40], */
-               "", /* TODO char original_called_party[24], */
-               "", /* TODO char last_redirecting_party_name[40], */
-               "", /* TODO char last_redirecting_party[24], */
-               0, /* TODO uint32_t original_called_party_redirect_reason, */
-               0, /* TODO uint32_t last_redirecting_reason, */
-               "", /* TODO char calling_party_voice_mailbox[24], */
-               "", /* TODO char called_party_voice_mailbox[24], */
-               "", /* TODO char original_called_party_voice_mailbox[24], */
-               "", /* TODO char last_redirecting_voice_mailbox[24], */
-               1, /* uint32_t call_instance, */
-               1, /* uint32_t call_security_status, */
-               0 /* uint32_t party_pi_restriction_bits */
-       );
+                       caller_party_name, /* char calling_party_name[40], */
+                       caller_party_number, /* char calling_party[24], */
+                       called_party_name, /* char called_party_name[40], */
+                       called_party_number, /* char called_party[24], */
+                       line_instance, /* uint32_t line_instance, */
+                       tech_pvt->call_id, /* uint32_t call_id, */
+                       call_type, /* uint32_t call_type, */
+                       "", /* TODO char original_called_party_name[40], */
+                       "", /* TODO char original_called_party[24], */
+                       "", /* TODO char last_redirecting_party_name[40], */
+                       "", /* TODO char last_redirecting_party[24], */
+                       0, /* TODO uint32_t original_called_party_redirect_reason, */
+                       0, /* TODO uint32_t last_redirecting_reason, */
+                       "", /* TODO char calling_party_voice_mailbox[24], */
+                       "", /* TODO char called_party_voice_mailbox[24], */
+                       "", /* TODO char original_called_party_voice_mailbox[24], */
+                       "", /* TODO char last_redirecting_voice_mailbox[24], */
+                       1, /* uint32_t call_instance, */
+                       1, /* uint32_t call_security_status, */
+                       0 /* uint32_t party_pi_restriction_bits */
+                               );
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -401,7 +400,7 @@ int skinny_session_send_call_info_all_callback(void *pArg, int argc, char **argv
        listener_t *listener = NULL;
 
        skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, 
-           device_name, device_instance, &listener);
+                       device_name, device_instance, &listener);
        if(listener) {
                skinny_session_send_call_info(helper->tech_pvt->session, listener, line_instance);
        }
@@ -415,7 +414,7 @@ switch_status_t skinny_session_send_call_info_all(switch_core_session_t *session
 
        helper.tech_pvt = tech_pvt;
        return skinny_session_walk_lines(tech_pvt->profile,
-           switch_core_session_get_uuid(tech_pvt->session), skinny_session_send_call_info_all_callback, &helper);
+                       switch_core_session_get_uuid(tech_pvt->session), skinny_session_send_call_info_all_callback, &helper);
 }
 
 struct skinny_session_set_variables_helper {
@@ -446,7 +445,7 @@ int skinny_session_set_variables_callback(void *pArg, int argc, char **argv, cha
 
        struct skinny_session_set_variables_helper *helper = pArg;
        char *tmp;
-       
+
        helper->count++;
        switch_channel_set_variable_name_printf(helper->channel, device_name, "skinny_device_name_%d", helper->count);
        if ((tmp = switch_mprintf("%d", device_instance))) {
@@ -484,7 +483,7 @@ switch_status_t skinny_session_set_variables(switch_core_session_t *session, lis
                switch_channel_set_variable_printf(helper.channel, "skinny_line_instance", "%d", line_instance);
        }
        status = skinny_session_walk_lines(helper.tech_pvt->profile,
-           switch_core_session_get_uuid(helper.tech_pvt->session), skinny_session_set_variables_callback, &helper);
+                       switch_core_session_get_uuid(helper.tech_pvt->session), skinny_session_set_variables_callback, &helper);
 
        switch_channel_set_variable_printf(helper.channel, "skinny_lines_count", "%d", helper.count);
        return status;
@@ -522,7 +521,7 @@ int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnN
        listener_t *listener = NULL;
 
        skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, 
-           device_name, device_instance, &listener);
+                       device_name, device_instance, &listener);
        if(listener) {
                switch_channel_t *channel = switch_core_session_get_channel(helper->tech_pvt->session);
                helper->lines_count++;
@@ -537,21 +536,21 @@ int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnN
 
                        if (switch_core_session_receive_message(helper->remote_session, &msg) != SWITCH_STATUS_SUCCESS) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_WARNING, 
-                                       "Unable to send SWITCH_MESSAGE_INDICATE_DISPLAY message to channel %s\n",
-                                       switch_core_session_get_uuid(helper->remote_session));
+                                               "Unable to send SWITCH_MESSAGE_INDICATE_DISPLAY message to channel %s\n",
+                                               switch_core_session_get_uuid(helper->remote_session));
                        }
                }
-               
+
                skinny_line_set_state(listener, line_instance, helper->tech_pvt->call_id, SKINNY_RING_IN);
                send_select_soft_keys(listener, line_instance, helper->tech_pvt->call_id, SKINNY_KEY_SET_RING_IN, 0xffff);
-           if ((tmp = switch_mprintf("%s%s", SKINNY_DISP_FROM, helper->tech_pvt->caller_profile->destination_number))) {
-               send_display_prompt_status(listener, 0, tmp, line_instance, helper->tech_pvt->call_id);
-                   switch_safe_free(tmp);
-           }
-           if ((tmp = switch_mprintf("\005\000\000\000%s", helper->tech_pvt->caller_profile->destination_number))) {
-                   send_display_pri_notify(listener, 10 /* message_timeout */, 5 /* priority */, tmp);
-                   switch_safe_free(tmp);
-           }
+               if ((tmp = switch_mprintf("%s%s", SKINNY_DISP_FROM, helper->tech_pvt->caller_profile->destination_number))) {
+                       send_display_prompt_status(listener, 0, tmp, line_instance, helper->tech_pvt->call_id);
+                       switch_safe_free(tmp);
+               }
+               if ((tmp = switch_mprintf("\005\000\000\000%s", helper->tech_pvt->caller_profile->destination_number))) {
+                       send_display_pri_notify(listener, 10 /* message_timeout */, 5 /* priority */, tmp);
+                       switch_safe_free(tmp);
+               }
                skinny_session_send_call_info(helper->tech_pvt->session, listener, line_instance);
                send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_BLINK);
                send_set_ringer(listener, SKINNY_RING_INSIDE, SKINNY_RING_FOREVER, 0, helper->tech_pvt->call_id);
@@ -574,7 +573,7 @@ switch_call_cause_t skinny_ring_lines(private_t *tech_pvt, switch_core_session_t
        helper.lines_count = 0;
 
        status = skinny_session_walk_lines(tech_pvt->profile,
-           switch_core_session_get_uuid(tech_pvt->session), skinny_ring_lines_callback, &helper);
+                       switch_core_session_get_uuid(tech_pvt->session), skinny_ring_lines_callback, &helper);
        skinny_session_set_variables(tech_pvt->session, NULL, 0);
 
        if (status != SWITCH_STATUS_SUCCESS) {
@@ -593,15 +592,13 @@ switch_status_t skinny_session_ring_out(switch_core_session_t *session, listener
        switch_assert(session);
        switch_assert(listener);
        switch_assert(listener->profile);
-       
+
        tech_pvt = switch_core_session_get_private(session);
 
        send_start_tone(listener, SKINNY_TONE_ALERT, 0, line_instance, tech_pvt->call_id);
        skinny_line_set_state(listener, line_instance, tech_pvt->call_id, SKINNY_RING_OUT);
-       send_select_soft_keys(listener, line_instance, tech_pvt->call_id,
-           SKINNY_KEY_SET_RING_OUT, 0xffff);
-       send_display_prompt_status(listener, 0, SKINNY_DISP_RING_OUT,
-               line_instance, tech_pvt->call_id);
+       send_select_soft_keys(listener, line_instance, tech_pvt->call_id, SKINNY_KEY_SET_RING_OUT, 0xffff);
+       send_display_prompt_status(listener, 0, SKINNY_DISP_RING_OUT, line_instance, tech_pvt->call_id);
        skinny_session_send_call_info(session, listener, line_instance);
 
        return SWITCH_STATUS_SUCCESS;
@@ -639,18 +636,18 @@ int skinny_session_answer_callback(void *pArg, int argc, char **argv, char **col
 
        skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, device_name, device_instance, &listener);
        if(listener) {
-           if(!strcmp(device_name, helper->listener->device_name) 
-                   && (device_instance == helper->listener->device_instance)
-                   && (line_instance == helper->line_instance)) {/* the answering line */
-               /* nothing */
-           } else {
-               send_define_current_time_date(listener);
-               send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_ON);
-               skinny_line_set_state(listener, line_instance, helper->tech_pvt->call_id, SKINNY_IN_USE_REMOTELY);
-               send_select_soft_keys(listener, line_instance, helper->tech_pvt->call_id, 10, 0x0002);
-               send_display_prompt_status(listener, 0, SKINNY_DISP_IN_USE_REMOTE, line_instance, helper->tech_pvt->call_id);
-               send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, helper->tech_pvt->call_id);
-           }
+               if(!strcmp(device_name, helper->listener->device_name) 
+                               && (device_instance == helper->listener->device_instance)
+                               && (line_instance == helper->line_instance)) {/* the answering line */
+                       /* nothing */
+               } else {
+                       send_define_current_time_date(listener);
+                       send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_ON);
+                       skinny_line_set_state(listener, line_instance, helper->tech_pvt->call_id, SKINNY_IN_USE_REMOTELY);
+                       send_select_soft_keys(listener, line_instance, helper->tech_pvt->call_id, 10, 0x0002);
+                       send_display_prompt_status(listener, 0, SKINNY_DISP_IN_USE_REMOTE, line_instance, helper->tech_pvt->call_id);
+                       send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, helper->tech_pvt->call_id);
+               }
        }
        return 0;
 }
@@ -664,15 +661,15 @@ switch_status_t skinny_session_answer(switch_core_session_t *session, listener_t
        switch_assert(session);
        switch_assert(listener);
        switch_assert(listener->profile);
-       
+
        channel = switch_core_session_get_channel(session);
        tech_pvt = switch_core_session_get_private(session);
 
-    send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, tech_pvt->call_id);
-    send_set_speaker_mode(listener, SKINNY_SPEAKER_ON);
-    send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_ON);
-    skinny_line_set_state(listener, line_instance, tech_pvt->call_id, SKINNY_OFF_HOOK);
-    send_activate_call_plane(listener, line_instance);
+       send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, tech_pvt->call_id);
+       send_set_speaker_mode(listener, SKINNY_SPEAKER_ON);
+       send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_ON);
+       skinny_line_set_state(listener, line_instance, tech_pvt->call_id, SKINNY_OFF_HOOK);
+       send_activate_call_plane(listener, line_instance);
 
        helper.tech_pvt = tech_pvt;
        helper.listener = listener;
@@ -696,32 +693,32 @@ switch_status_t skinny_session_start_media(switch_core_session_t *session, liste
        switch_assert(session);
        switch_assert(listener);
        switch_assert(listener->profile);
-       
+
        channel = switch_core_session_get_channel(session);
        tech_pvt = switch_core_session_get_private(session);
-       
+
        if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
                send_stop_tone(listener, line_instance, tech_pvt->call_id);
                send_open_receive_channel(listener,
-                       tech_pvt->call_id, /* uint32_t conference_id, */
-                       tech_pvt->call_id, /* uint32_t pass_thru_party_id, */
-                       20, /* uint32_t packets, */
-                       SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */
-                       0, /* uint32_t echo_cancel_type, */
-                       0, /* uint32_t g723_bitrate, */
-                       0, /* uint32_t conference_id2, */
-                       0 /* uint32_t reserved[10] */
-               );
+                               tech_pvt->call_id, /* uint32_t conference_id, */
+                               tech_pvt->call_id, /* uint32_t pass_thru_party_id, */
+                               20, /* uint32_t packets, */
+                               SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */
+                               0, /* uint32_t echo_cancel_type, */
+                               0, /* uint32_t g723_bitrate, */
+                               0, /* uint32_t conference_id2, */
+                               0 /* uint32_t reserved[10] */
+                               );
        }
        if (!switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
                skinny_line_set_state(listener, line_instance, tech_pvt->call_id, SKINNY_CONNECTED);
                send_select_soft_keys(listener, line_instance, tech_pvt->call_id,
-                       SKINNY_KEY_SET_CONNECTED, 0xffff);
+                               SKINNY_KEY_SET_CONNECTED, 0xffff);
                send_display_prompt_status(listener,
-                       0,
-                       SKINNY_DISP_CONNECTED,
-                       line_instance,
-                       tech_pvt->call_id);
+                               0,
+                               SKINNY_DISP_CONNECTED,
+                               line_instance,
+                               tech_pvt->call_id);
        }
        skinny_session_send_call_info(session, listener, line_instance);
 
@@ -735,7 +732,7 @@ switch_status_t skinny_session_hold_line(switch_core_session_t *session, listene
        switch_assert(session);
        switch_assert(listener);
        switch_assert(listener->profile);
-       
+
        tech_pvt = switch_core_session_get_private(session);
 
        skinny_session_stop_media(session, listener, line_instance);
@@ -746,7 +743,7 @@ switch_status_t skinny_session_hold_line(switch_core_session_t *session, listene
        skinny_line_set_state(listener, line_instance, tech_pvt->call_id, SKINNY_HOLD);
        send_select_soft_keys(listener, line_instance, tech_pvt->call_id, SKINNY_KEY_SET_ON_HOLD, 0xffff);
        send_display_prompt_status(listener, 0, SKINNY_DISP_HOLD,
-               line_instance, tech_pvt->call_id);
+                       line_instance, tech_pvt->call_id);
        skinny_session_send_call_info(tech_pvt->session, listener, line_instance);
        send_set_speaker_mode(listener, SKINNY_SPEAKER_OFF);
        send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, tech_pvt->call_id);
@@ -761,7 +758,7 @@ switch_status_t skinny_session_unhold_line(switch_core_session_t *session, liste
        switch_assert(session);
        switch_assert(listener);
        switch_assert(listener->profile);
-       
+
        tech_pvt = switch_core_session_get_private(session);
 
        skinny_hold_active_calls(listener);
@@ -784,7 +781,7 @@ switch_status_t skinny_session_transfer(switch_core_session_t *session, listener
        switch_assert(session);
        switch_assert(listener);
        switch_assert(listener->profile);
-       
+
        tech_pvt = switch_core_session_get_private(session);
        channel = switch_core_session_get_channel(session);
        remote_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
@@ -824,22 +821,22 @@ switch_status_t skinny_session_stop_media(switch_core_session_t *session, listen
        switch_assert(session);
        switch_assert(listener);
        switch_assert(listener->profile);
-       
+
        tech_pvt = switch_core_session_get_private(session);
 
        switch_clear_flag_locked(tech_pvt, TFLAG_IO);
 
        send_close_receive_channel(listener,
-               tech_pvt->call_id, /* uint32_t conference_id, */
-               tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
-               tech_pvt->call_id /* uint32_t conference_id2, */
-       );
+                       tech_pvt->call_id, /* uint32_t conference_id, */
+                       tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
+                       tech_pvt->call_id /* uint32_t conference_id2, */
+                       );
        send_stop_media_transmission(listener,
-               tech_pvt->call_id, /* uint32_t conference_id, */
-               tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
-               tech_pvt->call_id /* uint32_t conference_id2, */
-       );
-        
+                       tech_pvt->call_id, /* uint32_t conference_id, */
+                       tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
+                       tech_pvt->call_id /* uint32_t conference_id2, */
+                       );
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -869,13 +866,13 @@ int skinny_hold_active_calls_callback(void *pArg, int argc, char **argv, char **
        /* char *channel_uuid = argv[14]; */
        uint32_t call_id = atoi(argv[15]);
        /* uint32_t call_state = atoi(argv[16]); */
-       
-    session = skinny_profile_find_session(helper->listener->profile, helper->listener, &line_instance, call_id);
 
-    if(session) {
-        skinny_session_hold_line(session, helper->listener, line_instance);
+       session = skinny_profile_find_session(helper->listener->profile, helper->listener, &line_instance, call_id);
+
+       if(session) {
+               skinny_session_hold_line(session, helper->listener, line_instance);
                switch_core_session_rwunlock(session);
-    }
+       }
 
        return 0;
 }
@@ -884,22 +881,22 @@ switch_status_t skinny_hold_active_calls(listener_t *listener)
 {
        struct skinny_hold_active_calls_helper helper = {0};
        char *sql;
-       
+
        helper.listener = listener;
-       
+
        if ((sql = switch_mprintf(
-                       "SELECT skinny_lines.*, channel_uuid, call_id, call_state "
-                       "FROM skinny_active_lines "
-                       "INNER JOIN skinny_lines "
-                               "ON skinny_active_lines.device_name = skinny_lines.device_name "
-                               "AND skinny_active_lines.device_instance = skinny_lines.device_instance "
-                               "AND skinny_active_lines.line_instance = skinny_lines.line_instance "
-                       "WHERE skinny_lines.device_name='%s' AND skinny_lines.device_instance=%d AND (call_state=%d OR call_state=%d)",
-                       listener->device_name, listener->device_instance, SKINNY_PROCEED, SKINNY_CONNECTED))) {
+                                       "SELECT skinny_lines.*, channel_uuid, call_id, call_state "
+                                       "FROM skinny_active_lines "
+                                       "INNER JOIN skinny_lines "
+                                       "ON skinny_active_lines.device_name = skinny_lines.device_name "
+                                       "AND skinny_active_lines.device_instance = skinny_lines.device_instance "
+                                       "AND skinny_active_lines.line_instance = skinny_lines.line_instance "
+                                       "WHERE skinny_lines.device_name='%s' AND skinny_lines.device_instance=%d AND (call_state=%d OR call_state=%d)",
+                                       listener->device_name, listener->device_instance, SKINNY_PROCEED, SKINNY_CONNECTED))) {
                skinny_execute_sql_callback(listener->profile, listener->profile->sql_mutex, sql, skinny_hold_active_calls_callback, &helper);
                switch_safe_free(sql);
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -934,7 +931,7 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
 
        if (!zstr(listener->device_name)) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-                       "A device is already registred on this listener.\n");
+                               "A device is already registred on this listener.\n");
                send_register_reject(listener, "A device is already registred on this listener");
                return SWITCH_STATUS_FALSE;
        }
@@ -945,36 +942,36 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
 
        if (switch_xml_locate_user("id", request->data.reg.device_name, profile->domain, "", &xroot, &xdomain, &xuser, &xgroup, params) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't find device [%s@%s]\n"
-                                         "You must define a domain called '%s' in your directory and add a user with id=\"%s\".\n"
-                                         , request->data.reg.device_name, profile->domain, profile->domain, request->data.reg.device_name);
+                               "You must define a domain called '%s' in your directory and add a user with id=\"%s\".\n"
+                               , request->data.reg.device_name, profile->domain, profile->domain, request->data.reg.device_name);
                send_register_reject(listener, "Device not found");
                status =  SWITCH_STATUS_FALSE;
                goto end;
        }
 
        skinny_profile_find_listener_by_device_name_and_instance(listener->profile,
-               request->data.reg.device_name, request->data.reg.instance, &listener2);
+                       request->data.reg.device_name, request->data.reg.instance, &listener2);
        if (listener2) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-                       "Device %s:%d is already registred on another listener.\n",
-                       request->data.reg.device_name, request->data.reg.instance);
+                               "Device %s:%d is already registred on another listener.\n",
+                               request->data.reg.device_name, request->data.reg.instance);
                send_register_reject(listener, "Device is already registred on another listener");
                status =  SWITCH_STATUS_FALSE;
                goto end;
        }
 
        if ((sql = switch_mprintf(
-                       "INSERT INTO skinny_devices "
-                               "(name, user_id, instance, ip, type, max_streams, codec_string) "
-                               "VALUES ('%s','%d','%d', '%s', '%d', '%d', '%s')",
-                       request->data.reg.device_name,
-                       request->data.reg.user_id,
-                       request->data.reg.instance,
-                       inet_ntoa(request->data.reg.ip),
-                       request->data.reg.device_type,
-                       request->data.reg.max_streams,
-                       "" /* codec_string */
-                       ))) {
+                                       "INSERT INTO skinny_devices "
+                                       "(name, user_id, instance, ip, type, max_streams, codec_string) "
+                                       "VALUES ('%s','%d','%d', '%s', '%d', '%d', '%s')",
+                                       request->data.reg.device_name,
+                                       request->data.reg.user_id,
+                                       request->data.reg.instance,
+                                       inet_ntoa(request->data.reg.ip),
+                                       request->data.reg.device_type,
+                                       request->data.reg.max_streams,
+                                       "" /* codec_string */
+                                ))) {
                skinny_execute_sql(profile, sql, profile->sql_mutex);
                switch_safe_free(sql);
        }
@@ -1018,16 +1015,16 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
                                        const char *forward_noanswer = switch_xml_attr_soft(xbutton, "forward-noanswer");
                                        uint32_t noanswer_duration = atoi(switch_xml_attr_soft(xbutton, "noanswer-duration"));
                                        if ((sql = switch_mprintf(
-                                                       "INSERT INTO skinny_lines "
-                                                               "(device_name, device_instance, position, line_instance, "
-                                                               "label, value, caller_name, "
-                                                               "ring_on_idle, ring_on_active, busy_trigger, "
-                                                               "forward_all, forward_busy, forward_noanswer, noanswer_duration) "
-                                                               "VALUES('%s', %d, %d, %d, '%s', '%s', '%s', %d, %d, %d, '%s', '%s', '%s', %d)",
-                                                       request->data.reg.device_name, request->data.reg.instance, position, line_instance,
-                                                       label, value, caller_name,
-                                                       ring_on_idle, ring_on_active, busy_trigger,
-                                                       forward_all, forward_busy, forward_noanswer, noanswer_duration))) {
+                                                                       "INSERT INTO skinny_lines "
+                                                                       "(device_name, device_instance, position, line_instance, "
+                                                                       "label, value, caller_name, "
+                                                                       "ring_on_idle, ring_on_active, busy_trigger, "
+                                                                       "forward_all, forward_busy, forward_noanswer, noanswer_duration) "
+                                                                       "VALUES('%s', %d, %d, %d, '%s', '%s', '%s', %d, %d, %d, '%s', '%s', '%s', %d)",
+                                                                       request->data.reg.device_name, request->data.reg.instance, position, line_instance,
+                                                                       label, value, caller_name,
+                                                                       ring_on_idle, ring_on_active, busy_trigger,
+                                                                       forward_all, forward_busy, forward_noanswer, noanswer_duration))) {
                                                char *token, *url;
                                                skinny_execute_sql(profile, sql, profile->sql_mutex);
                                                switch_safe_free(sql);
@@ -1049,16 +1046,16 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
                                } else {
                                        const char *settings = switch_xml_attr_soft(xbutton, "settings");
                                        if ((sql = switch_mprintf(
-                                                       "INSERT INTO skinny_buttons "
-                                                               "(device_name, device_instance, position, type, label, value, settings) "
-                                                               "VALUES('%s', %d, %d, %d, '%s', '%s', '%s')",
-                                                       request->data.reg.device_name,
-                                                       request->data.reg.instance,
-                                                       position,
-                                                       type,
-                                                       label,
-                                                       value,
-                                                       settings))) {
+                                                                       "INSERT INTO skinny_buttons "
+                                                                       "(device_name, device_instance, position, type, label, value, settings) "
+                                                                       "VALUES('%s', %d, %d, %d, '%s', '%s', '%s')",
+                                                                       request->data.reg.device_name,
+                                                                       request->data.reg.instance,
+                                                                       position,
+                                                                       type,
+                                                                       label,
+                                                                       value,
+                                                                       settings))) {
                                                skinny_execute_sql(profile, sql, profile->sql_mutex);
                                                switch_safe_free(sql);
                                        }
@@ -1105,11 +1102,11 @@ switch_status_t skinny_handle_port_message(listener_t *listener, skinny_message_
        skinny_check_data_length(request, sizeof(request->data.as_uint16));
 
        if ((sql = switch_mprintf(
-                       "UPDATE skinny_devices SET port=%d WHERE name='%s' and instance=%d",
-                       request->data.port.port,
-                       listener->device_name,
-                       listener->device_instance
-                       ))) {
+                                       "UPDATE skinny_devices SET port=%d WHERE name='%s' and instance=%d",
+                                       request->data.port.port,
+                                       listener->device_name,
+                                       listener->device_instance
+                                ))) {
                skinny_execute_sql(profile, sql, profile->sql_mutex);
                switch_safe_free(sql);
        }
@@ -1128,7 +1125,7 @@ switch_status_t skinny_handle_keypad_button_message(listener_t *listener, skinny
                if (request->data.keypad_button.line_instance > 0) {
                        line_instance = request->data.keypad_button.line_instance;
                }
-           call_id = request->data.keypad_button.call_id;
+               call_id = request->data.keypad_button.call_id;
        }
 
        session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
@@ -1156,8 +1153,8 @@ switch_status_t skinny_handle_keypad_button_message(listener_t *listener, skinny
                /* TODO check call_id and line */
 
                if((skinny_line_get_state(listener, line_instance, tech_pvt->call_id) == SKINNY_OFF_HOOK)) {
-       
-                   skinny_session_process_dest(session, listener, line_instance, NULL, digit, 0);
+
+                       skinny_session_process_dest(session, listener, line_instance, NULL, digit, 0);
                } else {
                        if(digit != '\0') {
                                switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0)};
@@ -1208,19 +1205,19 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
        skinny_check_data_length(request, sizeof(request->data.stimulus)-sizeof(request->data.stimulus.call_id));
 
        if(skinny_check_data_length_soft(request, sizeof(request->data.stimulus))) {
-           call_id = request->data.stimulus.call_id;
+               call_id = request->data.stimulus.call_id;
        }
 
        switch(request->data.stimulus.instance_type) {
                case SKINNY_BUTTON_LAST_NUMBER_REDIAL:
-                   skinny_create_incoming_session(listener, &line_instance, &session);
+                       skinny_create_incoming_session(listener, &line_instance, &session);
                        skinny_session_process_dest(session, listener, line_instance, "redial", '\0', 0);
                        break;
                case SKINNY_BUTTON_SPEED_DIAL:
                        skinny_speed_dial_get(listener, request->data.stimulus.instance, &button);
                        if(strlen(button->line) > 0) {
-                       skinny_create_incoming_session(listener, &line_instance, &session);
-                           skinny_session_process_dest(session, listener, line_instance, button->line, '\0', 0);
+                               skinny_create_incoming_session(listener, &line_instance, &session);
+                               skinny_session_process_dest(session, listener, line_instance, button->line, '\0', 0);
                        }
                        break;
                case SKINNY_BUTTON_HOLD:
@@ -1234,11 +1231,11 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
                        session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
 
                        if(session) {
-                           status = skinny_session_transfer(session, listener, line_instance);
+                               status = skinny_session_transfer(session, listener, line_instance);
                        }                       
                        break;
                case SKINNY_BUTTON_VOICEMAIL:
-                   skinny_create_incoming_session(listener, &line_instance, &session);
+                       skinny_create_incoming_session(listener, &line_instance, &session);
                        skinny_session_process_dest(session, listener, line_instance, "vmain", '\0', 0);
                        break;
                default:
@@ -1263,7 +1260,7 @@ switch_status_t skinny_handle_off_hook_message(listener_t *listener, skinny_mess
                if (request->data.off_hook.line_instance > 0) {
                        line_instance = request->data.off_hook.line_instance;
                }
-           call_id = request->data.off_hook.call_id;
+               call_id = request->data.off_hook.call_id;
        }
 
        session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
@@ -1272,10 +1269,10 @@ switch_status_t skinny_handle_off_hook_message(listener_t *listener, skinny_mess
                skinny_session_answer(session, listener, line_instance);
        } else { /* start a new call */
                skinny_create_incoming_session(listener, &line_instance, &session);
-           tech_pvt = switch_core_session_get_private(session);
-           assert(tech_pvt != NULL);
+               tech_pvt = switch_core_session_get_private(session);
+               assert(tech_pvt != NULL);
 
-           skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0);
+               skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0);
        }
 
        if(session) {
@@ -1294,7 +1291,7 @@ switch_status_t skinny_handle_on_hook_message(listener_t *listener, skinny_messa
 
        if(skinny_check_data_length_soft(request, sizeof(request->data.on_hook))) {
                line_instance = request->data.on_hook.line_instance;
-           call_id = request->data.on_hook.call_id;
+               call_id = request->data.on_hook.call_id;
        }
 
        session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
@@ -1416,17 +1413,17 @@ switch_status_t skinny_handle_config_stat_request(listener_t *listener, skinny_m
        message->length = 4 + sizeof(message->data.config_res);
 
        if ((sql = switch_mprintf(
-                       "SELECT name, user_id, instance, '' AS user_name, '' AS server_name, "
-                               "(SELECT COUNT(*) FROM skinny_lines WHERE device_name='%s' AND device_instance=%d) AS number_lines, "
-                               "(SELECT COUNT(*) FROM skinny_buttons WHERE device_name='%s' AND device_instance=%d AND type=%d) AS number_speed_dials "
-                               "FROM skinny_devices WHERE name='%s' ",
-                       listener->device_name,
-                       listener->device_instance,
-                       listener->device_name,
-                       listener->device_instance,
-                       SKINNY_BUTTON_SPEED_DIAL,
-                       listener->device_name
-                       ))) {
+                                       "SELECT name, user_id, instance, '' AS user_name, '' AS server_name, "
+                                       "(SELECT COUNT(*) FROM skinny_lines WHERE device_name='%s' AND device_instance=%d) AS number_lines, "
+                                       "(SELECT COUNT(*) FROM skinny_buttons WHERE device_name='%s' AND device_instance=%d AND type=%d) AS number_speed_dials "
+                                       "FROM skinny_devices WHERE name='%s' ",
+                                       listener->device_name,
+                                       listener->device_instance,
+                                       listener->device_name,
+                                       listener->device_instance,
+                                       SKINNY_BUTTON_SPEED_DIAL,
+                                       listener->device_name
+                                ))) {
                skinny_execute_sql_callback(profile, profile->sql_mutex, sql, skinny_config_stat_res_callback, message);
                switch_safe_free(sql);
        }
@@ -1493,26 +1490,26 @@ switch_status_t skinny_handle_button_template_request(listener_t *listener, skin
 
        /* Add buttons */
        if ((sql = switch_mprintf(
-                       "SELECT device_name, device_instance, position, MIN(type, %d) AS type "
-                               "FROM skinny_buttons "
-                               "WHERE device_name='%s' AND device_instance=%d "
-                               "ORDER BY position",
-                       SKINNY_BUTTON_UNDEFINED,
-                       listener->device_name, listener->device_instance
-                       ))) {
+                                       "SELECT device_name, device_instance, position, MIN(type, %d) AS type "
+                                       "FROM skinny_buttons "
+                                       "WHERE device_name='%s' AND device_instance=%d "
+                                       "ORDER BY position",
+                                       SKINNY_BUTTON_UNDEFINED,
+                                       listener->device_name, listener->device_instance
+                                ))) {
                skinny_execute_sql_callback(profile, profile->sql_mutex, sql, skinny_handle_button_template_request_callback, &helper);
                switch_safe_free(sql);
        }
 
        /* Add lines */
        if ((sql = switch_mprintf(
-                       "SELECT device_name, device_instance, position, %d AS type "
-                               "FROM skinny_lines "
-                               "WHERE device_name='%s' AND device_instance=%d "
-                               "ORDER BY position",
-                       SKINNY_BUTTON_LINE,
-                       listener->device_name, listener->device_instance
-                       ))) {
+                                       "SELECT device_name, device_instance, position, %d AS type "
+                                       "FROM skinny_lines "
+                                       "WHERE device_name='%s' AND device_instance=%d "
+                                       "ORDER BY position",
+                                       SKINNY_BUTTON_LINE,
+                                       listener->device_name, listener->device_instance
+                                ))) {
                skinny_execute_sql_callback(profile, profile->sql_mutex, sql, skinny_handle_button_template_request_callback, &helper);
                switch_safe_free(sql);
        }
@@ -1527,7 +1524,7 @@ switch_status_t skinny_handle_button_template_request(listener_t *listener, skin
                }
        }
 
-       
+
 
        return skinny_send_reply(listener, message);;
 }
@@ -1545,13 +1542,13 @@ switch_status_t skinny_handle_version_request(listener_t *listener, skinny_messa
                        }
                }
        }
-       
+
        if (!zstr(listener->firmware_version)) {
                return send_version(listener, listener->firmware_version);
        } else {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                       "Device %s:%d is requesting for firmware version, but none is set.\n",
-                       listener->device_name, listener->device_instance);
+                               "Device %s:%d is requesting for firmware version, but none is set.\n",
+                               listener->device_name, listener->device_instance);
                return SWITCH_STATUS_SUCCESS;
        }
 }
@@ -1604,15 +1601,15 @@ switch_status_t skinny_handle_capabilities_response(listener_t *listener, skinny
        }
        codec_string[string_len] = '\0';
        if ((sql = switch_mprintf(
-                       "UPDATE skinny_devices SET codec_string='%s' WHERE name='%s'",
-                       codec_string,
-                       listener->device_name
-                       ))) {
+                                       "UPDATE skinny_devices SET codec_string='%s' WHERE name='%s'",
+                                       codec_string,
+                                       listener->device_name
+                                ))) {
                skinny_execute_sql(profile, sql, profile->sql_mutex);
                switch_safe_free(sql);
        }
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
-               "Codecs %s supported.\n", codec_string);
+                       "Codecs %s supported.\n", codec_string);
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1623,9 +1620,9 @@ switch_status_t skinny_handle_alarm(listener_t *listener, skinny_message_t *requ
        skinny_check_data_length(request, sizeof(request->data.alarm));
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
-               "Received alarm: Severity=%d, DisplayMessage=%s, Param1=%d, Param2=%d.\n",
-               request->data.alarm.alarm_severity, request->data.alarm.display_message,
-               request->data.alarm.alarm_param1, request->data.alarm.alarm_param2);
+                       "Received alarm: Severity=%d, DisplayMessage=%s, Param1=%d, Param2=%d.\n",
+                       request->data.alarm.alarm_severity, request->data.alarm.display_message,
+                       request->data.alarm.alarm_param1, request->data.alarm.alarm_param2);
        /* skinny::alarm event */
        skinny_device_event(listener, &event, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_ALARM);
        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-Alarm-Severity", "%d", request->data.alarm.alarm_severity);
@@ -1679,41 +1676,41 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste
                tech_pvt->remote_sdp_audio_port = request->data.open_receive_channel_ack.port;
 
                tech_pvt->rtp_session = switch_rtp_new(tech_pvt->local_sdp_audio_ip,
-                                                                                          tech_pvt->local_sdp_audio_port,
-                                                                                          tech_pvt->remote_sdp_audio_ip,
-                                                                                          tech_pvt->remote_sdp_audio_port,
-                                                                                          tech_pvt->agreed_pt,
-                                                                                          tech_pvt->read_impl.samples_per_packet,
-                                                                                          tech_pvt->codec_ms * 1000,
-                                                                                          (switch_rtp_flag_t) 0, "soft", &err,
-                                                                                          switch_core_session_get_pool(session));
+                               tech_pvt->local_sdp_audio_port,
+                               tech_pvt->remote_sdp_audio_ip,
+                               tech_pvt->remote_sdp_audio_port,
+                               tech_pvt->agreed_pt,
+                               tech_pvt->read_impl.samples_per_packet,
+                               tech_pvt->codec_ms * 1000,
+                               (switch_rtp_flag_t) 0, "soft", &err,
+                               switch_core_session_get_pool(session));
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG,
-                                                 "AUDIO RTP [%s] %s:%d->%s:%d codec: %u ms: %d [%s]\n",
-                                                 switch_channel_get_name(channel),
-                                                 tech_pvt->local_sdp_audio_ip,
-                                                 tech_pvt->local_sdp_audio_port,
-                                                 tech_pvt->remote_sdp_audio_ip,
-                                                 tech_pvt->remote_sdp_audio_port,
-                                                 tech_pvt->agreed_pt,
-                                                 tech_pvt->read_impl.microseconds_per_packet / 1000,
-                                                 switch_rtp_ready(tech_pvt->rtp_session) ? "SUCCESS" : err);
+                               "AUDIO RTP [%s] %s:%d->%s:%d codec: %u ms: %d [%s]\n",
+                               switch_channel_get_name(channel),
+                               tech_pvt->local_sdp_audio_ip,
+                               tech_pvt->local_sdp_audio_port,
+                               tech_pvt->remote_sdp_audio_ip,
+                               tech_pvt->remote_sdp_audio_port,
+                               tech_pvt->agreed_pt,
+                               tech_pvt->read_impl.microseconds_per_packet / 1000,
+                               switch_rtp_ready(tech_pvt->rtp_session) ? "SUCCESS" : err);
 #ifdef WIN32
                addr.s_addr = inet_addr((uint16_t) tech_pvt->local_sdp_audio_ip);
 #else
                inet_aton(tech_pvt->local_sdp_audio_ip, &addr);
 #endif
                send_start_media_transmission(listener,
-                       tech_pvt->call_id, /* uint32_t conference_id, */
-                       tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
-                       addr.s_addr, /* uint32_t remote_ip, */
-                       tech_pvt->local_sdp_audio_port, /* uint32_t remote_port, */
-                       20, /* uint32_t ms_per_packet, */
-                       SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */
-                       184, /* uint32_t precedence, */
-                       0, /* uint32_t silence_suppression, */
-                       0, /* uint16_t max_frames_per_packet, */
-                       0 /* uint32_t g723_bitrate */
-                       );
+                               tech_pvt->call_id, /* uint32_t conference_id, */
+                               tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
+                               addr.s_addr, /* uint32_t remote_ip, */
+                               tech_pvt->local_sdp_audio_port, /* uint32_t remote_port, */
+                               20, /* uint32_t ms_per_packet, */
+                               SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */
+                               184, /* uint32_t precedence, */
+                               0, /* uint32_t silence_suppression, */
+                               0, /* uint16_t max_frames_per_packet, */
+                               0 /* uint32_t g723_bitrate */
+                               );
 
                switch_set_flag_locked(tech_pvt, TFLAG_IO);
                if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
@@ -1725,8 +1722,8 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste
                }
        } else {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                       "Unable to find session for device %s:%d (call id=%d).\n", 
-                       listener->device_name, listener->device_instance, request->data.open_receive_channel_ack.pass_thru_party_id);
+                               "Unable to find session for device %s:%d (call id=%d).\n", 
+                               listener->device_name, listener->device_instance, request->data.open_receive_channel_ack.pass_thru_party_id);
        }
 end:
        if(session) {
@@ -1749,7 +1746,7 @@ switch_status_t skinny_handle_soft_key_set_request(listener_t *listener, skinny_
                skinny_send_reply(listener, message);
        } else {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-                       "Profile %s doesn't have a default <soft-key-set-set>.\n", listener->profile->name);
+                               "Profile %s doesn't have a default <soft-key-set-set>.\n", listener->profile->name);
        }
 
        /* Init the states */
@@ -1770,26 +1767,23 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
 
        if(skinny_check_data_length_soft(request, sizeof(request->data.soft_key_event))) {
                line_instance = request->data.soft_key_event.line_instance;
-           call_id = request->data.soft_key_event.call_id;
+               call_id = request->data.soft_key_event.call_id;
        }
 
        switch(request->data.soft_key_event.event) {
                case SOFTKEY_REDIAL:
-               status = skinny_create_incoming_session(listener, &line_instance, &session);
-
-                   skinny_session_process_dest(session, listener, line_instance, "redial", '\0', 0);
+                       status = skinny_create_incoming_session(listener, &line_instance, &session);
+                       skinny_session_process_dest(session, listener, line_instance, "redial", '\0', 0);
                        break;
                case SOFTKEY_NEWCALL:
-               status = skinny_create_incoming_session(listener, &line_instance, &session);
-
-                   skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0);
+                       status = skinny_create_incoming_session(listener, &line_instance, &session);
+                       skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0);
                        break;
                case SOFTKEY_HOLD:
-               session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
-
-                   if(session) {
-                   status = skinny_session_hold_line(session, listener, line_instance);
-               }
+                       session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
+                       if(session) {
+                               status = skinny_session_hold_line(session, listener, line_instance);
+                       }
                        break;
                case SOFTKEY_TRANSFER:
                        session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
@@ -1799,38 +1793,33 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
                        }
                        break;
                case SOFTKEY_BACKSPACE:
-               session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
-
-                   if(session) {
-                       skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 1);
-               }
+                       session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
+                       if(session) {
+                               skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 1);
+                       }
                        break;
                case SOFTKEY_ENDCALL:
-               session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
-
-                   if(session) {
-                           channel = switch_core_session_get_channel(session);
-
-                           switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
-               }
+                       session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
+                       if(session) {
+                               channel = switch_core_session_get_channel(session);
+                               switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+                       }
                        break;
                case SOFTKEY_RESUME:
-               session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
-
-                   if(session) {
-                   status = skinny_session_unhold_line(session, listener, line_instance);
-               }
+                       session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
+                       if(session) {
+                               status = skinny_session_unhold_line(session, listener, line_instance);
+                       }
                        break;
                case SOFTKEY_ANSWER:
-               session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
-
-                   if(session) {
+                       session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id);
+                       if(session) {
                                status = skinny_session_answer(session, listener, line_instance);
-                   }
+                       }
                        break;
                default:
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                               "Unknown SoftKeyEvent type: %d.\n", request->data.soft_key_event.event);
+                                       "Unknown SoftKeyEvent type: %d.\n", request->data.soft_key_event.event);
        }
 
        if(session) {
@@ -1877,8 +1866,8 @@ switch_status_t skinny_handle_soft_key_template_request(listener_t *listener, sk
        message->data.soft_key_template.total_soft_key_count = 21;
 
        memcpy(message->data.soft_key_template.soft_key,
-               soft_key_template_default,
-               sizeof(soft_key_template_default));
+                       soft_key_template_default,
+                       sizeof(soft_key_template_default));
 
        skinny_send_reply(listener, message);
 
@@ -1892,11 +1881,11 @@ switch_status_t skinny_headset_status_message(listener_t *listener, skinny_messa
        skinny_check_data_length(request, sizeof(request->data.headset_status));
 
        if ((sql = switch_mprintf(
-                       "UPDATE skinny_devices SET headset=%d WHERE name='%s' and instance=%d",
-                       (request->data.headset_status.mode==1) ? SKINNY_ACCESSORY_STATE_OFFHOOK : SKINNY_ACCESSORY_STATE_ONHOOK,
-                       listener->device_name,
-                       listener->device_instance
-                       ))) {
+                                       "UPDATE skinny_devices SET headset=%d WHERE name='%s' and instance=%d",
+                                       (request->data.headset_status.mode==1) ? SKINNY_ACCESSORY_STATE_OFFHOOK : SKINNY_ACCESSORY_STATE_ONHOOK,
+                                       listener->device_name,
+                                       listener->device_instance
+                                ))) {
                skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex);
                switch_safe_free(sql);
        }
@@ -2035,33 +2024,33 @@ switch_status_t skinny_handle_accessory_status_message(listener_t *listener, ski
        switch(request->data.accessory_status.accessory_id) {
                case SKINNY_ACCESSORY_HEADSET:
                        if ((sql = switch_mprintf(
-                                       "UPDATE skinny_devices SET headset=%d WHERE name='%s' and instance=%d",
-                                       request->data.accessory_status.accessory_status,
-                                       listener->device_name,
-                                       listener->device_instance
-                                       ))) {
+                                                       "UPDATE skinny_devices SET headset=%d WHERE name='%s' and instance=%d",
+                                                       request->data.accessory_status.accessory_status,
+                                                       listener->device_name,
+                                                       listener->device_instance
+                                                ))) {
                                skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex);
                                switch_safe_free(sql);
                        }
                        break;
                case SKINNY_ACCESSORY_HANDSET:
                        if ((sql = switch_mprintf(
-                                       "UPDATE skinny_devices SET handset=%d WHERE name='%s' and instance=%d",
-                                       request->data.accessory_status.accessory_status,
-                                       listener->device_name,
-                                       listener->device_instance
-                                       ))) {
+                                                       "UPDATE skinny_devices SET handset=%d WHERE name='%s' and instance=%d",
+                                                       request->data.accessory_status.accessory_status,
+                                                       listener->device_name,
+                                                       listener->device_instance
+                                                ))) {
                                skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex);
                                switch_safe_free(sql);
                        }
                        break;
                case SKINNY_ACCESSORY_SPEAKER:
                        if ((sql = switch_mprintf(
-                                       "UPDATE skinny_devices SET speaker=%d WHERE name='%s' and instance=%d",
-                                       request->data.accessory_status.accessory_status,
-                                       listener->device_name,
-                                       listener->device_instance
-                                       ))) {
+                                                       "UPDATE skinny_devices SET speaker=%d WHERE name='%s' and instance=%d",
+                                                       request->data.accessory_status.accessory_status,
+                                                       listener->device_name,
+                                                       listener->device_instance
+                                                ))) {
                                skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex);
                                switch_safe_free(sql);
                        }
@@ -2077,7 +2066,7 @@ switch_status_t skinny_handle_xml_alarm(listener_t *listener, skinny_message_t *
        char *tmp = NULL;
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
-               "Received XML alarm.\n");
+                       "Received XML alarm.\n");
        /* skinny::xml_alarm event */
        skinny_device_event(listener, &event, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_XML_ALARM);
        /* Ensure that the body is null-terminated */
@@ -2095,12 +2084,12 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re
 {
        if (listener->profile->debug >= 10 || request->type != KEEP_ALIVE_MESSAGE) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
-                       "Received %s (type=%x,length=%d) from %s:%d.\n", skinny_message_type2str(request->type), request->type, request->length,
-                       listener->device_name, listener->device_instance);
+                               "Received %s (type=%x,length=%d) from %s:%d.\n", skinny_message_type2str(request->type), request->type, request->length,
+                               listener->device_name, listener->device_instance);
        }
        if(zstr(listener->device_name) && request->type != REGISTER_MESSAGE && request->type != ALARM_MESSAGE && request->type != XML_ALARM_MESSAGE) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                       "Device should send a register message first. Received %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length);
+                               "Device should send a register message first. Received %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length);
                return SWITCH_STATUS_FALSE;
        }
        switch(request->type) {
@@ -2172,7 +2161,7 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re
                        return skinny_handle_xml_alarm(listener, request);
                default:
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-                               "Unhandled %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length);
+                                       "Unhandled %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length);
                        return SWITCH_STATUS_SUCCESS;
        }
 }
index 59bb4a1f2fd1c1cb0823d320962f5292b1713586..f5ce877f2773f63e4e323f8285aead80d0f97355 100644 (file)
@@ -108,181 +108,181 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = {
        {XML_ALARM_MESSAGE, "XMLAlarmMessage"},
        {0, NULL}
 };
-SKINNY_DECLARE_ID2STR(skinny_message_type2str, SKINNY_MESSAGE_TYPES, "UnknownMessage")
+       SKINNY_DECLARE_ID2STR(skinny_message_type2str, SKINNY_MESSAGE_TYPES, "UnknownMessage")
 SKINNY_DECLARE_STR2ID(skinny_str2message_type, SKINNY_MESSAGE_TYPES, -1)
 
-struct skinny_table SKINNY_DEVICE_TYPES[] = {
-       {1, "Cisco 30 SP+"},
-       {2, "Cisco 12 SP+"},
-       {3, "Cisco 12 SP"},
-       {4, "Cisco 12"},
-       {5, "Cisco 30 VIP"},
-       {6, "Cisco IP Phone 7910"},
-       {7, "Cisco IP Phone 7960"},
-       {8, "Cisco IP Phone 7940"},
-       {9, "Cisco IP Phone 7935"},
-       {12, "Cisco ATA 186"},
-       {365, "Cisco IP Phone CP-7921G"},
-       {404, "Cisco IP Phone CP-7962G"},
-       {436, "Cisco IP Phone CP-7965G"},
-       {30018, "Cisco IP Phone CP-7961G"},
-       {30019, "Cisco IP Phone 7936"},
-       {0, NULL}
-};
-SKINNY_DECLARE_ID2STR(skinny_device_type2str, SKINNY_DEVICE_TYPES, "UnknownDeviceType")
+       struct skinny_table SKINNY_DEVICE_TYPES[] = {
+               {1, "Cisco 30 SP+"},
+               {2, "Cisco 12 SP+"},
+               {3, "Cisco 12 SP"},
+               {4, "Cisco 12"},
+               {5, "Cisco 30 VIP"},
+               {6, "Cisco IP Phone 7910"},
+               {7, "Cisco IP Phone 7960"},
+               {8, "Cisco IP Phone 7940"},
+               {9, "Cisco IP Phone 7935"},
+               {12, "Cisco ATA 186"},
+               {365, "Cisco IP Phone CP-7921G"},
+               {404, "Cisco IP Phone CP-7962G"},
+               {436, "Cisco IP Phone CP-7965G"},
+               {30018, "Cisco IP Phone CP-7961G"},
+               {30019, "Cisco IP Phone 7936"},
+               {0, NULL}
+       };
+       SKINNY_DECLARE_ID2STR(skinny_device_type2str, SKINNY_DEVICE_TYPES, "UnknownDeviceType")
 SKINNY_DECLARE_STR2ID(skinny_str2device_type, SKINNY_DEVICE_TYPES, -1)
 
-struct skinny_table SKINNY_RING_TYPES[] = {
-       {SKINNY_RING_OFF, "RingOff"},
-       {SKINNY_RING_INSIDE, "RingInside"},
-       {SKINNY_RING_OUTSIDE, "RingOutside"},
-       {SKINNY_RING_FEATURE, "RingFeature"},
-       {0, NULL}
-};
-SKINNY_DECLARE_ID2STR(skinny_ring_type2str, SKINNY_RING_TYPES, "RingTypeUnknown")
+       struct skinny_table SKINNY_RING_TYPES[] = {
+               {SKINNY_RING_OFF, "RingOff"},
+               {SKINNY_RING_INSIDE, "RingInside"},
+               {SKINNY_RING_OUTSIDE, "RingOutside"},
+               {SKINNY_RING_FEATURE, "RingFeature"},
+               {0, NULL}
+       };
+       SKINNY_DECLARE_ID2STR(skinny_ring_type2str, SKINNY_RING_TYPES, "RingTypeUnknown")
 SKINNY_DECLARE_STR2ID(skinny_str2ring_type, SKINNY_RING_TYPES, -1)
 
-struct skinny_table SKINNY_RING_MODES[] = {
-       {SKINNY_RING_FOREVER, "RingForever"},
-       {SKINNY_RING_ONCE, "RingOnce"},
-       {0, NULL}
-};
-SKINNY_DECLARE_ID2STR(skinny_ring_mode2str, SKINNY_RING_MODES, "RingModeUnknown")
+       struct skinny_table SKINNY_RING_MODES[] = {
+               {SKINNY_RING_FOREVER, "RingForever"},
+               {SKINNY_RING_ONCE, "RingOnce"},
+               {0, NULL}
+       };
+       SKINNY_DECLARE_ID2STR(skinny_ring_mode2str, SKINNY_RING_MODES, "RingModeUnknown")
 SKINNY_DECLARE_STR2ID(skinny_str2ring_mode, SKINNY_RING_MODES, -1)
 
-struct skinny_table SKINNY_BUTTONS[] = {
-       {SKINNY_BUTTON_UNKNOWN, "Unknown"},
-       {SKINNY_BUTTON_LAST_NUMBER_REDIAL, "LastNumberRedial"},
-       {SKINNY_BUTTON_SPEED_DIAL, "SpeedDial"},
-       {SKINNY_BUTTON_HOLD, "Hold"},
-       {SKINNY_BUTTON_TRANSFER, "Transfer"},
-       {SKINNY_BUTTON_LINE, "Line"},
-       {SKINNY_BUTTON_VOICEMAIL, "Voicemail"},
-       {SKINNY_BUTTON_PRIVACY, "Privacy"},
-       {SKINNY_BUTTON_SERVICE_URL, "ServiceUrl"},
-       {SKINNY_BUTTON_UNDEFINED, "Undefined"},
-       {0, NULL}
-};
-SKINNY_DECLARE_ID2STR(skinny_button2str, SKINNY_BUTTONS, "Unknown")
+       struct skinny_table SKINNY_BUTTONS[] = {
+               {SKINNY_BUTTON_UNKNOWN, "Unknown"},
+               {SKINNY_BUTTON_LAST_NUMBER_REDIAL, "LastNumberRedial"},
+               {SKINNY_BUTTON_SPEED_DIAL, "SpeedDial"},
+               {SKINNY_BUTTON_HOLD, "Hold"},
+               {SKINNY_BUTTON_TRANSFER, "Transfer"},
+               {SKINNY_BUTTON_LINE, "Line"},
+               {SKINNY_BUTTON_VOICEMAIL, "Voicemail"},
+               {SKINNY_BUTTON_PRIVACY, "Privacy"},
+               {SKINNY_BUTTON_SERVICE_URL, "ServiceUrl"},
+               {SKINNY_BUTTON_UNDEFINED, "Undefined"},
+               {0, NULL}
+       };
+       SKINNY_DECLARE_ID2STR(skinny_button2str, SKINNY_BUTTONS, "Unknown")
 SKINNY_DECLARE_STR2ID(skinny_str2button, SKINNY_BUTTONS, -1)
 
-struct skinny_table SKINNY_SOFT_KEY_EVENTS[] = {
-       {SOFTKEY_REDIAL, "SoftkeyRedial"},
-       {SOFTKEY_NEWCALL, "SoftkeyNewcall"},
-       {SOFTKEY_HOLD, "SoftkeyHold"},
-       {SOFTKEY_TRANSFER, "SoftkeyTransfer"},
-       {SOFTKEY_CFWDALL, "SoftkeyCfwdall"},
-       {SOFTKEY_CFWDBUSY, "SoftkeyCfwdbusy"},
-       {SOFTKEY_CFWDNOANSWER, "SoftkeyCfwdnoanswer"},
-       {SOFTKEY_BACKSPACE, "SoftkeyBackspace"},
-       {SOFTKEY_ENDCALL, "SoftkeyEndcall"},
-       {SOFTKEY_RESUME, "SoftkeyResume"},
-       {SOFTKEY_ANSWER , "SoftkeyAnswer"},
-       {SOFTKEY_INFO, "SoftkeyInfo"},
-       {SOFTKEY_CONFRM, "SoftkeyConfrm"},
-       {SOFTKEY_PARK, "SoftkeyPark"},
-       {SOFTKEY_JOIN, "SoftkeyJoin"},
-       {SOFTKEY_MEETMECONFRM, "SoftkeyMeetmeconfrm"},
-       {SOFTKEY_CALLPICKUP, "SoftkeyCallpickup"},
-       {SOFTKEY_GRPCALLPICKUP, "SoftkeyGrpcallpickup"},
-       {SOFTKEY_DND, "SoftkeyDnd"},
-       {SOFTKEY_IDIVERT, "SoftkeyIdivert"},
-       {0, NULL}
-};
-SKINNY_DECLARE_ID2STR(skinny_soft_key_event2str, SKINNY_SOFT_KEY_EVENTS, "SoftkeyUnknown")
+       struct skinny_table SKINNY_SOFT_KEY_EVENTS[] = {
+               {SOFTKEY_REDIAL, "SoftkeyRedial"},
+               {SOFTKEY_NEWCALL, "SoftkeyNewcall"},
+               {SOFTKEY_HOLD, "SoftkeyHold"},
+               {SOFTKEY_TRANSFER, "SoftkeyTransfer"},
+               {SOFTKEY_CFWDALL, "SoftkeyCfwdall"},
+               {SOFTKEY_CFWDBUSY, "SoftkeyCfwdbusy"},
+               {SOFTKEY_CFWDNOANSWER, "SoftkeyCfwdnoanswer"},
+               {SOFTKEY_BACKSPACE, "SoftkeyBackspace"},
+               {SOFTKEY_ENDCALL, "SoftkeyEndcall"},
+               {SOFTKEY_RESUME, "SoftkeyResume"},
+               {SOFTKEY_ANSWER , "SoftkeyAnswer"},
+               {SOFTKEY_INFO, "SoftkeyInfo"},
+               {SOFTKEY_CONFRM, "SoftkeyConfrm"},
+               {SOFTKEY_PARK, "SoftkeyPark"},
+               {SOFTKEY_JOIN, "SoftkeyJoin"},
+               {SOFTKEY_MEETMECONFRM, "SoftkeyMeetmeconfrm"},
+               {SOFTKEY_CALLPICKUP, "SoftkeyCallpickup"},
+               {SOFTKEY_GRPCALLPICKUP, "SoftkeyGrpcallpickup"},
+               {SOFTKEY_DND, "SoftkeyDnd"},
+               {SOFTKEY_IDIVERT, "SoftkeyIdivert"},
+               {0, NULL}
+       };
+       SKINNY_DECLARE_ID2STR(skinny_soft_key_event2str, SKINNY_SOFT_KEY_EVENTS, "SoftkeyUnknown")
 SKINNY_DECLARE_STR2ID(skinny_str2soft_key_event, SKINNY_SOFT_KEY_EVENTS, 0)
 
-struct skinny_table SKINNY_LAMP_MODES[] = {
-       {SKINNY_LAMP_OFF, "Off"},
-       {SKINNY_LAMP_ON, "On"},
-       {SKINNY_LAMP_WINK, "Wink"},
-       {SKINNY_LAMP_FLASH, "Flash"},
-       {SKINNY_LAMP_BLINK, "Blink"},
-       {0, NULL}
-};
-SKINNY_DECLARE_ID2STR(skinny_lamp_mode2str, SKINNY_LAMP_MODES, "Unknown")
+       struct skinny_table SKINNY_LAMP_MODES[] = {
+               {SKINNY_LAMP_OFF, "Off"},
+               {SKINNY_LAMP_ON, "On"},
+               {SKINNY_LAMP_WINK, "Wink"},
+               {SKINNY_LAMP_FLASH, "Flash"},
+               {SKINNY_LAMP_BLINK, "Blink"},
+               {0, NULL}
+       };
+       SKINNY_DECLARE_ID2STR(skinny_lamp_mode2str, SKINNY_LAMP_MODES, "Unknown")
 SKINNY_DECLARE_STR2ID(skinny_str2lamp_mode, SKINNY_LAMP_MODES, -1)
 
-struct skinny_table SKINNY_SPEAKER_MODES[] = {
-       {SKINNY_SPEAKER_ON, "SpeakerOn"},
-       {SKINNY_SPEAKER_OFF, "SpeakerOff"},
-       {0, NULL}
-};
-SKINNY_DECLARE_ID2STR(skinny_speaker_mode2str, SKINNY_SPEAKER_MODES, "Unknown")
+       struct skinny_table SKINNY_SPEAKER_MODES[] = {
+               {SKINNY_SPEAKER_ON, "SpeakerOn"},
+               {SKINNY_SPEAKER_OFF, "SpeakerOff"},
+               {0, NULL}
+       };
+       SKINNY_DECLARE_ID2STR(skinny_speaker_mode2str, SKINNY_SPEAKER_MODES, "Unknown")
 SKINNY_DECLARE_STR2ID(skinny_str2speaker_mode, SKINNY_SPEAKER_MODES, -1)
 
-struct skinny_table SKINNY_KEY_SETS[] = {
-       {SKINNY_KEY_SET_ON_HOOK, "KeySetOnHook"},
-       {SKINNY_KEY_SET_CONNECTED, "KeySetConnected"},
-       {SKINNY_KEY_SET_ON_HOLD, "KeySetOnHold"},
-       {SKINNY_KEY_SET_RING_IN, "KeySetRingIn"},
-       {SKINNY_KEY_SET_OFF_HOOK, "KeySetOffHook"},
-       {SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER, "KeySetConnectedWithTransfer"},
-       {SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT, "KeySetDigitsAfterDialingFirstDigit"},
-       {SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE, "KeySetConnectedWithConference"},
-       {SKINNY_KEY_SET_RING_OUT, "KeySetRingOut"},
-       {SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES, "KeySetOffHookWithFeatures"},
-       {SKINNY_KEY_SET_IN_USE_HINT, "KeySetInUseHint"},
-       {0, NULL}
-};
-SKINNY_DECLARE_ID2STR(skinny_soft_key_set2str, SKINNY_KEY_SETS, "UNKNOWN_SOFT_KEY_SET")
+       struct skinny_table SKINNY_KEY_SETS[] = {
+               {SKINNY_KEY_SET_ON_HOOK, "KeySetOnHook"},
+               {SKINNY_KEY_SET_CONNECTED, "KeySetConnected"},
+               {SKINNY_KEY_SET_ON_HOLD, "KeySetOnHold"},
+               {SKINNY_KEY_SET_RING_IN, "KeySetRingIn"},
+               {SKINNY_KEY_SET_OFF_HOOK, "KeySetOffHook"},
+               {SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER, "KeySetConnectedWithTransfer"},
+               {SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT, "KeySetDigitsAfterDialingFirstDigit"},
+               {SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE, "KeySetConnectedWithConference"},
+               {SKINNY_KEY_SET_RING_OUT, "KeySetRingOut"},
+               {SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES, "KeySetOffHookWithFeatures"},
+               {SKINNY_KEY_SET_IN_USE_HINT, "KeySetInUseHint"},
+               {0, NULL}
+       };
+       SKINNY_DECLARE_ID2STR(skinny_soft_key_set2str, SKINNY_KEY_SETS, "UNKNOWN_SOFT_KEY_SET")
 SKINNY_DECLARE_STR2ID(skinny_str2soft_key_set, SKINNY_KEY_SETS, -1)
 
-struct skinny_table SKINNY_CALL_STATES[] = {
-       {SKINNY_OFF_HOOK, "OffHook"},
-       {SKINNY_ON_HOOK, "OnHook"},
-       {SKINNY_RING_OUT, "RingOut"},
-       {SKINNY_RING_IN, "RingIn"},
-       {SKINNY_CONNECTED, "Connected"},
-       {SKINNY_BUSY, "Busy"},
-       {SKINNY_LINE_IN_USE, "LineInUse"},
-       {SKINNY_HOLD, "Hold"},
-       {SKINNY_CALL_WAITING, "CallWaiting"},
-       {SKINNY_CALL_TRANSFER, "CallTransfer"},
-       {SKINNY_CALL_PARK, "CallPark"},
-       {SKINNY_PROCEED, "Proceed"},
-       {SKINNY_IN_USE_REMOTELY, "InUseRemotely"},
-       {SKINNY_INVALID_NUMBER, "InvalidNumber"},
-       {0, NULL}
-};
-SKINNY_DECLARE_ID2STR(skinny_call_state2str, SKINNY_CALL_STATES, "CallStateUnknown")
+       struct skinny_table SKINNY_CALL_STATES[] = {
+               {SKINNY_OFF_HOOK, "OffHook"},
+               {SKINNY_ON_HOOK, "OnHook"},
+               {SKINNY_RING_OUT, "RingOut"},
+               {SKINNY_RING_IN, "RingIn"},
+               {SKINNY_CONNECTED, "Connected"},
+               {SKINNY_BUSY, "Busy"},
+               {SKINNY_LINE_IN_USE, "LineInUse"},
+               {SKINNY_HOLD, "Hold"},
+               {SKINNY_CALL_WAITING, "CallWaiting"},
+               {SKINNY_CALL_TRANSFER, "CallTransfer"},
+               {SKINNY_CALL_PARK, "CallPark"},
+               {SKINNY_PROCEED, "Proceed"},
+               {SKINNY_IN_USE_REMOTELY, "InUseRemotely"},
+               {SKINNY_INVALID_NUMBER, "InvalidNumber"},
+               {0, NULL}
+       };
+       SKINNY_DECLARE_ID2STR(skinny_call_state2str, SKINNY_CALL_STATES, "CallStateUnknown")
 SKINNY_DECLARE_STR2ID(skinny_str2call_state, SKINNY_CALL_STATES, -1)
 
-struct skinny_table SKINNY_DEVICE_RESET_TYPES[] = {
-       {SKINNY_DEVICE_RESET, "DeviceReset"},
-       {SKINNY_DEVICE_RESTART, "DeviceRestart"},
-       {0, NULL}
-};
-SKINNY_DECLARE_ID2STR(skinny_device_reset_type2str, SKINNY_DEVICE_RESET_TYPES, "DeviceResetTypeUnknown")
+       struct skinny_table SKINNY_DEVICE_RESET_TYPES[] = {
+               {SKINNY_DEVICE_RESET, "DeviceReset"},
+               {SKINNY_DEVICE_RESTART, "DeviceRestart"},
+               {0, NULL}
+       };
+       SKINNY_DECLARE_ID2STR(skinny_device_reset_type2str, SKINNY_DEVICE_RESET_TYPES, "DeviceResetTypeUnknown")
 SKINNY_DECLARE_STR2ID(skinny_str2device_reset_type, SKINNY_DEVICE_RESET_TYPES, -1)
 
-struct skinny_table SKINNY_ACCESSORY_TYPES[] = {
-       {SKINNY_ACCESSORY_NONE, "AccessoryNone"},
-       {SKINNY_ACCESSORY_HEADSET, "Headset"},
-       {SKINNY_ACCESSORY_HANDSET, "Handset"},
-       {SKINNY_ACCESSORY_SPEAKER, "Speaker"},
-       {0, NULL}
-};
-SKINNY_DECLARE_ID2STR(skinny_accessory_type2str, SKINNY_ACCESSORY_TYPES, "AccessoryUnknown")
+       struct skinny_table SKINNY_ACCESSORY_TYPES[] = {
+               {SKINNY_ACCESSORY_NONE, "AccessoryNone"},
+               {SKINNY_ACCESSORY_HEADSET, "Headset"},
+               {SKINNY_ACCESSORY_HANDSET, "Handset"},
+               {SKINNY_ACCESSORY_SPEAKER, "Speaker"},
+               {0, NULL}
+       };
+       SKINNY_DECLARE_ID2STR(skinny_accessory_type2str, SKINNY_ACCESSORY_TYPES, "AccessoryUnknown")
 SKINNY_DECLARE_STR2ID(skinny_str2accessory_type, SKINNY_ACCESSORY_TYPES, -1)
 
-struct skinny_table SKINNY_ACCESSORY_STATES[] = {
-       {SKINNY_ACCESSORY_STATE_NONE, "AccessoryNoState"},
-       {SKINNY_ACCESSORY_STATE_OFFHOOK, "OffHook"},
-       {SKINNY_ACCESSORY_STATE_ONHOOK, "OnHook"},
-       {0, NULL}
-};
-SKINNY_DECLARE_ID2STR(skinny_accessory_state2str, SKINNY_ACCESSORY_STATES, "AccessoryStateUnknown")
+       struct skinny_table SKINNY_ACCESSORY_STATES[] = {
+               {SKINNY_ACCESSORY_STATE_NONE, "AccessoryNoState"},
+               {SKINNY_ACCESSORY_STATE_OFFHOOK, "OffHook"},
+               {SKINNY_ACCESSORY_STATE_ONHOOK, "OnHook"},
+               {0, NULL}
+       };
+       SKINNY_DECLARE_ID2STR(skinny_accessory_state2str, SKINNY_ACCESSORY_STATES, "AccessoryStateUnknown")
 SKINNY_DECLARE_STR2ID(skinny_str2accessory_state, SKINNY_ACCESSORY_STATES, -1)
 
-/* For Emacs:
- * Local Variables:
- * mode:c
- * indent-tabs-mode:t
- * tab-width:4
- * c-basic-offset:4
- * End:
- * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
- */
+       /* For Emacs:
       * Local Variables:
       * mode:c
       * indent-tabs-mode:t
       * tab-width:4
       * c-basic-offset:4
       * End:
       * For VIM:
       * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
       */
 
index 383e5bb2b13882deb25b9452581440e5a4cb5e4b..502c0b5eb62713cd422e45079df26fb4fef3261b 100644 (file)
 /* SKINNY TABLES */
 /*****************************************************************************/
 struct skinny_table {
-    uint32_t id;
-    const char *name;
+       uint32_t id;
+       const char *name;
 };
 
 #define SKINNY_DECLARE_ID2STR(func, TABLE, DEFAULT_STR) \
-const char *func(uint32_t id) \
+       const char *func(uint32_t id) \
 { \
-    const char *str = DEFAULT_STR; \
-    uint8_t x; \
-    \
-    for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
-           if (TABLE[x].id == id) {\
-                   str = TABLE[x].name;\
-                   break;\
-           }\
-    }\
-    \
-    return str;\
+       const char *str = DEFAULT_STR; \
+       uint8_t x; \
+       \
+       for (x = 0; x < (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 func(const char *str)\
 {\
-    uint32_t id = (uint32_t) DEFAULT_ID;\
-    \
-    if (*str > 47 && *str < 58) {\
-           id = atoi(str);\
-    } else {\
-           uint8_t x;\
-           for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1 && TABLE[x].name; x++) {\
-                   if (!strcasecmp(TABLE[x].name, str)) {\
-                           id = TABLE[x].id;\
-                           break;\
-                   }\
-           }\
-    }\
-    return id;\
+       uint32_t id = (uint32_t) DEFAULT_ID;\
+       \
+       if (*str > 47 && *str < 58) {\
+               id = atoi(str);\
+       } else {\
+               uint8_t x;\
+               for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1 && 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;\
-    uint8_t x;\
-    for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
-           switch_console_push_match(&my_matches, TABLE[x].name);\
-    }\
-    if (my_matches) {\
-           *matches = my_matches;\
-           status = SWITCH_STATUS_SUCCESS;\
-    }
+       switch_console_callback_match_t *my_matches = NULL;\
+uint8_t x;\
+for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
+       switch_console_push_match(&my_matches, TABLE[x].name);\
+}\
+if (my_matches) {\
+       *matches = my_matches;\
+       status = SWITCH_STATUS_SUCCESS;\
+}
 
 
 extern struct skinny_table SKINNY_MESSAGE_TYPES[72];
@@ -98,20 +98,20 @@ uint32_t skinny_str2device_type(const char *str);
 #define SKINNY_PUSH_DEVICE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_DEVICE_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,
+       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
+       SKINNY_RING_OFF = 1,
+       SKINNY_RING_INSIDE = 2,
+       SKINNY_RING_OUTSIDE = 3,
+       SKINNY_RING_FEATURE = 4
 };
 extern struct skinny_table SKINNY_RING_TYPES[5];
 const char *skinny_ring_type2str(uint32_t id);
@@ -119,8 +119,8 @@ 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,
+       SKINNY_RING_FOREVER = 1,
+       SKINNY_RING_ONCE = 2,
 };
 extern struct skinny_table SKINNY_RING_MODES[3];
 const char *skinny_ring_mode2str(uint32_t id);
@@ -129,11 +129,11 @@ uint32_t skinny_str2ring_mode(const char *str);
 
 
 enum skinny_lamp_mode {
-    SKINNY_LAMP_OFF = 1,
-    SKINNY_LAMP_ON = 2,
-    SKINNY_LAMP_WINK = 3,
-    SKINNY_LAMP_FLASH = 4,
-    SKINNY_LAMP_BLINK = 5,
+       SKINNY_LAMP_OFF = 1,
+       SKINNY_LAMP_ON = 2,
+       SKINNY_LAMP_WINK = 3,
+       SKINNY_LAMP_FLASH = 4,
+       SKINNY_LAMP_BLINK = 5,
 };
 extern struct skinny_table SKINNY_LAMP_MODES[6];
 const char *skinny_lamp_mode2str(uint32_t id);
@@ -141,8 +141,8 @@ 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,
+       SKINNY_SPEAKER_ON = 1,
+       SKINNY_SPEAKER_OFF = 2,
 };
 extern struct skinny_table SKINNY_SPEAKER_MODES[3];
 const char *skinny_speaker_mode2str(uint32_t id);
@@ -150,22 +150,22 @@ 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,
+       SKINNY_INBOUND_CALL = 1,
+       SKINNY_OUTBOUND_CALL = 2,
+       SKINNY_FORWARD_CALL = 3,
 };
 
 enum skinny_button_definition {
-    SKINNY_BUTTON_UNKNOWN = 0x00,
-    SKINNY_BUTTON_LAST_NUMBER_REDIAL = 0x01,
-    SKINNY_BUTTON_SPEED_DIAL = 0x02,
-    SKINNY_BUTTON_HOLD = 0x03,
-    SKINNY_BUTTON_TRANSFER = 0x04,
-    SKINNY_BUTTON_LINE = 0x09,
-    SKINNY_BUTTON_VOICEMAIL = 0x0F,
-    SKINNY_BUTTON_PRIVACY = 0x13,
-    SKINNY_BUTTON_SERVICE_URL = 0x14,
-    SKINNY_BUTTON_UNDEFINED = 0xFF,
+       SKINNY_BUTTON_UNKNOWN = 0x00,
+       SKINNY_BUTTON_LAST_NUMBER_REDIAL = 0x01,
+       SKINNY_BUTTON_SPEED_DIAL = 0x02,
+       SKINNY_BUTTON_HOLD = 0x03,
+       SKINNY_BUTTON_TRANSFER = 0x04,
+       SKINNY_BUTTON_LINE = 0x09,
+       SKINNY_BUTTON_VOICEMAIL = 0x0F,
+       SKINNY_BUTTON_PRIVACY = 0x13,
+       SKINNY_BUTTON_SERVICE_URL = 0x14,
+       SKINNY_BUTTON_UNDEFINED = 0xFF,
 };
 extern struct skinny_table SKINNY_BUTTONS[11];
 const char *skinny_button2str(uint32_t id);
@@ -173,26 +173,26 @@ uint32_t skinny_str2button(const char *str);
 #define SKINNY_PUSH_STIMULI SKINNY_DECLARE_PUSH_MATCH(SKINNY_BUTTONS)
 
 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,
+       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,
 };
 extern struct skinny_table SKINNY_SOFT_KEY_EVENTS[21];
 const char *skinny_soft_key_event2str(uint32_t id);
@@ -200,17 +200,17 @@ uint32_t skinny_str2soft_key_event(const char *str);
 #define SKINNY_PUSH_SOFT_KEY_EVENTS SKINNY_DECLARE_PUSH_MATCH(SOFT_KEY_EVENTS)
 
 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,
-    SKINNY_KEY_SET_IN_USE_HINT = 10,
+       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,
+       SKINNY_KEY_SET_IN_USE_HINT = 10,
 };
 extern struct skinny_table SKINNY_KEY_SETS[12];
 const char *skinny_soft_key_set2str(uint32_t id);
@@ -219,20 +219,20 @@ uint32_t skinny_str2soft_key_set(const char *str);
 
 
 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_LINE_IN_USE = 7,
-    SKINNY_HOLD = 8,
-    SKINNY_CALL_WAITING = 9,
-    SKINNY_CALL_TRANSFER = 10,
-    SKINNY_CALL_PARK = 11,
-    SKINNY_PROCEED = 12,
-    SKINNY_IN_USE_REMOTELY = 13,
-    SKINNY_INVALID_NUMBER = 14
+       SKINNY_OFF_HOOK = 1,
+       SKINNY_ON_HOOK = 2,
+       SKINNY_RING_OUT = 3,
+       SKINNY_RING_IN = 4,
+       SKINNY_CONNECTED = 5,
+       SKINNY_BUSY = 6,
+       SKINNY_LINE_IN_USE = 7,
+       SKINNY_HOLD = 8,
+       SKINNY_CALL_WAITING = 9,
+       SKINNY_CALL_TRANSFER = 10,
+       SKINNY_CALL_PARK = 11,
+       SKINNY_PROCEED = 12,
+       SKINNY_IN_USE_REMOTELY = 13,
+       SKINNY_INVALID_NUMBER = 14
 };
 extern struct skinny_table SKINNY_CALL_STATES[15];
 const char *skinny_call_state2str(uint32_t id);
@@ -240,8 +240,8 @@ uint32_t skinny_str2call_state(const char *str);
 #define SKINNY_PUSH_CALL_STATES SKINNY_DECLARE_PUSH_MATCH(SKINNY_CALL_STATES)
 
 enum skinny_device_reset_types {
-  SKINNY_DEVICE_RESET = 1,
-  SKINNY_DEVICE_RESTART = 2
+       SKINNY_DEVICE_RESET = 1,
+       SKINNY_DEVICE_RESTART = 2
 };
 extern struct skinny_table SKINNY_DEVICE_RESET_TYPES[3];
 const char *skinny_device_reset_type2str(uint32_t id);