| 1 | <? |
|---|
| 2 | # This file contains examples for all possible settings for CDRTool |
|---|
| 3 | # |
|---|
| 4 | # 1. Change all hostnames and passwords according to the installation |
|---|
| 5 | # 2. Copy this file to /etc/cdrtool/global.inc |
|---|
| 6 | # |
|---|
| 7 | |
|---|
| 8 | ########################################### |
|---|
| 9 | # System and web paths |
|---|
| 10 | |
|---|
| 11 | $CDRTool['tld'] = "/CDRTool"; |
|---|
| 12 | $CDRTool['Path'] = "/var/www/CDRTool"; |
|---|
| 13 | $_PHPLIB['libdir'] = $CDRTool['Path']. "/phplib/"; |
|---|
| 14 | include($_PHPLIB["libdir"] . "prepend.php3"); |
|---|
| 15 | |
|---|
| 16 | ########################################### |
|---|
| 17 | # PHP Error reporting |
|---|
| 18 | $errorReporting = (E_ALL & ~E_NOTICE); |
|---|
| 19 | $errorReporting = 1; // comment this out to enable PHP warnings |
|---|
| 20 | error_reporting($errorReporting); |
|---|
| 21 | |
|---|
| 22 | ########################################### |
|---|
| 23 | # Service provider information |
|---|
| 24 | $CDRTool['provider']['name'] = "SIP provider"; |
|---|
| 25 | $CDRTool['provider']['service'] = "SIP service"; |
|---|
| 26 | $CDRTool['provider']['timezone'] = "Europe/Amsterdam"; |
|---|
| 27 | $CDRTool['provider']['fromEmail'] = "support@example.com"; |
|---|
| 28 | $CDRTool['provider']['toEmail'] = "support@example.com"; |
|---|
| 29 | $CDRTool['provider']['sampleLoginSubscriber'] = "317100000@example.com"; |
|---|
| 30 | $CDRTool['provider']['sampleLoginDomain'] = "317100001@subdomain.example.com"; |
|---|
| 31 | |
|---|
| 32 | ########################################### |
|---|
| 33 | # Where the rating engine listens for network requests: |
|---|
| 34 | |
|---|
| 35 | ########################################### |
|---|
| 36 | # Rating engine settings |
|---|
| 37 | $RatingEngine=array("socketIP" => "IP.address.of.the.private.interface.of.cdrtool.example.com", |
|---|
| 38 | "socketPort" => "9024", |
|---|
| 39 | "cdr_source" => "opensips_radius", // points to a defined DATASOURCE |
|---|
| 40 | "log_delay" => 0.05, |
|---|
| 41 | "split_rating_table" => false, // when true individual rating tables are automatically created for each rate id |
|---|
| 42 | "csv_delimiter" => ",", // when importin CSV files |
|---|
| 43 | "priceDenominator" => 10000, // e.g. 1 Eur = 10000 units |
|---|
| 44 | "priceDecimalDigits" => 4, // how many digits to round the prices to |
|---|
| 45 | "minimumDurationCharged" => 0, // Only calls greater than this duration will be charged |
|---|
| 46 | "durationPeriodRated" => 60, // the prices from the rating table are calculated per this period |
|---|
| 47 | "trafficSizeRated" => 1024, // same as above but for data traffic |
|---|
| 48 | "reportMissingRates" => 0, // send email notifications if rates are missing from the ratingEngine |
|---|
| 49 | "minimumDuration" => 0, // minimum duration to rate, if call duration is shorter the price is zero |
|---|
| 50 | "allow" => array ('10.','192.168.0.1','127.0.0.1'), // list with clients allowed to connect |
|---|
| 51 | "MaxSessionTime" => 36000 // limit all prepaid calls to maximum 10 hours |
|---|
| 52 | ); |
|---|
| 53 | |
|---|
| 54 | ########################################### |
|---|
| 55 | # Normalize engine settings |
|---|
| 56 | $CDRTool['normalize']['defaultCountryCode'] = "31"; |
|---|
| 57 | |
|---|
| 58 | ########################################### |
|---|
| 59 | # build graphical statistics for these domains: |
|---|
| 60 | $CDRTool['statistics']['domains']=array("example.com"); |
|---|
| 61 | |
|---|
| 62 | # Carrier selection codes, strip first digits |
|---|
| 63 | # and allocate custom Billing Party |
|---|
| 64 | $CDRTool['normalize']['CS_CODES']= array("1684" => array ("name" =>"test@Call", |
|---|
| 65 | "BillingPartyId" =>"call@example.com", |
|---|
| 66 | "BillingDomain" =>"example.com", |
|---|
| 67 | "minimumLength" =>"9" |
|---|
| 68 | ) |
|---|
| 69 | ); |
|---|
| 70 | |
|---|
| 71 | ########################################### |
|---|
| 72 | # Anti-fraud settings |
|---|
| 73 | # create group quota in SER and deny calls to users in this group |
|---|
| 74 | $UserQuota["default"]["traffic"] = 5000; // MBytes |
|---|
| 75 | $UserQuota["default"]["cost"] = 1000; // Euro |
|---|
| 76 | |
|---|
| 77 | ########################################### |
|---|
| 78 | # CDRTool databases |
|---|
| 79 | |
|---|
| 80 | class DB_CDRTool extends DB_Sql { |
|---|
| 81 | var $Host = "sipdb"; |
|---|
| 82 | var $Database = "cdrtool"; |
|---|
| 83 | var $User = "cdradmin"; |
|---|
| 84 | var $Password = "PASSWORD"; |
|---|
| 85 | var $Halt_On_Error ="yes"; |
|---|
| 86 | } |
|---|
| 87 | |
|---|
| 88 | class DB_Locker extends DB_Sql { |
|---|
| 89 | var $Host = "sipdb"; |
|---|
| 90 | var $Database = "cdrtool"; |
|---|
| 91 | var $User = "locker"; |
|---|
| 92 | var $Password = "PASSWORD"; |
|---|
| 93 | var $Halt_On_Error ="yes"; |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | class DB_radius extends DB_Sql { |
|---|
| 97 | var $Host = "sipdb"; |
|---|
| 98 | var $Database = "radius"; |
|---|
| 99 | var $User = "radius"; |
|---|
| 100 | var $Password = "PASSWORD"; |
|---|
| 101 | var $Halt_On_Error ="no"; |
|---|
| 102 | } |
|---|
| 103 | |
|---|
| 104 | class DB_opensips extends DB_Sql { |
|---|
| 105 | var $Host = "sipdb"; |
|---|
| 106 | var $Database = "opensips"; |
|---|
| 107 | var $User = "opensips"; |
|---|
| 108 | var $Password = "PASSWORD"; |
|---|
| 109 | var $Halt_On_Error ="yes"; |
|---|
| 110 | } |
|---|
| 111 | |
|---|
| 112 | class DB_siptrace extends DB_Sql { |
|---|
| 113 | var $Host = "sipdb"; |
|---|
| 114 | var $Database = "siptrace"; |
|---|
| 115 | var $User = "opensips"; |
|---|
| 116 | var $Password = "PASSWORD"; |
|---|
| 117 | var $Halt_On_Error ="yes"; |
|---|
| 118 | } |
|---|
| 119 | |
|---|
| 120 | class DB_mediaproxy extends DB_Sql { |
|---|
| 121 | var $Host = "sipdb"; |
|---|
| 122 | var $Database = "mediaproxy"; |
|---|
| 123 | var $User = "mediaproxy"; |
|---|
| 124 | var $Password = "PASSWORD"; |
|---|
| 125 | var $Halt_On_Error ="yes"; |
|---|
| 126 | } |
|---|
| 127 | |
|---|
| 128 | $replicated_databases=array('cluster1'=>array( |
|---|
| 129 | "db1"=>array('ip' =>'10.0.0.131', |
|---|
| 130 | 'slave_of'=>'db2', |
|---|
| 131 | 'user' =>'process', |
|---|
| 132 | 'password'=>'password', |
|---|
| 133 | 'replication_user' =>'replication', |
|---|
| 134 | 'replication_password'=>'password', |
|---|
| 135 | 'active_master' => true |
|---|
| 136 | ), |
|---|
| 137 | "db2"=>array('ip' =>'10.0.0.132', |
|---|
| 138 | 'slave_of'=>'db1', |
|---|
| 139 | 'user' =>'process', |
|---|
| 140 | 'password'=>'password', |
|---|
| 141 | 'replication_user' =>'replication', |
|---|
| 142 | 'replication_password'=>'password' |
|---|
| 143 | ) ) |
|---|
| 144 | ); |
|---|
| 145 | |
|---|
| 146 | |
|---|
| 147 | # To allow subscribers to login and access their own CDRs. See |
|---|
| 148 | # OpenSIPS_DomainAuth from phplib/local.inc as example |
|---|
| 149 | |
|---|
| 150 | class DomainAuthLocal extends OpenSIPS_DomainAuth { |
|---|
| 151 | } |
|---|
| 152 | |
|---|
| 153 | class PageLayoutLocal extends PageLayout { |
|---|
| 154 | } |
|---|
| 155 | |
|---|
| 156 | ########################################### |
|---|
| 157 | # CDRTool datasources |
|---|
| 158 | |
|---|
| 159 | class CDRS_opensips_custom extends CDRS_opensips { |
|---|
| 160 | // this shows how you can modify the default behavior of standard CDRS_opensips class |
|---|
| 161 | // you can overwrite any function from that class here |
|---|
| 162 | // to use this class set the data source 'class' setting to the name of this class |
|---|
| 163 | } |
|---|
| 164 | |
|---|
| 165 | $DATASOURCES=array( |
|---|
| 166 | "unknown"=>array( |
|---|
| 167 | "class" => "CDRS_unknown" // do not delete this datasource |
|---|
| 168 | ), |
|---|
| 169 | "opensips_radius"=>array( |
|---|
| 170 | "name" => "OpenSIPS", |
|---|
| 171 | "class" => "CDRS_opensips_custom", |
|---|
| 172 | "db_class" => array("DB_radius2","DB_radius"), |
|---|
| 173 | "table" => "radacct", // or "radacct".date("Ym") if sql.conf uses the mysql procedure to auto-rotate tables |
|---|
| 174 | "rating" => "1", // enable rating |
|---|
| 175 | "rateField" => "Rate", // which field stores the rating info |
|---|
| 176 | "E164_class" => "E164_custom", // define a custom class to determine the E164 for a telephone number |
|---|
| 177 | // see E164 classes as example in library/cdr_generic.php |
|---|
| 178 | "priceField" => "Price", |
|---|
| 179 | "DestinationIdField" => "DestinationId", |
|---|
| 180 | "normalizedField" => "Normalized", |
|---|
| 181 | "BillingPartyIdField"=> "UserName", |
|---|
| 182 | "db_susbcribers" => "DB_opensips", |
|---|
| 183 | "domain_table" => "domain", // table of db_susbcribers that holds domains served by the sip proxy |
|---|
| 184 | "subscriber_table" => "subscriber", // table of db_susbcribers that holds susbcribers served by the sip proxy |
|---|
| 185 | "intAccessCode" => "00", // international acess code, numbers prefixed with this are considered international destinations |
|---|
| 186 | "natAccessCode" => "0", // international acess code, numbers prefixed with this are considered national destinations |
|---|
| 187 | "sipTrace" => "sip_trace", // which datasource is used for display of sip trace |
|---|
| 188 | "mediaTrace" => "media_trace", // which datasource is used for display of media trace |
|---|
| 189 | "UserQuotaClass" => "OpenSIPSQuota", |
|---|
| 190 | "UserQuotaNotify" => "1", // send e-mail notifications when quota is exceeded |
|---|
| 191 | "notifyLastSessions" => true, // send e-mail notifications with sessions received in the last 24 hours |
|---|
| 192 | "soapEngineId" => '', // used by Multimedia Service Platform |
|---|
| 193 | "domainTranslation_SourceIP" => array( |
|---|
| 194 | "10.0.0.1" => "gateway.example.com" // translate Realm for sessions originating from IP address 10.0.0.1 |
|---|
| 195 | ), |
|---|
| 196 | "domainTranslation" => array( |
|---|
| 197 | "gw02.domain.com" => "pstn.domain.com" // translate Realm |
|---|
| 198 | ), |
|---|
| 199 | "purgeCDRsAfter" => 120, // how many days to keep old CDRs, valid only when Radius tables are not atomatically rotated |
|---|
| 200 | "db_registrar" => "DB_opensips", // opensips location database |
|---|
| 201 | "enableThor" => false, // set to true if using SIP Thor |
|---|
| 202 | "mediaSessions" => "sipthor", // NGNPro engine id used by SIP Thor |
|---|
| 203 | "networkStatus" => "sipthor", // NGNPro engine id used by SIP Thor |
|---|
| 204 | "mediaDispatcher" => "tls:10.0.0.1:25061", // Where to get the active media sessions from MediaProxy 2.0 |
|---|
| 205 | // Create /etc/cdrtool/mediaproxy.pem containing the certificate and private key |
|---|
| 206 | "mediaServers" => array( |
|---|
| 207 | "10.0.0.2", |
|---|
| 208 | "10.0.0.3" |
|---|
| 209 | ) // where to get the active sessions from MediaRroxy 1.x |
|---|
| 210 | ), |
|---|
| 211 | "cisco" =>array("name" => "Cisco gateway", |
|---|
| 212 | "class" => "CDRS_cisco", |
|---|
| 213 | "db_class" => "DB_cisco", |
|---|
| 214 | "table" => "radacct", |
|---|
| 215 | "rateField" => "Rate", |
|---|
| 216 | "rating" => "1", |
|---|
| 217 | "priceField" => "Price", |
|---|
| 218 | "DestinationIdField" => "DestinationId", |
|---|
| 219 | "normalizedField" => "Normalized", |
|---|
| 220 | "traceInURL" => array( |
|---|
| 221 | "10.0.0.2"=>"opensips_radius", |
|---|
| 222 | "Asterisk"=>"asterisk" |
|---|
| 223 | ), |
|---|
| 224 | "traceOutURL" => array( |
|---|
| 225 | "10.0.0.2"=>"opensips_radius" |
|---|
| 226 | ), |
|---|
| 227 | "purgeCDRsAfter" => 180 // how many days to keep the CDRs |
|---|
| 228 | ), |
|---|
| 229 | "asterisk" =>array("name" => "Asterisk server", |
|---|
| 230 | "class" => "CDRS_asterisk", |
|---|
| 231 | "table" => "asterisk_cdr", |
|---|
| 232 | "db_class" => "DB_radius", |
|---|
| 233 | "rateField" => "Rate", |
|---|
| 234 | "rating" => "1", |
|---|
| 235 | "priceField" => "Price", |
|---|
| 236 | "DestinationIdField" => "DestinationId", |
|---|
| 237 | "normalizedField" => "Normalized", |
|---|
| 238 | "contexts" => array( |
|---|
| 239 | "SIP"=>array("WEBName"=>"SIP Provider 1"), |
|---|
| 240 | "PSTN"=>array("WEBName"=>"PSTN 2 ENUM") |
|---|
| 241 | ), |
|---|
| 242 | "traceInURL" => array( |
|---|
| 243 | "SIP"=>"opensips_radius" |
|---|
| 244 | ), |
|---|
| 245 | "traceOutURL" => array( |
|---|
| 246 | "SIP"=>"opensips_radius" |
|---|
| 247 | ), |
|---|
| 248 | "purgeCDRsAfter" => 180 // how many days to keep the CDRs |
|---|
| 249 | |
|---|
| 250 | ), |
|---|
| 251 | "sip_trace" =>array( |
|---|
| 252 | "name" => "SIP trace", |
|---|
| 253 | "db_class" => "DB_siptrace", |
|---|
| 254 | "table" => "sip_trace", |
|---|
| 255 | "purgeRecordsAfter" => "7", |
|---|
| 256 | "SIPProxies" => array("10.0.0.1"=>"SIP Proxy 1", |
|---|
| 257 | "10.0.0.2"=>"SIP Proxy 2" |
|---|
| 258 | ), |
|---|
| 259 | "invisible" => 1, // hide this datasource in call search page / datasource selection |
|---|
| 260 | "mediaTrace" => "media_trace" |
|---|
| 261 | ), |
|---|
| 262 | |
|---|
| 263 | "sip_trace_thor" =>array( |
|---|
| 264 | "name" => "SIP trace Thor", |
|---|
| 265 | "enableThor" => true, |
|---|
| 266 | "soapEngineId" => "sipthor", |
|---|
| 267 | "mediaTrace" => "media_trace_thor", |
|---|
| 268 | "invisible" => 1, |
|---|
| 269 | ), |
|---|
| 270 | "media_trace" =>array( |
|---|
| 271 | "name" => "Media trace", |
|---|
| 272 | "db_class" => "DB_mediaproxy", |
|---|
| 273 | "enableThor" => false, |
|---|
| 274 | "invisible" => 1 |
|---|
| 275 | ), |
|---|
| 276 | "media_trace_thor" =>array( |
|---|
| 277 | "name" => "Media trace Thor", |
|---|
| 278 | "enableThor" => true, |
|---|
| 279 | "soapEngineId" => "sipthor", |
|---|
| 280 | "invisible" => 1 |
|---|
| 281 | ) |
|---|
| 282 | ); |
|---|
| 283 | |
|---|
| 284 | // load other CDRTool libraries |
|---|
| 285 | $CDRToolModules=array("opensips","asterisk"); |
|---|
| 286 | |
|---|
| 287 | $tz=$CDRTool['provider']['timezone']; |
|---|
| 288 | putenv("TZ=$tz"); |
|---|
| 289 | |
|---|
| 290 | if ($_SERVER['REMOTE_ADDR']=="10.0.0.1") { |
|---|
| 291 | // display debug information only from this host |
|---|
| 292 | //$verbose=1; |
|---|
| 293 | } else { |
|---|
| 294 | // prevent set of verbose via post/get |
|---|
| 295 | unset($verbose); |
|---|
| 296 | } |
|---|
| 297 | ?> |
|---|