Skip to end of metadata
Go to start of metadata

Below is a quick reference that can be used to translate traditional extensions.conf dialplan concepts to their analog in extensions.lua.

Extension Patterns

Extension pattern matching syntax on logic works the same for extensions.conf and extensions.lua.

extensions.conf

extensions.lua

Context Includes

extensions.conf

extensions.lua

Loops

extensions.conf

extensions.lua

Variables

extensions.conf

extensions.lua

Applications

extensions.conf

extensions.lua

Macros/GoSub

Macros can be defined in pbx_lua by naming a context 'macro-*' just as in extensions.conf, but generally where you would use macros or gosub in extensions.conf you would simply use a function in lua.

extensions.conf

extensions.lua

Goto

While Goto is an extenstions.conf staple, it should generally be avoided in pbx_lua in favor of functions.

extensions.conf

extensions.lua

Icon

The app.goto() function will not work as expected in pbx_lua in Asterisk 1.8. If you must use app.goto() you must manually return control back to asterisk using return from the dialplan extension function, otherwise execution will continue after the call to app.goto(). Calls to app.goto() should work as expected in Asterisk 10 but still should not be necessary in most cases.

In Asterisk 1.8, use return
  • No labels

1 Comment

  1. return app.goto("default", "100", 1)

    should be updated to:

    return app['goto']("default", "100", 1)
    Since goto is a reserved keyword in lua 5.2 and will throw an error.