SlideShare una empresa de Scribd logo
1 de 41
Descargar para leer sin conexión
www.kamailio.org
Kamailio
API Based SIP Routing rock solid sip server since 2001
Daniel-Constantin Mierla
www.asipto.com
@miconda
fast and sipurious
About Kamailio
bits about the project
Ground Zero
SIP signalling routing
• fast
• reliable
• flexible
In other words
• not initiating calls
• not answering calls
• no audio-video processing
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
http://www.kamailioworld.com
YouTube Kamailio World 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
Highlights 2014
evapi
db_mongodb
core
tm
dispatcher
uac
rtpengine
dialog
enhancements
tsilo
kazoo
jsonrpc-s
debugger
(per module debug)
(log pv assignment)
usrloc - dmq - ims
uuid
nosip
ndb_mongodb
http://www.kamailio.org/wiki/features/new-in-4.1.x
http://www.kamailio.org/wiki/features/new-in-4.2.x
http://www.kamailio.org/wiki/features/new-in-devel
Highlights 2015
statsd
tcpops
core
pv
rr
uac
http://www.kamailio.org/wiki/features/new-in-4.1.x
http://www.kamailio.org/wiki/features/new-in-4.2.x
http://www.kamailio.org/wiki/features/new-in-4.3.x
http://www.kamailio.org/wiki/features/new-in-devel
janson
dialplan
enhancements
erlang
auth_xkeys
jansonrpc-c
ims
usrloc - dmq - registrar
jsonrpc-s fifo
ndb_redis
ndb_mongodb
geoip2
rtjson
new
performat
memory
manger
webrtc
WebRTC
kamailio
sip over
websockets
websocket support since 2012
SRTP (DTLS)
classic sip
network
sip signaling
webrtc
network
kamailio
rtpengine
SIP
RTP - SRTP control
protocol
udp-tcp-tls-sctp
SRTP (DTLS)
SIP
websocket
media
encryption/decryption
(audio/video/…)
https://github.com/sipwise/rtpengine
- the Sipwise media proxy for Kamailio -
WebRTC SIP Gateway
Kamcli
❖ new Kamailio command line interface tool
❖ written in Python
❖ extensible via modules
❖ easier to handle input values and format output
❖ targets using RPC (e.g., JSONRPC) control interface
❖ https://github.com/asipto/kamcli
Siremis Web Interface
Code Repository on Github
Kamailio Business Directory
Anyone offering services related to Kamailio can get listed there with:
- name and contact coordinates
- short description
Kamailio Used-By Directory
Anyone using Kamailio can get listed there with:
- name and contact coordinates
- short description
- logo
http://www.asipto.com/sw/kamailio-admin-book/
Kamailio
API Based SIP Routing
Two Common Architectures
main signalling server edge signalling server
(sbc)
Load Balancer - LCR - …
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;
}
}
}
Routing Extensions
❖ over 200 modules, plenty of them for routing
❖ dispatcher
❖ lcr
❖ carrierroute
❖ pdt
❖ mtree
❖ dialplan
❖ prefix route
❖ speeddial
❖ aliases
❖ location
❖ …
fast, native implementation
route selection and data model rigidity
Generic Tools
❖ blending for a better taste
❖ configuration script expressions
❖ xavp (avp) - per transaction storing data
❖ htable, mtree - global in memory storage systems
❖ sql - nosql connectors
❖ http - jsonrpc clients
❖ embedded interpreters (lua, perl, python, …)
❖ json - xml tools
❖ message queues & event api
The Logic Schism
SIP Standard Handling Business Decision
sip parsing
authentication
record routing
retransmissions
headers management
failure rerouting
…
authorization
billing
next hops
cheapest rout
qos
available resources
…
KAMAILIO YOUR API
Basic Concepts
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;
}
}
Building Blocks
❖ fetching the next routing hops
❖ raw data
❖ http/rpc results + parsing
❖ structured data
❖ rtjson
❖ processing
❖ synchronous
❖ config wait & act
❖ asynchronous
❖ evapi, mqueue & rtimer
HTTP & You
the http_query() from utils module
http_query(“http://myapi.local/sip.php?src=$(ru{s.escape.param})&dst=$(fu{s.escape.param})”,
"$var(result)")
<?php
echo “sip:” . $_GET[“dst”] . “@1.2.3.4;transport=tls”
. ”|”
. “sip:” . $_GET[“dst”] . “@2.3.4.5;transport=sctp”;
?>
http://kamailio.org/docs/modules/stable/modules/utils.html#utils.f.http_query
Kamailio Config
Serial Forking
request_route {
...
http_query(“http://myapi.local/sip.php?src=$(ru{s.escape.param})&dst=$(fu{s.escape.param})”,
“$var(result)");
$ru = $(var(result){s.select,0,|});
$xavp(newdst) = $(var(result){s.select,1,|});
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;
}
}
Your Response Structure
<?php
echo “<route><uri>sip:” . $_GET[“dst”] . “@1.2.3.4;transport=tls”
. ”</uri><uri>”
. “sip:” . $_GET[“dst”] . “@2.3.4.5;transport=sctp”
. “</uri></route>;
?>
xmlops module to parse the response
<?php
echo “{ ‘routes’: [ ‘sip:” . $_GET[“dst”] . “@1.2.3.4;transport=tls”
. ”’, ”
. “‘sip:” . $_GET[“dst”] . “@2.3.4.5;transport=sctp'”
. “] }”;
?>
json or jansson module to parse the response
too many options
too much config scripting
many like structured, well defined data
“one good option”
Predefined Routing Response
❖ kamailio config - combine:
❖ evapi
❖ jansson
❖ rtjson
❖ external application
❖ node.js
❖ json data response
❖ predfined structure
evapi
❖ event based API
❖ bare data or netstrings serialization
❖ data format up to you
❖ asynchronous processing
❖ park invite request
❖ send event data
❖ resuming handling the invite when receiving response on the event
http://kamailio.org/docs/modules/stable/modules/evapi.html
rtjson
❖ use json input to fill routing attributes
❖ request uri
❖ outbound proxy
❖ intermediary hops
❖ local socket
❖ caller/callee addresses
❖ extra headers
❖ ringing timeout
❖ flags
http://kamailio.org/docs/modules/stable/modules/rtjson.html
rtjson
{
"version": "1.0",
"routing": "serial",
"routes": [
{
"uri": "sip:127.0.0.1:5080",
"dst_uri": "sip:127.0.0.1:5082",
"path": "<sip:127.0.0.1:5084>, <sip:127.0.0.1:5086>",
"socket": "udp:127.0.0.1:5060",
"headers": {
"from": {
"display": "Alice",
"uri": "sip:alice@127.0.0.1"
},
"to": {
"display": "Alice",
"uri": "sip:alice@127.0.0.1"
},
"extra": "X-Hdr-A: abcrnX-Hdr-B: bcdrn"
},
"branch_flags": 8,
"fr_timer": 5000,
"fr_inv_timer": 30000
},
…
kamailio.cfg
…
route[TOEVAPI] {
evapi_async_relay("{n "event": "sip-routing",n"
" "tindex": $T(id_index), "tlabel": $T(id_label),"
" "caller": "$fU", "callee": "$rU"n}");
xlog("L_INFO", "suspended transaction: $T(id_index) / $T(id_label)n");
exit;
}
…
node.js
http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs
…
var response = {};
response.version="1.0";
response.xtra = {};
response.xtra.tindex=jdoc.tindex;
response.xtra.tlabel=jdoc.tlabel;
response.routing = "serial";
response.routes = [];
response.routes[0] = {};
response.routes[0].uri = "sip:127.0.0.1:5080";
response.routes[0].headers = {};
response.routes[0].headers.extra = "X-Hdr-A: abcrnX-Hdr-B: bcdrn";
response.routes[1] = {};
response.routes[1].uri = "sip:127.0.0.1:5090";
response.routes[1].headers = {};
response.routes[1].headers.extra = "X-Hdr-C: cdernX-Hdr-D: defrn";
return kanapi_send_response(JSON.stringify(response));
…
node.js
http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs
…
function kanapi_send_response(data) {
var buffer;
data = new Buffer(data || '', null);
buffer = Buffer.concat([new Buffer(data.length + ':', null), data, new Buffer(',', null)]);
// console.log(‘[‘ + data + '] :----> [' + buffer + ']');
client.write(buffer.toString('ascii'));
return buffer;
}
…
kamailio.cfg
…
event_route[evapi:message-received] {
xlog("received [$evapi(msg)] from $evapi(srcaddr):$evapi(srcport)n");
if($evapi(msg)=~"routing" && $evapi(msg)=~"tindex") {
jansson_get("xtra.tindex", "$evapi(msg)", "$var(tindex)");
jansson_get("xtra.tlabel", "$evapi(msg)", "$var(tlabel)");
$var(evmsg) = $evapi(msg);
xlog("L_INFO", "preparing to resume transaction for processing: $var(tindex) / $var(tlabel)n");
t_continue("$var(tindex)", "$var(tlabel)", "EVAPIRESPONSE");
}
}
…
kamailio.cfg
…
route[EVAPIRESPONSE] {
xlog("L_INFO", "resumed transaction for processing: $T(id_index) / $T(id_label)n");
rtjson_init_routes("$var(evmsg)");
rtjson_push_routes();
t_on_branch("MANAGE_BRANCH");
t_on_failure("MANAGE_FAILURE");
route(RELAY);
exit;
}
…
failure_route[MANAGE_FAILURE] {
route(NATMANAGE);
if (t_is_canceled()) {
exit;
}
if(rtjson_next_route()) {
t_on_branch("MANAGE_BRANCH");
t_on_failure("MANAGE_FAILURE");
route(RELAY);
exit;
}
}
…
In summary
it’s all about you
• pick your desired format: json, xml,
custom
• pick your desired transport: http, rpc,
evapi, or even sip
• pick handling style: sync or async
• pick your external call routing
controller: node+js, http+php,
standalone app, …
or sip, kamailio and you
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?!?
Daniel-Constantin Mierla
www.asipto.com
@miconda

Más contenido relacionado

La actualidad más candente

Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...Fred Posner
 
Using Kamailio for Scalability and Security
Using Kamailio for Scalability and SecurityUsing Kamailio for Scalability and Security
Using Kamailio for Scalability and SecurityFred Posner
 
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
 
SIPREC RTPEngine Media Forking
SIPREC RTPEngine Media ForkingSIPREC RTPEngine Media Forking
SIPREC RTPEngine Media ForkingHossein Yavari
 
Continuous Integration and Kamailio
Continuous Integration and KamailioContinuous Integration and Kamailio
Continuous Integration and KamailioGiacomo Vacca
 
Three Ways Kamailio Can Help Your FreeSWITCH Deployment
Three Ways Kamailio Can Help Your FreeSWITCH DeploymentThree Ways Kamailio Can Help Your FreeSWITCH Deployment
Three Ways Kamailio Can Help Your FreeSWITCH DeploymentFred Posner
 
Kamalio and Asterisk: What, Why & How
Kamalio and Asterisk: What, Why & HowKamalio and Asterisk: What, Why & How
Kamalio and Asterisk: What, Why & HowFred Posner
 
FreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceFreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceEvan McGee
 
Scaling Asterisk with Kamailio
Scaling Asterisk with KamailioScaling Asterisk with Kamailio
Scaling Asterisk with KamailioFred Posner
 
Kamailio with Docker and Kubernetes
Kamailio with Docker and KubernetesKamailio with Docker and Kubernetes
Kamailio with Docker and KubernetesPaolo Visintin
 
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 - workshopstefansayer
 
FreeSWITCH as a Kickass SBC
FreeSWITCH as a Kickass SBCFreeSWITCH as a Kickass SBC
FreeSWITCH as a Kickass SBCMoises Silva
 
Kamailio - SIP Firewall for Carrier Grade Traffic
Kamailio - SIP Firewall for Carrier Grade TrafficKamailio - SIP Firewall for Carrier Grade Traffic
Kamailio - SIP Firewall for Carrier Grade TrafficDaniel-Constantin Mierla
 
SIP & TLS - Security in a peer to peer world
SIP & TLS - Security in a peer to peer worldSIP & TLS - Security in a peer to peer world
SIP & TLS - Security in a peer to peer worldOlle E Johansson
 
Kamailio - Large Unified Communication Platforms
Kamailio - Large Unified Communication PlatformsKamailio - Large Unified Communication Platforms
Kamailio - Large Unified Communication PlatformsDaniel-Constantin Mierla
 
Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDPFaster packet processing in Linux: XDP
Faster packet processing in Linux: XDPDaniel T. Lee
 

La actualidad más candente (20)

Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
 
Using Kamailio for Scalability and Security
Using Kamailio for Scalability and SecurityUsing Kamailio for Scalability and Security
Using Kamailio for Scalability and Security
 
Kamailio on Docker
Kamailio on DockerKamailio on Docker
Kamailio on Docker
 
Kamailio - Load Balancing Load Balancers
Kamailio - Load Balancing Load BalancersKamailio - Load Balancing Load Balancers
Kamailio - Load Balancing Load Balancers
 
Sipwise rtpengine
Sipwise rtpengineSipwise rtpengine
Sipwise rtpengine
 
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.
 
SIPREC RTPEngine Media Forking
SIPREC RTPEngine Media ForkingSIPREC RTPEngine Media Forking
SIPREC RTPEngine Media Forking
 
Continuous Integration and Kamailio
Continuous Integration and KamailioContinuous Integration and Kamailio
Continuous Integration and Kamailio
 
Three Ways Kamailio Can Help Your FreeSWITCH Deployment
Three Ways Kamailio Can Help Your FreeSWITCH DeploymentThree Ways Kamailio Can Help Your FreeSWITCH Deployment
Three Ways Kamailio Can Help Your FreeSWITCH Deployment
 
Kamalio and Asterisk: What, Why & How
Kamalio and Asterisk: What, Why & HowKamalio and Asterisk: What, Why & How
Kamalio and Asterisk: What, Why & How
 
FreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceFreeSWITCH as a Microservice
FreeSWITCH as a Microservice
 
Scaling Asterisk with Kamailio
Scaling Asterisk with KamailioScaling Asterisk with Kamailio
Scaling Asterisk with Kamailio
 
Kamailio with Docker and Kubernetes
Kamailio with Docker and KubernetesKamailio with Docker and Kubernetes
Kamailio with Docker and Kubernetes
 
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 - SIP Firewall for Carrier Grade Traffic
Kamailio - SIP Firewall for Carrier Grade TrafficKamailio - SIP Firewall for Carrier Grade Traffic
Kamailio - SIP Firewall for Carrier Grade Traffic
 
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
 
SIP & TLS - Security in a peer to peer world
SIP & TLS - Security in a peer to peer worldSIP & TLS - Security in a peer to peer world
SIP & TLS - Security in a peer to peer world
 
Kamailio - Large Unified Communication Platforms
Kamailio - Large Unified Communication PlatformsKamailio - Large Unified Communication Platforms
Kamailio - Large Unified Communication Platforms
 
Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDPFaster packet processing in Linux: XDP
Faster packet processing in Linux: XDP
 

Similar a Kamailio - API Based SIP Routing

Kamailio - Surfing Big Waves Of SIP With Style
Kamailio - Surfing Big Waves Of SIP With StyleKamailio - Surfing Big Waves Of SIP With Style
Kamailio - Surfing Big Waves Of SIP With StyleDaniel-Constantin Mierla
 
Kamailio and VoIP Wild World
Kamailio and VoIP Wild WorldKamailio and VoIP Wild World
Kamailio and VoIP Wild World2600Hz
 
FOSDEM 2017 - RTC Services With Lua and Kamailio
FOSDEM 2017 - RTC Services With Lua and KamailioFOSDEM 2017 - RTC Services With Lua and Kamailio
FOSDEM 2017 - RTC Services With Lua and KamailioDaniel-Constantin Mierla
 
Designing High Performance RTC Signaling Servers
Designing High Performance RTC Signaling ServersDesigning High Performance RTC Signaling Servers
Designing High Performance RTC Signaling ServersDaniel-Constantin Mierla
 
SIP Server Optimizations for Mobile Networks
SIP Server Optimizations for Mobile NetworksSIP Server Optimizations for Mobile Networks
SIP Server Optimizations for Mobile NetworksDaniel-Constantin Mierla
 
Skydive, real-time network analyzer, container integration
Skydive, real-time network analyzer, container integrationSkydive, real-time network analyzer, container integration
Skydive, real-time network analyzer, container integrationSylvain Afchain
 
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto Docker, Inc.
 
Learning the basics of Apache NiFi for iot OSS Europe 2020
Learning the basics of Apache NiFi for iot OSS Europe 2020Learning the basics of Apache NiFi for iot OSS Europe 2020
Learning the basics of Apache NiFi for iot OSS Europe 2020Timothy Spann
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot CampTroy Miles
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileIVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileAmazon Web Services Japan
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web DevelopmentCheng-Yi Yu
 
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...Aman Kohli
 
Kamailioworld 2018 - Modular and test driven SIP Routing with Lua
Kamailioworld 2018 - Modular and test driven SIP Routing with LuaKamailioworld 2018 - Modular and test driven SIP Routing with Lua
Kamailioworld 2018 - Modular and test driven SIP Routing with LuaSebastian Damm
 

Similar a Kamailio - API Based SIP Routing (20)

Kamailio - Surfing Big Waves Of SIP With Style
Kamailio - Surfing Big Waves Of SIP With StyleKamailio - Surfing Big Waves Of SIP With Style
Kamailio - Surfing Big Waves Of SIP With Style
 
Kamailio - SIP Servers Everywhere
Kamailio - SIP Servers EverywhereKamailio - SIP Servers Everywhere
Kamailio - SIP Servers Everywhere
 
Kamailio and VoIP Wild World
Kamailio and VoIP Wild WorldKamailio and VoIP Wild World
Kamailio and VoIP Wild World
 
Kamailio and VoIP Wild World
Kamailio and VoIP Wild WorldKamailio and VoIP Wild World
Kamailio and VoIP Wild World
 
FOSDEM 2017 - RTC Services With Lua and Kamailio
FOSDEM 2017 - RTC Services With Lua and KamailioFOSDEM 2017 - RTC Services With Lua and Kamailio
FOSDEM 2017 - RTC Services With Lua and Kamailio
 
Kamailio Updates - VUC 588
Kamailio Updates - VUC 588Kamailio Updates - VUC 588
Kamailio Updates - VUC 588
 
Designing High Performance RTC Signaling Servers
Designing High Performance RTC Signaling ServersDesigning High Performance RTC Signaling Servers
Designing High Performance RTC Signaling Servers
 
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
 
Skydive 5/07/2016
Skydive 5/07/2016Skydive 5/07/2016
Skydive 5/07/2016
 
SIP Server Optimizations for Mobile Networks
SIP Server Optimizations for Mobile NetworksSIP Server Optimizations for Mobile Networks
SIP Server Optimizations for Mobile Networks
 
Skydive, real-time network analyzer, container integration
Skydive, real-time network analyzer, container integrationSkydive, real-time network analyzer, container integration
Skydive, real-time network analyzer, container integration
 
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
 
Learning the basics of Apache NiFi for iot OSS Europe 2020
Learning the basics of Apache NiFi for iot OSS Europe 2020Learning the basics of Apache NiFi for iot OSS Europe 2020
Learning the basics of Apache NiFi for iot OSS Europe 2020
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileIVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
 
Nodejs - A quick tour (v5)
Nodejs - A quick tour (v5)Nodejs - A quick tour (v5)
Nodejs - A quick tour (v5)
 
Loom and concurrency latest
Loom and concurrency latestLoom and concurrency latest
Loom and concurrency latest
 
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
 
Kamailioworld 2018 - Modular and test driven SIP Routing with Lua
Kamailioworld 2018 - Modular and test driven SIP Routing with LuaKamailioworld 2018 - Modular and test driven SIP Routing with Lua
Kamailioworld 2018 - Modular and test driven SIP Routing with Lua
 

Más de Daniel-Constantin Mierla (10)

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
 
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 - 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
 
Aynchronous Processing in Kamailio Configuration File
Aynchronous Processing in Kamailio Configuration FileAynchronous Processing in Kamailio Configuration File
Aynchronous Processing in Kamailio Configuration File
 

Último

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 

Último (20)

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

Kamailio - API Based SIP Routing

  • 1. www.kamailio.org Kamailio API Based SIP Routing rock solid sip server since 2001 Daniel-Constantin Mierla www.asipto.com @miconda fast and sipurious
  • 3. Ground Zero SIP signalling routing • fast • reliable • flexible In other words • not initiating calls • not answering calls • no audio-video processing
  • 4. 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
  • 5. http://www.kamailioworld.com YouTube Kamailio World Channel https://www.youtube.com/channel/UCElq4JNTPd7bs2vbfAAYVJA
  • 6. Kamailio World 2016 - Planning a Special Edition Kamailio Project 15 YEARS OF DEVELOPMENT 2001-2016 from SER to Kamailio www.kamailioworld.com
  • 7. Highlights 2014 evapi db_mongodb core tm dispatcher uac rtpengine dialog enhancements tsilo kazoo jsonrpc-s debugger (per module debug) (log pv assignment) usrloc - dmq - ims uuid nosip ndb_mongodb http://www.kamailio.org/wiki/features/new-in-4.1.x http://www.kamailio.org/wiki/features/new-in-4.2.x http://www.kamailio.org/wiki/features/new-in-devel
  • 10. classic sip network sip signaling webrtc network kamailio rtpengine SIP RTP - SRTP control protocol udp-tcp-tls-sctp SRTP (DTLS) SIP websocket media encryption/decryption (audio/video/…) https://github.com/sipwise/rtpengine - the Sipwise media proxy for Kamailio - WebRTC SIP Gateway
  • 11. Kamcli ❖ new Kamailio command line interface tool ❖ written in Python ❖ extensible via modules ❖ easier to handle input values and format output ❖ targets using RPC (e.g., JSONRPC) control interface ❖ https://github.com/asipto/kamcli
  • 14. Kamailio Business Directory Anyone offering services related to Kamailio can get listed there with: - name and contact coordinates - short description
  • 15. Kamailio Used-By Directory Anyone using Kamailio can get listed there with: - name and contact coordinates - short description - logo
  • 18. Two Common Architectures main signalling server edge signalling server (sbc)
  • 19. Load Balancer - LCR - … 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; } } }
  • 20. Routing Extensions ❖ over 200 modules, plenty of them for routing ❖ dispatcher ❖ lcr ❖ carrierroute ❖ pdt ❖ mtree ❖ dialplan ❖ prefix route ❖ speeddial ❖ aliases ❖ location ❖ …
  • 21. fast, native implementation route selection and data model rigidity
  • 22. Generic Tools ❖ blending for a better taste ❖ configuration script expressions ❖ xavp (avp) - per transaction storing data ❖ htable, mtree - global in memory storage systems ❖ sql - nosql connectors ❖ http - jsonrpc clients ❖ embedded interpreters (lua, perl, python, …) ❖ json - xml tools ❖ message queues & event api
  • 23. The Logic Schism SIP Standard Handling Business Decision sip parsing authentication record routing retransmissions headers management failure rerouting … authorization billing next hops cheapest rout qos available resources … KAMAILIO YOUR API
  • 24. Basic Concepts 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; } }
  • 25. Building Blocks ❖ fetching the next routing hops ❖ raw data ❖ http/rpc results + parsing ❖ structured data ❖ rtjson ❖ processing ❖ synchronous ❖ config wait & act ❖ asynchronous ❖ evapi, mqueue & rtimer
  • 26. HTTP & You the http_query() from utils module http_query(“http://myapi.local/sip.php?src=$(ru{s.escape.param})&dst=$(fu{s.escape.param})”, "$var(result)") <?php echo “sip:” . $_GET[“dst”] . “@1.2.3.4;transport=tls” . ”|” . “sip:” . $_GET[“dst”] . “@2.3.4.5;transport=sctp”; ?> http://kamailio.org/docs/modules/stable/modules/utils.html#utils.f.http_query
  • 27. Kamailio Config Serial Forking request_route { ... http_query(“http://myapi.local/sip.php?src=$(ru{s.escape.param})&dst=$(fu{s.escape.param})”, “$var(result)"); $ru = $(var(result){s.select,0,|}); $xavp(newdst) = $(var(result){s.select,1,|}); 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; } }
  • 28. Your Response Structure <?php echo “<route><uri>sip:” . $_GET[“dst”] . “@1.2.3.4;transport=tls” . ”</uri><uri>” . “sip:” . $_GET[“dst”] . “@2.3.4.5;transport=sctp” . “</uri></route>; ?> xmlops module to parse the response <?php echo “{ ‘routes’: [ ‘sip:” . $_GET[“dst”] . “@1.2.3.4;transport=tls” . ”’, ” . “‘sip:” . $_GET[“dst”] . “@2.3.4.5;transport=sctp'” . “] }”; ?> json or jansson module to parse the response
  • 29. too many options too much config scripting many like structured, well defined data “one good option”
  • 30.
  • 31. Predefined Routing Response ❖ kamailio config - combine: ❖ evapi ❖ jansson ❖ rtjson ❖ external application ❖ node.js ❖ json data response ❖ predfined structure
  • 32. evapi ❖ event based API ❖ bare data or netstrings serialization ❖ data format up to you ❖ asynchronous processing ❖ park invite request ❖ send event data ❖ resuming handling the invite when receiving response on the event http://kamailio.org/docs/modules/stable/modules/evapi.html
  • 33. rtjson ❖ use json input to fill routing attributes ❖ request uri ❖ outbound proxy ❖ intermediary hops ❖ local socket ❖ caller/callee addresses ❖ extra headers ❖ ringing timeout ❖ flags http://kamailio.org/docs/modules/stable/modules/rtjson.html
  • 34. rtjson { "version": "1.0", "routing": "serial", "routes": [ { "uri": "sip:127.0.0.1:5080", "dst_uri": "sip:127.0.0.1:5082", "path": "<sip:127.0.0.1:5084>, <sip:127.0.0.1:5086>", "socket": "udp:127.0.0.1:5060", "headers": { "from": { "display": "Alice", "uri": "sip:alice@127.0.0.1" }, "to": { "display": "Alice", "uri": "sip:alice@127.0.0.1" }, "extra": "X-Hdr-A: abcrnX-Hdr-B: bcdrn" }, "branch_flags": 8, "fr_timer": 5000, "fr_inv_timer": 30000 }, …
  • 35. kamailio.cfg … route[TOEVAPI] { evapi_async_relay("{n "event": "sip-routing",n" " "tindex": $T(id_index), "tlabel": $T(id_label)," " "caller": "$fU", "callee": "$rU"n}"); xlog("L_INFO", "suspended transaction: $T(id_index) / $T(id_label)n"); exit; } …
  • 36. node.js http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs … var response = {}; response.version="1.0"; response.xtra = {}; response.xtra.tindex=jdoc.tindex; response.xtra.tlabel=jdoc.tlabel; response.routing = "serial"; response.routes = []; response.routes[0] = {}; response.routes[0].uri = "sip:127.0.0.1:5080"; response.routes[0].headers = {}; response.routes[0].headers.extra = "X-Hdr-A: abcrnX-Hdr-B: bcdrn"; response.routes[1] = {}; response.routes[1].uri = "sip:127.0.0.1:5090"; response.routes[1].headers = {}; response.routes[1].headers.extra = "X-Hdr-C: cdernX-Hdr-D: defrn"; return kanapi_send_response(JSON.stringify(response)); …
  • 37. node.js http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs … function kanapi_send_response(data) { var buffer; data = new Buffer(data || '', null); buffer = Buffer.concat([new Buffer(data.length + ':', null), data, new Buffer(',', null)]); // console.log(‘[‘ + data + '] :----> [' + buffer + ']'); client.write(buffer.toString('ascii')); return buffer; } …
  • 38. kamailio.cfg … event_route[evapi:message-received] { xlog("received [$evapi(msg)] from $evapi(srcaddr):$evapi(srcport)n"); if($evapi(msg)=~"routing" && $evapi(msg)=~"tindex") { jansson_get("xtra.tindex", "$evapi(msg)", "$var(tindex)"); jansson_get("xtra.tlabel", "$evapi(msg)", "$var(tlabel)"); $var(evmsg) = $evapi(msg); xlog("L_INFO", "preparing to resume transaction for processing: $var(tindex) / $var(tlabel)n"); t_continue("$var(tindex)", "$var(tlabel)", "EVAPIRESPONSE"); } } …
  • 39. kamailio.cfg … route[EVAPIRESPONSE] { xlog("L_INFO", "resumed transaction for processing: $T(id_index) / $T(id_label)n"); rtjson_init_routes("$var(evmsg)"); rtjson_push_routes(); t_on_branch("MANAGE_BRANCH"); t_on_failure("MANAGE_FAILURE"); route(RELAY); exit; } … failure_route[MANAGE_FAILURE] { route(NATMANAGE); if (t_is_canceled()) { exit; } if(rtjson_next_route()) { t_on_branch("MANAGE_BRANCH"); t_on_failure("MANAGE_FAILURE"); route(RELAY); exit; } } …
  • 40. In summary it’s all about you • pick your desired format: json, xml, custom • pick your desired transport: http, rpc, evapi, or even sip • pick handling style: sync or async • pick your external call routing controller: node+js, http+php, standalone app, … or sip, kamailio and you
  • 41. 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?!? Daniel-Constantin Mierla www.asipto.com @miconda