Module: sems Branch: master Commit: 03b6cad124049ec305306822d10bc5a8287a337b URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=03b6cad124049ec305306822d10bc5a8287a337b
Author: Václav Kubart <[email protected]> Committer: Václav Kubart <[email protected]> Date: Fri May 4 14:03:26 2012 +0200 b/f: AmB2BMedia: possible to force symmetric RTP The SBC profile parameter rtp_relay_force_symmetric_rtp was ignored. Thanks to Peter Loeppky for report. --- apps/sbc/SBCCallProfile.cpp | 5 +++-- core/AmB2BMedia.cpp | 3 ++- core/AmB2BMedia.h | 3 +++ core/AmRtpAudio.cpp | 4 ++-- core/AmRtpAudio.h | 2 +- core/AmRtpStream.cpp | 5 +++-- core/AmRtpStream.h | 2 +- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/apps/sbc/SBCCallProfile.cpp b/apps/sbc/SBCCallProfile.cpp index 5790863..0514a52 100644 --- a/apps/sbc/SBCCallProfile.cpp +++ b/apps/sbc/SBCCallProfile.cpp @@ -666,7 +666,9 @@ bool SBCCallProfile::evaluate(const AmSipRequest& req, REPLACE_NONEMPTY_STR(next_hop_for_replies); } - if (rtprelay_enabled) { + if (!transcoder.evaluate(REPLACE_VALS)) return false; + + if (rtprelay_enabled || transcoder.isActive()) { // evaluate other RTP relay related params only if enabled // FIXME: really not evaluate rtprelay_enabled itself? REPLACE_NONEMPTY_STR(force_symmetric_rtp); @@ -727,7 +729,6 @@ bool SBCCallProfile::evaluate(const AmSipRequest& req, REPLACE_IFACE(outbound_interface, outbound_interface_value); - if (!transcoder.evaluate(REPLACE_VALS)) return false; if (!codec_prefs.evaluate(REPLACE_VALS)) return false; // TODO: activate filter if transcoder or codec_prefs is set? diff --git a/core/AmB2BMedia.cpp b/core/AmB2BMedia.cpp index ebdc9cb..9fac358 100644 --- a/core/AmB2BMedia.cpp +++ b/core/AmB2BMedia.cpp @@ -145,6 +145,7 @@ AudioStreamData::AudioStreamData(AmB2BSession *session): stream = new AmRtpAudio(session, session->getRtpRelayInterface()); stream->setRtpRelayTransparentSeqno(session->getRtpRelayTransparentSeqno()); stream->setRtpRelayTransparentSSRC(session->getRtpRelayTransparentSSRC()); + force_symmetric_rtp = session->getRtpRelayForceSymmetricRtp(); } void AudioStreamData::clear() @@ -222,7 +223,7 @@ bool AudioStreamData::initStream(AmSession *session, // TODO: try to init only in case there are some payloads which can't be relayed stream->forceSdpMediaIndex(media_idx); - if (stream->init(local_sdp, remote_sdp) == 0) { + if (stream->init(local_sdp, remote_sdp, force_symmetric_rtp) == 0) { stream->setPlayoutType(playout_type); initialized = true; if (session->isDtmfDetectionEnabled()) { diff --git a/core/AmB2BMedia.h b/core/AmB2BMedia.h index 8c2a726..1bced01 100644 --- a/core/AmB2BMedia.h +++ b/core/AmB2BMedia.h @@ -52,6 +52,9 @@ class AudioStreamData { * transcoding purposes). */ bool initialized; + /** remembered value of the option from AmB2BSession */ + bool force_symmetric_rtp; + /** DTMF detector used by dtmf_queue */ AmDtmfDetector *dtmf_detector; diff --git a/core/AmRtpAudio.cpp b/core/AmRtpAudio.cpp index 505ac47..9d02c7f 100644 --- a/core/AmRtpAudio.cpp +++ b/core/AmRtpAudio.cpp @@ -315,10 +315,10 @@ void AmRtpAudio::getSdpAnswer(unsigned int index, } int AmRtpAudio::init(const AmSdp& local, - const AmSdp& remote) + const AmSdp& remote, bool force_symmetric_rtp) { DBG("AmRtpAudio::init(...)\n"); - if(AmRtpStream::init(local,remote)){ + if(AmRtpStream::init(local,remote,force_symmetric_rtp)){ return -1; } diff --git a/core/AmRtpAudio.h b/core/AmRtpAudio.h index 4d8eb3f..9e7c8d3 100644 --- a/core/AmRtpAudio.h +++ b/core/AmRtpAudio.h @@ -152,7 +152,7 @@ public: void getSdpAnswer(unsigned int index, const SdpMedia& offer, SdpMedia& answer); int init(const AmSdp& local, - const AmSdp& remote); + const AmSdp& remote, bool force_symmetric_rtp = false); void setPlayoutType(PlayoutType type); diff --git a/core/AmRtpStream.cpp b/core/AmRtpStream.cpp index 97628c0..5ceeb9c 100644 --- a/core/AmRtpStream.cpp +++ b/core/AmRtpStream.cpp @@ -525,7 +525,8 @@ void AmRtpStream::getSdpAnswer(unsigned int index, const SdpMedia& offer, SdpMed } int AmRtpStream::init(const AmSdp& local, - const AmSdp& remote) + const AmSdp& remote, + bool force_passive_mode) { if((sdp_media_index < 0) || ((unsigned)sdp_media_index >= local.media.size()) || @@ -625,7 +626,7 @@ int AmRtpStream::init(const AmSdp& local, if (local.conn.address.empty()) setLocalIP(local_media.conn.address); else setLocalIP(local.conn.address); - setPassiveMode(remote_media.dir == SdpMedia::DirActive); + setPassiveMode(remote_media.dir == SdpMedia::DirActive || force_passive_mode); if (remote.conn.address.empty()) setRAddr(remote_media.conn.address, remote_media.port); else setRAddr(remote.conn.address, remote_media.port); diff --git a/core/AmRtpStream.h b/core/AmRtpStream.h index 5278c01..d70e166 100644 --- a/core/AmRtpStream.h +++ b/core/AmRtpStream.h @@ -401,7 +401,7 @@ public: * @warning It is necessary to call getSdpOffer/getSdpAnswer prior to init(...) * @warning so that the internal SDP media line index is set properly. */ - virtual int init(const AmSdp& local, const AmSdp& remote); + virtual int init(const AmSdp& local, const AmSdp& remote, bool force_passive_mode = false); /** * Stops RTP stream. _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
