SlideShare a Scribd company logo
ClueCon 2019 – Chicago, IL
Three Ways Kamailio can Help Your
FreeSWITCH Deployment
ClueCon 2019 – Chicago, IL
Who am I? Kama what?
1. Fred Posner
2. @fredposner
3. https://qxork.com
→ → kamailio.org ← ←
ClueCon 2019 – Chicago, IL
Recently launched v2.0
ClueCon 2019 – Chicago, IL
Agenda
1. Brief description of Kamailio
2. Use DISPATCHER for carrier and internal routing
3. Use PERMISSIONS instead of ACL
4. Use HTABLE for all the things
ClueCon 2019 – Chicago, IL
What is Kamailio?
ClueCon 2019 – Chicago, IL
Fred’s Phases of Learning SIP
1. WTF is this matrix shit?
2. Oh, it’s like HTTP
3. (After FreeSWITCH) Oh, I
get it
4. SIP is pretty straight
forward
5. (After Kamailio) oh dear
god I was wrong
6. What level of hell is this?
7. Ok... I’m getting it again
8. One truly never knows
everything about SIP
ClueCon 2019 – Chicago, IL
What is Kamailio?
●
Very, very fast
●
Hundreds of Thousands
of registrations
●
1000’s of cps
ClueCon 2019 – Chicago, IL
DISPATCHER
ClueCon 2019 – Chicago, IL
DISPATCHER Module
●
SIP Load Balancer
●
SIP Traffic Dispatcher
●
Many algorithms
●
Stateless
ClueCon 2019 – Chicago, IL
DISPATCHER Module
●
Group nodes in logical
sets
●
Probing of nodes
(actionable)
ClueCon 2019 – Chicago, IL
DISPATCHER Module
●
Probing auto-detects failures
●
Failures can be updated on
status code as well (5xx, 4xx,
etc).
●
Fails over to next node in
group
ClueCon 2019 – Chicago, IL
DISPATCHER Module
route[DISPATCH] {
if(!ds_select_dst("1", "4")) { # round robin on group 1
send_reply("404", "No destination");
exit;
}
t_on_failure("RTF_DISPATCH");
route(RELAY);
exit;
}
failure_route[RTF_DISPATCH] {
if (t_is_canceled()) {
exit;
}
# 500 error or timeout
if (t_check_status("500")
or (t_branch_timeout() and !t_branch_replied())) {
if(ds_next_dst()) {
t_on_failure("RTF_DISPATCH");
route(RELAY);
exit;
}
}
}
➔
https://www.kamailio.org/docs/modules/stable/modules/dispatcher.html
ClueCon 2019 – Chicago, IL
PERMISSIONS
ClueCon 2019 – Chicago, IL
PERMISSIONS Module
• IP based ACL for:
• Routing
• Registrations
• URI permissions
• Address permissions
• Trusted requests
ClueCon 2019 – Chicago, IL
PERMISSIONS Module
BEFORE
<configuration name="acl.conf" description="Network Lists">
<network-lists>
<list name="test1" default="deny">
<node type="allow" cidr="1.2.3.0/24"/>
<node type="allow" cidr="2.3.0.0/16"/>
<node type="allow" cidr="3.4.5.6/32"/>
<node type="allow" cidr="4.5.6.0/24"/>
</list>
</network-lists>
</configuration>
AFTER
<configuration name="acl.conf"
description="Network Lists">
<network-lists>
<list name="test1" default="deny">
<node type="allow" cidr="[kamailio]/32"/>
</list>
</network-lists>
</configuration>
ClueCon 2019 – Chicago, IL
PERMISSIONS Module
●
File or DB
●
Can run by function or
logical groupings
●
Port, Protocol, Address
●
Reloadable
ClueCon 2019 – Chicago, IL
PERMISSIONS Module
// Check if source address/port is in group 1
if (!allow_address("1", "$si", "$sp")) {
sl_send_reply("403", "Forbidden");
};
...
if (allow_trusted()) {
t_relay();
}
...
if (allow_trusted("$si", "$proto")) {
t_relay();
}
ClueCon 2019 – Chicago, IL
HTABLE
ClueCon 2019 – Chicago, IL
“If you’re not using HTABLE,
you’re doing something wrong.”
—@miconda
ClueCon 2019 – Chicago, IL
HTABLE Module
●
Hash Table Containers
●
Stored in memory
●
Automatic Replication
(DMQ)
ClueCon 2019 – Chicago, IL
HTABLE Module
You can use HTABLE to block bad traffic...
Config:
# ----- htable params -----
/* ip ban htable with
autoexpire after 5 minutes */
modparam("htable", "htable",
"ipban=>size=8;autoexpire=300;
")
if(src_ip!=myself) {
if($sht(ipban=>$si)!=$null) {
# ip is already blocked
xdbg("request from blocked IP n");
exit;
}
if (!pike_check_req()) {
xlog("L_ALERT","ALERT: pike blocking $rm from
$fu (IP:$si:$sp)n");
$sht(ipban=>$si) = 1;
exit;
}
}
ClueCon 2019 – Chicago, IL
HTABLE Module
You can use HTABLE to
cache authentication…
modparam("htable", "htable",
"auth=>size=10;autoexpire=300;")
modparam("auth_db", "load_credentials",
"$avp(password)=password")
route[AUTHCACHE]{
if($sht(auth=>$au::passwd)!=$null) {
if (!pv_auth_check("$fd",
"$sht(auth=>$au::passwd)", "0", "1")) {
auth_challenge("$fd", “1”);
exit;
}
} else {
# authenticate requests
if (!auth_check("$fd", "subscriber", "1")) {
auth_challenge("$fd", "0");
exit;
}
$sht(auth=>$au::passwd) = $avp(password);
}
# user authenticated - remove auth header
if(!is_method("REGISTER|PUBLISH"))
consume_credentials();
}
ClueCon 2019 – Chicago, IL
HTABLE Module
You can use HTABLE to cache
anything…
if (is_method("INVITE")) {
setflag(FLT_ACC); # do accounting
$sht(cps=>$ci) = "caps";
if ($sht(stats=>caps) < ($shtcv(cps=>==caps) / 10)) {
$sht(stats=>caps) = $shtcv(cps=>==caps) / 10;
}
}
if (is_method("REGISTER") || is_method("INVITE")) {
$sht(regs=>$si) = $sht(regs=>$si) + 1;
if($sht(regs=>$si)>15) {
xlog("L_INFO","more than 15 auths from $si n");
if(src_ip!=myself) {
xlog("L_INFO","blocking $rm from $fu (IP:$si:$sp)n");
exec_msg("/usr/local/etc/kamailio/matrix-
post.sh "LODVOIP: (more than 15 auths) blocking $rm from $fu
(IP:$si:$sp)"");
$sht(ipban=>$si) = 1;
}
send_reply(401, "Unauthorized AU");
exit;
}
}
ClueCon 2019 – Chicago, IL
3 Quick Ways to Help FreeSWITCH
1. DISPATCHER
2. PERMISSIONS
3. HTABLE
1. Stability
2. Security
3. Scalability
But, there’s so much more you can do…
ClueCon 2019 – Chicago, IL
Thank you!
●
See you in Berlin for...
Kamailio World!!!
●
Questions?
●
Contact
●
qxork.com / @fredposner
●
Cookies & More
●
BearBakeShop.com

More Related Content

What's hot

Scaling FreeSWITCH Performance
Scaling FreeSWITCH PerformanceScaling FreeSWITCH Performance
Scaling FreeSWITCH Performance
Moises Silva
 
Kamailio - API Based SIP Routing
Kamailio - API Based SIP RoutingKamailio - API Based SIP Routing
Kamailio - API Based SIP Routing
Daniel-Constantin Mierla
 
Kamailio - SIP Routing in Lua
Kamailio - SIP Routing in LuaKamailio - SIP Routing in Lua
Kamailio - SIP Routing in Lua
Daniel-Constantin Mierla
 
Homer - Workshop at Kamailio World 2017
Homer - Workshop at Kamailio World 2017Homer - Workshop at Kamailio World 2017
Homer - Workshop at Kamailio World 2017
Giacomo Vacca
 
Kamailio - Load Balancing Load Balancers
Kamailio - Load Balancing Load BalancersKamailio - Load Balancing Load Balancers
Kamailio - Load Balancing Load Balancers
Daniel-Constantin Mierla
 
Using Kamailio for Scalability and Security
Using Kamailio for Scalability and SecurityUsing Kamailio for Scalability and Security
Using Kamailio for Scalability and Security
Fred Posner
 
SIP Attack Handling (Kamailio World 2021)
SIP Attack Handling (Kamailio World 2021)SIP Attack Handling (Kamailio World 2021)
SIP Attack Handling (Kamailio World 2021)
Fred Posner
 
Getting started with SIP Express Media Server SIP app server and SBC - workshop
Getting started with SIP Express Media Server SIP app server and SBC - workshopGetting started with SIP Express Media Server SIP app server and SBC - workshop
Getting started with SIP Express Media Server SIP app server and SBC - workshop
stefansayer
 
FreeSWITCH as a Kickass SBC
FreeSWITCH as a Kickass SBCFreeSWITCH as a Kickass SBC
FreeSWITCH as a Kickass SBC
Moises Silva
 
Kamailio - Secure Communication
Kamailio - Secure CommunicationKamailio - Secure Communication
Kamailio - Secure Communication
Daniel-Constantin Mierla
 
Why is Kamailio so different? An introduction.
Why is Kamailio so different? An introduction.Why is Kamailio so different? An introduction.
Why is Kamailio so different? An introduction.
Olle E Johansson
 
Astricon 10 (October 2013) - SIP over WebSocket on Kamailio
Astricon 10 (October 2013) - SIP over WebSocket on KamailioAstricon 10 (October 2013) - SIP over WebSocket on Kamailio
Astricon 10 (October 2013) - SIP over WebSocket on Kamailio
Crocodile WebRTC SDK and Cloud Signalling Network
 
Sipwise rtpengine
Sipwise rtpengineSipwise rtpengine
Sipwise rtpengine
Andreas Granig
 
FreeSWITCH on Docker
FreeSWITCH on DockerFreeSWITCH on Docker
FreeSWITCH on Docker
建澄 吳
 
Introduction to Kamailio (TADSummit 2020 Asia)
Introduction to Kamailio (TADSummit 2020 Asia)Introduction to Kamailio (TADSummit 2020 Asia)
Introduction to Kamailio (TADSummit 2020 Asia)
Fred Posner
 
rtpengine - Media Relaying and Beyond
rtpengine - Media Relaying and Beyondrtpengine - Media Relaying and Beyond
rtpengine - Media Relaying and Beyond
Andreas Granig
 
SIP Testing with FreeSWITCH
SIP Testing with FreeSWITCHSIP Testing with FreeSWITCH
SIP Testing with FreeSWITCH
Moises Silva
 
Introduction to FreeSWITCH
Introduction to FreeSWITCHIntroduction to FreeSWITCH
Introduction to FreeSWITCH
Chien Cheng Wu
 
FreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceFreeSWITCH as a Microservice
FreeSWITCH as a Microservice
Evan McGee
 
SIP Tutorial/Workshop 1
SIP Tutorial/Workshop 1SIP Tutorial/Workshop 1
SIP Tutorial/Workshop 1
Mihály Mészáros
 

What's hot (20)

Scaling FreeSWITCH Performance
Scaling FreeSWITCH PerformanceScaling FreeSWITCH Performance
Scaling FreeSWITCH Performance
 
Kamailio - API Based SIP Routing
Kamailio - API Based SIP RoutingKamailio - API Based SIP Routing
Kamailio - API Based SIP Routing
 
Kamailio - SIP Routing in Lua
Kamailio - SIP Routing in LuaKamailio - SIP Routing in Lua
Kamailio - SIP Routing in Lua
 
Homer - Workshop at Kamailio World 2017
Homer - Workshop at Kamailio World 2017Homer - Workshop at Kamailio World 2017
Homer - Workshop at Kamailio World 2017
 
Kamailio - Load Balancing Load Balancers
Kamailio - Load Balancing Load BalancersKamailio - Load Balancing Load Balancers
Kamailio - Load Balancing Load Balancers
 
Using Kamailio for Scalability and Security
Using Kamailio for Scalability and SecurityUsing Kamailio for Scalability and Security
Using Kamailio for Scalability and Security
 
SIP Attack Handling (Kamailio World 2021)
SIP Attack Handling (Kamailio World 2021)SIP Attack Handling (Kamailio World 2021)
SIP Attack Handling (Kamailio World 2021)
 
Getting started with SIP Express Media Server SIP app server and SBC - workshop
Getting started with SIP Express Media Server SIP app server and SBC - workshopGetting started with SIP Express Media Server SIP app server and SBC - workshop
Getting started with SIP Express Media Server SIP app server and SBC - workshop
 
FreeSWITCH as a Kickass SBC
FreeSWITCH as a Kickass SBCFreeSWITCH as a Kickass SBC
FreeSWITCH as a Kickass SBC
 
Kamailio - Secure Communication
Kamailio - Secure CommunicationKamailio - Secure Communication
Kamailio - Secure Communication
 
Why is Kamailio so different? An introduction.
Why is Kamailio so different? An introduction.Why is Kamailio so different? An introduction.
Why is Kamailio so different? An introduction.
 
Astricon 10 (October 2013) - SIP over WebSocket on Kamailio
Astricon 10 (October 2013) - SIP over WebSocket on KamailioAstricon 10 (October 2013) - SIP over WebSocket on Kamailio
Astricon 10 (October 2013) - SIP over WebSocket on Kamailio
 
Sipwise rtpengine
Sipwise rtpengineSipwise rtpengine
Sipwise rtpengine
 
FreeSWITCH on Docker
FreeSWITCH on DockerFreeSWITCH on Docker
FreeSWITCH on Docker
 
Introduction to Kamailio (TADSummit 2020 Asia)
Introduction to Kamailio (TADSummit 2020 Asia)Introduction to Kamailio (TADSummit 2020 Asia)
Introduction to Kamailio (TADSummit 2020 Asia)
 
rtpengine - Media Relaying and Beyond
rtpengine - Media Relaying and Beyondrtpengine - Media Relaying and Beyond
rtpengine - Media Relaying and Beyond
 
SIP Testing with FreeSWITCH
SIP Testing with FreeSWITCHSIP Testing with FreeSWITCH
SIP Testing with FreeSWITCH
 
Introduction to FreeSWITCH
Introduction to FreeSWITCHIntroduction to FreeSWITCH
Introduction to FreeSWITCH
 
FreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceFreeSWITCH as a Microservice
FreeSWITCH as a Microservice
 
SIP Tutorial/Workshop 1
SIP Tutorial/Workshop 1SIP Tutorial/Workshop 1
SIP Tutorial/Workshop 1
 

Similar to Three Ways Kamailio Can Help Your FreeSWITCH Deployment

Three Ways Kamailio Can Help Your Asterisk Deployment
Three Ways Kamailio Can Help Your Asterisk DeploymentThree Ways Kamailio Can Help Your Asterisk Deployment
Three Ways Kamailio Can Help Your Asterisk Deployment
Fred Posner
 
Attacking and defending GraphQL applications: a hands-on approach
 Attacking and defending GraphQL applications: a hands-on approach Attacking and defending GraphQL applications: a hands-on approach
Attacking and defending GraphQL applications: a hands-on approach
Davide Cioccia
 
Testing RESTful Web Services
Testing RESTful Web ServicesTesting RESTful Web Services
Testing RESTful Web Services
TechWell
 
Open Source - NOVALUG January 2019
Open Source  - NOVALUG January 2019Open Source  - NOVALUG January 2019
Open Source - NOVALUG January 2019
plarsen67
 
Interconnection Automation For All - GPF 2023
Interconnection Automation For All - GPF 2023Interconnection Automation For All - GPF 2023
Interconnection Automation For All - GPF 2023
Chris Grundemann
 
2011-03-29 London - drools
2011-03-29 London - drools2011-03-29 London - drools
2011-03-29 London - droolsGeoffrey De Smet
 
AskTOM Office Hours on Database Triggers
AskTOM Office Hours on Database TriggersAskTOM Office Hours on Database Triggers
AskTOM Office Hours on Database Triggers
Steven Feuerstein
 
Observability
ObservabilityObservability
Observability
Ebru Cucen Çüçen
 
Observability
ObservabilityObservability
Observability
Ebru Cucen Çüçen
 
You got database in my cloud!
You got database  in my cloud!You got database  in my cloud!
You got database in my cloud!
Liz Frost
 
Migrating PostgreSQL to the Cloud
Migrating PostgreSQL to the CloudMigrating PostgreSQL to the Cloud
Migrating PostgreSQL to the Cloud
Mike Fowler
 
Wi-Fi Hotspot Attacks
Wi-Fi Hotspot AttacksWi-Fi Hotspot Attacks
Wi-Fi Hotspot Attacks
Greg Foss
 
Testing RESTful Web Services
Testing RESTful Web ServicesTesting RESTful Web Services
Testing RESTful Web Services
TechWell
 
Data to Go: Mobile API Design (SXSW)
Data to Go: Mobile API Design (SXSW)Data to Go: Mobile API Design (SXSW)
Data to Go: Mobile API Design (SXSW)
Chuck Greb
 
A tale of two proxies
A tale of two proxiesA tale of two proxies
A tale of two proxies
SensePost
 
Logging & Docker - Season 2
Logging & Docker - Season 2Logging & Docker - Season 2
Logging & Docker - Season 2
Christian Beedgen
 
«Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned ...
«Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned ...«Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned ...
«Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned ...
it-people
 
Hitchikers guide handout
Hitchikers guide handoutHitchikers guide handout
Hitchikers guide handout
Federico Campoli
 
About Flink streaming
About Flink streamingAbout Flink streaming
About Flink streaming
용휘 김
 
Serverless, The Middy Way - Workshop
Serverless, The Middy Way - WorkshopServerless, The Middy Way - Workshop
Serverless, The Middy Way - Workshop
Luciano Mammino
 

Similar to Three Ways Kamailio Can Help Your FreeSWITCH Deployment (20)

Three Ways Kamailio Can Help Your Asterisk Deployment
Three Ways Kamailio Can Help Your Asterisk DeploymentThree Ways Kamailio Can Help Your Asterisk Deployment
Three Ways Kamailio Can Help Your Asterisk Deployment
 
Attacking and defending GraphQL applications: a hands-on approach
 Attacking and defending GraphQL applications: a hands-on approach Attacking and defending GraphQL applications: a hands-on approach
Attacking and defending GraphQL applications: a hands-on approach
 
Testing RESTful Web Services
Testing RESTful Web ServicesTesting RESTful Web Services
Testing RESTful Web Services
 
Open Source - NOVALUG January 2019
Open Source  - NOVALUG January 2019Open Source  - NOVALUG January 2019
Open Source - NOVALUG January 2019
 
Interconnection Automation For All - GPF 2023
Interconnection Automation For All - GPF 2023Interconnection Automation For All - GPF 2023
Interconnection Automation For All - GPF 2023
 
2011-03-29 London - drools
2011-03-29 London - drools2011-03-29 London - drools
2011-03-29 London - drools
 
AskTOM Office Hours on Database Triggers
AskTOM Office Hours on Database TriggersAskTOM Office Hours on Database Triggers
AskTOM Office Hours on Database Triggers
 
Observability
ObservabilityObservability
Observability
 
Observability
ObservabilityObservability
Observability
 
You got database in my cloud!
You got database  in my cloud!You got database  in my cloud!
You got database in my cloud!
 
Migrating PostgreSQL to the Cloud
Migrating PostgreSQL to the CloudMigrating PostgreSQL to the Cloud
Migrating PostgreSQL to the Cloud
 
Wi-Fi Hotspot Attacks
Wi-Fi Hotspot AttacksWi-Fi Hotspot Attacks
Wi-Fi Hotspot Attacks
 
Testing RESTful Web Services
Testing RESTful Web ServicesTesting RESTful Web Services
Testing RESTful Web Services
 
Data to Go: Mobile API Design (SXSW)
Data to Go: Mobile API Design (SXSW)Data to Go: Mobile API Design (SXSW)
Data to Go: Mobile API Design (SXSW)
 
A tale of two proxies
A tale of two proxiesA tale of two proxies
A tale of two proxies
 
Logging & Docker - Season 2
Logging & Docker - Season 2Logging & Docker - Season 2
Logging & Docker - Season 2
 
«Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned ...
«Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned ...«Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned ...
«Что такое serverless-архитектура и как с ней жить?» Николай Марков, Aligned ...
 
Hitchikers guide handout
Hitchikers guide handoutHitchikers guide handout
Hitchikers guide handout
 
About Flink streaming
About Flink streamingAbout Flink streaming
About Flink streaming
 
Serverless, The Middy Way - Workshop
Serverless, The Middy Way - WorkshopServerless, The Middy Way - Workshop
Serverless, The Middy Way - Workshop
 

More from Fred Posner

Security Asterisk or FreePBX with APIBAN
Security Asterisk or FreePBX with APIBANSecurity Asterisk or FreePBX with APIBAN
Security Asterisk or FreePBX with APIBAN
Fred Posner
 
Kamalio and Asterisk: What, Why & How
Kamalio and Asterisk: What, Why & HowKamalio and Asterisk: What, Why & How
Kamalio and Asterisk: What, Why & How
Fred Posner
 
Protect Kamailio Against DoS Attacks With APIBan
Protect Kamailio Against DoS Attacks With APIBanProtect Kamailio Against DoS Attacks With APIBan
Protect Kamailio Against DoS Attacks With APIBan
Fred Posner
 
Kamailio, FreeSWITCH, and the Half-Blood Prince
Kamailio, FreeSWITCH, and the Half-Blood PrinceKamailio, FreeSWITCH, and the Half-Blood Prince
Kamailio, FreeSWITCH, and the Half-Blood Prince
Fred Posner
 
CommCon 2020: Kamailio for RTC Stability, Scaling, and Security
CommCon 2020: Kamailio for RTC Stability, Scaling, and SecurityCommCon 2020: Kamailio for RTC Stability, Scaling, and Security
CommCon 2020: Kamailio for RTC Stability, Scaling, and Security
Fred Posner
 
Advanced SIP: Communicating with Humans (Kamailio World 2019)
Advanced SIP: Communicating with Humans (Kamailio World 2019)Advanced SIP: Communicating with Humans (Kamailio World 2019)
Advanced SIP: Communicating with Humans (Kamailio World 2019)
Fred Posner
 

More from Fred Posner (6)

Security Asterisk or FreePBX with APIBAN
Security Asterisk or FreePBX with APIBANSecurity Asterisk or FreePBX with APIBAN
Security Asterisk or FreePBX with APIBAN
 
Kamalio and Asterisk: What, Why & How
Kamalio and Asterisk: What, Why & HowKamalio and Asterisk: What, Why & How
Kamalio and Asterisk: What, Why & How
 
Protect Kamailio Against DoS Attacks With APIBan
Protect Kamailio Against DoS Attacks With APIBanProtect Kamailio Against DoS Attacks With APIBan
Protect Kamailio Against DoS Attacks With APIBan
 
Kamailio, FreeSWITCH, and the Half-Blood Prince
Kamailio, FreeSWITCH, and the Half-Blood PrinceKamailio, FreeSWITCH, and the Half-Blood Prince
Kamailio, FreeSWITCH, and the Half-Blood Prince
 
CommCon 2020: Kamailio for RTC Stability, Scaling, and Security
CommCon 2020: Kamailio for RTC Stability, Scaling, and SecurityCommCon 2020: Kamailio for RTC Stability, Scaling, and Security
CommCon 2020: Kamailio for RTC Stability, Scaling, and Security
 
Advanced SIP: Communicating with Humans (Kamailio World 2019)
Advanced SIP: Communicating with Humans (Kamailio World 2019)Advanced SIP: Communicating with Humans (Kamailio World 2019)
Advanced SIP: Communicating with Humans (Kamailio World 2019)
 

Recently uploaded

English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 

Recently uploaded (20)

English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 

Three Ways Kamailio Can Help Your FreeSWITCH Deployment

  • 1. ClueCon 2019 – Chicago, IL Three Ways Kamailio can Help Your FreeSWITCH Deployment
  • 2. ClueCon 2019 – Chicago, IL Who am I? Kama what? 1. Fred Posner 2. @fredposner 3. https://qxork.com → → kamailio.org ← ←
  • 3. ClueCon 2019 – Chicago, IL Recently launched v2.0
  • 4. ClueCon 2019 – Chicago, IL Agenda 1. Brief description of Kamailio 2. Use DISPATCHER for carrier and internal routing 3. Use PERMISSIONS instead of ACL 4. Use HTABLE for all the things
  • 5. ClueCon 2019 – Chicago, IL What is Kamailio?
  • 6. ClueCon 2019 – Chicago, IL Fred’s Phases of Learning SIP 1. WTF is this matrix shit? 2. Oh, it’s like HTTP 3. (After FreeSWITCH) Oh, I get it 4. SIP is pretty straight forward 5. (After Kamailio) oh dear god I was wrong 6. What level of hell is this? 7. Ok... I’m getting it again 8. One truly never knows everything about SIP
  • 7. ClueCon 2019 – Chicago, IL What is Kamailio? ● Very, very fast ● Hundreds of Thousands of registrations ● 1000’s of cps
  • 8. ClueCon 2019 – Chicago, IL DISPATCHER
  • 9. ClueCon 2019 – Chicago, IL DISPATCHER Module ● SIP Load Balancer ● SIP Traffic Dispatcher ● Many algorithms ● Stateless
  • 10. ClueCon 2019 – Chicago, IL DISPATCHER Module ● Group nodes in logical sets ● Probing of nodes (actionable)
  • 11. ClueCon 2019 – Chicago, IL DISPATCHER Module ● Probing auto-detects failures ● Failures can be updated on status code as well (5xx, 4xx, etc). ● Fails over to next node in group
  • 12. ClueCon 2019 – Chicago, IL DISPATCHER Module route[DISPATCH] { if(!ds_select_dst("1", "4")) { # round robin on group 1 send_reply("404", "No destination"); exit; } t_on_failure("RTF_DISPATCH"); route(RELAY); exit; } failure_route[RTF_DISPATCH] { if (t_is_canceled()) { exit; } # 500 error or timeout if (t_check_status("500") or (t_branch_timeout() and !t_branch_replied())) { if(ds_next_dst()) { t_on_failure("RTF_DISPATCH"); route(RELAY); exit; } } } ➔ https://www.kamailio.org/docs/modules/stable/modules/dispatcher.html
  • 13. ClueCon 2019 – Chicago, IL PERMISSIONS
  • 14. ClueCon 2019 – Chicago, IL PERMISSIONS Module • IP based ACL for: • Routing • Registrations • URI permissions • Address permissions • Trusted requests
  • 15. ClueCon 2019 – Chicago, IL PERMISSIONS Module BEFORE <configuration name="acl.conf" description="Network Lists"> <network-lists> <list name="test1" default="deny"> <node type="allow" cidr="1.2.3.0/24"/> <node type="allow" cidr="2.3.0.0/16"/> <node type="allow" cidr="3.4.5.6/32"/> <node type="allow" cidr="4.5.6.0/24"/> </list> </network-lists> </configuration> AFTER <configuration name="acl.conf" description="Network Lists"> <network-lists> <list name="test1" default="deny"> <node type="allow" cidr="[kamailio]/32"/> </list> </network-lists> </configuration>
  • 16. ClueCon 2019 – Chicago, IL PERMISSIONS Module ● File or DB ● Can run by function or logical groupings ● Port, Protocol, Address ● Reloadable
  • 17. ClueCon 2019 – Chicago, IL PERMISSIONS Module // Check if source address/port is in group 1 if (!allow_address("1", "$si", "$sp")) { sl_send_reply("403", "Forbidden"); }; ... if (allow_trusted()) { t_relay(); } ... if (allow_trusted("$si", "$proto")) { t_relay(); }
  • 18. ClueCon 2019 – Chicago, IL HTABLE
  • 19. ClueCon 2019 – Chicago, IL “If you’re not using HTABLE, you’re doing something wrong.” —@miconda
  • 20. ClueCon 2019 – Chicago, IL HTABLE Module ● Hash Table Containers ● Stored in memory ● Automatic Replication (DMQ)
  • 21. ClueCon 2019 – Chicago, IL HTABLE Module You can use HTABLE to block bad traffic... Config: # ----- htable params ----- /* ip ban htable with autoexpire after 5 minutes */ modparam("htable", "htable", "ipban=>size=8;autoexpire=300; ") if(src_ip!=myself) { if($sht(ipban=>$si)!=$null) { # ip is already blocked xdbg("request from blocked IP n"); exit; } if (!pike_check_req()) { xlog("L_ALERT","ALERT: pike blocking $rm from $fu (IP:$si:$sp)n"); $sht(ipban=>$si) = 1; exit; } }
  • 22. ClueCon 2019 – Chicago, IL HTABLE Module You can use HTABLE to cache authentication… modparam("htable", "htable", "auth=>size=10;autoexpire=300;") modparam("auth_db", "load_credentials", "$avp(password)=password") route[AUTHCACHE]{ if($sht(auth=>$au::passwd)!=$null) { if (!pv_auth_check("$fd", "$sht(auth=>$au::passwd)", "0", "1")) { auth_challenge("$fd", “1”); exit; } } else { # authenticate requests if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } $sht(auth=>$au::passwd) = $avp(password); } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); }
  • 23. ClueCon 2019 – Chicago, IL HTABLE Module You can use HTABLE to cache anything… if (is_method("INVITE")) { setflag(FLT_ACC); # do accounting $sht(cps=>$ci) = "caps"; if ($sht(stats=>caps) < ($shtcv(cps=>==caps) / 10)) { $sht(stats=>caps) = $shtcv(cps=>==caps) / 10; } } if (is_method("REGISTER") || is_method("INVITE")) { $sht(regs=>$si) = $sht(regs=>$si) + 1; if($sht(regs=>$si)>15) { xlog("L_INFO","more than 15 auths from $si n"); if(src_ip!=myself) { xlog("L_INFO","blocking $rm from $fu (IP:$si:$sp)n"); exec_msg("/usr/local/etc/kamailio/matrix- post.sh "LODVOIP: (more than 15 auths) blocking $rm from $fu (IP:$si:$sp)""); $sht(ipban=>$si) = 1; } send_reply(401, "Unauthorized AU"); exit; } }
  • 24. ClueCon 2019 – Chicago, IL 3 Quick Ways to Help FreeSWITCH 1. DISPATCHER 2. PERMISSIONS 3. HTABLE 1. Stability 2. Security 3. Scalability But, there’s so much more you can do…
  • 25. ClueCon 2019 – Chicago, IL Thank you! ● See you in Berlin for... Kamailio World!!! ● Questions? ● Contact ● qxork.com / @fredposner ● Cookies & More ● BearBakeShop.com