SlideShare a Scribd company logo
8
Most read
12
Most read
16
Most read
Kamailio - SIP Routing in Lua
Kamailio SIP LUA 
Amoocon 2010 
Rostock, Germany 
Do Your SIP Routing In Lua! 
Daniel-Constantin Mierla 
Co-Founder Kamailio (OpenSER) 
www.asipto.com
Kamailio SIP Lua 
It is all about love 
www.kamailio.org 2 
Wine, moon ... and you 
... hacking SIP
Kamailio SIP Lua 
Instead of introduction 
• if you missed my previous presentation 
• “The SIP Router Project - Asynchronous SIP Routing” 
Links: 
• http://www.kamailio.org 
• http://sip-router.org 
• http://www.lua.org 
www.kamailio.org 3
Kamailio SIP Lua 
Lua 
What is Lua? 
• Lua is a powerful, fast, lightweight, embeddable scripting 
language. 
• Lua combines simple procedural syntax with powerful 
data description constructs based on associative arrays 
and extensible semantics. Lua is dynamically typed, runs by 
interpreting bytecode for a register-based virtual 
machine, and has automatic memory management with 
incremental garbage collection, making it ideal for 
configuration, scripting, and rapid prototyping. 
• http://www.lua.org 
www.kamailio.org 4
Kamailio SIP Lua 
Lua 
Why choose Lua? 
• Lua has been used in many industrial applications (e.g., 
Adobe's Photoshop Lightroom), with an emphasis on 
embedded systems (e.g., the Ginga middleware for digital 
TV in Brazil) and games (e.g., World of Warcraft). Lua is 
currently the leading scripting language in games.. 
• Lua is supported by other telephony engines, e.g., Asterisk 
and FreeSWITCH 
• http://www.lua.org 
www.kamailio.org 5
Kamailio SIP Lua 
Lua 
More about Lua? 
• is fast 
• is portable 
• is embeddable 
• is powerful (but simple) 
• is small 
• is free 
• http://www.lua.org 
www.kamailio.org 6
Kamailio SIP Lua 
Kamailio and SIP routing 
Where we stand today? 
• flexible configuration language, still limited pretty much to 
SIP only 
• the power is in hands (and brain) of administrator 
• SIP specific extensions added mainly by writing C 
modules 
• for the rest: Lua, Perl, Python and Java 
www.kamailio.org 7
Kamailio SIP Lua 
Kamailio and Lua 
Why together? 
• need to integrate with other communication platforms 
• it is about realtime communication, so being fast is 
important 
• routing logic may require non-SIP related operations 
• all characteristics of Lua indicates it a very good candidate 
www.kamailio.org 8
Kamailio SIP Lua 
Kamailio and Lua 
How does it work? 
• load module: app_lua 
• Lua scripts can be loaded at startup or on-the-fly at 
runtime 
• entire Lua scripts can be executed or just functions from 
the scripts 
• Lua scripts have access to SIP messages and config 
variables 
• Lua scripts can return back config variables 
• Lua scripts can execute functions from config file 
http://kamailio.org/docs/modules/devel/modules/app_lua.html 
www.kamailio.org 9
Kamailio SIP Lua 
Kamailio Lua API 
Lua packages 
• package sr 
• access to Kamailio core functions 
• method to execute functions exported by modules 
• container for other sub-packages 
• package sr.hdr 
• header manipulation 
• get, add, remove 
• package sr.pv 
• pseudo-variables manipulation 
• access to all pseudo-variables - hundreds of them 
• package sr.sl 
• exports internal sl module API (stateless reply) 
http://sip-router.org/wiki/api/lua/devel 
www.kamailio.org 10
sr.hdr.append_to_reply("X-Src: " .. sr.pv.get("$si") .. ":" .. sr.pv.get("$sp") .. "rn"); 
Kamailio SIP Lua 
Kamailio Lua API 
Basic example 
Lua script: 
function sr_append_srcaddr_to_reply() 
end 
Kamailio config: 
modparam("app_lua", "load", "/path/to/myscript.lua") 
... 
route { 
... 
if(!lua_run("sr_append_srcaddr_to_reply")) 
{ 
xdbg("SCRIPT: failed to execute lua function!n"); 
} 
... 
} 
www.kamailio.org 11
Kamailio SIP Lua 
SIPWEET 
www.kamailio.org 12
Kamailio SIP Lua 
SIPWEET 
Send tweets on SIP events 
• missed call notification 
• instant messaging 
• reminders 
Monitor tweets for SIP services 
• tweet-to-dial 
• reminder setup 
• scheduled calls 
• profile update 
www.kamailio.org 13
Kamailio SIP Lua 
SIPWEET 
Design 
• Lua twitter library 
• Twitter operation is an HTTP request 
• can take some time to be processed 
• we cannot afford that when processing SIP signaling 
• solution: use asynchronous processing 
• config file message queue 
• dedicated process for twitter operations 
• Kamailio modules 
• app_lua 
• mqueue 
• rtimer 
• sqlops 
• Sample implementation 
• notification of a missed call 
• use of Twitter direct message 
www.kamailio.org 14
Kamailio SIP Lua 
SIPWEET 
Config 
loadmodule "app_lua.so" 
loadmodule "rtimer.so" 
loadmodule "sqlops.so" 
loadmodule “mqueue.so” 
# ----- app_lua ----- 
modparam("app_lua", "load", 
"usr/local/etc/kamailio/lua/sipweet.lua") 
# ----- rtimer ----- 
modparam("rtimer", "timer", 
"name=sipweet;interval=60;mode=1;") 
modparam("rtimer", "exec", 
"timer=sipweet;route=SIPWEET;") 
# ----- sqlops ----- 
modparam("sqlops","sqlcon", 
"ca=>mysql://openser:openserrw@localhost/openser") 
# ----- mqueue ----- 
modparam("mqueue", "mqueue", "name=sipweet") 
www.kamailio.org 15
Kamailio SIP Lua 
SIPWEET 
Config 
# Twitter routing 
route[SIPWEET] { 
# consume tweeties 
while(mq_fetch("sipweet")) 
{ 
xlog("Tweeting to $mqk(sipweet) [[$mqv(sipweet)]]n"); 
# get twitter user 
sql_query("ca", 
"select twuser from sipweetusers where sipuser='$mqk(sipweet)'", 
"ra"); 
if($dbr(ra=>rows)>0) 
{ 
$var(twuser) = $dbr(ra=>[0,0]); 
$var(twuser) = $mqv(sipweet); 
if(!lua_runstring("sipweetdm([[$var(twuser)]], [[$var(twmsg)]])")) 
{ 
xdbg("failed to send dm to: $mqk(sipweet) - $var(twuser)!n"); 
} 
} 
} 
} 
www.kamailio.org 16
Kamailio SIP Lua 
SIPWEET 
Config 
# Twitees queuing 
route[TWQUEUE] { 
if(!is_method("INVITE")) 
return; 
mq_add("sipweet", "$rU", "Missed call from $fU [$Tf]"); 
} 
route { 
... 
if(!lookup(“location”)) { 
route(TWQUEUE); 
t_newtran(); 
t_reply("404", "Not Found"); 
exit; 
} 
... 
} 
www.kamailio.org 17
Kamailio SIP Lua 
SIPWEET 
Database table 
CREATE TABLE `sipweetusers` ( 
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, 
`twuser` varchar(64) NOT NULL, 
`sipuser` varchar(64) NOT NULL, 
PRIMARY KEY (`id`), 
UNIQUE KEY (`twuser`), 
UNIQUE KEY (`sipuser`) 
); 
www.kamailio.org 18
Kamailio SIP Lua 
SIPWEET 
Lua script 
-- SIPweet 
-- loading module 
local twitter = require("twitter") 
local initialized = 0 
local me 
function sipweetinit() 
if initialized == 0 then 
me = twitter.Client( "TWUSER", "TWPASSWD" ) 
tret = me:VerifyCredentials() 
initialized = 1 
end 
end 
function sipweetdm(user, txt) 
sipweetinit() 
tret = me:NewDirectMessage(user, txt) 
end 
www.kamailio.org 19
Kamailio SIP Lua 
SIPWEET 
And the messages goes ... 
• nice and quick to your twitter client 
www.kamailio.org 20
Meet us next week in Berlin 
• Developer Meeting, Tue, Jun 8 
• LinuxTag Booth, Jun 9-12 
Kamailio SIP Lua 
SIPWEET 
Concluding 
• This was a proof of concept to do easy twitter integration 
• Kamailio Lua API 
• Asynchronous Twitter Notification System by Config Only 
• Improvements and new services at your imagination 
• or mine - prepare the credit card or a good bottle of wine 
• follow us - cool stuff ahead 
Contact 
•Daniel-Constantin Mierla 
•twitter: miconda 
•daniel@asipto.com 
•http://www.asipto.com 
•http://www.kamailio.org 
Questions? 
www.kamailio.org 21

More Related Content

PDF
rtpengine and kamailio - or how to simulate calls at scale
PDF
Sipwise rtpengine
PDF
rtpengine - Media Relaying and Beyond
ODP
Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
PDF
Scaling FreeSWITCH Performance
PDF
SIPREC RTPEngine Media Forking
PDF
Scaling Asterisk with Kamailio
PDF
Kamailio, FreeSWITCH, and You
rtpengine and kamailio - or how to simulate calls at scale
Sipwise rtpengine
rtpengine - Media Relaying and Beyond
Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
Scaling FreeSWITCH Performance
SIPREC RTPEngine Media Forking
Scaling Asterisk with Kamailio
Kamailio, FreeSWITCH, and You

What's hot (20)

PDF
Kamailio - API Based SIP Routing
ODP
Expanding Asterisk with Kamailio
PDF
Kamailio with Docker and Kubernetes
PDF
SIP Attack Handling (Kamailio World 2021)
PDF
Continuous Integration and Kamailio
PDF
Kamailio - Secure Communication
PDF
Linux Networking Explained
PDF
Introduction to FreeSWITCH
PDF
Astricon 10 (October 2013) - SIP over WebSocket on Kamailio
PDF
FreeSWITCH as a Microservice
PDF
Three Ways Kamailio Can Help Your FreeSWITCH Deployment
PDF
Kamailio :: A Quick Introduction
PDF
Kamailio - Load Balancing Load Balancers
PPTX
Firewalls, SIP Servers and SBC - What's the Differences?
PDF
LinuxCon 2015 Linux Kernel Networking Walkthrough
PPTX
Bare Metal Cluster with Kubernetes, Istio and Metallb | Nguyen Phuong An, Ngu...
PDF
Kamailio on Docker
PPTX
Tutorial: Using GoBGP as an IXP connecting router
PPTX
FreeSWITCH as a Kickass SBC
PDF
The Linux Block Layer - Built for Fast Storage
Kamailio - API Based SIP Routing
Expanding Asterisk with Kamailio
Kamailio with Docker and Kubernetes
SIP Attack Handling (Kamailio World 2021)
Continuous Integration and Kamailio
Kamailio - Secure Communication
Linux Networking Explained
Introduction to FreeSWITCH
Astricon 10 (October 2013) - SIP over WebSocket on Kamailio
FreeSWITCH as a Microservice
Three Ways Kamailio Can Help Your FreeSWITCH Deployment
Kamailio :: A Quick Introduction
Kamailio - Load Balancing Load Balancers
Firewalls, SIP Servers and SBC - What's the Differences?
LinuxCon 2015 Linux Kernel Networking Walkthrough
Bare Metal Cluster with Kubernetes, Istio and Metallb | Nguyen Phuong An, Ngu...
Kamailio on Docker
Tutorial: Using GoBGP as an IXP connecting router
FreeSWITCH as a Kickass SBC
The Linux Block Layer - Built for Fast Storage
Ad

Similar to Kamailio - SIP Routing in Lua (20)

PDF
Kamailio - Unifying SIP and Web Worlds with Lua
PDF
Aynchronous Processing in Kamailio Configuration File
PDF
Kamailioworld 2018 - Modular and test driven SIP Routing with Lua
PDF
Apache Traffic Server & Lua
ODP
Introduction to Lua Luajit Openresty Luvit
PDF
SIP Router Project
PDF
Homer - Workshop at Kamailio World 2017
PDF
Designing High Performance RTC Signaling Servers
PDF
Kamailio Updates - VUC 588
PDF
An Incomplete Data Tools Landscape for Hackers in 2015
PDF
Advanced technic for OS upgrading in 3 minutes
ODP
Knolx session
PPTX
Real-Time Log Analysis with Apache Mesos, Kafka and Cassandra
PDF
Real-time Streaming Pipelines with FLaNK
PDF
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
PDF
murakumo Cloud Controller
PDF
Web development with Lua @ Bulgaria Web Summit 2016
PDF
Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...
PPTX
Serverless Pune meetup 3
PPTX
Python the lingua franca of FEWS
Kamailio - Unifying SIP and Web Worlds with Lua
Aynchronous Processing in Kamailio Configuration File
Kamailioworld 2018 - Modular and test driven SIP Routing with Lua
Apache Traffic Server & Lua
Introduction to Lua Luajit Openresty Luvit
SIP Router Project
Homer - Workshop at Kamailio World 2017
Designing High Performance RTC Signaling Servers
Kamailio Updates - VUC 588
An Incomplete Data Tools Landscape for Hackers in 2015
Advanced technic for OS upgrading in 3 minutes
Knolx session
Real-Time Log Analysis with Apache Mesos, Kafka and Cassandra
Real-time Streaming Pipelines with FLaNK
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
murakumo Cloud Controller
Web development with Lua @ Bulgaria Web Summit 2016
Docker at Shopify: From This-Looks-Fun to Production by Simon Eskildsen (Shop...
Serverless Pune meetup 3
Python the lingua franca of FEWS
Ad

More from Daniel-Constantin Mierla (14)

PDF
FOSDEM 2017 - RTC Services With Lua and Kamailio
PDF
TAD Summit 2016 - The Mobile World Up Side Down
PDF
Snappy Kamailio
PDF
Kamailio - Surfing Big Waves Of SIP With Style
PDF
SIP Server Optimizations for Mobile Networks
PDF
Kamailio and VoIP Wild World
PDF
10 Years SER - Awards
PDF
Sculpturing SIP World
PDF
CPDL - Charging Plan Definition Language
PDF
SER - SIP Express Router
PDF
Kamailio - Large Unified Communication Platforms
PDF
Kamailio - SIP Servers Everywhere
PDF
Kamailio - SIP Firewall for Carrier Grade Traffic
PDF
Kamailio - The Story for Asterisk
FOSDEM 2017 - RTC Services With Lua and Kamailio
TAD Summit 2016 - The Mobile World Up Side Down
Snappy Kamailio
Kamailio - Surfing Big Waves Of SIP With Style
SIP Server Optimizations for Mobile Networks
Kamailio and VoIP Wild World
10 Years SER - Awards
Sculpturing SIP World
CPDL - Charging Plan Definition Language
SER - SIP Express Router
Kamailio - Large Unified Communication Platforms
Kamailio - SIP Servers Everywhere
Kamailio - SIP Firewall for Carrier Grade Traffic
Kamailio - The Story for Asterisk

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Electronic commerce courselecture one. Pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Empathic Computing: Creating Shared Understanding
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Teaching material agriculture food technology
20250228 LYD VKU AI Blended-Learning.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Electronic commerce courselecture one. Pdf
NewMind AI Weekly Chronicles - August'25 Week I
Empathic Computing: Creating Shared Understanding
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Unlocking AI with Model Context Protocol (MCP)
Building Integrated photovoltaic BIPV_UPV.pdf
Machine learning based COVID-19 study performance prediction
Per capita expenditure prediction using model stacking based on satellite ima...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectral efficient network and resource selection model in 5G networks
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
NewMind AI Monthly Chronicles - July 2025
Chapter 3 Spatial Domain Image Processing.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
CIFDAQ's Market Insight: SEC Turns Pro Crypto

Kamailio - SIP Routing in Lua

  • 2. Kamailio SIP LUA Amoocon 2010 Rostock, Germany Do Your SIP Routing In Lua! Daniel-Constantin Mierla Co-Founder Kamailio (OpenSER) www.asipto.com
  • 3. Kamailio SIP Lua It is all about love www.kamailio.org 2 Wine, moon ... and you ... hacking SIP
  • 4. Kamailio SIP Lua Instead of introduction • if you missed my previous presentation • “The SIP Router Project - Asynchronous SIP Routing” Links: • http://www.kamailio.org • http://sip-router.org • http://www.lua.org www.kamailio.org 3
  • 5. Kamailio SIP Lua Lua What is Lua? • Lua is a powerful, fast, lightweight, embeddable scripting language. • Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping. • http://www.lua.org www.kamailio.org 4
  • 6. Kamailio SIP Lua Lua Why choose Lua? • Lua has been used in many industrial applications (e.g., Adobe's Photoshop Lightroom), with an emphasis on embedded systems (e.g., the Ginga middleware for digital TV in Brazil) and games (e.g., World of Warcraft). Lua is currently the leading scripting language in games.. • Lua is supported by other telephony engines, e.g., Asterisk and FreeSWITCH • http://www.lua.org www.kamailio.org 5
  • 7. Kamailio SIP Lua Lua More about Lua? • is fast • is portable • is embeddable • is powerful (but simple) • is small • is free • http://www.lua.org www.kamailio.org 6
  • 8. Kamailio SIP Lua Kamailio and SIP routing Where we stand today? • flexible configuration language, still limited pretty much to SIP only • the power is in hands (and brain) of administrator • SIP specific extensions added mainly by writing C modules • for the rest: Lua, Perl, Python and Java www.kamailio.org 7
  • 9. Kamailio SIP Lua Kamailio and Lua Why together? • need to integrate with other communication platforms • it is about realtime communication, so being fast is important • routing logic may require non-SIP related operations • all characteristics of Lua indicates it a very good candidate www.kamailio.org 8
  • 10. Kamailio SIP Lua Kamailio and Lua How does it work? • load module: app_lua • Lua scripts can be loaded at startup or on-the-fly at runtime • entire Lua scripts can be executed or just functions from the scripts • Lua scripts have access to SIP messages and config variables • Lua scripts can return back config variables • Lua scripts can execute functions from config file http://kamailio.org/docs/modules/devel/modules/app_lua.html www.kamailio.org 9
  • 11. Kamailio SIP Lua Kamailio Lua API Lua packages • package sr • access to Kamailio core functions • method to execute functions exported by modules • container for other sub-packages • package sr.hdr • header manipulation • get, add, remove • package sr.pv • pseudo-variables manipulation • access to all pseudo-variables - hundreds of them • package sr.sl • exports internal sl module API (stateless reply) http://sip-router.org/wiki/api/lua/devel www.kamailio.org 10
  • 12. sr.hdr.append_to_reply("X-Src: " .. sr.pv.get("$si") .. ":" .. sr.pv.get("$sp") .. "rn"); Kamailio SIP Lua Kamailio Lua API Basic example Lua script: function sr_append_srcaddr_to_reply() end Kamailio config: modparam("app_lua", "load", "/path/to/myscript.lua") ... route { ... if(!lua_run("sr_append_srcaddr_to_reply")) { xdbg("SCRIPT: failed to execute lua function!n"); } ... } www.kamailio.org 11
  • 13. Kamailio SIP Lua SIPWEET www.kamailio.org 12
  • 14. Kamailio SIP Lua SIPWEET Send tweets on SIP events • missed call notification • instant messaging • reminders Monitor tweets for SIP services • tweet-to-dial • reminder setup • scheduled calls • profile update www.kamailio.org 13
  • 15. Kamailio SIP Lua SIPWEET Design • Lua twitter library • Twitter operation is an HTTP request • can take some time to be processed • we cannot afford that when processing SIP signaling • solution: use asynchronous processing • config file message queue • dedicated process for twitter operations • Kamailio modules • app_lua • mqueue • rtimer • sqlops • Sample implementation • notification of a missed call • use of Twitter direct message www.kamailio.org 14
  • 16. Kamailio SIP Lua SIPWEET Config loadmodule "app_lua.so" loadmodule "rtimer.so" loadmodule "sqlops.so" loadmodule “mqueue.so” # ----- app_lua ----- modparam("app_lua", "load", "usr/local/etc/kamailio/lua/sipweet.lua") # ----- rtimer ----- modparam("rtimer", "timer", "name=sipweet;interval=60;mode=1;") modparam("rtimer", "exec", "timer=sipweet;route=SIPWEET;") # ----- sqlops ----- modparam("sqlops","sqlcon", "ca=>mysql://openser:openserrw@localhost/openser") # ----- mqueue ----- modparam("mqueue", "mqueue", "name=sipweet") www.kamailio.org 15
  • 17. Kamailio SIP Lua SIPWEET Config # Twitter routing route[SIPWEET] { # consume tweeties while(mq_fetch("sipweet")) { xlog("Tweeting to $mqk(sipweet) [[$mqv(sipweet)]]n"); # get twitter user sql_query("ca", "select twuser from sipweetusers where sipuser='$mqk(sipweet)'", "ra"); if($dbr(ra=>rows)>0) { $var(twuser) = $dbr(ra=>[0,0]); $var(twuser) = $mqv(sipweet); if(!lua_runstring("sipweetdm([[$var(twuser)]], [[$var(twmsg)]])")) { xdbg("failed to send dm to: $mqk(sipweet) - $var(twuser)!n"); } } } } www.kamailio.org 16
  • 18. Kamailio SIP Lua SIPWEET Config # Twitees queuing route[TWQUEUE] { if(!is_method("INVITE")) return; mq_add("sipweet", "$rU", "Missed call from $fU [$Tf]"); } route { ... if(!lookup(“location”)) { route(TWQUEUE); t_newtran(); t_reply("404", "Not Found"); exit; } ... } www.kamailio.org 17
  • 19. Kamailio SIP Lua SIPWEET Database table CREATE TABLE `sipweetusers` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `twuser` varchar(64) NOT NULL, `sipuser` varchar(64) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY (`twuser`), UNIQUE KEY (`sipuser`) ); www.kamailio.org 18
  • 20. Kamailio SIP Lua SIPWEET Lua script -- SIPweet -- loading module local twitter = require("twitter") local initialized = 0 local me function sipweetinit() if initialized == 0 then me = twitter.Client( "TWUSER", "TWPASSWD" ) tret = me:VerifyCredentials() initialized = 1 end end function sipweetdm(user, txt) sipweetinit() tret = me:NewDirectMessage(user, txt) end www.kamailio.org 19
  • 21. Kamailio SIP Lua SIPWEET And the messages goes ... • nice and quick to your twitter client www.kamailio.org 20
  • 22. Meet us next week in Berlin • Developer Meeting, Tue, Jun 8 • LinuxTag Booth, Jun 9-12 Kamailio SIP Lua SIPWEET Concluding • This was a proof of concept to do easy twitter integration • Kamailio Lua API • Asynchronous Twitter Notification System by Config Only • Improvements and new services at your imagination • or mine - prepare the credit card or a good bottle of wine • follow us - cool stuff ahead Contact •Daniel-Constantin Mierla •twitter: miconda •daniel@asipto.com •http://www.asipto.com •http://www.kamailio.org Questions? www.kamailio.org 21