Rollback accidentally commited files in previous commit.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6137 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
4590f53dc7
commit
353f7e696d
|
@ -47,7 +47,7 @@
|
|||
|
||||
; The following parameters are handled internally and cannot be changed:
|
||||
; time, chan, operation, cdrwrite, cdrtrack, cdrcreate, cdrid, runid,
|
||||
; direction, status, duration, billtime, ringtime, answered, delivered, released
|
||||
; direction, status, duration, billtime, ringtime
|
||||
|
||||
|
||||
; Special section for time formatting
|
||||
|
|
|
@ -190,12 +190,6 @@ bool CallEndpoint::disconnect(bool final, const char* reason, bool notify, const
|
|||
e->disconnect();
|
||||
}
|
||||
|
||||
Channel* chan = YOBJECT(Channel,this);
|
||||
if (chan && chan->isDelivered()) {
|
||||
chan = YOBJECT(Channel,temp);
|
||||
if (chan && !chan->isDelivered())
|
||||
chan->setDelivered();
|
||||
}
|
||||
temp->setPeer(0,reason,notify,params);
|
||||
bool dead = !alive();
|
||||
if (dead)
|
||||
|
@ -395,7 +389,7 @@ Channel::Channel(Driver* driver, const char* id, bool outgoing)
|
|||
: CallEndpoint(id),
|
||||
m_parameters(""), m_driver(driver), m_outgoing(outgoing),
|
||||
m_timeout(0), m_maxcall(0), m_maxPDD(0), m_dtmfTime(0),
|
||||
m_toutAns(0), m_dtmfSeq(0), m_answered(false), m_delivered(false)
|
||||
m_toutAns(0), m_dtmfSeq(0), m_answered(false)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
@ -404,7 +398,7 @@ Channel::Channel(Driver& driver, const char* id, bool outgoing)
|
|||
: CallEndpoint(id),
|
||||
m_parameters(""), m_driver(&driver), m_outgoing(outgoing),
|
||||
m_timeout(0), m_maxcall(0), m_maxPDD(0), m_dtmfTime(0),
|
||||
m_toutAns(0), m_dtmfSeq(0), m_answered(false), m_delivered(false)
|
||||
m_toutAns(0), m_dtmfSeq(0), m_answered(false)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
@ -593,13 +587,12 @@ void Channel::status(const char* newstat)
|
|||
m_answered = true;
|
||||
// stop pre-answer timeout, restart answered timeout
|
||||
m_maxcall = 0;
|
||||
setDelivered();
|
||||
maxPDD(0);
|
||||
if (m_toutAns)
|
||||
timeout(Time::now() + m_toutAns*(u_int64_t)1000);
|
||||
}
|
||||
else if (!m_delivered &&
|
||||
(m_status == YSTRING("ringing") || m_status == YSTRING("progressing")))
|
||||
setDelivered();
|
||||
else if (m_status == YSTRING("ringing") || m_status == YSTRING("progressing"))
|
||||
maxPDD(0);
|
||||
}
|
||||
|
||||
const char* Channel::direction() const
|
||||
|
@ -674,7 +667,6 @@ void Channel::complete(Message& msg, bool minimal) const
|
|||
if (getLastPeerId(peer))
|
||||
msg.setParam("lastpeerid",peer);
|
||||
msg.setParam("answered",String::boolText(m_answered));
|
||||
msg.setParam("delivered",String::boolText(m_delivered));
|
||||
msg.setParam("direction",direction());
|
||||
}
|
||||
|
||||
|
|
|
@ -105,9 +105,6 @@ private:
|
|||
m_hangup;
|
||||
String m_dir;
|
||||
String m_status;
|
||||
bool m_answered;
|
||||
bool m_delivered;
|
||||
bool m_released;
|
||||
String m_cdrId;
|
||||
bool m_first;
|
||||
bool m_write;
|
||||
|
@ -242,9 +239,6 @@ static const char* const s_forbidden[] = {
|
|||
"cdrcreate",
|
||||
"cdrid",
|
||||
"runid",
|
||||
"answered",
|
||||
"delivered",
|
||||
"released",
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -313,7 +307,6 @@ static void expireHungup()
|
|||
|
||||
CdrBuilder::CdrBuilder(const char *name)
|
||||
: NamedList(name), m_dir("unknown"), m_status("unknown"),
|
||||
m_answered(false), m_delivered(false), m_released(false),
|
||||
m_first(true), m_write(true)
|
||||
{
|
||||
m_statusTime = m_start = m_call = m_ringing = m_answer = m_hangup = 0;
|
||||
|
@ -379,10 +372,6 @@ void CdrBuilder::emit(const char *operation)
|
|||
m->addParam("billtime",printTime(buf,t_hangup - t_answer));
|
||||
m->addParam("ringtime",printTime(buf,t_answer - t_ringing));
|
||||
m->addParam("status",m_status);
|
||||
m->addParam("answered",String::boolText(m_answered));
|
||||
m->addParam("delivered",String::boolText(m_delivered));
|
||||
if (m_released)
|
||||
m->addParam("released",String::boolText(m_released));
|
||||
String tmp;
|
||||
|
||||
if (m_startTime.m_enabled) {
|
||||
|
@ -498,10 +487,6 @@ bool CdrBuilder::update(const Message& msg, int type, u_int64_t val)
|
|||
}
|
||||
else if (s->name() == YSTRING("direction"))
|
||||
m_dir = *s;
|
||||
else if (s->name() == YSTRING("answered"))
|
||||
m_answered = s->toBoolean();
|
||||
else if (s->name() == YSTRING("delivered"))
|
||||
m_delivered = s->toBoolean();
|
||||
else {
|
||||
// search the parameter
|
||||
Param* p = static_cast<Param*>(s_params[s->name()]);
|
||||
|
@ -521,7 +506,6 @@ bool CdrBuilder::update(const Message& msg, int type, u_int64_t val)
|
|||
update(type,val);
|
||||
|
||||
if (type == CdrHangup) {
|
||||
m_released = msg.getBoolValue(YSTRING("released"));
|
||||
s_cdrs.remove(this);
|
||||
// object is now destroyed, "this" no longer valid
|
||||
return false;
|
||||
|
|
|
@ -214,8 +214,6 @@ public:
|
|||
static const TokenDict s_operations[];
|
||||
// Append an onDemand component
|
||||
bool appendOnDemand(SignallingComponent* cmp, int type);
|
||||
// Check for call delivered in parameters
|
||||
bool checkDelivered(const NamedList& params, const String& prefix = String::empty());
|
||||
// Install a relay
|
||||
inline bool requestRelay(int id, const char* name, unsigned priority = 100)
|
||||
{ return installRelay(id,name,priority); }
|
||||
|
@ -1605,11 +1603,6 @@ void SigChannel::endDisconnect(const Message& params, bool handled)
|
|||
|
||||
void SigChannel::hangup(const char* reason, SignallingEvent* event, const NamedList* extra)
|
||||
{
|
||||
if (isOutgoing() && event && event->message() && !isDelivered()) {
|
||||
SS7MsgISUP* isup = YOBJECT(SS7MsgISUP,event->message());
|
||||
if (isup && plugin.checkDelivered(isup->params()))
|
||||
setDelivered();
|
||||
}
|
||||
static const String params = "reason";
|
||||
Lock lock(m_mutex);
|
||||
releaseCallAccepted();
|
||||
|
@ -1652,8 +1645,6 @@ void SigChannel::hangup(const char* reason, SignallingEvent* event, const NamedL
|
|||
Message* m = message("chan.hangup",true);
|
||||
m->setParam("status",status());
|
||||
m->setParam("reason",m_reason);
|
||||
if (event)
|
||||
m->addParam("released",String::boolText(true));
|
||||
Engine::enqueue(m);
|
||||
}
|
||||
|
||||
|
@ -2839,19 +2830,6 @@ bool SigDriver::appendOnDemand(SignallingComponent* cmp, int type)
|
|||
return true;
|
||||
}
|
||||
|
||||
// Check for call delivered in parameters
|
||||
bool SigDriver::checkDelivered(const NamedList& params, const String& prefix)
|
||||
{
|
||||
const String& loc = params[prefix + "CauseIndicators.location"];
|
||||
if (loc == YSTRING("U"))
|
||||
return true;
|
||||
const String& cause = params[prefix + "CauseIndicators"];
|
||||
if (!cause)
|
||||
return false;
|
||||
return cause == YSTRING("busy") || cause == YSTRING("noanswer") ||
|
||||
cause == YSTRING("call-delivered");
|
||||
}
|
||||
|
||||
bool SigDriver::initOnDemand(NamedList& sect, int type)
|
||||
{
|
||||
Lock lock(m_onDemandMutex);
|
||||
|
@ -4820,12 +4798,8 @@ bool IsupDecodeHandler::received(Message& msg)
|
|||
if (pcType == SS7PointCode::Other)
|
||||
return false;
|
||||
|
||||
if (m_isup->decodeMessage(msg,msgType,pcType,paramPtr,data->length()-1)) {
|
||||
NamedString* ns = msg.getParam(prefix + "checkdelivered");
|
||||
if (ns)
|
||||
*ns = String::boolText(plugin.checkDelivered(msg,prefix));
|
||||
if (m_isup->decodeMessage(msg,msgType,pcType,paramPtr,data->length()-1))
|
||||
return true;
|
||||
}
|
||||
msg.setParam("error","Parser failure");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -950,7 +950,7 @@ public:
|
|||
void doRefer(SIPTransaction* t);
|
||||
void doMessage(SIPTransaction* t);
|
||||
void reInvite(SIPTransaction* t);
|
||||
void hangup(bool remote = true);
|
||||
void hangup();
|
||||
inline const SIPDialog& dialog() const
|
||||
{ return m_dialog; }
|
||||
inline void setStatus(const char *stat, int state = -1)
|
||||
|
@ -992,10 +992,6 @@ protected:
|
|||
virtual void mediaChanged(const SDPMedia& media);
|
||||
virtual void dispatchingRtp(Message*& msg, SDPMedia* media);
|
||||
virtual void endDisconnect(const Message& msg, bool handled);
|
||||
inline bool checkDelivered() const
|
||||
{ return isOutgoing() && !isDelivered(); }
|
||||
void checkDelivered(int code, bool checkParams = false, const SIPMessage* msg = 0,
|
||||
const MimeHeaderLine* sipReason = 0, const MimeHeaderLine* q850Reason = 0);
|
||||
|
||||
private:
|
||||
virtual void statusParams(String& str);
|
||||
|
@ -1016,7 +1012,7 @@ private:
|
|||
// Decode an application/isup body into 'msg' if configured to do so
|
||||
// The message's name and user data are restored before exiting, regardless the result
|
||||
// Return true if an ISUP message was succesfully decoded
|
||||
bool decodeIsupBody(Message& msg, MimeBody* body, bool checkDelivered = false);
|
||||
bool decodeIsupBody(Message& msg, MimeBody* body);
|
||||
// Build the body of a SIP message from an engine message
|
||||
// Encode an ISUP message from parameters received in msg if enabled to process them
|
||||
// Build a multipart/mixed body if more then one body is going to be sent
|
||||
|
@ -2046,8 +2042,7 @@ inline bool addBodyParam(NamedList& nl, const char* param, MimeBody* body, const
|
|||
// Decode an application/isup body into 'msg' if configured to do so
|
||||
// The message's name and user data are restored before exiting, regardless the result
|
||||
// Return true if an ISUP message was succesfully decoded
|
||||
static bool doDecodeIsupBody(const DebugEnabler* debug, Message& msg, MimeBody* body,
|
||||
bool checkDelivered = false)
|
||||
static bool doDecodeIsupBody(const DebugEnabler* debug, Message& msg, MimeBody* body)
|
||||
{
|
||||
if (!s_sipt_isup)
|
||||
return false;
|
||||
|
@ -2064,10 +2059,7 @@ static bool doDecodeIsupBody(const DebugEnabler* debug, Message& msg, MimeBody*
|
|||
msg.addParam("message-prefix","isup.");
|
||||
addBodyParam(msg,"isup.protocol-type",isup,"version");
|
||||
addBodyParam(msg,"isup.protocol-basetype",isup,"base");
|
||||
if (checkDelivered)
|
||||
msg.addParam("isup.checkdelivered","");
|
||||
msg.addParam(new NamedPointer("rawdata",new DataBlock(isup->body())));
|
||||
|
||||
bool ok = Engine::dispatch(msg);
|
||||
// Clear added params and restore message
|
||||
if (!ok) {
|
||||
|
@ -2198,34 +2190,6 @@ static void setAuthError(SIPTransaction* trans, const NamedList& params,
|
|||
trans->requestAuth(getGlobal(r,s_realm),domain,stale);
|
||||
}
|
||||
|
||||
// Retrieve Reason header(s) from message
|
||||
static void getHeaderReason(const SIPMessage* msg, const MimeHeaderLine*& sip,
|
||||
const MimeHeaderLine*& q850)
|
||||
{
|
||||
if (!msg)
|
||||
return;
|
||||
for (const ObjList* o = msg->header.skipNull(); o; o = o->skipNext()) {
|
||||
const MimeHeaderLine* t = static_cast<const MimeHeaderLine*>(o->get());
|
||||
if (t->name() |= "Reason")
|
||||
continue;
|
||||
if (*t == YSTRING("SIP")) {
|
||||
if (!sip)
|
||||
sip = t;
|
||||
}
|
||||
else if (*t == YSTRING("Q.850")) {
|
||||
if (!q850)
|
||||
q850 = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieve the integer value of header 'cause' parameter
|
||||
static inline int getCauseParamInt(const MimeHeaderLine* hdr)
|
||||
{
|
||||
const NamedString* p = hdr ? hdr->getParam(YSTRING("cause")) : 0;
|
||||
return p ? p->toInteger() : 0;
|
||||
}
|
||||
|
||||
|
||||
// Replace all methods from comma separated list
|
||||
// If no method is set use other or setDefEmpty (reset to default)
|
||||
|
@ -6242,7 +6206,7 @@ YateSIPConnection::~YateSIPConnection()
|
|||
void YateSIPConnection::destroyed()
|
||||
{
|
||||
DDebug(this,DebugAll,"YateSIPConnection::destroyed() [%p]",this);
|
||||
hangup(false);
|
||||
hangup();
|
||||
clearTransaction();
|
||||
TelEngine::destruct(m_route);
|
||||
TelEngine::destruct(m_routes);
|
||||
|
@ -6302,7 +6266,7 @@ void YateSIPConnection::detachTransaction2()
|
|||
startPendingUpdate();
|
||||
}
|
||||
|
||||
void YateSIPConnection::hangup(bool remote)
|
||||
void YateSIPConnection::hangup()
|
||||
{
|
||||
if (m_hungup)
|
||||
return;
|
||||
|
@ -6319,8 +6283,6 @@ void YateSIPConnection::hangup(bool remote)
|
|||
Message* m = message("chan.hangup");
|
||||
if (res)
|
||||
m->setParam("reason",res);
|
||||
if (remote)
|
||||
m->addParam("released",String::boolText(true));
|
||||
Engine::enqueue(m);
|
||||
if (!error)
|
||||
error = res.c_str();
|
||||
|
@ -6622,7 +6584,7 @@ bool YateSIPConnection::process(SIPEvent* ev)
|
|||
if (msg->body) {
|
||||
paramMutex().unlock();
|
||||
Message tmp("isup.decode");
|
||||
bool ok = decodeIsupBody(tmp,msg->body,checkDelivered());
|
||||
bool ok = decodeIsupBody(tmp,msg->body);
|
||||
ok = copySipBody(tmp,msg->body) || ok;
|
||||
paramMutex().lock();
|
||||
if (ok)
|
||||
|
@ -6664,8 +6626,6 @@ bool YateSIPConnection::process(SIPEvent* ev)
|
|||
Debug(this,DebugMild,"Received %d redirect without Contact [%p]",code,this);
|
||||
}
|
||||
paramMutex().unlock();
|
||||
if (checkDelivered())
|
||||
checkDelivered(code,true,msg);
|
||||
hangup();
|
||||
}
|
||||
else if (code == 408) {
|
||||
|
@ -6845,7 +6805,7 @@ bool YateSIPConnection::processTransaction2(SIPEvent* ev, const SIPMessage* msg,
|
|||
if (fatal) {
|
||||
setReason("Request Timeout",408);
|
||||
mylock.drop();
|
||||
hangup(false);
|
||||
hangup();
|
||||
mylock.acquire(driver());
|
||||
}
|
||||
else {
|
||||
|
@ -6898,7 +6858,7 @@ bool YateSIPConnection::processTransaction2(SIPEvent* ev, const SIPMessage* msg,
|
|||
TelEngine::destruct(lst);
|
||||
setReason("Media information changed during reINVITE",415);
|
||||
mylock.drop();
|
||||
hangup(false);
|
||||
hangup();
|
||||
return false;
|
||||
}
|
||||
setReason("Missing media information",415);
|
||||
|
@ -6906,7 +6866,7 @@ bool YateSIPConnection::processTransaction2(SIPEvent* ev, const SIPMessage* msg,
|
|||
else
|
||||
setReason(msg->reason,code);
|
||||
mylock.drop();
|
||||
hangup(false);
|
||||
hangup();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -7075,7 +7035,7 @@ bool YateSIPConnection::reInviteForward(SIPTransaction* t, MimeSdpBody* sdp, int
|
|||
// media is uncertain now so drop the call
|
||||
setReason("Internal Server Error",500);
|
||||
mylock.drop();
|
||||
hangup(false);
|
||||
hangup();
|
||||
}
|
||||
else {
|
||||
// we remember the request and leave it pending
|
||||
|
@ -7205,7 +7165,7 @@ void YateSIPConnection::doBye(SIPTransaction* t)
|
|||
setPartyChanged(t->initialMessage()->getParty(),this);
|
||||
if (msg->body) {
|
||||
Message tmp("isup.decode");
|
||||
bool ok = decodeIsupBody(tmp,msg->body,checkDelivered());
|
||||
bool ok = decodeIsupBody(tmp,msg->body);
|
||||
ok = copySipBody(tmp,msg->body) || ok;
|
||||
if (ok) {
|
||||
paramMutex().lock();
|
||||
|
@ -7230,8 +7190,6 @@ void YateSIPConnection::doBye(SIPTransaction* t)
|
|||
setReason(MimeHeaderLine::unquote(*text),m_reasonCode,driver());
|
||||
// FIXME: add SIP and Q.850 cause codes
|
||||
}
|
||||
if (checkDelivered())
|
||||
checkDelivered(0,true,msg);
|
||||
t->setResponse(m);
|
||||
m->deref();
|
||||
m_byebye = false;
|
||||
|
@ -7771,51 +7729,6 @@ void YateSIPConnection::endDisconnect(const Message& msg, bool handled)
|
|||
paramMutex().unlock();
|
||||
}
|
||||
|
||||
static inline bool isSipDelivered(int code)
|
||||
{
|
||||
return code == 486 || code == 600 || code == 603;
|
||||
}
|
||||
|
||||
void YateSIPConnection::checkDelivered(int code, bool checkParams, const SIPMessage* msg,
|
||||
const MimeHeaderLine* sip, const MimeHeaderLine* q850)
|
||||
{
|
||||
if (isIncoming())
|
||||
return;
|
||||
// NOTE: TESTING purpose only
|
||||
const char* stage = "sip code";
|
||||
String tmp(msg ? (char*)msg->getBuffer().data() : "",msg ? msg->getBuffer().length() : 0);
|
||||
if (tmp)
|
||||
tmp = "\r\n-----\r\n" + tmp + "\r\n-----";
|
||||
while (true) {
|
||||
if (isSipDelivered(code))
|
||||
break;
|
||||
stage = "ISUP message";
|
||||
if (checkParams) {
|
||||
// Check decoded message carried by body (isup)
|
||||
Lock lck(paramMutex());
|
||||
const String& prefix = parameters()[YSTRING("message-prefix")];
|
||||
if (prefix && parameters().getBoolValue(prefix + "checkdelivered"))
|
||||
break;
|
||||
}
|
||||
if (!(sip || q850) && msg)
|
||||
getHeaderReason(msg,sip,q850);
|
||||
stage = "Q.850 reason";
|
||||
// Check Q.850 cause first: it indicates cause at remote interworking
|
||||
if (q850) {
|
||||
int cause = getCauseParamInt(q850);
|
||||
if (cause == 7 || cause == 17 || cause == 19)
|
||||
break;
|
||||
}
|
||||
stage = "SIP reason";
|
||||
if (sip && isSipDelivered(getCauseParamInt(sip)))
|
||||
break;
|
||||
Debug(this,DebugTest,"Not detected delivered code=%d%s",code,tmp.safe());
|
||||
return;
|
||||
}
|
||||
Debug(this,DebugTest,"Detected delivered by '%s'%s",stage,tmp.safe());
|
||||
setDelivered();
|
||||
}
|
||||
|
||||
void YateSIPConnection::statusParams(String& str)
|
||||
{
|
||||
Channel::statusParams(str);
|
||||
|
@ -8126,9 +8039,9 @@ bool YateSIPConnection::initTransfer(Message*& msg, SIPMessage*& sipNotify,
|
|||
}
|
||||
|
||||
// Decode an application/isup body into 'msg' if configured to do so
|
||||
bool YateSIPConnection::decodeIsupBody(Message& msg, MimeBody* body, bool checkDelivered)
|
||||
bool YateSIPConnection::decodeIsupBody(Message& msg, MimeBody* body)
|
||||
{
|
||||
return doDecodeIsupBody(this,msg,body,checkDelivered);
|
||||
return doDecodeIsupBody(this,msg,body);
|
||||
}
|
||||
|
||||
// Build the body of a SIP message from an engine message
|
||||
|
|
17
yatephone.h
17
yatephone.h
|
@ -1642,7 +1642,6 @@ class YATE_API Channel : public CallEndpoint, public DebugEnabler, public Messag
|
|||
{
|
||||
friend class Driver;
|
||||
friend class Router;
|
||||
friend class CallEndpoint;
|
||||
YNOCOPY(Channel); // no automatic copies please
|
||||
private:
|
||||
NamedList m_parameters;
|
||||
|
@ -1663,7 +1662,6 @@ protected:
|
|||
String m_targetid;
|
||||
String m_billid;
|
||||
bool m_answered;
|
||||
bool m_delivered;
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -1888,13 +1886,6 @@ public:
|
|||
inline bool isAnswered() const
|
||||
{ return m_answered; }
|
||||
|
||||
/**
|
||||
* Check if the call was delivered or not
|
||||
* @return True if the call was delivered
|
||||
*/
|
||||
inline bool isDelivered() const
|
||||
{ return m_delivered; }
|
||||
|
||||
/**
|
||||
* Get the direction of the channel as string
|
||||
* @return "incoming" or "outgoing" according to the direction
|
||||
|
@ -2154,14 +2145,6 @@ protected:
|
|||
inline NamedList& parameters()
|
||||
{ return m_parameters; }
|
||||
|
||||
/**
|
||||
* Set call delivered flag. Update related data
|
||||
*/
|
||||
inline void setDelivered() {
|
||||
m_delivered = true;
|
||||
maxPDD(0);
|
||||
}
|
||||
|
||||
private:
|
||||
void init();
|
||||
Channel(); // no default constructor please
|
||||
|
|
Loading…
Reference in New Issue