app_lua Module in Kamailio (KEMI)

Kamailio, SIP server, offers a vast array of modules to extend its functionality. App_lua modiule is one of them . It offers a simple yet flexible syntax, allowing you to use the vast ecosystem of Lua libraries and tools to extend Kamailio's capabilities even further

App_lua enables you to execute Lua scripts within Kamailio, opening up a world of possibilities for handling SIP traffic, manipulating headers and bodies, and even integrating with external systems.

With 'app_lua’ module you can:

Access and modify SIP headers on the fly

Route traffic dynamically based on custom conditions

Integrate with external services and APIs

Implement complex call handling logic

Perform real-time data processing and analytics

And so much more!

Imagine a scenario where you want to leverage the intelligence of an external application server to determine the optimal routing destination for your SIP invites. In this article, I will show you how to leverage the power of Lua scripting to communicate with your application server via web services, making dynamic routing decisions based on real-time data

I have prepared a practical sample here that Kamailio Server ask my application Server where to route traffic based on the source ip address . The destination can be SIP gateway, A voicemail Server or drop the invite for the blacklisted ip addresses.

to access the sample you can refer to my github Lean Kamailio Repo