sofia log-level control improvements
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6728 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
98c156d807
commit
d8786f35fd
|
@ -128,6 +128,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sip_profiles", "sip_profile
|
|||
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}"
|
||||
|
|
|
@ -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"/>
|
||||
|
|
|
@ -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"/>
|
||||
|
|
|
@ -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"/>
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -1354,6 +1354,7 @@ SWITCH_STANDARD_API(sofia_function)
|
|||
"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 @@ SWITCH_STANDARD_API(sofia_function)
|
|||
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;
|
||||
|
|
|
@ -148,7 +148,8 @@ typedef enum {
|
|||
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 {
|
||||
|
|
|
@ -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 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||
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 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
|||
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 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||
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 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue