real-time charging for opensips 2.1 using...

23
Real-time charging for OpenSIPS 2.1 using CGRateS Dan Christian Bogos [email protected] OpenSIPS Summit Amsterdam, May 2015

Upload: vuongtuong

Post on 11-Mar-2018

231 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

Real-time charging for OpenSIPS 2.1 using CGRateS

Dan Christian [email protected]

OpenSIPS Summit Amsterdam, May 2015

Page 2: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

Our Background

Located in Bavaria/Germany, over 8 years of experience with architecting server side solutions in VoIP environment Platform implementations covering both wholesale and retail business categories

Responsibly understanding real-time processing constrains and the seriousness of live system outages

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 3: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

About CGRateSCharging/Billing engine Plug-able into existing billing infrastructureAccommodate new components into ISP/ITSP network (eg: add new VoIP switch, SMS Service, Data stream)

Modular architectureEasy to enhance by rewriting specific componentsJSON/HTTP/GOB RPC API

Performance OrientedBuilt-in transactional cache system (data ageing, live counters)Asynchronous processing with micro-threads

Feature-richMulti-tenancy, derived charging, account bundles, LCR, CDRStats, rates history, etc

Test driven developmentAprox. 900 tests as part of the build system

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 4: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

Actively maintained*stats provided by openhub.net

About CGRateS (2)

Page 5: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

Fast and … very fast

About CGRateS (3)

Page 6: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

CGRateS subsystems

Page 7: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

RATING

Highly configurable ratingConnect fees, rate units, rate increments, rates grouping, various rounding methods, configurable decimals in costs, maximum cost per destination with hit strategy

Performance orientedFully cachedAsynchronous processing

Rating profile scheduling

Derived ChargingReseller/distributors chaining or inbound/outbound traffic charging

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 8: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

RATING (2)

Multiple TypeOfRecord support (eg: *voice, *data, *sms)

Multiple Category filters for same TOR(eg: calls, premium_calls, inbound_calls)

Multiple rating subjects with fallback(useful for example with roaming CDRs)

Rating Aliases

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 9: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

Git powered History Server

Page 10: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

ACCOUNTING

Prepaid, Postpaid, Pseudo-prepaid controller

Account Monitors through ActionTriggersBalance Monitors (min/max)Counters Monitors (min/max) – eg: Usage per DestinationSynchronous and Asynchronous Actions triggered

Session emulationThrough DerivedCharging

Accounts Aliases

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 11: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

ACCOUNTING (2)

Unlimited Balances per Account*voice, *data, *sms, *monetaryBalance selection prioritisation through weightsVarious bundle combinations

Shared/Group Balances

Balance lifetime controlsEg: balance expires or balance is active on specific time intervals

Concurrent sessions per accountBalance reservation in chunks of debit intervalBalance refundsDebit sleep when needed

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 12: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

ACCOUNTING - Fraud Detection

Part of Accounting SubsystemTightly integrated, balance operations cannot avoid it

Balances monitoringMinimum & maximum balance monitors

Counters monitoringMinimum & maximum counter monitors

Scheduler integrationOne-time, recurrent triggers

Synchronous & Asynchronous Actions

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 13: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

Account handling logic

Page 14: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

CDR SERVER

Realtime CDR ServerAccessible Internal, GOB, JSON, HTTP-JSON, HTTP-REST interfaces

Offline CDR Import (eg: csv format)Automated via Linux inotify or scheduledSimultaneous folders monitored with multiple import templates per folder

Zero configuration CDR SourcesFreeSWITCHKamailioOpenSIPS

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 15: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

CDR SERVER (2)

Derived Charging support

Real-time CDR replicationRaw or Rated CDRs

CDR ExporterCSV, Fixed Length Fields, CombinedExport templates

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 16: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

CDR STATS

Standalone component Internally or remotely accessiblePerformance oriented

RawCDR and RatedCDR sources

Multiple Stats QueuesPer server and individually configurable stat queues for same CDR

Highly configurable Stats QueuesQueueLength, TimeWindow, MetricsCDR Field Filters

Individually configured ActionTriggersOne-time, recurrent triggersSynchronous & Asynchronous Actions executedPart of the Fraud Detection mechanism

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 17: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

LCRCore component logicInternally or remotely accessible through APIer or RATER componentsPerformance oriented, fully cached

Advanced profile selection mechanismFilter on Direction,Tenant,Category,Account,Subject,DestinationWeight based prioritization

Extended functionality through multiple strategies*static, *least_cost, *highest_cost, *qos_thresholds, *qosFlexible strategy parameters

Tightly coupled with ACCOUNTING subsystemProvide LCR over bundles

Integrate traffic patternsCompute LCR for specific call duration

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 18: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

CGRates Peripherals

APIer (RPC server)Tariff plan and Account managementExport commands form internal components (Eg: get_cdrs, export_cdrs, etc)Partial and full rates/accounts reload without restarts

ConsoleInteractive and non-interactiveHistoryHelpCommand auto-completion

LoaderCSV Imports

Tester

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 19: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

OpenSIPS Integration

Multiple integration mechanismsBased on traffic profileShared data through pseudovariables

REST_CLIENT for call authorization, LCRHTTP-JSON RPC Request/Answer

EVI ACC_ACCOUNTING*prepaid, *pseudoprepaid, *postpaid, *rated

EVI E_ACC_CDR*pseudoprepaid, *postpaid, *rated

CDR.csv processing*pseudoprepaid, *postpaid, *rated

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 20: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

OpenSIPS Real-time Prepaid

Call AuthorizationAsync/sync support through the user of rest_clientSets maximum call duration through dialog timeout

Call disconnectExecuted through mi_datagram by CGR SessionManager

Call StartOut of E_ACC_EVENT via event_datagram to CGR-SMStarts debit loop in case of prepaid calls – real or emulated ones

Call Stop/MissedOut of E_ACC_EVENT/E_ACC_MISSED_EVENT via event_datagram to CGR-SMStops debit loopWrites CDRs

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 21: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

OpenSIPS Real-time Prepaid - DEMO

Simple call handlingExplanation of opensips.cfgMonitor traffic exchanged between OpenSIPS and CGRateS Call auth and LCR processingCDR Export via cgr-console

Advanced call handlingSimultaneous calls out of same accountFraud detection with automatic mitigation example

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 22: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

Where to go from here

Websitehttp://www.cgrates.org

Documentationhttp://cgrates.readthedocs.org

Code + issues tracker https://github.com/cgrates/cgrates

SupportGoogle group: CGRateSIRC Freenode: #cgrates

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015

Page 23: Real-time charging for OpenSIPS 2.1 using CGRateSopensips.org/.../Dan_Bogos-OpenSIPS_Summit2015-CGRateS.pdf · Real-time charging for OpenSIPS 2.1 OpenSIPS Summit Amsterdam, May 2015

Thank you!

Questions?

Real-time charging for OpenSIPS 2.1OpenSIPS Summit Amsterdam, May 2015