Fixed bug: use the same format for both directions if changed by called party. Allow formats to be changed when routing an incoming call.
git-svn-id: http://yate.null.ro/svn/yate/trunk@4512 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
304ca28170
commit
110ae190cd
|
@ -573,10 +573,12 @@ bool IAXEngine::checkCallToken(const SocketAddr& addr, IAXFullFrame& frame)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool IAXEngine::acceptFormatAndCapability(IAXTransaction* trans)
|
||||
bool IAXEngine::acceptFormatAndCapability(IAXTransaction* trans, unsigned int* caps)
|
||||
{
|
||||
if (!trans)
|
||||
return false;
|
||||
if (caps)
|
||||
trans->m_capability &= (u_int32_t)*caps;
|
||||
u_int32_t format = trans->format();
|
||||
u_int32_t capability = m_capability & trans->capability();
|
||||
#ifdef XDEBUG
|
||||
|
@ -592,10 +594,14 @@ bool IAXEngine::acceptFormatAndCapability(IAXTransaction* trans)
|
|||
#endif
|
||||
// Valid capability ?
|
||||
if (!capability) {
|
||||
#ifdef DEBUG
|
||||
if (!trans->outgoing())
|
||||
Debug(this,DebugNote,"acceptFormatAndCapability. No capabilities received.");
|
||||
#endif
|
||||
trans->m_capability = 0;
|
||||
trans->m_format = 0;
|
||||
if (trans->outgoing())
|
||||
trans->m_formatIn = 0;
|
||||
else
|
||||
trans->m_formatOut = 0;
|
||||
Debug(this,DebugNote,"Transaction(%u,%u) without common media [%p]",
|
||||
trans->localCallNo(),trans->remoteCallNo(),trans);
|
||||
return false;
|
||||
}
|
||||
for (;;) {
|
||||
|
@ -616,7 +622,8 @@ bool IAXEngine::acceptFormatAndCapability(IAXTransaction* trans)
|
|||
format = IAXFormat::audioData[i].value;
|
||||
break;
|
||||
}
|
||||
DDebug(this,DebugNote,"acceptFormatAndCapability. Unable to choose a format.");
|
||||
Debug(this,DebugNote,"Unable to choose a common format for transaction(%u,%u) [%p]",
|
||||
trans->localCallNo(),trans->remoteCallNo(),trans);
|
||||
return false;
|
||||
}
|
||||
DDebug(this,DebugAll,"acceptFormatAndCapability. Format %u: '%s'.",
|
||||
|
@ -624,8 +631,7 @@ bool IAXEngine::acceptFormatAndCapability(IAXTransaction* trans)
|
|||
trans->m_format = format;
|
||||
trans->m_capability = capability;
|
||||
trans->m_formatIn = format;
|
||||
if (!trans->outgoing())
|
||||
trans->m_formatOut = format;
|
||||
trans->m_formatOut = format;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -2328,9 +2328,10 @@ public:
|
|||
/**
|
||||
* Process the initial received format and capability. If accepted on exit will set the transaction format and capability
|
||||
* @param trans Transaction that received the new format
|
||||
* @param caps Optional codecs to set in transaction before processing
|
||||
* @return True if accepted
|
||||
*/
|
||||
bool acceptFormatAndCapability(IAXTransaction* trans);
|
||||
bool acceptFormatAndCapability(IAXTransaction* trans, unsigned int* caps = 0);
|
||||
|
||||
/**
|
||||
* Default event handler. event MUST NOT be deleted
|
||||
|
|
|
@ -1589,6 +1589,12 @@ void YIAXConnection::callAccept(Message& msg)
|
|||
DDebug(this,DebugCall,"callAccept [%p]",this);
|
||||
m_mutexTrans.lock();
|
||||
if (m_transaction) {
|
||||
const char* fmts = msg.getValue("formats");
|
||||
if (fmts) {
|
||||
u_int32_t codecs = iplugin.codecs();
|
||||
iplugin.updateCodecsFromRoute(codecs,fmts);
|
||||
iplugin.getEngine()->acceptFormatAndCapability(m_transaction,&codecs);
|
||||
}
|
||||
m_transaction->sendAccept();
|
||||
// Enable trunking if trunkin parameter is enabled
|
||||
if (msg.getBoolValue("trunkin"))
|
||||
|
|
Loading…
Reference in New Issue