Skip to content
Snippets Groups Projects
Commit c891cd82 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2943] Set destination ip address during updateDestinationIpAddress

Was previously called in start rtp session too
parent 5c34d5a8
No related branches found
No related tags found
No related merge requests found
...@@ -109,6 +109,7 @@ namespace sfl { ...@@ -109,6 +109,7 @@ namespace sfl {
// this destination and update a new one. // this destination and update a new one.
ost::InetHostAddress _remote_ip; ost::InetHostAddress _remote_ip;
// Main destination port for this rtp session. // Main destination port for this rtp session.
// Stored in case reINVITE, which may require to forget // Stored in case reINVITE, which may require to forget
// this destination and update a new one // this destination and update a new one
...@@ -208,7 +209,7 @@ namespace sfl { ...@@ -208,7 +209,7 @@ namespace sfl {
assert(_ca); assert(_ca);
_debug ("Local audio port %i will be used", _ca->getLocalAudioPort()); _info ("Rtp: Local audio port %i will be used", _ca->getLocalAudioPort());
//mic, we receive from soundcard in stereo, and we send encoded //mic, we receive from soundcard in stereo, and we send encoded
_audiolayer = _manager->getAudioDriver(); _audiolayer = _manager->getAudioDriver();
...@@ -223,7 +224,7 @@ namespace sfl { ...@@ -223,7 +224,7 @@ namespace sfl {
template <typename D> template <typename D>
AudioRtpSession<D>::~AudioRtpSession() AudioRtpSession<D>::~AudioRtpSession()
{ {
_debug ("Delete AudioRtpSession instance"); _debug ("Rtp: Delete AudioRtpSession instance");
try { try {
terminate(); terminate();
...@@ -232,8 +233,6 @@ namespace sfl { ...@@ -232,8 +233,6 @@ namespace sfl {
throw; throw;
} }
_debug("Unbind audio RTP stream for call id %s", _ca->getCallId().c_str());
// _audiolayer->getMainBuffer()->unBindAll(_ca->getCallId());
_manager->getAudioDriver()->getMainBuffer()->unBindAll(_ca->getCallId()); _manager->getAudioDriver()->getMainBuffer()->unBindAll(_ca->getCallId());
delete [] _micData; delete [] _micData;
...@@ -243,7 +242,6 @@ namespace sfl { ...@@ -243,7 +242,6 @@ namespace sfl {
delete [] _spkrDataConverted; delete [] _spkrDataConverted;
delete _time; delete _time;
delete _converter; delete _converter;
_debug ("AudioRtpSession instance deleted");
} }
template <typename D> template <typename D>
...@@ -318,26 +316,29 @@ namespace sfl { ...@@ -318,26 +316,29 @@ namespace sfl {
void AudioRtpSession<D>::setDestinationIpAddress(void) void AudioRtpSession<D>::setDestinationIpAddress(void)
{ {
if (_ca == NULL) { if (_ca == NULL) {
_debug ("Sipcall is gone."); _warn ("Rtp: Sipcall is gone.");
throw AudioRtpSessionException(); throw AudioRtpSessionException();
} }
_debug ("Setting IP address for the RTP session"); _info ("RTP: Setting IP address for the RTP session");
// Store remote ip in case we would need to forget current destination // Store remote ip in case we would need to forget current destination
_remote_ip = ost::InetHostAddress(_ca->getLocalSDP()->get_remote_ip().c_str()); _remote_ip = ost::InetHostAddress(_ca->getLocalSDP()->get_remote_ip().c_str());
_debug ("Init audio RTP session: remote ip %s", _ca->getLocalSDP()->get_remote_ip().data());
if (!_remote_ip) { if (!_remote_ip) {
_debug ("Target IP address [%s] is not correct!", _ca->getLocalSDP()->get_remote_ip().data()); _warn("Rtp: Target IP address (%s) is not correct!",
_ca->getLocalSDP()->get_remote_ip().data());
return; return;
} }
// Store remote port in case we would need to forget current destination // Store remote port in case we would need to forget current destination
_remote_port = (unsigned short) _ca->getLocalSDP()->get_remote_audio_port(); _remote_port = (unsigned short) _ca->getLocalSDP()->get_remote_audio_port();
_info("RTP: New remote address for session: %s:%d",
_ca->getLocalSDP()->get_remote_ip().data(), _remote_port);
if (! static_cast<D*>(this)->addDestination (_remote_ip, _remote_port)) { if (! static_cast<D*>(this)->addDestination (_remote_ip, _remote_port)) {
_debug ("Can't add destination to session!"); _warn("Rtp: Can't add new destination to session!");
return; return;
} }
} }
...@@ -346,9 +347,10 @@ namespace sfl { ...@@ -346,9 +347,10 @@ namespace sfl {
void AudioRtpSession<D>::updateDestinationIpAddress(void) void AudioRtpSession<D>::updateDestinationIpAddress(void)
{ {
// Destination address are stored in a list in ccrtp // Destination address are stored in a list in ccrtp
// This method clear off this entry // This method remove the current destination entry
_debug("updateDestinationIpAddress: remove destination %s", _ca->getLocalSDP()->get_remote_ip().c_str());
static_cast<D*>(this)->forgetDestination(_remote_ip, _remote_port); if(!static_cast<D*>(this)->forgetDestination(_remote_ip, _remote_port, _remote_port+1))
_warn("Rtp: Could not remove previous destination");
// new destination is stored in call // new destination is stored in call
// we just need to recall this method // we just need to recall this method
...@@ -534,7 +536,6 @@ namespace sfl { ...@@ -534,7 +536,6 @@ namespace sfl {
{ {
setSessionTimeouts(); setSessionTimeouts();
setDestinationIpAddress();
setSessionMedia(); setSessionMedia();
initBuffers(); initBuffers();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment