Requesting an ACK on incoming MGCP transactions can be disabled per engine or transaction.

git-svn-id: http://yate.null.ro/svn/yate/trunk@2367 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2008-11-25 18:17:26 +00:00
parent a0734d1e1a
commit 72b441af71
3 changed files with 35 additions and 4 deletions

View File

@ -113,7 +113,8 @@ MGCPEngine::MGCPEngine(bool gateway, const char* name, const NamedList* params)
m_retransCount(TR_RETRANS_COUNT),
m_extraTime(TR_EXTRA_TIME * 1000),
m_parseParamToLower(true),
m_provisional(true)
m_provisional(true),
m_ackRequest(true)
{
debugName((name && *name) ? name : (gateway ? "mgcp_gw" : "mgcp_ca"));
@ -157,6 +158,7 @@ void MGCPEngine::initialize(const NamedList& params)
m_parseParamToLower = params.getBoolValue("lower_case_params",true);
m_provisional = params.getBoolValue("send_provisional",true);
m_ackRequest = params.getBoolValue("request_ack",true);
// Bind socket if not valid
if (!m_socket.valid()) {

View File

@ -42,10 +42,13 @@ MGCPTransaction::MGCPTransaction(MGCPEngine* engine, MGCPMessage* msg, bool outg
m_crtRetransInterval(0),
m_retransCount(0),
m_timeout(false),
m_ackRequest(true),
m_private(0)
{
if (m_engine)
if (m_engine) {
ackRequest(m_engine->ackRequest());
m_engine->appendTrans(this);
}
else {
Debug(engine,DebugNote,"Can't create MGCP transaction without engine");
return;
@ -180,10 +183,13 @@ bool MGCPTransaction::setResponse(MGCPMessage* msg)
m_debug.c_str(),msg->name().c_str(),state(),this);
m_response = msg;
// Force response ACK request
m_response->params.setParam("K","");
if (m_ackRequest)
// Force response ACK request
m_response->params.setParam("K","");
// Send and init timeout
send(m_response);
if (!m_ackRequest)
changeState(Ack);
initTimeout(Time(),false);
return true;
}

View File

@ -339,6 +339,13 @@ public:
inline bool timeout() const
{ return m_timeout; }
/**
* Set the remote ACK request flag
* @param request False if remote is not required to send an ACK
*/
inline void ackRequest(bool request)
{ m_ackRequest = request; }
/**
* Get the private user data of this transaction
* @return The private user data of this transaction
@ -467,6 +474,7 @@ private:
unsigned int m_crtRetransInterval; // Current retransmission interval
unsigned int m_retransCount; // Remainig number of retransmissions
bool m_timeout; // Transaction timeout flag
bool m_ackRequest; // Remote is requested to send ACK
void* m_private; // Data used by this transaction's user
String m_debug; // String used to identify the transaction in debug messages
};
@ -816,6 +824,20 @@ public:
inline bool provisional() const
{ return m_provisional; }
/**
* Get the remote ACK request flag
* @return True if remote will be requested to send an ACK
*/
inline bool ackRequest() const
{ return m_ackRequest; }
/**
* Set the remote ACK request flag
* @param request False to not request from remote to send an ACK
*/
inline void ackRequest(bool request)
{ m_ackRequest = request; }
/**
* Initialize this engine
* @param params Engine's parameters
@ -1046,6 +1068,7 @@ private:
u_int64_t m_extraTime; // Time to live after the transaction terminated gracefully
bool m_parseParamToLower; // Convert received messages' params to lower case
bool m_provisional; // Send provisional responses flag
bool m_ackRequest; // Remote is requested to send ACK
ObjList m_knownCommands; // The list of known commands
ObjList m_threads;
};