How to deploy WebRTC, Class5, Class4 and SBC - Kamailio

How to deploy
WebRTC, Class5, Class4 and SBC Services
within minutes
Andreas Granig
<agranig@sipwise.com>
Andrew Pogrebennyk
<apogrebennyk@sipwise.com>
Victor Seva
<vseva@sipwise.com>
What's the sip:provider CE?
в—Џ
в—Џ
в—Џ
в—Џ
A turn-key appliance for real-time
communication (voice, video, presence, IM)
using SIP and XMPP
for carrier environments with 50k+ subscribers
and 2k+ parallel calls
based on Kamailio, Prosody and Sipwise
projects
Some Statistics
в—Џ
First public release in December 2010
в—Џ
11 releases so far (latest is mr3.2.1)
в—Џ
18k+ downloads total, ~1k per month
Agenda
в—Џ
Set up your VMs
в—Џ
Hook up SIP, WebRTC and XMPP Clients
в—Џ
Use Rewrite Rules, Peering and Billing
в—Џ
Know the Architecture
в—Џ
Manage Configuration Files
в—Џ
Tweaks for different Use Cases
Set up your VMs
в—Џ
http://www.vagrantup.com
в—Џ
http://www.virtualbox.org
в—Џ
https://s3В­euВ­westВ­1.amazonaws.com/kamailioworld2014/sip_provider_CE_mr3.2.1_vagrant.box
$В vagrantВ initВ spceВ sip_provider_CE_mr3.2.1_vagrant.box
$В vagrantВ up
Accessing your SPCE
в—Џ
в—Џ
https://your-ip:1443
administrator/administrator
vagrant ssh
sudo -s
root/sipwise
Creating a Reseller
в—Џ
(Almost) Everything is Multi-Tenant!
в—Џ
в—Џ
в—Џ
в—Џ
в—Џ
в—Џ
в—Џ
в—Џ
Domains
Customers
Subscribers
Billing Profiles
Rewrite Rules
Tenant A
в—Џ
в—Џ
в—Џ
в—Џ
в—Џ
Domains
Customers
Subscribers
Billing Profiles
Rewrite Rules
Tenant B
Resellers
Peerings
Security Bans
в—Џ
в—Џ
в—Џ
в—Џ
в—Џ
Domains
Customers
Subscribers
Billing Profiles
Rewrite Rules
Tenant C
Creating a Reseller
в—Џ
default Reseller, or your own:
в—Џ
Settings в†’ Resellers в†’ Create with Default
в—Џ
Adapt Default Values
в—Џ
–
Base Information
–
Contact Email
–
Admin Logins
Create Billing Profile for Customers
Creating a Domain
в—Џ
Domain-Preferences are defaults for
Subscriber-Preferences
Domain
example.org
в—Џ
в—Џ
user1@example.org
в—Џ
Subscriber
use_rtpproxy: always with plain SDP
use_rtpproxy: domain default
- or use_rtpproxy: always with rtpproxy as only ICE candidate
Creating a Domain
в—Џ
Your IP as Domain, or your own:
в—Џ
Settings в†’ Domains в†’ Create Domain
в—Џ
Default Domain-Preferences are fine (for now)
Creating a Customer
в—Џ
Customers are Billing Containers
Customer
#1234
user1@example.org
Subscribers
Contact
me@gmail.com
100€ used
50€ left
Contract Balance
Creating a Customer
в—Џ
Use an existing one, or your own:
в—Џ
Settings в†’ Customers в†’ Create Customer
–
Select/Create a Contact
–
Select/Create a Billing Profile
Creating a Subscriber
в—Џ
Now we're there!
Subscriber
user1@example.org
SIP
Creating a Subscriber
в—Џ
Use an existing one, or your own:
в—Џ
Settings в†’ Customers в†’ Your Customer
в†’ Details в†’ Create Subscriber
в—Џ
or
в—Џ
Settings в†’ Subscribers в†’ Create Subscriber
Connecting your Subscribers
в—Џ
SIP and XMPP work out of the box
в—Џ
SIP/TLS needs to be enabled
–
vimВ /etc/ngcpВ­config/config.yml
–
kamailioВ в†’В lbВ в†’В tlsВ в†’В enable:В 'yes'
–
ngcpcfgВ apply
What about WebRTC?
ws://yourВ­ip:5060/ws, wss://yourВ­ip:5061/ws, wss://yourВ­ip:1443/wss/sip/
в—Џ
Needs Preference Tweaking as of mr3.2.x
в—Џ
Subscribers в†’ Details в†’ Preferences
в†’ NAT and Media Flow Control
в—Џ
–
use_rtpproxy:В Never,В AlwaysВ withВ rtpproxyВ asВ additional/onlyВ ICEВ candidate
–
srtp_transcoding:В Transparent,В PreferВ SRTP
–
rtcp_feedback:В Transparent,В PreferВ AVPF
Depends on your Use Case (SIP ↔ WebRTC Bridging)
Rewrite Rules
в—Џ
Your Dial-Plans in Perl Regex
Rule Set
Dialplan Germany
M:В ^0([1В­9][0В­9]+)$
R:В ${caller_cc}\1
D:В NationalВ toВ E.164
Inbound Caller
M:В ^0([1В­9][0В­9]+)$
R:В ${caller_cc}\1
D:В NationalВ toВ E.164
Inbound Callee
Preferences as
${caller_xxx} and
${callee_xxx} variables
M:В ^([1В­9][0В­9]+)$
R:В 00\1
D:В E.164В toВ International
Outbound Caller
M:В ^([1В­9][0В­9]+)$
R:В 00\1
D:В E.164В toВ International
Outbound Callee
Creating Rewrite Rules
в—Џ
в—Џ
в—Џ
Settings в†’ Rewrite Rules
Processing stops on first match (order
matters)
Assign to Subscribers, Domains and Peer
–
Preferences в†’ rewrite_rule_set
Peerings
в—Џ
Dynamic peering via ENUM
–
в—Џ
в—Џ
config.yml: kamailio в†’ proxy в†’ use_enum
Dynamic peering via Foreign Domains
–
Dom-Preference: allow_out_foreign_domain
–
Dom-Preference: unauth_inbound_calls
Static peering via Peering Groups
–
Everything not local goes to peer
–
Force inbound/outbound to peer via Preferences
Static Peerings
в—Џ
Settings в†’ Peerings в†’ Create Peering Group
Peering Group
в—Џ
Telefonica
gw1.telefonica.de
gw2.telefonica.de
Peering Servers
в—Џ
в—Џ
в—Џ
в—Џ
Priority over multiple Groups
Auto-Failover after all Servers used
Weight per server
Random selection
Auto-Failover
в—Џ
gw1.telefonica.de
gw2.telefonica.de
Peering Rules
в—Џ
Callee prefix length
Match on
в—Џ
Caller pattern
в—Џ
Callee pattern
Billing Profiles
в—Џ
Settings в†’ Billing в†’ Create Billing Profile
Billing Profile
Offpeak Times
myprofile
Mo-Fr 00:00-07:95
Mo-Fr 18:00-23:59
Sa-Su
2014-12-25
^49 в†’ 20cents
^43 в†’ 30cents
@example.org в†’ 1cent
Germany Fixed
Germany Mobile
Europe
Billing Fees
Billing Zones
That's it for the operational part
Easy, eh?
sip:provider Architecture
SIP Components
Configuration Framework
в—Џ
Templates!
в—Џ
Controlled by:
в—Џ
–
/etc/ngcpВ­config/config.yml
–
/etc/ngcpВ­config/constants.yml
–
/etc/ngcpВ­config/network.yml
Template sources:
–
в—Џ
/etc/ngcpВ­config/templates/...
Backed by Git (but you don't use it directly)
Changing Configs
в—Џ
Use customtt-Files!
$В cpВ \
В В В В /etc/ngcpВ­config/templates/etc/kamailio/lb/kamailio.cfg.tt2В \
В В В В /etc/ngcpВ­config/templates/etc/kamailio/lb/kamailio.cfg.customtt.tt2
в—Џ
Apply changes
$В ngcpcfgВ apply
–
в—Џ
Commits your changes, generates configs and restarts
affected services (neat, eh?)
Automatically tracks everything you drop into
/etc/ngcp-config/templates/
Your Use Cases?
в—Џ
If we wanted to do $this...
в—Џ
then you have to do $that
Your turn!
More Questions?
@sipwise
http://lists.sipwise.com/listinfo/spce-user
agranig@sipwise.com