Hi
As I trying to add holdtime in core level instead of custom patch, but almost calculated the holdtime and debug console emitting the value properly but failed to add into emitting CDR message to get it stored in Database.
Due to clear show fully operational function are hidden with “..” value.
Appreciated if Anybody help me on this.
Yate Version : 6.0.1-dev
SIP Client/IP Phone : For Making Call.
Ysipchan.cpp:
bool YateSIPConnection::reInviteProxy(SIPTransaction* t, MimeSdpBody* sdp, int invite)
{
..
..
..
msg->addParam("audio_changed",String::boolText(audioChg));
msg->addParam("mute",String::boolText(MediaStarted != m_mediaStatus));
// Holdtime Patch START
if( MediaStarted != m_mediaStatus)
msg->addParam("status","hold");
else
msg->addParam("status","unhold");
// Holdtime Patch END
putMedia(*msg);
Engine::enqueue(msg);
..
..
..
}
Cdrbuild.cpp:
Variable Initialization :
class CdrHandler : public MessageHandler
{
public:
CdrHandler(const char *name, int type, int prio = 50)
: MessageHandler(name,prio,__plugin.name()),
m_type(type)
{ }
virtual bool received(Message &msg);
private:
int m_type;
u_int64_t
m_holdsec,
m_hold,
m_unhold;
};
Variable Initialization 2 :
class CdrBuilder : public NamedList
{
public:
..
..
..
private:
u_int64_t
m_start,
m_call,
m_ringing,
m_answer,
m_holdsec,
m_hangup;
..
..
..
}
Variable Initializations 3 :
CdrBuilder::CdrBuilder(const char *name)
: NamedList(name), m_dir("unknown"), m_status("unknown"),
m_first(true), m_write(true)
{
m_statusTime = m_start = m_call = m_ringing = m_answer = m_hangup = m_holdsec = 0;
m_cdrId = ++s_seq;
}
Hold Time Calculation On cdrbuild function :
bool CdrHandler::received(Message &msg)
{
Lock lock(s_mutex);
..
..
..
if (m_type == CdrUpdate) {
const String* oper = msg.getParam(YSTRING("operation"));
const String* TBmute = msg.getParam(YSTRING("mute"));
if (oper && (*oper != YSTRING("cdrbuild")) )
track = false;
if (oper && TBmute && (*TBmute == YSTRING("true")) ) {
track = true;
m_hold = Time::msecNow();
}
if (oper && TBmute && (*TBmute == YSTRING("false") ) && m_hold && ( m_hold > 0 ) ){
track = true;
m_unhold = Time::msecNow();
if(m_holdsec)
m_holdsec = m_holdsec + m_unhold - m_hold;
else
m_holdsec = m_unhold - m_hold;
if(m_holdsec)
Debug("cdrbuild",DebugAll,"TBholdtime is '%lu'",m_holdsec);
}
}
..
..
..
}
Holdtime Emit Function :
void CdrBuilder::emit(const char *operation)
{
..
..
..
m->addParam("ringtime",printTime(buf,t_answer - t_ringing));
m->addParam("holdtime",printTime(buf,m_holdsec)); // Holdtime Emit. This is where I need value to be emit.
m->addParam("status",m_status);
..
..
..
}