Skip to end of metadata
Go to start of metadata

Some example extensions.lua files can be found below. They demonstrate various ways to organize extensions.

Less Clutter

Instead of defining every extension inline, you can use this method to create a neater extensions.lua file. Since the extensions table and each context are both normal lua tables, you can treat them as such and build them piece by piece.

extensions.lua

Less Clutter v2

In this example, we use a fancy function to register extensions.

extensions.lua
  • No labels

3 Comments

  1. This page ( Examples ) could cause issues with the namespace. I would suggest "Lua Examples" or "Examples of Lua usage". The same could be said for Dialplan Hints, Advanced Topics, Tips and Tricks, and Interacting with Asterisk (apps, variables, and functions).

    1. We can rename the page if that becomes an issue.

      1. OK, I have dealt with namespace issues on larger projects. It becomes a problem fast.