PHP Scripting


Instead of using extensions.conf for my dialplan, can I use PHP scripts instead?



You can use the AGI interface, but it’s going to be much more complex to write and maintain. It’ll also be slower.

If you prefer doing your things in PHP, you could start with a dialplan like this:

exten => _X.,1,NoOp(${DNID})
exten => _X.,n,AGI(application.agi)

exten => h,1,DeadAGI(end_call.agi)
exten => h,n,Hangup

Note that it starts with the application.agi script before picking up the line, you need to do that in your script.
Allso note that a second script is called after a hangup occured.
Allthough you should take a close look at performance during actual use, this does work (quite well).