SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
Surfing BigWaves of SIP with Style
Daniel-Constantin Mierla @miconda - www.asipto.com - Co-Founder Kamailio
October 2015
a very large set of features
kamailio
continuos development since 2001
2002 Jun 2005 Jul 2008 Aug 2008 Nov 2008
SIP Express Router (SER)
OpenSER Kamailio
Other Forks...
Same application: Kamailio - SER
Oct 2009 Jan 2010
v3.0.0
Integration
Completed
v1.5.0
Sep 2011Sep 2001
First
Line
Of
Code
Open
Source
GPL
FhG
Fokus
Institute
Berlin
rename
Awarded
Best Open
Source
Networking
Software
2009
By InfoWorld
10
Years
Jun 2012
v3.3.0
ITSPA
UK
Award
Mar 2013
v4.0.0
Kamailio
v4.1.0
Dec 2013
………. v4.2.0
Oct 2014
now over 100 on github
June 2015
v4.3.0
not designed as a typical telephony engine
open source sip server
framework - toolkit
SIP signalling routing
• fast
• reliable
• flexible
In other words
• not initiating calls
• not answering calls
• no audio-video processing
Key Features
✤ Modular SIP Poxy, Registrar and Redirect server
✤ Designed for scalability and flexibility
✤ IPv4, IPv6, UDP, TCP, TLS, SCTP, WebSocket
✤ NAT Traversal, internal and external caching engines
✤ JSON, XMLRPC, HTTP APIs
✤ IMS Extensions, SIP-I/SIP-T, IM & Presence
✤ SQL and NoSQL backends
✤ Asynchronous processing (TCP/TLS, SIP routing), external event API
✤ Embedded interpreters (Lua, Perl, Python, .Net, Java)
✤ Load balancing, LCR, DID routing, Number portability
Dealing with high
SIP traffic volume
Detect and require a retry after a while
Increase performances of a Kamailio
instance
Scale the RTC platform
detect and require a retry after a while
Registration
sip registrar tunings
REGISTER
(contact address)
REGISTER
(contact address)
(credentials)
401
(authentication req)
200 OK
(contact addresses)
SIP Registrar
Require user's
authentication
Authenticate user
Save contact address
Confirm registration
✤ registration storms
✤ reply to retry after
✤ randomize expires value
…
modparam("registrar", "expires_range", 30) # expires within [0.7*expires .. expires]
modparam("registrar", "retry_after", 30)
…
$var(retry) = 10 + ($RANDOM mod 300);
append_to_reply(“Retry-After: rn”);
send_reply(“500”, “Try later”);
…
Authentication
sip authentication tunings
INVITE B@Y
Alice Server Y
407 Proxy Authentication Required
Proxy-Authenticate:....
....realm=X,nonce=aaa
Proxy X
INVITE B@Y
Proxy-Authorization:....
....user=A,realm=X,uri=B@Y,
....nonce=aaa,response=bbb
INVITE B@Y
Proxy-Authorization:....
....user=alice,realm=X,uri=b@Y,
....nonce=aaa,response=bbb
401 Unauthorized
WWW-Authenticate:....
....realm=Y,nonce=ccc
401 Unauthorized
WWW-Authenticate:....
....realm=Y,nonce=ccc
INVITE B@Y
Proxy-Authorization:....
....user=A,realm=X,uri=B@Y,
....nonce=aaa,response=bbb
Authorization: ....
....user=A,realm=Y,uri=B@Y
....nonce=ccc,response=ddd
INVITE B@Y
Proxy-Authorization:....
....user=A,realm=X,uri=B@Y,
....nonce=aaa,response=bbb
Authorization: ....
....user=A,realm=Y,uri=B@Y
....nonce=ccc,response=ddd
✤ caching user profile
✤ password and other attributes
✤ check first the cache, if not found, then fetch from database and store in memory
…
loadmodule "auth.so"
loadmodule “auth_db.so"
loadmodule "htable.so"
…
modparam("auth_db", "db_url", DBURL)
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "load_credentials", “$avp(password)=password”)
modparam("auth_db", "use_domain", MULTIDOMAIN)
…
modparam("htable", "htable", "users=>size=10;autoexpire=300;")
…
…
route[AUTH] {
….
if (is_method("REGISTER") || from_uri==myself)
{
# authenticate requests
if($sht(users=>$fU)!=$null) {
if (!pv_auth_check(“$fd”, “$sht(users=>$fU)”, “0”, ”1”)) {
auth_challenge("$fd", "0");
exit;
}
} else {
if (!auth_check("$fd", "subscriber", "1")) {
auth_challenge("$fd", "0");
exit;
}
$sht(users=>$fU) = $avp(password);
}
# user authenticated - remove auth header
if(!is_method("REGISTER|PUBLISH"))
consume_credentials();
}
…
✤ client certificate or key based authentication
✤ avoid the auth challenge extra round trip
✤ tls with client certificate
✤ auth_xkey module
…
modparam("auth_xkeys", "xkey", "id=abc;name=xyz;value=secret;expires=72000")
…
…
auth_xkeys_add("X-My-Key", "abc", "sha256", "$Ri:$fu:$ru:$hdr(CSeq)");
…
if(!auth_xkeys_add("X-My-Key", "abc", "sha256", "$si:$fu:$ru:$hdr(CSeq)")) {
send_reply("403", "Forbidden");
exit;
}
remove_hf("X-My-Key");
…
Forwarding
sip proxy tunings
alice
bob
proxy
server
INVITE
sip:b@sipserver.net
INVITE
sip:b@newaddress.ip
100 Trying
100 Trying
200 OK
200 OK
180 Ringing
✤ pipelimit
✤ reply with retry after
✤ send redirect to another node
…
$var(retry) = 10 + ($RANDOM mod 300);
append_to_reply(“Retry-After: rn”);
send_reply(“503”, “Try later”);
…
…
$var(limit) = 20;
if (!pl_check("$au", "TAILDROP", "$var(limit)")) {
pl_drop(“10”, “60”);
exit;
}
…
…
if (!pl_check("$au", "TAILDROP", "$var(limit)")) {
$ru = “sip:” + $rU + “@newserver.net”;
send_reply(“302”, “Moved temporarily”);
exit;
}
…
increase performances of a sip server instance
✤ timer processes
✤ lazy operations for many modules
✤ keep alives, cleaning expired data
✤ increase (or reduce) the timer interval
…
modparam("usrloc", "timer_procs", 4)
…
modparam("nathelper", "natping_processes", 6)
…
modparam("dialog", "timer_procs", 4)
modparam("dialog", "ka_timer", 10)
modparam("dialog", "ka_interval", 300)
…
✤ internal hash sizes
✤ indexing of data in memory
✤ location records (usrloc), dialogs, generic hash tables
…
modparam("usrloc", "hash_size", 12)
…
modparam("htable", "htable", “a=>size=4;autoexpire=7200;")
modparam("htable", "htable", "b=>size=8;")
…
modparam("dispatcher", "ds_hash_size", 9)
…
https://en.wikipedia.org/wiki/Hash_table
Hash Table Head
name:test
size: 2
key: alice
slots
“xyz”
0
1
2
3
key: bob
123
key: john
“1ab”
✤ asynchronous processing
✤ delegate the execution to other workers than sip routing processes
✤ async module
✤ tmx (suspend) - mqueue (transmit) - rtimer (process)
✤ async database queries (mysql)
✤ async http/jsonrpc interactions
…
async_workers=4
…
modparam("sqlops","sqlcon","ca=>dbdriver://username:password@dbhost/dbname")
sql_query_async("ca", "delete from domain");
…
modparam("acc", "db_insert_mode", 2)
…
http://www.kamailio.org/events/2014-KamailioWorld/day2/26-Daniel-Constantin.Mierla-Kamailio.cfg-Async.pdf
✤ bonus
✤ children
✤ number of worker processes
✤ tcp - tls
✤ max connections
✤ file description limits
✤ internal dns caching
✤ blacklisting
✤ don’t forget
✤ database indexes
✤ syslog asynchronous mode
✤ dns infrastructure availability
✤ api services responsiveness
scale the rtc platform
dispatcher module
• list of balancing nodes from file or database
• monitoring of nodes (activate/inactivate
automatically)
• re-route in case of failure
• various algorithms: hashing, weight distribution, round
robin, call load distribution, priority routing
• reload list of nodes without restart
# Dispatch requests
route[DISPATCH] {
# round robin dispatching on gateways group '1'
if(!ds_select_dst("1",“4")) {
send_reply("404", "No destination");
exit;
}
xdbg("--- SCRIPT: going to <$ru> via <$du>n");
t_on_failure("RTF_DISPATCH");
route(RELAY);
exit;
}
# Re-route in case of failure
failure_route[RTF_DISPATCH] {
if (t_is_canceled()) {
exit;
}
# next node - only for 500 or local timeout
if (t_check_status(“500") || (t_branch_timeout() && !t_branch_replied())) {
if(ds_next_dst()) {
t_on_failure("RTF_DISPATCH");
route(RELAY);
exit;
}
}
}
Load balancing
Parallel Forking
request_route {
...
append_branch(“sip:103@kamailio.org”);
append_branch(“sip:104@kamailio.org”);
$var(newdst) = “sip:105@kamailio.org”;
append_branch(“$var(newdst)”);
t_relay();
}
Serial Forking
request_route {
...
$ru = “sip:102@kamailio.org”;
$xavp(newdst) = “sip:103@kamailio.org”;
$xavp(newdst) = “sip:104@kamailio.org”;
t_on_failure(“RETRY”);
t_relay();
}
failure_route[RETRY] {
if (t_is_canceled()) {
exit;
}
if($xavp(newdst) != $null) {
$ru = $xavp(newdst);
$xavp(newdst) = $null;
t_on_failure(“RETRY”);
t_relay();
exit;
}
}
Externalize services
the sip routing basics
✤ lack of resources (e.g., development)
✤ centralized management
✤ large volume of data
✤ number portability database
✤ billing, dids routing, etc
❖ fetching the next routing hops
❖ raw data
❖ http/rpc results + parsing
❖ structured data
❖ rtjson
❖ processing
❖ synchronous
❖ config wait & act
❖ asynchronous
❖ evapi, mqueue & rtimer
Building Blocks
❖ kamailio config - combine:
❖ evapi
❖ jansson
❖ rtjson
❖ external application
❖ node.js
❖ json data response
❖ predfined structure
http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs
Platform Scalability
USERS
CALLS
USERS
CALLS
USERS
CALLS
forking
✤ not found on local location table and not coming from the other nodes
✤ set destination to the other nodes (update $ru and append_branch())
✤ parallel forking (or serial forking with low transmission timeout)
USERS
CALLS
USERS
CALLS
USERS
CALLS
replication
central node
- redirect server
- proxy without record routing
# Handle SIP registrations
route[REGISTRAR] {
if (is_method("REGISTER")) {
if(isflagset(FLT_NATS)) {
setbflag(FLB_NATB);
# uncomment next line to do SIP NAT pinging
## setbflag(FLB_NATSIPPING);
}
if (!save("location"))
sl_reply_error();
$uac_req(method)=“KUSRLOC"
$uac_req(ruri)="sip:store@centralnode.kamailio.org";
$uac_req(furi)="sip:server@server1.kamailio.org";
$uac_req(hdrs)="Content-Type: text/kusrlocrn";
pv_printf(“$uac_req(body)”, "$fu@fd");
uac_send_req();
exit;
}
}
route[TOMAIN] {
$du = "sip:CENTRALNODEIP";
route(RELAY);
exit;
}
# USER location service
route[LOCATION] {
#!ifdef WITH_SPEEDDIAL
# search for short dialing - 2-digit extension
if($rU=~"^[0-9][0-9]$")
if(sd_lookup("speed_dial"))
route(SIPOUT);
#!endif
#!ifdef WITH_ALIASDB
# search in DB-based aliases
if(alias_db_lookup("dbaliases"))
route(SIPOUT);
#!endif
$avp(oexten) = $rU;
if (!lookup("location")) {
if(src_ip!=CENTRALNODEIP)
route(TOMAIN);
...
}
modparam(“htable”, “htable”, “kusrloc=>size=10;autoexpire=7200;”)
...
request_route {
# add here ip authorization, etc…
# handle location update notification
if(method=="KUSRLOC" && $rU=="store") {
$sht(kusrloc=>$rb) = “sip:” + $si + “:” + $sp + “;transport=” + $pr;
send_reply("200", "Stored");
exit;
}
# handle standard SIP requests
if($sht(kusrloc=>$rU@$rd)!=$null) {
$du = $sht(kusrloc=>$rU@$rd);
t_relay();
exit;
}
send_reply(“404”, “Not found”);
exit;
}
forking
replication
www.kamailio.org
tutorials
mailing lists
reference documentation
http://www.asipto.com/sw/kamailio-admin-book/
http://www.kamailioworld.com
YouTube KamailioWorld Channel
https://www.youtube.com/channel/UCElq4JNTPd7bs2vbfAAYVJA
Kamailio World 2016 - Planning a Special Edition
Kamailio Project
15 YEARS OF DEVELOPMENT
2001-2016
from SER to Kamailio
www.kamailioworld.com
Thank you!
Questions?
@miconda

Weitere ähnliche Inhalte

Was ist angesagt?

Expanding Asterisk with Kamailio
Expanding Asterisk with KamailioExpanding Asterisk with Kamailio
Expanding Asterisk with KamailioFred Posner
 
Static Typing in Vault
Static Typing in VaultStatic Typing in Vault
Static Typing in VaultGlynnForrest
 
Securing Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultSecuring Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultBram Vogelaar
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principlesPerl Careers
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stackBram Vogelaar
 
Apache::LogFormat::Compiler YAPC::Asia 2013 Tokyo LT-Thon
Apache::LogFormat::Compiler YAPC::Asia 2013 Tokyo LT-ThonApache::LogFormat::Compiler YAPC::Asia 2013 Tokyo LT-Thon
Apache::LogFormat::Compiler YAPC::Asia 2013 Tokyo LT-ThonMasahiro Nagano
 
How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server Masahiro Nagano
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStackBram Vogelaar
 
Lua tech talk
Lua tech talkLua tech talk
Lua tech talkLocaweb
 
Ground Control to Nomad Job Dispatch
Ground Control to Nomad Job DispatchGround Control to Nomad Job Dispatch
Ground Control to Nomad Job DispatchMichael Lange
 
On UnQLite
On UnQLiteOn UnQLite
On UnQLitecharsbar
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stackBram Vogelaar
 
Roll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaRoll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaJon Moore
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmusBram Vogelaar
 
{{more}} Kibana4
{{more}} Kibana4{{more}} Kibana4
{{more}} Kibana4琛琳 饶
 
Observability with Consul Connect
Observability with Consul ConnectObservability with Consul Connect
Observability with Consul ConnectBram Vogelaar
 
Redis And python at pycon_2011
Redis And python at pycon_2011Redis And python at pycon_2011
Redis And python at pycon_2011sunilar0ra
 

Was ist angesagt? (20)

Kamailio and VoIP Wild World
Kamailio and VoIP Wild WorldKamailio and VoIP Wild World
Kamailio and VoIP Wild World
 
Expanding Asterisk with Kamailio
Expanding Asterisk with KamailioExpanding Asterisk with Kamailio
Expanding Asterisk with Kamailio
 
Kamailio - Secure Communication
Kamailio - Secure CommunicationKamailio - Secure Communication
Kamailio - Secure Communication
 
Static Typing in Vault
Static Typing in VaultStatic Typing in Vault
Static Typing in Vault
 
Securing Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp VaultSecuring Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp Vault
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principles
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stack
 
Apache::LogFormat::Compiler YAPC::Asia 2013 Tokyo LT-Thon
Apache::LogFormat::Compiler YAPC::Asia 2013 Tokyo LT-ThonApache::LogFormat::Compiler YAPC::Asia 2013 Tokyo LT-Thon
Apache::LogFormat::Compiler YAPC::Asia 2013 Tokyo LT-Thon
 
How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server How to build a High Performance PSGI/Plack Server
How to build a High Performance PSGI/Plack Server
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStack
 
Lua tech talk
Lua tech talkLua tech talk
Lua tech talk
 
Ground Control to Nomad Job Dispatch
Ground Control to Nomad Job DispatchGround Control to Nomad Job Dispatch
Ground Control to Nomad Job Dispatch
 
Zabbix Console
Zabbix ConsoleZabbix Console
Zabbix Console
 
On UnQLite
On UnQLiteOn UnQLite
On UnQLite
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stack
 
Roll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaRoll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and Lua
 
Testing your infrastructure with litmus
Testing your infrastructure with litmusTesting your infrastructure with litmus
Testing your infrastructure with litmus
 
{{more}} Kibana4
{{more}} Kibana4{{more}} Kibana4
{{more}} Kibana4
 
Observability with Consul Connect
Observability with Consul ConnectObservability with Consul Connect
Observability with Consul Connect
 
Redis And python at pycon_2011
Redis And python at pycon_2011Redis And python at pycon_2011
Redis And python at pycon_2011
 

Ähnlich wie Kamailio - Surfing Big Waves Of SIP With Style

Kamailio and VoIP Wild World
Kamailio and VoIP Wild WorldKamailio and VoIP Wild World
Kamailio and VoIP Wild World2600Hz
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web DevelopmentCheng-Yi Yu
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomyDongmin Yu
 
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기NAVER D2
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for CassandraEdward Capriolo
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"DataStax Academy
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup PerformanceJustin Cataldo
 
Express Presentation
Express PresentationExpress Presentation
Express Presentationaaronheckmann
 
Leveraging Hadoop in your PostgreSQL Environment
Leveraging Hadoop in your PostgreSQL EnvironmentLeveraging Hadoop in your PostgreSQL Environment
Leveraging Hadoop in your PostgreSQL EnvironmentJim Mlodgenski
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with PrometheusShiao-An Yuan
 
HashiConf Digital 2020: HashiCorp Vault configuration as code via HashiCorp T...
HashiConf Digital 2020: HashiCorp Vault configuration as code via HashiCorp T...HashiConf Digital 2020: HashiCorp Vault configuration as code via HashiCorp T...
HashiConf Digital 2020: HashiCorp Vault configuration as code via HashiCorp T...Andrey Devyatkin
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?Ben Hall
 
Web Performance Workshop - Velocity London 2013
Web Performance Workshop - Velocity London 2013Web Performance Workshop - Velocity London 2013
Web Performance Workshop - Velocity London 2013Andy Davies
 
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry PiMonitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry PiInfluxData
 
Building and Scaling Node.js Applications
Building and Scaling Node.js ApplicationsBuilding and Scaling Node.js Applications
Building and Scaling Node.js ApplicationsOhad Kravchick
 
KazooCon 2014 - Playing Kazoo Dudka Style
KazooCon 2014 - Playing Kazoo Dudka StyleKazooCon 2014 - Playing Kazoo Dudka Style
KazooCon 2014 - Playing Kazoo Dudka Style2600Hz
 
Building an ML Platform with Ray and MLflow
Building an ML Platform with Ray and MLflowBuilding an ML Platform with Ray and MLflow
Building an ML Platform with Ray and MLflowDatabricks
 
KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天tblanlan
 

Ähnlich wie Kamailio - Surfing Big Waves Of SIP With Style (20)

Kamailio and VoIP Wild World
Kamailio and VoIP Wild WorldKamailio and VoIP Wild World
Kamailio and VoIP Wild World
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
 
Kamailio - SIP Servers Everywhere
Kamailio - SIP Servers EverywhereKamailio - SIP Servers Everywhere
Kamailio - SIP Servers Everywhere
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomy
 
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
 
Express Presentation
Express PresentationExpress Presentation
Express Presentation
 
Leveraging Hadoop in your PostgreSQL Environment
Leveraging Hadoop in your PostgreSQL EnvironmentLeveraging Hadoop in your PostgreSQL Environment
Leveraging Hadoop in your PostgreSQL Environment
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with Prometheus
 
HashiConf Digital 2020: HashiCorp Vault configuration as code via HashiCorp T...
HashiConf Digital 2020: HashiCorp Vault configuration as code via HashiCorp T...HashiConf Digital 2020: HashiCorp Vault configuration as code via HashiCorp T...
HashiConf Digital 2020: HashiCorp Vault configuration as code via HashiCorp T...
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?
 
Web Performance Workshop - Velocity London 2013
Web Performance Workshop - Velocity London 2013Web Performance Workshop - Velocity London 2013
Web Performance Workshop - Velocity London 2013
 
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry PiMonitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
 
Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
Building and Scaling Node.js Applications
Building and Scaling Node.js ApplicationsBuilding and Scaling Node.js Applications
Building and Scaling Node.js Applications
 
KazooCon 2014 - Playing Kazoo Dudka Style
KazooCon 2014 - Playing Kazoo Dudka StyleKazooCon 2014 - Playing Kazoo Dudka Style
KazooCon 2014 - Playing Kazoo Dudka Style
 
Building an ML Platform with Ray and MLflow
Building an ML Platform with Ray and MLflowBuilding an ML Platform with Ray and MLflow
Building an ML Platform with Ray and MLflow
 
KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天
 

Mehr von Daniel-Constantin Mierla (12)

TAD Summit 2016 - The Mobile World Up Side Down
TAD Summit 2016 - The Mobile World Up Side DownTAD Summit 2016 - The Mobile World Up Side Down
TAD Summit 2016 - The Mobile World Up Side Down
 
Snappy Kamailio
Snappy KamailioSnappy Kamailio
Snappy Kamailio
 
SIP Server Optimizations for Mobile Networks
SIP Server Optimizations for Mobile NetworksSIP Server Optimizations for Mobile Networks
SIP Server Optimizations for Mobile Networks
 
Kamailio - SIP Routing in Lua
Kamailio - SIP Routing in LuaKamailio - SIP Routing in Lua
Kamailio - SIP Routing in Lua
 
10 Years SER - Awards
10 Years SER - Awards10 Years SER - Awards
10 Years SER - Awards
 
Sculpturing SIP World
Sculpturing SIP WorldSculpturing SIP World
Sculpturing SIP World
 
CPDL - Charging Plan Definition Language
CPDL - Charging Plan Definition LanguageCPDL - Charging Plan Definition Language
CPDL - Charging Plan Definition Language
 
SER - SIP Express Router
SER - SIP Express RouterSER - SIP Express Router
SER - SIP Express Router
 
SIP Router Project
SIP Router ProjectSIP Router Project
SIP Router Project
 
Kamailio - Large Unified Communication Platforms
Kamailio - Large Unified Communication PlatformsKamailio - Large Unified Communication Platforms
Kamailio - Large Unified Communication Platforms
 
Kamailio - Unifying SIP and Web Worlds with Lua
Kamailio - Unifying SIP and Web Worlds with LuaKamailio - Unifying SIP and Web Worlds with Lua
Kamailio - Unifying SIP and Web Worlds with Lua
 
Kamailio - The Story for Asterisk
Kamailio - The Story for AsteriskKamailio - The Story for Asterisk
Kamailio - The Story for Asterisk
 

Kürzlich hochgeladen

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Kürzlich hochgeladen (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

Kamailio - Surfing Big Waves Of SIP With Style

  • 1. Surfing BigWaves of SIP with Style Daniel-Constantin Mierla @miconda - www.asipto.com - Co-Founder Kamailio October 2015
  • 2. a very large set of features kamailio continuos development since 2001 2002 Jun 2005 Jul 2008 Aug 2008 Nov 2008 SIP Express Router (SER) OpenSER Kamailio Other Forks... Same application: Kamailio - SER Oct 2009 Jan 2010 v3.0.0 Integration Completed v1.5.0 Sep 2011Sep 2001 First Line Of Code Open Source GPL FhG Fokus Institute Berlin rename Awarded Best Open Source Networking Software 2009 By InfoWorld 10 Years Jun 2012 v3.3.0 ITSPA UK Award Mar 2013 v4.0.0 Kamailio v4.1.0 Dec 2013 ………. v4.2.0 Oct 2014 now over 100 on github June 2015 v4.3.0
  • 3. not designed as a typical telephony engine open source sip server framework - toolkit SIP signalling routing • fast • reliable • flexible In other words • not initiating calls • not answering calls • no audio-video processing
  • 4. Key Features ✤ Modular SIP Poxy, Registrar and Redirect server ✤ Designed for scalability and flexibility ✤ IPv4, IPv6, UDP, TCP, TLS, SCTP, WebSocket ✤ NAT Traversal, internal and external caching engines ✤ JSON, XMLRPC, HTTP APIs ✤ IMS Extensions, SIP-I/SIP-T, IM & Presence ✤ SQL and NoSQL backends ✤ Asynchronous processing (TCP/TLS, SIP routing), external event API ✤ Embedded interpreters (Lua, Perl, Python, .Net, Java) ✤ Load balancing, LCR, DID routing, Number portability
  • 5. Dealing with high SIP traffic volume Detect and require a retry after a while Increase performances of a Kamailio instance Scale the RTC platform
  • 6. detect and require a retry after a while
  • 7. Registration sip registrar tunings REGISTER (contact address) REGISTER (contact address) (credentials) 401 (authentication req) 200 OK (contact addresses) SIP Registrar Require user's authentication Authenticate user Save contact address Confirm registration
  • 8. ✤ registration storms ✤ reply to retry after ✤ randomize expires value … modparam("registrar", "expires_range", 30) # expires within [0.7*expires .. expires] modparam("registrar", "retry_after", 30) … $var(retry) = 10 + ($RANDOM mod 300); append_to_reply(“Retry-After: rn”); send_reply(“500”, “Try later”); …
  • 9. Authentication sip authentication tunings INVITE B@Y Alice Server Y 407 Proxy Authentication Required Proxy-Authenticate:.... ....realm=X,nonce=aaa Proxy X INVITE B@Y Proxy-Authorization:.... ....user=A,realm=X,uri=B@Y, ....nonce=aaa,response=bbb INVITE B@Y Proxy-Authorization:.... ....user=alice,realm=X,uri=b@Y, ....nonce=aaa,response=bbb 401 Unauthorized WWW-Authenticate:.... ....realm=Y,nonce=ccc 401 Unauthorized WWW-Authenticate:.... ....realm=Y,nonce=ccc INVITE B@Y Proxy-Authorization:.... ....user=A,realm=X,uri=B@Y, ....nonce=aaa,response=bbb Authorization: .... ....user=A,realm=Y,uri=B@Y ....nonce=ccc,response=ddd INVITE B@Y Proxy-Authorization:.... ....user=A,realm=X,uri=B@Y, ....nonce=aaa,response=bbb Authorization: .... ....user=A,realm=Y,uri=B@Y ....nonce=ccc,response=ddd
  • 10. ✤ caching user profile ✤ password and other attributes ✤ check first the cache, if not found, then fetch from database and store in memory … loadmodule "auth.so" loadmodule “auth_db.so" loadmodule "htable.so" … modparam("auth_db", "db_url", DBURL) modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password") modparam("auth_db", "load_credentials", “$avp(password)=password”) modparam("auth_db", "use_domain", MULTIDOMAIN) … modparam("htable", "htable", "users=>size=10;autoexpire=300;") …
  • 11. … route[AUTH] { …. if (is_method("REGISTER") || from_uri==myself) { # authenticate requests if($sht(users=>$fU)!=$null) { if (!pv_auth_check(“$fd”, “$sht(users=>$fU)”, “0”, ”1”)) { auth_challenge("$fd", "0"); exit; } } else { if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } $sht(users=>$fU) = $avp(password); } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); } …
  • 12. ✤ client certificate or key based authentication ✤ avoid the auth challenge extra round trip ✤ tls with client certificate ✤ auth_xkey module … modparam("auth_xkeys", "xkey", "id=abc;name=xyz;value=secret;expires=72000") … … auth_xkeys_add("X-My-Key", "abc", "sha256", "$Ri:$fu:$ru:$hdr(CSeq)"); … if(!auth_xkeys_add("X-My-Key", "abc", "sha256", "$si:$fu:$ru:$hdr(CSeq)")) { send_reply("403", "Forbidden"); exit; } remove_hf("X-My-Key"); …
  • 14. ✤ pipelimit ✤ reply with retry after ✤ send redirect to another node … $var(retry) = 10 + ($RANDOM mod 300); append_to_reply(“Retry-After: rn”); send_reply(“503”, “Try later”); … … $var(limit) = 20; if (!pl_check("$au", "TAILDROP", "$var(limit)")) { pl_drop(“10”, “60”); exit; } … … if (!pl_check("$au", "TAILDROP", "$var(limit)")) { $ru = “sip:” + $rU + “@newserver.net”; send_reply(“302”, “Moved temporarily”); exit; } …
  • 15. increase performances of a sip server instance
  • 16. ✤ timer processes ✤ lazy operations for many modules ✤ keep alives, cleaning expired data ✤ increase (or reduce) the timer interval … modparam("usrloc", "timer_procs", 4) … modparam("nathelper", "natping_processes", 6) … modparam("dialog", "timer_procs", 4) modparam("dialog", "ka_timer", 10) modparam("dialog", "ka_interval", 300) …
  • 17. ✤ internal hash sizes ✤ indexing of data in memory ✤ location records (usrloc), dialogs, generic hash tables … modparam("usrloc", "hash_size", 12) … modparam("htable", "htable", “a=>size=4;autoexpire=7200;") modparam("htable", "htable", "b=>size=8;") … modparam("dispatcher", "ds_hash_size", 9) … https://en.wikipedia.org/wiki/Hash_table Hash Table Head name:test size: 2 key: alice slots “xyz” 0 1 2 3 key: bob 123 key: john “1ab”
  • 18. ✤ asynchronous processing ✤ delegate the execution to other workers than sip routing processes ✤ async module ✤ tmx (suspend) - mqueue (transmit) - rtimer (process) ✤ async database queries (mysql) ✤ async http/jsonrpc interactions … async_workers=4 … modparam("sqlops","sqlcon","ca=>dbdriver://username:password@dbhost/dbname") sql_query_async("ca", "delete from domain"); … modparam("acc", "db_insert_mode", 2) … http://www.kamailio.org/events/2014-KamailioWorld/day2/26-Daniel-Constantin.Mierla-Kamailio.cfg-Async.pdf
  • 19. ✤ bonus ✤ children ✤ number of worker processes ✤ tcp - tls ✤ max connections ✤ file description limits ✤ internal dns caching ✤ blacklisting
  • 20. ✤ don’t forget ✤ database indexes ✤ syslog asynchronous mode ✤ dns infrastructure availability ✤ api services responsiveness
  • 21. scale the rtc platform
  • 22. dispatcher module • list of balancing nodes from file or database • monitoring of nodes (activate/inactivate automatically) • re-route in case of failure • various algorithms: hashing, weight distribution, round robin, call load distribution, priority routing • reload list of nodes without restart # Dispatch requests route[DISPATCH] { # round robin dispatching on gateways group '1' if(!ds_select_dst("1",“4")) { send_reply("404", "No destination"); exit; } xdbg("--- SCRIPT: going to <$ru> via <$du>n"); t_on_failure("RTF_DISPATCH"); route(RELAY); exit; } # Re-route in case of failure failure_route[RTF_DISPATCH] { if (t_is_canceled()) { exit; } # next node - only for 500 or local timeout if (t_check_status(“500") || (t_branch_timeout() && !t_branch_replied())) { if(ds_next_dst()) { t_on_failure("RTF_DISPATCH"); route(RELAY); exit; } } } Load balancing
  • 23. Parallel Forking request_route { ... append_branch(“sip:103@kamailio.org”); append_branch(“sip:104@kamailio.org”); $var(newdst) = “sip:105@kamailio.org”; append_branch(“$var(newdst)”); t_relay(); } Serial Forking request_route { ... $ru = “sip:102@kamailio.org”; $xavp(newdst) = “sip:103@kamailio.org”; $xavp(newdst) = “sip:104@kamailio.org”; t_on_failure(“RETRY”); t_relay(); } failure_route[RETRY] { if (t_is_canceled()) { exit; } if($xavp(newdst) != $null) { $ru = $xavp(newdst); $xavp(newdst) = $null; t_on_failure(“RETRY”); t_relay(); exit; } } Externalize services the sip routing basics ✤ lack of resources (e.g., development) ✤ centralized management ✤ large volume of data ✤ number portability database ✤ billing, dids routing, etc
  • 24. ❖ fetching the next routing hops ❖ raw data ❖ http/rpc results + parsing ❖ structured data ❖ rtjson ❖ processing ❖ synchronous ❖ config wait & act ❖ asynchronous ❖ evapi, mqueue & rtimer Building Blocks
  • 25. ❖ kamailio config - combine: ❖ evapi ❖ jansson ❖ rtjson ❖ external application ❖ node.js ❖ json data response ❖ predfined structure http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs
  • 26. Platform Scalability USERS CALLS USERS CALLS USERS CALLS forking ✤ not found on local location table and not coming from the other nodes ✤ set destination to the other nodes (update $ru and append_branch()) ✤ parallel forking (or serial forking with low transmission timeout)
  • 28. # Handle SIP registrations route[REGISTRAR] { if (is_method("REGISTER")) { if(isflagset(FLT_NATS)) { setbflag(FLB_NATB); # uncomment next line to do SIP NAT pinging ## setbflag(FLB_NATSIPPING); } if (!save("location")) sl_reply_error(); $uac_req(method)=“KUSRLOC" $uac_req(ruri)="sip:store@centralnode.kamailio.org"; $uac_req(furi)="sip:server@server1.kamailio.org"; $uac_req(hdrs)="Content-Type: text/kusrlocrn"; pv_printf(“$uac_req(body)”, "$fu@fd"); uac_send_req(); exit; } } route[TOMAIN] { $du = "sip:CENTRALNODEIP"; route(RELAY); exit; } # USER location service route[LOCATION] { #!ifdef WITH_SPEEDDIAL # search for short dialing - 2-digit extension if($rU=~"^[0-9][0-9]$") if(sd_lookup("speed_dial")) route(SIPOUT); #!endif #!ifdef WITH_ALIASDB # search in DB-based aliases if(alias_db_lookup("dbaliases")) route(SIPOUT); #!endif $avp(oexten) = $rU; if (!lookup("location")) { if(src_ip!=CENTRALNODEIP) route(TOMAIN); ... }
  • 29. modparam(“htable”, “htable”, “kusrloc=>size=10;autoexpire=7200;”) ... request_route { # add here ip authorization, etc… # handle location update notification if(method=="KUSRLOC" && $rU=="store") { $sht(kusrloc=>$rb) = “sip:” + $si + “:” + $sp + “;transport=” + $pr; send_reply("200", "Stored"); exit; } # handle standard SIP requests if($sht(kusrloc=>$rU@$rd)!=$null) { $du = $sht(kusrloc=>$rU@$rd); t_relay(); exit; } send_reply(“404”, “Not found”); exit; }
  • 34. Kamailio World 2016 - Planning a Special Edition Kamailio Project 15 YEARS OF DEVELOPMENT 2001-2016 from SER to Kamailio www.kamailioworld.com Thank you! Questions? @miconda