New parameters "cdrwrite" allows skipping writing of CDR records while still
tracking the channels. git-svn-id: http://voip.null.ro/svn/yate@1373 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
8aa1ead124
commit
985b349df0
|
@ -21,4 +21,5 @@
|
||||||
;username=false
|
;username=false
|
||||||
|
|
||||||
; The following parameters are handled internally and cannot be changed:
|
; The following parameters are handled internally and cannot be changed:
|
||||||
; time, chan, operation, direction, status, duration, billtime, ringtime
|
; time, chan, operation, cdrwrite,
|
||||||
|
; direction, status, duration, billtime, ringtime
|
||||||
|
|
|
@ -78,6 +78,7 @@ private:
|
||||||
String m_dir;
|
String m_dir;
|
||||||
String m_status;
|
String m_status;
|
||||||
bool m_first;
|
bool m_first;
|
||||||
|
bool m_write;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Param : public String
|
class Param : public String
|
||||||
|
@ -133,6 +134,7 @@ static const char* const s_forbidden[] = {
|
||||||
"duration",
|
"duration",
|
||||||
"billtime",
|
"billtime",
|
||||||
"ringtime",
|
"ringtime",
|
||||||
|
"cdrwrite",
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -157,7 +159,8 @@ static const char* printTime(char* buf,u_int64_t usec)
|
||||||
}
|
}
|
||||||
|
|
||||||
CdrBuilder::CdrBuilder(const char *name)
|
CdrBuilder::CdrBuilder(const char *name)
|
||||||
: NamedList(name), m_dir("unknown"), m_status("unknown"), m_first(true)
|
: NamedList(name), m_dir("unknown"), m_status("unknown"),
|
||||||
|
m_first(true), m_write(true)
|
||||||
{
|
{
|
||||||
m_start = m_call = m_ringing = m_answer = m_hangup = 0;
|
m_start = m_call = m_ringing = m_answer = m_hangup = 0;
|
||||||
}
|
}
|
||||||
|
@ -213,6 +216,7 @@ void CdrBuilder::emit(const char *operation)
|
||||||
if (ext)
|
if (ext)
|
||||||
m->setParam("external",ext);
|
m->setParam("external",ext);
|
||||||
}
|
}
|
||||||
|
m->addParam("cdrwrite",String::boolText(m_write));
|
||||||
unsigned int n = length();
|
unsigned int n = length();
|
||||||
for (unsigned int i = 0; i < n; i++) {
|
for (unsigned int i = 0; i < n; i++) {
|
||||||
const NamedString* s = getParam(i);
|
const NamedString* s = getParam(i);
|
||||||
|
@ -265,6 +269,9 @@ bool CdrBuilder::update(const Message& msg, int type, u_int64_t val)
|
||||||
s_cdrs.remove(this);
|
s_cdrs.remove(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// cdrwrite must be consistent over all emitted messages so we read it once
|
||||||
|
if (m_first)
|
||||||
|
m_write = msg.getBoolValue("cdrwrite",true);
|
||||||
unsigned int n = msg.length();
|
unsigned int n = msg.length();
|
||||||
for (unsigned int i = 0; i < n; i++) {
|
for (unsigned int i = 0; i < n; i++) {
|
||||||
const NamedString* s = msg.getParam(i);
|
const NamedString* s = msg.getParam(i);
|
||||||
|
|
|
@ -70,6 +70,8 @@ bool CdrFileHandler::received(Message &msg)
|
||||||
String op(msg.getValue("operation"));
|
String op(msg.getValue("operation"));
|
||||||
if (op != "finalize")
|
if (op != "finalize")
|
||||||
return false;
|
return false;
|
||||||
|
if (!msg.getBoolValue("cdrwrite",true))
|
||||||
|
return false;
|
||||||
|
|
||||||
Lock lock(m_lock);
|
Lock lock(m_lock);
|
||||||
if (m_file && m_format) {
|
if (m_file && m_format) {
|
||||||
|
|
Loading…
Reference in New Issue