Added back the call.preroute message.
git-svn-id: http://yate.null.ro/svn/yate/trunk@590 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
8c8af3dad4
commit
111e3b2d0f
|
@ -20,6 +20,9 @@
|
|||
; engine.timer: bool: Activate handler on the "engine.timer" message
|
||||
;engine.timer=no
|
||||
|
||||
; call.preroute: bool: Activate handler on the "call.preroute" message
|
||||
;call.preroute=no
|
||||
|
||||
; call.route: bool: Activate handler on the "call.route" message
|
||||
;call.route=no
|
||||
|
||||
|
@ -74,6 +77,13 @@ query=UPDATE users SET location=NULL,expires=NULL WHERE expires IS NOT NULL AND
|
|||
query=UPDATE users SET location=NULL,expires=NULL WHERE expires IS NOT NULL AND expires<=CURRENT_TIMESTAMP
|
||||
|
||||
|
||||
[call.preroute]
|
||||
; Query and result name for the prerouting message
|
||||
|
||||
query=
|
||||
priority=120
|
||||
|
||||
|
||||
[call.route]
|
||||
; Query and result name for the routing message
|
||||
|
||||
|
|
|
@ -980,8 +980,13 @@ bool Router::route()
|
|||
bool ok = !tmp.null();
|
||||
if (ok)
|
||||
m_msg->retValue() = tmp;
|
||||
else
|
||||
else {
|
||||
if (*m_msg == "call.preroute") {
|
||||
Engine::dispatch(m_msg);
|
||||
*m_msg = "call.route";
|
||||
}
|
||||
ok = Engine::dispatch(m_msg);
|
||||
}
|
||||
|
||||
m_driver->lock();
|
||||
Channel* chan = m_driver->find(m_id);
|
||||
|
|
|
@ -962,7 +962,7 @@ H323Connection::AnswerCallResponse YateH323Connection::OnAnswerCall(const PStrin
|
|||
}
|
||||
|
||||
const YateH323EndPoint& ep = static_cast<const YateH323EndPoint&>(GetEndPoint());
|
||||
Message *m = m_chan->message("call.route",false,true);
|
||||
Message *m = m_chan->message("call.preroute",false,true);
|
||||
if (ep.c_str())
|
||||
m->setParam("in_line",ep.c_str());
|
||||
const char *s = s_cfg.getValue("incoming","context");
|
||||
|
|
|
@ -527,7 +527,7 @@ IAXConnection::~IAXConnection()
|
|||
|
||||
bool IAXConnection::startRouting(iax_event *e)
|
||||
{
|
||||
Message *m = message("call.route");
|
||||
Message *m = message("call.preroute");
|
||||
if (e->ies.calling_name)
|
||||
m->addParam("callername",e->ies.calling_name);
|
||||
else
|
||||
|
|
|
@ -869,7 +869,7 @@ void PriChan::ring(pri_event_ring &ev)
|
|||
m_inband = m_span->inband();
|
||||
openData(lookup(ev.layer1,dict_str2law),0);
|
||||
|
||||
m = message("call.route");
|
||||
m = message("call.preroute");
|
||||
if (m_span->overlapped() && !ev.complete && (::strlen(ev.callednum) < m_span->overlapped())) {
|
||||
::pri_need_more_info(m_span->pri(),m_call,m_chan,!isISDN());
|
||||
m->addParam("overlapped","yes");
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
Regist,
|
||||
UnRegist,
|
||||
Auth,
|
||||
PreRoute,
|
||||
Route,
|
||||
Cdr,
|
||||
Timer
|
||||
|
@ -109,7 +110,7 @@ static void replaceParams(String& str, const Message &msg)
|
|||
}
|
||||
|
||||
// copy parameters from SQL result to a Message
|
||||
static void copyParams(Message& msg, Array *a, const char* resultName = 0, int row = 0)
|
||||
static void copyParams(Message& msg, Array* a, const char* resultName = 0, int row = 0)
|
||||
{
|
||||
if (!a)
|
||||
return;
|
||||
|
@ -214,6 +215,22 @@ bool AAAHandler::received(Message& msg)
|
|||
return false;
|
||||
}
|
||||
break;
|
||||
case PreRoute:
|
||||
{
|
||||
if (s_critical)
|
||||
return failure(&msg);
|
||||
Message m("database");
|
||||
m.addParam("account",m_account);
|
||||
m.addParam("query",query);
|
||||
if (Engine::dispatch(m))
|
||||
if (m.getIntValue("rows") >=1)
|
||||
{
|
||||
Array* a = static_cast<Array*>(m.userObject("Array"));
|
||||
copyParams(msg,a,m_result);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case Route:
|
||||
{
|
||||
if (s_critical)
|
||||
|
@ -224,7 +241,7 @@ bool AAAHandler::received(Message& msg)
|
|||
if (Engine::dispatch(m))
|
||||
if (m.getIntValue("rows") >=1)
|
||||
{
|
||||
Array *a = (Array *)m.userData();
|
||||
Array* a = static_cast<Array*>(m.userObject("Array"));
|
||||
copyParams(msg,a,m_result);
|
||||
if (msg.retValue().null())
|
||||
{
|
||||
|
@ -398,6 +415,7 @@ void RegistModule::initialize()
|
|||
addHandler("engine.timer",AAAHandler::Timer);
|
||||
addHandler("user.unregister",AAAHandler::UnRegist);
|
||||
addHandler("user.register",AAAHandler::Regist);
|
||||
addHandler("call.preroute",AAAHandler::PreRoute);
|
||||
addHandler("call.route",AAAHandler::Route);
|
||||
}
|
||||
|
||||
|
|
|
@ -1281,7 +1281,7 @@ YateSIPConnection::YateSIPConnection(SIPEvent* ev, SIPTransaction* tr)
|
|||
|
||||
URI uri(m_tr->getURI());
|
||||
YateSIPLine* line = plugin.findLine(m_host,m_port,m_uri.getUser());
|
||||
Message *m = message("call.route");
|
||||
Message *m = message("call.preroute");
|
||||
|
||||
if (line) {
|
||||
// call comes from line we have registered to - trust it...
|
||||
|
|
Loading…
Reference in New Issue