Author: mikej Date: Wed Dec 12 21:42:00 2007 New Revision: 6728 Modified: freeswitch/trunk/Freeswitch.2008.sln freeswitch/trunk/conf/sip_profiles/default.xml freeswitch/trunk/conf/sip_profiles/nat.xml freeswitch/trunk/conf/sip_profiles/outbound.xml freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.2008.vcproj freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Log: sofia log-level control improvements Modified: freeswitch/trunk/Freeswitch.2008.sln ============================================================================== --- freeswitch/trunk/Freeswitch.2008.sln (original) +++ freeswitch/trunk/Freeswitch.2008.sln Wed Dec 12 21:42:00 2007 @@ -128,6 +128,7 @@ ProjectSection(SolutionItems) = preProject conf\sip_profiles\default.xml = conf\sip_profiles\default.xml conf\sip_profiles\nat.xml = conf\sip_profiles\nat.xml + conf\sip_profiles\outbound.xml = conf\sip_profiles\outbound.xml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lang", "lang", "{09455AA9-C243-4F16-A1A1-A016881A2765}" Modified: freeswitch/trunk/conf/sip_profiles/default.xml ============================================================================== --- freeswitch/trunk/conf/sip_profiles/default.xml (original) +++ freeswitch/trunk/conf/sip_profiles/default.xml Wed Dec 12 21:42:00 2007 @@ -16,6 +16,8 @@ <settings> <param name="debug" value="0"/> + <!--<param name="sip_trace" value="yes"/>--> + sip_trace <param name="context" value="public"/> <param name="rfc2833-pt" value="101"/> <param name="sip-port" value="5060"/> Modified: freeswitch/trunk/conf/sip_profiles/nat.xml ============================================================================== --- freeswitch/trunk/conf/sip_profiles/nat.xml (original) +++ freeswitch/trunk/conf/sip_profiles/nat.xml Wed Dec 12 21:42:00 2007 @@ -6,6 +6,7 @@ <settings> <param name="debug" value="0"/> + <!--<param name="sip_trace" value="yes"/>--> <param name="rfc2833-pt" value="101"/> <param name="sip-port" value="5070"/> <param name="dialplan" value="XML"/> Modified: freeswitch/trunk/conf/sip_profiles/outbound.xml ============================================================================== --- freeswitch/trunk/conf/sip_profiles/outbound.xml (original) +++ freeswitch/trunk/conf/sip_profiles/outbound.xml Wed Dec 12 21:42:00 2007 @@ -11,6 +11,7 @@ <settings> <param name="debug" value="0"/> + <!--<param name="sip_trace" value="yes"/>--> <param name="rfc2833-pt" value="101"/> <param name="sip-port" value="5080"/> <param name="dialplan" value="XML"/> Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.2008.vcproj ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.2008.vcproj (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.2008.vcproj Wed Dec 12 21:42:00 2007 @@ -39,7 +39,7 @@ /> <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\su";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nua";"$(InputDir)..\..\..\..\libs\sofia-sip\win32";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\url";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\sip";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\msg";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\sdp";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nta";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nea";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\soa";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\iptsec";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\bnf"" + AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\su";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nua";"$(InputDir)..\..\..\..\libs\sofia-sip\win32";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\url";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\sip";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\msg";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\sdp";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nta";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nea";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\soa";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\iptsec";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\bnf";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\tport"" PreprocessorDefinitions="LIBSOFIA_SIP_UA_STATIC;PTW32_STATIC_LIB" UsePrecompiledHeader="0" DisableSpecificWarnings="4201" @@ -105,7 +105,7 @@ /> <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\su";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nua";"$(InputDir)..\..\..\..\libs\sofia-sip\win32";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\url";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\sip";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\msg";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\sdp";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nta";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nea";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\soa";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\iptsec";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\bnf"" + AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\su";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nua";"$(InputDir)..\..\..\..\libs\sofia-sip\win32";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\url";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\sip";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\msg";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\sdp";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nta";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\nea";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\soa";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\iptsec";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\bnf";"$(InputDir)..\..\..\..\libs\sofia-sip\libsofia-sip-ua\tport"" PreprocessorDefinitions="LIBSOFIA_SIP_UA_STATIC;PTW32_STATIC_LIB" UsePrecompiledHeader="0" DisableSpecificWarnings="4201" Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Wed Dec 12 21:42:00 2007 @@ -1354,6 +1354,7 @@ "sofia help\n" "sofia profile <profile_name> [start|stop|restart|flush_inbound_reg|[register|unregister] [<gateway name>|all]] [reloadxml]\n" "sofia status [[profile | gateway] <name>]\n" + "sofia loglevel [0-9]\n" "--------------------------------------------------------------------------------\n"; if (session) { @@ -1379,6 +1380,20 @@ func = cmd_profile; } else if (!strcasecmp(argv[0], "status")) { func = cmd_status; + } else if (!strcasecmp(argv[0], "loglevel")) { + if (argc > 1 && argv[1]) { + int level; + level = atoi(argv[1]); + if (level >= 0 && level <= 9) { + su_log_set_level(NULL, atoi(argv[1])); + stream->write_function(stream, "Sofia-sip log level set to [%d]", level); + } else { + stream->write_function(stream, "%s", usage_string); + } + } else { + stream->write_function(stream, "%s", usage_string); + } + goto done; } else if (!strcasecmp(argv[0], "help")) { stream->write_function(stream, "%s", usage_string); goto done; Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Wed Dec 12 21:42:00 2007 @@ -148,7 +148,8 @@ TFLAG_INB_NOMEDIA = (1 << 23), TFLAG_LATE_NEGOTIATION = (1 << 24), TFLAG_SDP = (1 << 25), - TFLAG_VIDEO = (1 << 26) + TFLAG_VIDEO = (1 << 26), + TFLAG_TPORT_LOG = (1 << 27) } TFLAGS; struct mod_sofia_globals { Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Dec 12 21:42:00 2007 @@ -36,8 +36,19 @@ #include "mod_sofia.h" #include "sofia-sip/msg_parser.h" #include "sofia-sip/sip_extra.h" +#include "sofia-sip/tport_tag.h" extern su_log_t tport_log[]; +extern su_log_t iptsec_log[]; +extern su_log_t nea_log[]; +extern su_log_t nta_log[]; +extern su_log_t nth_client_log[]; +extern su_log_t nth_server_log[]; +extern su_log_t nua_log[]; +extern su_log_t soa_log[]; +extern su_log_t sresolv_log[]; +extern su_log_t stun_log[]; + static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, char const *phrase, @@ -334,6 +345,7 @@ uint32_t ireg_loops = 0; uint32_t gateway_loops = 0; switch_event_t *s_event; + int tport_log = 0; switch_mutex_lock(mod_sofia_globals.mutex); mod_sofia_globals.threads++; @@ -350,10 +362,14 @@ goto end; } + if (switch_test_flag(profile, TFLAG_TPORT_LOG)) { + tport_log = 1; + } + profile->nua = nua_create(profile->s_root, /* Event loop */ sofia_event_callback, /* Callback for processing events */ profile, /* Additional data to pass to callback */ - NUTAG_URL(profile->bindurl), NTATAG_UDP_MTU(65536), TAG_END()); /* Last tag should always finish the sequence */ + NUTAG_URL(profile->bindurl), NTATAG_UDP_MTU(65536), TAG_IF(tport_log,TPTAG_LOG(1)), TAG_END()); /* Last tag should always finish the sequence */ if (!profile->nua) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Creating SIP UA for profile: %s\n", profile->name); @@ -755,8 +771,6 @@ char *val = (char *) switch_xml_attr_soft(param, "value"); if (!strcasecmp(var, "log-level")) { su_log_set_level(NULL, atoi(val)); - } else if (!strcasecmp(var, "log-level-trace")) { - su_log_set_level(tport_log, atoi(val)); } } } @@ -813,7 +827,8 @@ profile->debug = atoi(val); } else if (!strcasecmp(var, "use-rtp-timer") && switch_true(val)) { switch_set_flag(profile, TFLAG_TIMER); - + } else if (!strcasecmp(var, "sip_trace") && switch_true(val)) { + switch_set_flag(profile, TFLAG_TPORT_LOG); } else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) { #ifdef SWITCH_HAVE_ODBC profile->odbc_dsn = switch_core_strdup(profile->pool, val);