Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
46457f60
Commit
46457f60
authored
13 years ago
by
Tristan Matthews
Browse files
Options
Downloads
Patches
Plain Diff
* #7276: minor cleanup
parent
69e82362
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
daemon/src/sip/sipaccount.h
+4
-0
4 additions, 0 deletions
daemon/src/sip/sipaccount.h
daemon/src/sip/sipvoiplink.cpp
+22
-18
22 additions, 18 deletions
daemon/src/sip/sipvoiplink.cpp
with
26 additions
and
18 deletions
daemon/src/sip/sipaccount.h
+
4
−
0
View file @
46457f60
...
...
@@ -442,6 +442,10 @@ class SIPAccount : public Account {
*/
static
std
::
string
getLoginName
();
// noncopyable
SIPAccount
(
const
SIPAccount
&
);
SIPAccount
&
operator
=
(
const
SIPAccount
&
);
// The pjsip client registration information
pjsip_regc
*
regc_
;
// To check if the account is registered
...
...
This diff is collapsed.
Click to expand it.
daemon/src/sip/sipvoiplink.cpp
+
22
−
18
View file @
46457f60
...
...
@@ -126,14 +126,16 @@ int SIPSessionReinvite(SIPCall *);
*/
void
onCallTransfered
(
pjsip_inv_session
*
inv
,
pjsip_rx_data
*
rdata
);
std
::
string
load
SIPLocalIP
()
std
::
string
get
SIPLocalIP
()
{
pj_sockaddr
ip_addr
;
if
(
pj_gethostip
(
pj_AF_INET
(),
&
ip_addr
)
==
PJ_SUCCESS
)
return
pj_inet_ntoa
(
ip_addr
.
ipv4
.
sin_addr
);
return
""
;
else
{
ERROR
(
"SIPVoIPLink: Could not get local IP"
);
return
""
;
}
}
pjsip_route_hdr
*
createRouteSet
(
const
std
::
string
&
route
,
pj_pool_t
*
hdr_pool
)
...
...
@@ -187,7 +189,7 @@ SIPVoIPLink::SIPVoIPLink() : evThread_(new EventThread(this))
TRY
(
pjsip_endpt_create
(
&
cp_
->
factory
,
pj_gethostname
()
->
ptr
,
&
endpt_
));
if
(
load
SIPLocalIP
().
empty
())
if
(
get
SIPLocalIP
().
empty
())
throw
VoipLinkException
(
"UserAgent: Unable to determine network capabilities"
);
TRY
(
pjsip_tsx_layer_init_module
(
endpt_
));
...
...
@@ -230,6 +232,7 @@ SIPVoIPLink::SIPVoIPLink() : evThread_(new EventThread(this))
DEBUG
(
"UserAgent: pjsip version %s for %s initialized"
,
pj_get_version
(),
PJ_OS_NAME
);
TRY
(
pjsip_replaces_init_module
(
endpt_
));
#undef TRY
evThread_
->
start
();
}
...
...
@@ -392,7 +395,7 @@ Call *SIPVoIPLink::newOutgoingCall(const std::string& id, const std::string& toU
std
::
string
localAddr
(
getInterfaceAddrFromName
(
account
->
getLocalInterface
()));
if
(
localAddr
==
"0.0.0.0"
)
localAddr
=
load
SIPLocalIP
();
localAddr
=
get
SIPLocalIP
();
setCallMediaLocal
(
call
,
localAddr
);
...
...
@@ -402,7 +405,7 @@ Call *SIPVoIPLink::newOutgoingCall(const std::string& id, const std::string& toU
getInterfaceAddrFromName
(
account
->
getLocalInterface
());
if
(
addrSdp
==
"0.0.0.0"
)
addrSdp
=
load
SIPLocalIP
();
addrSdp
=
get
SIPLocalIP
();
// Initialize the session using ULAW as default codec in case of early media
// The session should be ready to receive media once the first INVITE is sent, before
...
...
@@ -474,7 +477,7 @@ SIPVoIPLink::hangup(const std::string& id)
throw
VoipLinkException
(
"No invite session for this call"
);
// Looks for sip routes
if
(
not
(
account
->
getServiceRoute
().
empty
())
)
{
if
(
not
account
->
getServiceRoute
().
empty
())
{
pjsip_route_hdr
*
route_set
=
createRouteSet
(
account
->
getServiceRoute
(),
inv
->
pool
);
pjsip_dlg_set_route_set
(
inv
->
dlg
,
route_set
);
}
...
...
@@ -877,7 +880,7 @@ bool SIPVoIPLink::SIPNewIpToIpCall(const std::string& id, const std::string& to)
std
::
string
localAddress
(
getInterfaceAddrFromName
(
account
->
getLocalInterface
()));
if
(
localAddress
==
"0.0.0.0"
)
localAddress
=
load
SIPLocalIP
();
localAddress
=
get
SIPLocalIP
();
setCallMediaLocal
(
call
,
localAddress
);
...
...
@@ -1002,7 +1005,7 @@ void SIPVoIPLink::createTlsListener(SIPAccount *account, pjsip_tpfactory **liste
pj_str_t
pjAddress
;
pj_cstr
(
&
pjAddress
,
PJ_INADDR_ANY
);
pj_sockaddr_in_set_str_addr
(
&
local_addr
,
&
pjAddress
);
std
::
string
localIP
(
load
SIPLocalIP
());
std
::
string
localIP
(
get
SIPLocalIP
());
pjsip_host_port
a_name
=
{
pj_str
((
char
*
)
localIP
.
c_str
()),
...
...
@@ -1019,7 +1022,7 @@ void SIPVoIPLink::createTlsTransport(SIPAccount *account, std::string remoteAddr
pj_cstr
(
&
remote
,
remoteAddr
.
c_str
());
pj_sockaddr_in
rem_addr
;
pj_sockaddr_in_init
(
&
rem_addr
,
&
remote
,
(
pj_uint16_t
)
5061
);
pj_sockaddr_in_init
(
&
rem_addr
,
&
remote
,
(
pj_uint16_t
)
DEFAULT_SIP_TLS_PORT
);
static
pjsip_tpfactory
*
localTlsListener
=
NULL
;
/** The local tls listener */
...
...
@@ -1072,7 +1075,7 @@ void SIPVoIPLink::createUdpTransport(SIPAccount *account)
bound_addr
.
sin_family
=
PJ_AF_INET
;
if
(
account
->
getLocalInterface
()
==
"default"
)
{
listeningAddress
=
load
SIPLocalIP
();
listeningAddress
=
get
SIPLocalIP
();
bound_addr
.
sin_addr
.
s_addr
=
pj_htonl
(
PJ_INADDR_ANY
);
}
else
{
listeningAddress
=
getInterfaceAddrFromName
(
account
->
getLocalInterface
());
...
...
@@ -1084,11 +1087,12 @@ void SIPVoIPLink::createUdpTransport(SIPAccount *account)
listeningPort
=
account
->
getPublishedPort
();
}
// We must specify this here to avoid the IP2IP_PROFILE to create a transport with name 0.0.0.0 to appear in the via header
// We must specify this here to avoid the IP2IP_PROFILE creating a
// transport with the name 0.0.0.0 appearing in the via header
if
(
account
->
getAccountID
()
==
IP2IP_PROFILE
)
listeningAddress
=
load
SIPLocalIP
();
listeningAddress
=
get
SIPLocalIP
();
if
(
listeningAddress
.
empty
()
||
listeningPort
==
0
)
if
(
listeningAddress
.
empty
()
or
listeningPort
==
0
)
return
;
const
pjsip_host_port
a_name
=
{
...
...
@@ -1217,7 +1221,7 @@ void SIPVoIPLink::findLocalAddressFromUri(const std::string& uri, pjsip_transpor
tp_sel
=
initTransportSelector
(
transport
,
pool_
);
pj_str_t
localAddress
=
{
0
,
0
};
int
i_port
;
int
i_port
=
0
;
if
(
pjsip_tpmgr_find_local_addr
(
tpmgr
,
pool_
,
transportType
,
tp_sel
,
&
localAddress
,
&
i_port
)
!=
PJ_SUCCESS
)
return
;
...
...
@@ -1225,7 +1229,7 @@ void SIPVoIPLink::findLocalAddressFromUri(const std::string& uri, pjsip_transpor
addr
=
std
::
string
(
localAddress
.
ptr
,
localAddress
.
slen
);
if
(
addr
==
"0.0.0.0"
)
addr
=
load
SIPLocalIP
();
addr
=
get
SIPLocalIP
();
ss
.
str
(
""
);
ss
<<
i_port
;
...
...
@@ -1364,7 +1368,7 @@ static void sdp_create_offer_cb(pjsip_inv_session *inv, pjmedia_sdp_session **p_
std
::
string
addrSdp
(
localAddress
);
if
(
localAddress
==
"0.0.0.0"
)
localAddress
=
load
SIPLocalIP
();
localAddress
=
get
SIPLocalIP
();
if
(
addrSdp
==
"0.0.0.0"
)
addrSdp
=
localAddress
;
...
...
@@ -1751,7 +1755,7 @@ static pj_bool_t transaction_request_cb(pjsip_rx_data *rdata)
pjsip_tpselector
*
tp
=
SIPVoIPLink
::
instance
()
->
initTransportSelector
(
account
->
transport_
,
call
->
getMemoryPool
());
if
(
addrToUse
==
"0.0.0.0"
)
addrToUse
=
load
SIPLocalIP
();
addrToUse
=
get
SIPLocalIP
();
if
(
addrSdp
==
"0.0.0.0"
)
addrSdp
=
addrToUse
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment