Python DialPlan + Stasis ( A.R.I. )

Hello Community,

I have been working with asterisk through Lua scripts. I didn’t implement the first architecture, but I had to do a lot of maintenance work at Lua Scripts. People who developed the first versions used “/etc/asterisk/extensions.lua” like the bellow :

extensions = {
default = {
["_.*."] = function(context, extension)
dofile(context, extension)
end,
h = function()

end,
}
}

This works fine, starting the first script through LUA dofile function. But this way a lot of LUA libraries had to be developed to treat JSON, XML , HTTP and other features. Our scripts need to send commands back to Asterisk and wait for events, so we had to develop code combining LUA, C++ and ARI.

Alongside this, I started to code some Python scripts, that interact very well with asterisk and since it is a “Swiss army knife”, it has a lot of libraries to treat JSON, HTTP, XML, etc and ARI.
So I imagined a asterisk dialplan start using extensions.conf instead the extensions.lua that I showed above.
I mean a extensions.conf like below :

exten => _XXXX,1,NoOp()
exten => _XXXX,n,Answer()
exten => _XXXX,n, AGI( /Scripts/Python/start.py)
exten => _XXXX,n,Stasis(“ARI”)
exten => _XXXX,n,Hangup()

This second extension looks to work fine, and this way I could diminish the amount of LUA libraries code I had, coding everything in Python.
What I really don’t know is if there are some disadvantages in using this second approach in relation to the first, i.e., using a python starting script through AGI followed by Stasis application instead of using dofile to call a lua start script.
Is this second approach more likely to eventually cause locked threads inside asterisk ?

Lua is rarely used, so the implications of it aren’t really that well understood.

As for the normal dialplan and AGI/Stasis it should be fine with minimal load. If the AGI is frequently used then you’d want to use FastAGI[1] or just do everything in ARI if you can.

[1] https://www.freepbx.org/performance-improvements-in-freepbx/

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.