Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
a1f45ff7
Commit
a1f45ff7
authored
Jul 17, 2012
by
Alexandre Savard
Browse files
#13652: Make SIP log level should be controlable from environment variable
parent
10319d91
Changes
2
Hide whitespace changes
Inline
Side-by-side
daemon/src/sip/sipvoiplink.cpp
View file @
a1f45ff7
...
...
@@ -72,6 +72,7 @@
#include
<arpa/inet.h>
#include
<resolv.h>
#include
<istream>
// #include <fstream>
#include
<utility>
// for std::pair
#include
<map>
...
...
@@ -83,6 +84,9 @@ bool SIPVoIPLink::destroyed_ = false;
namespace
{
/** Environment variable used to set pjsip's logging level */
#define SIPLOGLEVEL "SIPLOGLEVEL"
/** A map to retreive SFLphone internal call id
* Given a SIP call ID (usefull for transaction sucha as transfer)*/
static
std
::
map
<
std
::
string
,
std
::
string
>
transferCallID
;
...
...
@@ -417,8 +421,8 @@ SIPVoIPLink::SIPVoIPLink() : sipTransport(endpt_, cp_, pool_), evThread_(this)
TRY
(
pj_init
());
TRY
(
pjlib_util_init
());
// From 0 (min) to 6 (max)
pj_log_set_l
evel
(
6
);
setSipLogL
evel
();
TRY
(
pjnath_init
());
pj_caching_pool_init
(
cp_
,
&
pj_pool_factory_default_policy
,
0
);
...
...
@@ -521,6 +525,22 @@ void SIPVoIPLink::destroy()
instance_
=
0
;
}
void
SIPVoIPLink
::
setSipLogLevel
()
{
std
::
string
loglevel
=
getenv
(
SIPLOGLEVEL
);
int
level
=
0
;
if
(
!
loglevel
.
empty
())
{
if
(
!
(
std
::
istringstream
(
loglevel
)
>>
level
)
)
level
=
0
;
level
=
level
>
6
?
6
:
level
;
level
=
level
<
0
?
0
:
level
;
}
// From 0 (min) to 6 (max)
pj_log_set_level
(
level
);
}
// Called from EventThread::run (not main thread)
bool
SIPVoIPLink
::
getEvent
()
{
...
...
daemon/src/sip/sipvoiplink.h
View file @
a1f45ff7
...
...
@@ -78,6 +78,13 @@ class SIPVoIPLink : public VoIPLink {
*/
static
void
destroy
();
/**
* Set pjsip's log level based on the SIPLOGLEVEL environment variable.
* SIPLOGLEVEL = 0 minimum logging
* SIPLOGLEVEL = 6 maximum logging
*/
static
void
setSipLogLevel
();
/**
* Event listener. Each event send by the call manager is received and handled from here
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment