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
b86b6fe9
Commit
b86b6fe9
authored
16 years ago
by
Emmanuel Milou
Browse files
Options
Downloads
Patches
Plain Diff
fix port problems
parent
b61c3339
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/audio/audiortp.cpp
+1
-1
1 addition, 1 deletion
src/audio/audiortp.cpp
src/sdp.cpp
+16
-1
16 additions, 1 deletion
src/sdp.cpp
src/sdp.h
+12
-8
12 additions, 8 deletions
src/sdp.h
src/sipvoiplink.cpp
+28
-11
28 additions, 11 deletions
src/sipvoiplink.cpp
src/sipvoiplink.h
+1
-1
1 addition, 1 deletion
src/sipvoiplink.h
with
58 additions
and
22 deletions
src/audio/audiortp.cpp
+
1
−
1
View file @
b86b6fe9
...
@@ -196,7 +196,7 @@ AudioRtpRTX::initAudioRtpSession (void)
...
@@ -196,7 +196,7 @@ AudioRtpRTX::initAudioRtpSession (void)
_codecSampleRate
=
_audiocodec
->
getClockRate
();
_codecSampleRate
=
_audiocodec
->
getClockRate
();
remoteIP
=
_ca
->
get
R
emote
I
p
();
remoteIP
=
_ca
->
get
LocalSDP
()
->
get_r
emote
_i
p
();
_debug
(
"Init audio RTP session - remote IP = %s
\n
"
,
remoteIP
.
c_str
());
_debug
(
"Init audio RTP session - remote IP = %s
\n
"
,
remoteIP
.
c_str
());
ost
::
InetHostAddress
remote_ip
(
remoteIP
.
c_str
());
ost
::
InetHostAddress
remote_ip
(
remoteIP
.
c_str
());
if
(
!
remote_ip
)
{
if
(
!
remote_ip
)
{
...
...
This diff is collapsed.
Click to expand it.
src/sdp.cpp
+
16
−
1
View file @
b86b6fe9
...
@@ -165,6 +165,10 @@ int Sdp::receiving_initial_offer( pjmedia_sdp_session* remote ){
...
@@ -165,6 +165,10 @@ int Sdp::receiving_initial_offer( pjmedia_sdp_session* remote ){
// Build the local offer to respond
// Build the local offer to respond
create_local_offer
(
);
create_local_offer
(
);
// Retrieve some useful remote information
this
->
fetch_remote_ip_from_sdp
(
remote
);
//this->fetch_remote_audio_port_from_sdp ();
status
=
pjmedia_sdp_neg_create_w_remote_offer
(
_pool
,
status
=
pjmedia_sdp_neg_create_w_remote_offer
(
_pool
,
get_local_sdp_session
(),
remote
,
&
_negociator
);
get_local_sdp_session
(),
remote
,
&
_negociator
);
state
=
pjmedia_sdp_neg_get_state
(
_negociator
);
state
=
pjmedia_sdp_neg_get_state
(
_negociator
);
...
@@ -347,7 +351,7 @@ void Sdp::set_local_media_capabilities () {
...
@@ -347,7 +351,7 @@ void Sdp::set_local_media_capabilities () {
/* Only one audio media used right now */
/* Only one audio media used right now */
audio
=
new
sdpMedia
(
MIME_TYPE_AUDIO
);
audio
=
new
sdpMedia
(
MIME_TYPE_AUDIO
);
audio
->
set_port
(
_l
ocalAudioPort
);
audio
->
set_port
(
get
ocalAudioPort
);
/* We retrieve the codecs selected by the user */
/* We retrieve the codecs selected by the user */
selected_codecs
=
Manager
::
instance
().
getCodecDescriptorMap
().
getActiveCodecs
();
selected_codecs
=
Manager
::
instance
().
getCodecDescriptorMap
().
getActiveCodecs
();
...
@@ -367,6 +371,8 @@ void Sdp::attribute_port_to_all_media (int port) {
...
@@ -367,6 +371,8 @@ void Sdp::attribute_port_to_all_media (int port) {
std
::
vector
<
sdpMedia
*>
medias
;
std
::
vector
<
sdpMedia
*>
medias
;
int
i
,
size
;
int
i
,
size
;
set_local_extern_audio_port
(
port
);
medias
=
get_local_media_cap
();
medias
=
get_local_media_cap
();
size
=
medias
.
size
();
size
=
medias
.
size
();
...
@@ -381,3 +387,12 @@ std::string Sdp::convert_int_to_string (int value) {
...
@@ -381,3 +387,12 @@ std::string Sdp::convert_int_to_string (int value) {
result
<<
value
;
result
<<
value
;
return
result
.
str
();
return
result
.
str
();
}
}
void
Sdp
::
fetch_remote_ip_from_sdp
(
pjmedia_sdp_session
*
r_sdp
)
{
std
::
string
remote_ip
;
remote_ip
=
r_sdp
->
conn
->
addr
.
ptr
;
_debug
(
" Remote Audio IP: %s
\n
"
,
remote_ip
.
c_str
());
set_remote_ip
(
remote_ip
);
}
This diff is collapsed.
Click to expand it.
src/sdp.h
+
12
−
8
View file @
b86b6fe9
...
@@ -149,10 +149,10 @@ class Sdp {
...
@@ -149,10 +149,10 @@ class Sdp {
*/
*/
void
attribute_port_to_all_media
(
int
port
);
void
attribute_port_to_all_media
(
int
port
);
///////////////////////////////////////////////////////////////////////////33
void
set_local_extern_audio_port
(
int
port
){
_local_extern_audio_port
=
port
;
}
void
setLocalExternAudioPort
(
int
port
){
_localAudioPort
=
port
;
}
int
getLocalExternAudioPort
(
void
){
return
_localAudioPort
;
}
int
get_local_extern_audio_port
(
void
){
return
_local_extern_audio_port
;
}
///////////////////////////////////////////////////////////////////////////33
void
toString
(
void
);
void
toString
(
void
);
...
@@ -160,25 +160,25 @@ class Sdp {
...
@@ -160,25 +160,25 @@ class Sdp {
* Set remote's IP addr. [not protected]
* Set remote's IP addr. [not protected]
* @param ip The remote IP address
* @param ip The remote IP address
*/
*/
void
set
R
emote
IP
(
const
std
::
string
&
ip
)
{
_remoteIPAddress
=
ip
;
}
void
set
_r
emote
_ip
(
const
std
::
string
&
ip
)
{
_remoteIPAddress
=
ip
;
}
/**
/**
* Set remote's audio port. [not protected]
* Set remote's audio port. [not protected]
* @param port The remote audio port
* @param port The remote audio port
*/
*/
void
set
R
emote
A
udio
P
ort
(
unsigned
int
port
)
{
_remote
A
udio
P
ort
=
port
;
}
void
set
_r
emote
_a
udio
_p
ort
(
unsigned
int
port
)
{
_remote
_a
udio
_p
ort
=
port
;
}
/**
/**
* Return audio port at destination [mutex protected]
* Return audio port at destination [mutex protected]
* @return unsigned int The remote audio port
* @return unsigned int The remote audio port
*/
*/
unsigned
int
get
R
emote
A
udio
P
ort
()
{
return
_remote
A
udio
P
ort
;
}
unsigned
int
get
_r
emote
_a
udio
_p
ort
()
{
return
_remote
_a
udio
_p
ort
;
}
/**
/**
* Return IP of destination [mutex protected]
* Return IP of destination [mutex protected]
* @return const std:string The remote IP address
* @return const std:string The remote IP address
*/
*/
const
std
::
string
&
get
R
emote
I
p
()
{
return
_remoteIPAddress
;
}
const
std
::
string
&
get
_r
emote
_i
p
()
{
return
_remoteIPAddress
;
}
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
...
@@ -288,7 +288,11 @@ class Sdp {
...
@@ -288,7 +288,11 @@ class Sdp {
std
::
string
convert_int_to_string
(
int
value
);
std
::
string
convert_int_to_string
(
int
value
);
int
_localAudioPort
;
void
fetch_remote_ip_from_sdp
(
pjmedia_sdp_session
*
r_sdp
);
void
fetch_remote_audio_port_from_sdp
(
pjmedia_sdp_media
*
r_sdp
);
int
_local_extern_audio_port
;
//////////////////////////////////////////////////////////////////3
//////////////////////////////////////////////////////////////////3
/** Remote's IP address */
/** Remote's IP address */
...
...
This diff is collapsed.
Click to expand it.
src/sipvoiplink.cpp
+
28
−
11
View file @
b86b6fe9
...
@@ -477,6 +477,8 @@ SIPVoIPLink::answer(const CallID& id)
...
@@ -477,6 +477,8 @@ SIPVoIPLink::answer(const CallID& id)
SIPCall
*
call
;
SIPCall
*
call
;
pj_status_t
status
;
pj_status_t
status
;
pjsip_tx_data
*
tdata
;
pjsip_tx_data
*
tdata
;
Sdp
*
local_sdp
;
pjsip_inv_session
*
inv_session
;
_debug
(
"SIPVoIPLink::answer: start answering
\n
"
);
_debug
(
"SIPVoIPLink::answer: start answering
\n
"
);
...
@@ -487,15 +489,19 @@ SIPVoIPLink::answer(const CallID& id)
...
@@ -487,15 +489,19 @@ SIPVoIPLink::answer(const CallID& id)
return
false
;
return
false
;
}
}
// User answered the incoming call, tell peer this news
local_sdp
=
call
->
getLocalSDP
();
if
(
call
->
getLocalSDP
()
->
start_negociation
())
{
inv_session
=
call
->
getInvSession
();
// Create and send a 200(OK) response
status
=
local_sdp
->
start_negociation
();
if
(
status
==
PJ_SUCCESS
)
{
_debug
(
"SIPVoIPLink::answer:UserAgent: Negociation success! : call %s
\n
"
,
call
->
getCallId
().
c_str
());
_debug
(
"SIPVoIPLink::answer:UserAgent: Negociation success! : call %s
\n
"
,
call
->
getCallId
().
c_str
());
status
=
pjsip_inv_answer
(
call
->
getInvSession
(),
PJSIP_SC_OK
,
NULL
,
NULL
,
&
tdata
);
// Create and send a 200(OK) response
status
=
pjsip_inv_answer
(
inv_session
,
PJSIP_SC_OK
,
NULL
,
NULL
,
&
tdata
);
PJ_ASSERT_RETURN
(
status
==
PJ_SUCCESS
,
1
);
PJ_ASSERT_RETURN
(
status
==
PJ_SUCCESS
,
1
);
status
=
pjsip_inv_send_msg
(
call
->
getInvS
ession
()
,
tdata
);
status
=
pjsip_inv_send_msg
(
inv_s
ession
,
tdata
);
PJ_ASSERT_RETURN
(
status
==
PJ_SUCCESS
,
1
);
PJ_ASSERT_RETURN
(
status
==
PJ_SUCCESS
,
1
);
// Start the RTP sessions
_debug
(
"SIPVoIPLink::answer: Starting AudioRTP when answering : call %s
\n
"
,
call
->
getCallId
().
c_str
());
_debug
(
"SIPVoIPLink::answer: Starting AudioRTP when answering : call %s
\n
"
,
call
->
getCallId
().
c_str
());
if
(
_audiortp
->
createNewSession
(
call
)
>=
0
)
{
if
(
_audiortp
->
createNewSession
(
call
)
>=
0
)
{
call
->
setAudioStart
(
true
);
call
->
setAudioStart
(
true
);
...
@@ -506,11 +512,22 @@ SIPVoIPLink::answer(const CallID& id)
...
@@ -506,11 +512,22 @@ SIPVoIPLink::answer(const CallID& id)
_debug
(
"SIPVoIPLink::answer: Unable to start sound when answering %s/%d
\n
"
,
__FILE__
,
__LINE__
);
_debug
(
"SIPVoIPLink::answer: Unable to start sound when answering %s/%d
\n
"
,
__FILE__
,
__LINE__
);
}
}
}
}
else
{
// Create and send a 488/Not acceptable here
// because the SDP negociation failed
status
=
pjsip_inv_answer
(
inv_session
,
PJSIP_SC_NOT_ACCEPTABLE_HERE
,
NULL
,
NULL
,
&
tdata
);
PJ_ASSERT_RETURN
(
status
==
PJ_SUCCESS
,
1
);
status
=
pjsip_inv_send_msg
(
inv_session
,
tdata
);
PJ_ASSERT_RETURN
(
status
==
PJ_SUCCESS
,
1
);
// Terminate the call
_debug
(
"SIPVoIPLink::answer: fail terminate call %s
\n
"
,
call
->
getCallId
().
c_str
());
_debug
(
"SIPVoIPLink::answer: fail terminate call %s
\n
"
,
call
->
getCallId
().
c_str
());
terminateOneCall
(
call
->
getCallId
());
terminateOneCall
(
call
->
getCallId
());
removeCall
(
call
->
getCallId
());
removeCall
(
call
->
getCallId
());
return
false
;
return
false
;
}
}
}
bool
bool
SIPVoIPLink
::
hangup
(
const
CallID
&
id
)
SIPVoIPLink
::
hangup
(
const
CallID
&
id
)
...
...
This diff is collapsed.
Click to expand it.
src/sipvoiplink.h
+
1
−
1
View file @
b86b6fe9
...
@@ -112,7 +112,7 @@ class SIPVoIPLink : public VoIPLink
...
@@ -112,7 +112,7 @@ class SIPVoIPLink : public VoIPLink
/**
/**
* Answer the call
* Answer the call
* @param id The call identifier
* @param id The call identifier
* @return
bool
True on success
* @return
int
True on success
*/
*/
bool
answer
(
const
CallID
&
id
);
bool
answer
(
const
CallID
&
id
);
...
...
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