Lua dialplan

I’ve found that, if for example I put the following lines in my extensions.lua:

extensions = {
default = {
["_X."] = answerCalls;

and, in the same file, I wrote a function like this:

function answerCalls(arg1,arg2)
(any valid code for answering incoming calls)

when a call arrive to my Asterisk box the function is executed and the values of the two arguments are always filled with context and extension (in this case, if the number called is 051123456, arg1 contains “default” and arg2 “051123456”).
I’m happy with this, but I’ve a question: is this behavior expected? It’s a “non written” rule? And, over all, may I count on it? Will be forever there from now on?
Thanks in advance to anybody will clear this to me.

Yes the context and extension are always the first two (and only) arguments that are passed to extension functions. That is by design and will remain.

1 Like