Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
Column
width50%
Panel

extensions.conf

Code Block
[default]
exten => 100,1,Goto(102,1)

exten => 102,1,Playback("demo-thanks")
exten => 102,n,Hangup
Column
width50%
Panel

extensions.lua

Code Block
extensions = {}
extensions.default = {}

function do_hangup()
   app.playback("demo-thanks")
   app.hangup()
end

extensions.default[100] = function()
   do_hangup()

   -- we could have just set extensions.default[100] = do_hangup
end

Info

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 1.10 but still should not be necessary in most cases.

Code Block
titleIn Asterisk 1.8, use return
function extension_function(c, e)
   return app.goto("default", "100", 1)

   -- without that 'return' the rest of the function would execute normally
   app.verbose("Did you forget to use 'return'?")
end