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
cc75ae8c
Commit
cc75ae8c
authored
11 years ago
by
Tristan Matthews
Browse files
Options
Downloads
Patches
Plain Diff
* #29034: SDP: update SDP struct on STUN update
parent
40959af2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
daemon/src/sip/sdp.cpp
+26
-0
26 additions, 0 deletions
daemon/src/sip/sdp.cpp
daemon/src/sip/sdp.h
+1
-3
1 addition, 3 deletions
daemon/src/sip/sdp.h
daemon/src/sip/sipvoiplink.cpp
+2
-1
2 additions, 1 deletion
daemon/src/sip/sipvoiplink.cpp
with
29 additions
and
4 deletions
daemon/src/sip/sdp.cpp
+
26
−
0
View file @
cc75ae8c
...
@@ -337,6 +337,18 @@ void Sdp::addRTCPAttribute(pjmedia_sdp_media *med)
...
@@ -337,6 +337,18 @@ void Sdp::addRTCPAttribute(pjmedia_sdp_media *med)
pjmedia_sdp_attr_add
(
&
med
->
attr_count
,
med
->
attr
,
attr
);
pjmedia_sdp_attr_add
(
&
med
->
attr_count
,
med
->
attr
,
attr
);
}
}
void
Sdp
::
setPublishedIP
(
const
std
::
string
&
ip_addr
)
{
publishedIpAddr_
=
ip_addr
;
if
(
localSession_
)
{
localSession_
->
origin
.
addr
=
pj_str
((
char
*
)
publishedIpAddr_
.
c_str
());
localSession_
->
conn
->
addr
=
localSession_
->
origin
.
addr
;
if
(
not
pjmedia_sdp_validate
(
localSession_
))
ERROR
(
"Could not validate SDP"
);
}
}
void
void
Sdp
::
updatePorts
(
const
std
::
vector
<
pj_sockaddr_in
>
&
sockets
)
Sdp
::
updatePorts
(
const
std
::
vector
<
pj_sockaddr_in
>
&
sockets
)
{
{
...
@@ -344,6 +356,20 @@ Sdp::updatePorts(const std::vector<pj_sockaddr_in> &sockets)
...
@@ -344,6 +356,20 @@ Sdp::updatePorts(const std::vector<pj_sockaddr_in> &sockets)
localAudioControlPort_
=
pj_ntohs
(
sockets
[
1
].
sin_port
);
localAudioControlPort_
=
pj_ntohs
(
sockets
[
1
].
sin_port
);
localVideoDataPort_
=
pj_ntohs
(
sockets
[
2
].
sin_port
);
localVideoDataPort_
=
pj_ntohs
(
sockets
[
2
].
sin_port
);
localVideoControlPort_
=
pj_ntohs
(
sockets
[
3
].
sin_port
);
localVideoControlPort_
=
pj_ntohs
(
sockets
[
3
].
sin_port
);
if
(
localSession_
)
{
if
(
localSession_
->
media
[
0
])
{
localSession_
->
media
[
0
]
->
desc
.
port
=
localAudioDataPort_
;
// update RTCP attribute
if
(
pjmedia_sdp_media_remove_all_attr
(
localSession_
->
media
[
0
],
"rtcp"
))
addRTCPAttribute
(
localSession_
->
media
[
0
]);
}
if
(
localSession_
->
media
[
1
])
localSession_
->
media
[
1
]
->
desc
.
port
=
localVideoDataPort_
;
if
(
not
pjmedia_sdp_validate
(
localSession_
))
ERROR
(
"Could not validate SDP"
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
daemon/src/sip/sdp.h
+
1
−
3
View file @
cc75ae8c
...
@@ -153,9 +153,7 @@ class Sdp {
...
@@ -153,9 +153,7 @@ class Sdp {
/*
/*
* Write accessor. Set the local IP address that will be used in the sdp session
* Write accessor. Set the local IP address that will be used in the sdp session
*/
*/
void
setPublishedIP
(
const
std
::
string
&
ip_addr
)
{
void
setPublishedIP
(
const
std
::
string
&
ip_addr
);
publishedIpAddr_
=
ip_addr
;
}
/*
/*
* Read accessor. Get the local IP address
* Read accessor. Get the local IP address
...
...
This diff is collapsed.
Click to expand it.
daemon/src/sip/sipvoiplink.cpp
+
2
−
1
View file @
cc75ae8c
...
@@ -226,8 +226,9 @@ void updateSDPFromSTUN(SIPCall &call, SIPAccount &account, const SipTransport &t
...
@@ -226,8 +226,9 @@ void updateSDPFromSTUN(SIPCall &call, SIPAccount &account, const SipTransport &t
stunPorts
.
resize
(
4
);
stunPorts
.
resize
(
4
);
account
.
setPublishedAddress
(
pj_inet_ntoa
(
stunPorts
[
0
].
sin_addr
));
account
.
setPublishedAddress
(
pj_inet_ntoa
(
stunPorts
[
0
].
sin_addr
));
call
.
getLocalSDP
()
->
updatePorts
(
stunPorts
);
// published IP MUST be updated first, since RTCP depends on it
call
.
getLocalSDP
()
->
setPublishedIP
(
account
.
getPublishedAddress
());
call
.
getLocalSDP
()
->
setPublishedIP
(
account
.
getPublishedAddress
());
call
.
getLocalSDP
()
->
updatePorts
(
stunPorts
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
}
catch
(
const
std
::
runtime_error
&
e
)
{
ERROR
(
"%s"
,
e
.
what
());
ERROR
(
"%s"
,
e
.
what
());
}
}
...
...
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