Copy parameters to the disconnect list after prerouting.
This allows setting parameters in chan.hangup and CDR for calls cancelled during routing. git-svn-id: http://yate.null.ro/svn/yate/trunk@5174 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
11cd48f1b1
commit
fbb10ee055
|
@ -68,6 +68,8 @@ static Mutex s_callidMutex(false,"CallID");
|
||||||
// of call endpoints at the same time
|
// of call endpoints at the same time
|
||||||
static Mutex s_mutex(true,"CallEndpoint");
|
static Mutex s_mutex(true,"CallEndpoint");
|
||||||
static const String s_audioType = "audio";
|
static const String s_audioType = "audio";
|
||||||
|
static const String s_copyParams = "copyparams";
|
||||||
|
|
||||||
|
|
||||||
CallEndpoint::CallEndpoint(const char* id)
|
CallEndpoint::CallEndpoint(const char* id)
|
||||||
: m_peer(0), m_id(id), m_mutex(0)
|
: m_peer(0), m_id(id), m_mutex(0)
|
||||||
|
@ -596,7 +598,7 @@ Message* Channel::message(const char* name, const NamedList* original, const cha
|
||||||
Message* msg = message(name,minimal,data);
|
Message* msg = message(name,minimal,data);
|
||||||
if (original) {
|
if (original) {
|
||||||
if (!params)
|
if (!params)
|
||||||
params = original->getValue(YSTRING("copyparams"));
|
params = original->getValue(s_copyParams);
|
||||||
if (!null(params))
|
if (!null(params))
|
||||||
msg->copyParams(*original,params);
|
msg->copyParams(*original,params);
|
||||||
}
|
}
|
||||||
|
@ -829,7 +831,7 @@ void Channel::callRejected(const char* error, const char* reason, const Message*
|
||||||
{
|
{
|
||||||
Debug(this,DebugMild,"Call rejected error='%s' reason='%s' [%p]",error,reason,this);
|
Debug(this,DebugMild,"Call rejected error='%s' reason='%s' [%p]",error,reason,this);
|
||||||
if (msg) {
|
if (msg) {
|
||||||
const String* cp = msg->getParam(YSTRING("copyparams"));
|
const String* cp = msg->getParam(s_copyParams);
|
||||||
if (!TelEngine::null(cp)) {
|
if (!TelEngine::null(cp)) {
|
||||||
s_paramMutex.lock();
|
s_paramMutex.lock();
|
||||||
parameters().copyParams(*msg,*cp);
|
parameters().copyParams(*msg,*cp);
|
||||||
|
@ -1602,6 +1604,12 @@ bool Router::route()
|
||||||
Debug(m_driver,DebugInfo,"Connection '%s' vanished while prerouting!",m_id.c_str());
|
Debug(m_driver,DebugInfo,"Connection '%s' vanished while prerouting!",m_id.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const String* cp = m_msg->getParam(s_copyParams);
|
||||||
|
if (!TelEngine::null(cp)) {
|
||||||
|
Channel::paramMutex().lock();
|
||||||
|
chan->parameters().copyParams(*m_msg,*cp);
|
||||||
|
Channel::paramMutex().unlock();
|
||||||
|
}
|
||||||
bool dropCall = ok && ((m_msg->retValue() == YSTRING("-")) || (m_msg->retValue() == YSTRING("error")));
|
bool dropCall = ok && ((m_msg->retValue() == YSTRING("-")) || (m_msg->retValue() == YSTRING("error")));
|
||||||
if (dropCall)
|
if (dropCall)
|
||||||
chan->callRejected(m_msg->getValue(YSTRING("error"),"unknown"),
|
chan->callRejected(m_msg->getValue(YSTRING("error"),"unknown"),
|
||||||
|
@ -1658,7 +1666,7 @@ bool Router::route()
|
||||||
const char* reason = m_msg->getValue(YSTRING("reason"),
|
const char* reason = m_msg->getValue(YSTRING("reason"),
|
||||||
((s_noconn == error) ? "Could not connect to target" : (const char*)0));
|
((s_noconn == error) ? "Could not connect to target" : (const char*)0));
|
||||||
Message m(s_disconnected);
|
Message m(s_disconnected);
|
||||||
const String* cp = m_msg->getParam(YSTRING("copyparams"));
|
const String* cp = m_msg->getParam(s_copyParams);
|
||||||
if (!TelEngine::null(cp))
|
if (!TelEngine::null(cp))
|
||||||
m.copyParams(*m_msg,*cp);
|
m.copyParams(*m_msg,*cp);
|
||||||
chan->complete(m);
|
chan->complete(m);
|
||||||
|
|
Loading…
Reference in New Issue