Wait for session initiate result to send stream host for file transfer session.

git-svn-id: http://yate.null.ro/svn/yate/trunk@5482 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2013-04-23 11:13:10 +00:00
parent ab33142e65
commit 32b5f99080
1 changed files with 31 additions and 17 deletions

View File

@ -1628,11 +1628,37 @@ bool YJGConnection::handleEvent(JGEvent* event)
bool rspOk = (event->type() == JGEvent::ResultOk);
// Notify ringing if initiate was confirmed and the remote party doesn't support it
if (rspOk && m_ftStatus == FTNone && event->action() == JGSession::ActInitiate &&
!m_session->hasFeature(XMPPNamespace::JingleAppsRtpInfo))
Engine::enqueue(message("call.ringing",false,true));
if (event->action() == JGSession::ActInitiate) {
if (m_ftStatus == FTNone) {
// Non file transfer session
// Notify ringing if initiate was confirmed and the remote party doesn't support it
if (rspOk && !m_session->hasFeature(XMPPNamespace::JingleAppsRtpInfo))
Engine::enqueue(message("call.ringing",false,true));
}
else {
// File transfer session
// Send stream host
if (rspOk) {
bool ok = false;
if (m_session) {
m_session->buildSocksDstAddr(m_dstAddrDomain);
ok = setupSocksFileTransfer(false);
if (!ok) {
ok = (m_ftStatus != FTTerminated);
if (ok) {
// Send empty host
m_streamHosts.clear();
m_session->sendStreamHosts(m_streamHosts,&m_ftStanzaId);
}
}
}
if (!ok)
hangup("noconn");
return ok;
}
}
}
if (m_ftStanzaId && m_ftStanzaId == event->id()) {
m_ftStanzaId = "";
String usedHost;
@ -1955,18 +1981,6 @@ bool YJGConnection::presenceChanged(bool available, NamedList* params)
return true;
}
m_session->userData(this);
if (m_ftStatus != FTNone) {
m_session->buildSocksDstAddr(m_dstAddrDomain);
if (!setupSocksFileTransfer(false)) {
if (m_ftStatus == FTTerminated) {
hangup("noconn");
return true;
}
// Send empty host
m_streamHosts.clear();
m_session->sendStreamHosts(m_streamHosts,&m_ftStanzaId);
}
}
return false;
}