]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_skinny: add easy access to set blocking/non-blocking mode for skinny socket on...
authorNathan Neulinger <nneul@neulinger.org>
Wed, 18 Jun 2014 22:06:54 +0000 (17:06 -0500)
committerNathan Neulinger <nneul@neulinger.org>
Wed, 18 Jun 2014 22:06:54 +0000 (17:06 -0500)
src/mod/endpoints/mod_skinny/conf/skinny_profiles/internal.xml
src/mod/endpoints/mod_skinny/mod_skinny.c
src/mod/endpoints/mod_skinny/mod_skinny.h

index 98da04abe6acef11a9105f600d59481dd4d9e1fe..de785ffa3186e98b4e09c1430d37047df85ae872 100644 (file)
@@ -12,6 +12,8 @@
     <param name="odbc-dsn" value=""/>
     <param name="debug" value="4"/>
     <param name="auto-restart" value="true"/>
+    <!-- send individual SCCP PDUs immediately instead of buffering -->
+    <!-- <param name="non-blocking" value="true"/> -->
     <param name="ext-voicemail" value="vmain"/>
     <param name="ext-redial" value="redial"/>
     <!-- <param name="ext-meetme" value="conference"/> -->
index e2a715baa106302c7e6a09fbd66280fb051912df..88905973d0b239320050b937be7e66d864e3d06e 100644 (file)
@@ -166,6 +166,7 @@ switch_status_t skinny_profile_dump(const skinny_profile_t *profile, switch_stre
        stream->write_function(stream, "DBName            \t%s\n", profile->dbname ? profile->dbname : switch_str_nil(profile->odbc_dsn));
        stream->write_function(stream, "Debug             \t%d\n", profile->debug);
        stream->write_function(stream, "Auto-Restart      \t%d\n", profile->auto_restart);
+       stream->write_function(stream, "Non-Blocking      \t%d\n", profile->non_blocking);
        /* stats */
        stream->write_function(stream, "CALLS-IN          \t%d\n", profile->ib_calls);
        stream->write_function(stream, "FAILED-CALLS-IN   \t%d\n", profile->ib_failed_calls);
@@ -1720,12 +1721,12 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
 
        switch_assert(listener != NULL);
 
-#if MOD_SKINNY_NONBLOCK
-       switch_socket_opt_set(listener->sock, SWITCH_SO_TCP_NODELAY, TRUE);
-       switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, TRUE);
-#else
-       switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, FALSE);
-#endif
+       if ( profile->non_blocking ) {
+               switch_socket_opt_set(listener->sock, SWITCH_SO_TCP_NODELAY, TRUE);
+               switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, TRUE);
+       } else {
+               switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, FALSE);
+       }
 
        /* 200 ms to allow reasonably fast reaction on digit timeout */
        switch_socket_timeout_set(listener->sock, 200000);
@@ -2033,6 +2034,8 @@ switch_status_t skinny_profile_set(skinny_profile_t *profile, const char *var, c
                profile->debug = atoi(val);
        } else if (!strcasecmp(var, "auto-restart")) {
                profile->auto_restart = switch_true(val);
+       } else if (!strcasecmp(var, "non-blocking")) {
+               profile->non_blocking = switch_true(val);
        } else if (!strcasecmp(var, "ext-voicemail")) {
                if (!profile->ext_voicemail || strcmp(val, profile->ext_voicemail)) {
                        profile->ext_voicemail = switch_core_strdup(profile->pool, val);
@@ -2106,6 +2109,7 @@ static switch_status_t load_skinny_config(void)
                                profile->pool = profile_pool;
                                profile->name = switch_core_strdup(profile->pool, profile_name);
                                profile->auto_restart = SWITCH_TRUE;
+                               profile->non_blocking = SWITCH_FALSE;
                                profile->digit_timeout = 10000; /* 10 seconds */
                                switch_mutex_init(&profile->sql_mutex, SWITCH_MUTEX_NESTED, profile->pool);
                                switch_mutex_init(&profile->listener_mutex, SWITCH_MUTEX_NESTED, profile->pool);
index 91598f56bbfdf5eff26dca6e99b0f9384c46fdf2..e3571dfe950d968422ed6a664ab30dca77d529b3 100644 (file)
@@ -124,6 +124,7 @@ struct skinny_profile {
        char date_format[6];
        int debug;
        int auto_restart;
+       int non_blocking;
        switch_hash_t *soft_key_set_sets_hash;
        switch_hash_t *device_type_params_hash;
        /* extensions */