Always use the RTP started flag, no matter in which version.

git-svn-id: http://voip.null.ro/svn/yate@5230 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2012-08-17 23:08:21 +00:00
parent 2d3c720bba
commit b6d72c4fc5
1 changed files with 15 additions and 7 deletions

View File

@ -325,7 +325,7 @@ private:
Mutex m_mutex; // Lock transport and session
State m_state; // Connection state
JGSession* m_session; // Jingle session attached to this connection
bool m_rtpStarted; // RTP started flag used by version 0 of the jingle session
bool m_rtpStarted; // RTP started flag
bool m_acceptRelay; // Accept to replace with a relay candidate
JGSession::Version m_sessVersion; // Jingle session version
int m_sessFlags; // Session flags
@ -1399,11 +1399,11 @@ bool YJGConnection::msgTone(Message& msg, const char* tone)
Lock lock(m_mutex);
// Inband and RFC 2833 require an active local RTP stream
if (meth == YJGDriver::DtmfInband) {
if (m_rtpId && dtmfInband(tone))
if (m_rtpStarted && dtmfInband(tone))
return true;
}
else if (meth == YJGDriver::DtmfRfc2833) {
if (m_rtpId) {
if (m_rtpStarted) {
msg.setParam("targetid",m_rtpId);
return false;
}
@ -2146,7 +2146,7 @@ void YJGConnection::processActionTransportInfo(JGEvent* event)
if (ok) {
event->confirmElement();
if (newContent) {
if (!dataFlags(OnHold))
if ((m_rtpStarted || m_audioContent || m_rtpId.null()) && !dataFlags(OnHold))
resetCurrentAudioContent(isAnswered(),!isAnswered(),true,newContent);
}
else if ((startAudioContent && !startRtp()) || !(m_audioContent || dataFlags(OnHold)))
@ -2316,14 +2316,15 @@ void YJGConnection::removeContent(JGSessionContent* c)
// add a new identical content and remove the old old one from the session
void YJGConnection::removeCurrentAudioContent(bool removeReq)
{
if (!dataFlags(OnHold)) {
if (m_rtpStarted || m_audioContent || dataFlags(OnHold)) {
clearEndpoint();
m_rtpId.clear();
m_rtpStarted = false;
}
if (!m_audioContent)
return;
Debug(this,DebugAll,"Resetting current audio content (%p,'%s') [%p]",
Debug(this,DebugAll,"Removing current audio content (%p,'%s') [%p]",
m_audioContent,m_audioContent->toString().c_str(),this);
// Remove from list if not re-usable
@ -2364,7 +2365,11 @@ void YJGConnection::removeCurrentAudioContent(bool removeReq)
bool YJGConnection::resetCurrentAudioContent(bool session, bool earlyMedia,
bool sendTransInfo, JGSessionContent* newContent, bool sendRing)
{
// Reset the current audio content
DDebug(this,DebugAll,"Resetting current audio content (%s,%s,%s,%p,%s) [%p]",
String::boolText(session),String::boolText(earlyMedia),
String::boolText(sendTransInfo),newContent,String::boolText(sendRing),this);
// Remove the current audio content
removeCurrentAudioContent();
// Set nothing if on hold
@ -2530,6 +2535,7 @@ bool YJGConnection::startRtp()
Engine::enqueue(msg);
}
else if (m_audioContent->m_rtpLocalCandidates.m_type == JGRtpCandidates::RtpRawUdp) {
m_rtpStarted = true;
// Send trying
if (m_session) {
XmlElement* trying = XMPPUtils::createElement(XmlTag::Trying,
@ -2855,6 +2861,7 @@ bool YJGConnection::initLocalCandidates(JGSessionContent& content, bool sendTran
}
}
m_rtpId = m.getValue("rtpid");
plugin.setLocalIp(rtp->m_address,m);
rtp->m_port = m.getValue("localport","-1");
@ -3264,6 +3271,7 @@ void YJGConnection::handleAudioInfoEvent(JGEvent* event)
if (hold) {
clearEndpoint();
m_rtpId.clear();
m_rtpStarted = false;
}
Engine::dispatch(*m);
TelEngine::destruct(m);