More Cisco-ification and PortaBill handling.
git-svn-id: http://yate.null.ro/svn/yate/trunk@736 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
ddadc78203
commit
e3a15aa3a7
|
@ -38,6 +38,13 @@
|
|||
; simplify: bool: Simplify returned partial URIs by stripping parameters
|
||||
;simplify=no
|
||||
|
||||
; maxcall: int: Maximum time to wait until call is answered in milliseconds
|
||||
;maxcall=
|
||||
|
||||
; stoperror: string: Regular expression matching the names of the errors
|
||||
; that will terminate the entire call, not just one route
|
||||
;stoperror=busy
|
||||
|
||||
|
||||
;[nas]
|
||||
;There can be several sections named [nas] or [nas SOMETHING]
|
||||
|
@ -102,7 +109,6 @@ add:Service-Type=8
|
|||
rad_auth=no
|
||||
rad_server=common
|
||||
; Some RADIUS attributes you're likely to set
|
||||
add:h323-conf-id=${billid}
|
||||
add:h323-disconnect-cause=${q931_cause}
|
||||
add:Acct-Delay-Time=0
|
||||
|
||||
|
@ -130,6 +136,5 @@ add:Acct-Delay-Time=0
|
|||
|
||||
; Some RADIUS attributes you're likely to set
|
||||
add:Cisco-NAS-Port=${chan}
|
||||
add:h323-remote-address=${address}
|
||||
add:NAS-Identifier=Yate
|
||||
;add:NAS-IP-Address=
|
||||
|
|
|
@ -70,6 +70,8 @@ static bool s_unisocket = false;
|
|||
static bool s_pb_enabled = false;
|
||||
static bool s_pb_parallel = false;
|
||||
static bool s_pb_simplify = false;
|
||||
static String s_pb_stoperror;
|
||||
static String s_pb_maxcall;
|
||||
|
||||
// Attribute types, not exactly as in RFC 2865
|
||||
enum {
|
||||
|
@ -443,6 +445,10 @@ static void portaBillingRoute(NamedList& params, const ObjList* attributes)
|
|||
if (route) {
|
||||
Debug(&__plugin,DebugCall,"PortaBilling returned route '%s'",route.c_str());
|
||||
params.setParam("callto",route);
|
||||
if (s_pb_maxcall)
|
||||
params.setParam("maxcall",s_pb_maxcall);
|
||||
if (s_pb_stoperror && route.startsWith("fork",true))
|
||||
params.setParam("stoperror",s_pb_stoperror);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1367,6 +1373,11 @@ bool AcctHandler::received(Message& msg)
|
|||
if (billid.null())
|
||||
return false;
|
||||
|
||||
String address = msg.getValue("address");
|
||||
int sep = address.find(':');
|
||||
if (sep >= 0)
|
||||
address = address.substr(0,sep);
|
||||
|
||||
String dir = msg.getValue("direction");
|
||||
if (dir == "incoming")
|
||||
dir = "answer";
|
||||
|
@ -1378,17 +1389,33 @@ bool AcctHandler::received(Message& msg)
|
|||
RadiusClient radclient;
|
||||
if (!radclient.prepareAttributes(msg,true))
|
||||
return false;
|
||||
|
||||
// create a Cisco-compatible conference ID
|
||||
MD5 cid(billid);
|
||||
String confid;
|
||||
confid << cid.hexDigest().substr(0,8) << " ";
|
||||
confid << cid.hexDigest().substr(8,8) << " ";
|
||||
confid << cid.hexDigest().substr(16,8) << " ";
|
||||
confid << cid.hexDigest().substr(24,8);
|
||||
confid.toUpper();
|
||||
|
||||
// cryptographically generate an unique call leg ID
|
||||
MD5 sid(billid);
|
||||
sid << msg.getValue("chan");
|
||||
|
||||
double t = msg.getDoubleValue("time");
|
||||
|
||||
radclient.addAttribute("Acct-Session-Id",sid.hexDigest());
|
||||
radclient.addAttribute("Acct-Status-Type",acctStat);
|
||||
radclient.addAttribute("h323-call-origin",dir);
|
||||
radclient.addAttribute("h323-conf-id",confid);
|
||||
radclient.addAttribute("h323-remote-address",address);
|
||||
|
||||
String tmp;
|
||||
String tmp("call-id=");
|
||||
if (address.null())
|
||||
address = s_localAddr.host();
|
||||
tmp << billid << "@" << address;
|
||||
radclient.addAttribute("Cisco-AVPair",tmp);
|
||||
|
||||
double t = msg.getDoubleValue("time");
|
||||
ciscoTime(t,tmp);
|
||||
radclient.addAttribute("h323-setup-time",tmp);
|
||||
|
||||
|
@ -1442,13 +1469,15 @@ void RadiusModule::initialize()
|
|||
s_cfgMutex.lock();
|
||||
s_cfg = Engine::configFile("yradius");
|
||||
s_cfg.load();
|
||||
s_cfgMutex.unlock();
|
||||
s_localTime = s_cfg.getBoolValue("general","local_time",false);
|
||||
s_shortnum = s_cfg.getBoolValue("general","short_number",false);
|
||||
s_unisocket = s_cfg.getBoolValue("general","single_socket",false);
|
||||
s_pb_enabled = s_cfg.getBoolValue("portabill","enabled",false);
|
||||
s_pb_parallel = s_cfg.getBoolValue("portabill","parallel",false);
|
||||
s_pb_simplify = s_cfg.getBoolValue("portabill","simplify",false);
|
||||
s_pb_stoperror = s_cfg.getValue("portabill","stoperror","busy");
|
||||
s_pb_maxcall = s_cfg.getValue("portabill","maxcall");
|
||||
s_cfgMutex.unlock();
|
||||
|
||||
if (m_init || !s_cfg.getBoolValue("general","enabled",true))
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue