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
63a40673
Commit
63a40673
authored
Aug 14, 2013
by
Tristan Matthews
Browse files
* #27724: sdp: use published IP address for STUN
parent
7fb07ff3
Changes
3
Hide whitespace changes
Inline
Side-by-side
daemon/src/sip/sdp.cpp
View file @
63a40673
...
...
@@ -65,7 +65,7 @@ Sdp::Sdp(pj_pool_t *pool)
,
video_codec_list_
()
,
sessionAudioMedia_
()
,
sessionVideoMedia_
()
,
local
IpAddr_
()
,
published
IpAddr_
()
,
remoteIpAddr_
()
,
localAudioDataPort_
(
0
)
,
localAudioControlPort_
(
0
)
...
...
@@ -323,7 +323,7 @@ Sdp::setMediaDescriptorLines(bool audio)
void
Sdp
::
addRTCPAttribute
(
pjmedia_sdp_media
*
med
)
{
std
::
ostringstream
os
;
os
<<
local
IpAddr_
<<
":"
<<
localAudioControlPort_
;
os
<<
published
IpAddr_
<<
":"
<<
localAudioControlPort_
;
const
std
::
string
str
(
os
.
str
());
pj_str_t
input_str
=
pj_str
((
char
*
)
str
.
c_str
());
pj_sockaddr
outputAddr
;
...
...
@@ -424,7 +424,7 @@ int Sdp::createLocalSession(const vector<int> &selectedAudioCodecs, const vector
localSession_
->
origin
.
id
=
tv
.
sec
+
2208988800UL
;
localSession_
->
origin
.
net_type
=
pj_str
((
char
*
)
"IN"
);
localSession_
->
origin
.
addr_type
=
pj_str
((
char
*
)
"IP4"
);
localSession_
->
origin
.
addr
=
pj_str
((
char
*
)
local
IpAddr_
.
c_str
());
localSession_
->
origin
.
addr
=
pj_str
((
char
*
)
published
IpAddr_
.
c_str
());
localSession_
->
name
=
pj_str
((
char
*
)
PACKAGE
);
...
...
daemon/src/sip/sdp.h
View file @
63a40673
...
...
@@ -153,15 +153,15 @@ class Sdp {
/*
* Write accessor. Set the local IP address that will be used in the sdp session
*/
void
set
Local
IP
(
const
std
::
string
&
ip_addr
)
{
local
IpAddr_
=
ip_addr
;
void
set
Published
IP
(
const
std
::
string
&
ip_addr
)
{
published
IpAddr_
=
ip_addr
;
}
/*
* Read accessor. Get the local IP address
*/
std
::
string
get
Local
IP
()
const
{
return
local
IpAddr_
;
std
::
string
get
Published
IP
()
const
{
return
published
IpAddr_
;
}
void
setLocalPublishedAudioPort
(
int
port
)
{
...
...
@@ -311,7 +311,7 @@ class Sdp {
std
::
vector
<
sfl
::
AudioCodec
*>
sessionAudioMedia_
;
std
::
vector
<
std
::
string
>
sessionVideoMedia_
;
std
::
string
local
IpAddr_
;
std
::
string
published
IpAddr_
;
std
::
string
remoteIpAddr_
;
int
localAudioDataPort_
;
...
...
daemon/src/sip/sipvoiplink.cpp
View file @
63a40673
...
...
@@ -227,6 +227,7 @@ void updateSDPFromSTUN(SIPCall &call, SIPAccount &account, const SipTransport &t
account
.
setPublishedAddress
(
pj_inet_ntoa
(
stunPorts
[
0
].
sin_addr
));
call
.
getLocalSDP
()
->
updatePorts
(
stunPorts
);
call
.
getLocalSDP
()
->
setPublishedIP
(
account
.
getPublishedAddress
());
}
catch
(
const
std
::
runtime_error
&
e
)
{
ERROR
(
"%s"
,
e
.
what
());
}
...
...
@@ -343,7 +344,7 @@ pj_bool_t transaction_request_cb(pjsip_rx_data *rdata)
setCallMediaLocal
(
call
,
addrToUse
);
call
->
getLocalSDP
()
->
set
Local
IP
(
addrSdp
);
call
->
getLocalSDP
()
->
set
Published
IP
(
addrSdp
);
call
->
getAudioRtp
().
initConfig
();
try
{
...
...
@@ -932,7 +933,7 @@ Call *SIPVoIPLink::SIPNewIpToIpCall(const std::string& id, const std::string& to
// Building the local SDP offer
Sdp
*
localSDP
=
call
->
getLocalSDP
();
localSDP
->
set
Local
IP
(
localAddress
);
localSDP
->
set
Published
IP
(
localAddress
);
const
bool
created
=
localSDP
->
createOffer
(
account
->
getActiveAudioCodecs
(),
account
->
getActiveVideoCodecs
());
if
(
not
created
or
not
SIPStartCall
(
call
))
{
...
...
@@ -1001,7 +1002,7 @@ Call *SIPVoIPLink::newRegisteredAccountCall(const std::string& id, const std::st
call
->
initRecFilename
(
toUrl
);
Sdp
*
localSDP
=
call
->
getLocalSDP
();
localSDP
->
set
Local
IP
(
addrSdp
);
localSDP
->
set
Published
IP
(
addrSdp
);
const
bool
created
=
localSDP
->
createOffer
(
account
->
getActiveAudioCodecs
(),
account
->
getActiveVideoCodecs
());
if
(
not
created
or
not
SIPStartCall
(
call
))
{
...
...
@@ -1021,8 +1022,11 @@ SIPVoIPLink::answer(Call *call)
SIPCall
*
sipCall
=
static_cast
<
SIPCall
*>
(
call
);
if
(
!
sipCall
->
inv
->
neg
)
{
WARN
(
"Negotiator is NULL, we've received an INVITE without an SDP"
);
pjmedia_sdp_session
*
dummy
;
pjmedia_sdp_session
*
dummy
=
0
;
sdp_create_offer_cb
(
sipCall
->
inv
,
&
dummy
);
SIPAccount
*
account
=
Manager
::
instance
().
getSipAccount
(
sipCall
->
getAccountId
());
if
(
account
and
account
->
isStunEnabled
())
updateSDPFromSTUN
(
*
sipCall
,
*
account
,
SIPVoIPLink
::
instance
()
->
sipTransport
);
}
call
->
answer
();
...
...
@@ -1788,7 +1792,7 @@ void sdp_create_offer_cb(pjsip_inv_session *inv, pjmedia_sdp_session **p_offer)
setCallMediaLocal
(
call
,
localAddress
);
Sdp
*
localSDP
=
call
->
getLocalSDP
();
localSDP
->
set
Local
IP
(
addrSdp
);
localSDP
->
set
Published
IP
(
addrSdp
);
const
bool
created
=
localSDP
->
createOffer
(
account
->
getActiveAudioCodecs
(),
account
->
getActiveVideoCodecs
());
if
(
created
)
*
p_offer
=
localSDP
->
getLocalSdpSession
();
...
...
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