Search code examples
asterisksippbxagidialplan

How to execute code before making a call on Asterisk


I have an asterisk pbx server. I’m new to asterisk, I know there are dial plans extensions groups etc. My goal is to handle a dial event do some checks then decide whether to let the call go through or not. I read about ARI AGI AMI and dial plan but I got confused and don’t know how to proceed. I just want to execute code (call an API for example) when any number is dialed, and drop the call or let it through according to that.

I know if I do more research I can get something working, but honestly I don’t have time. I just need to know where to look.


Solution

  • So I solved it. In case anyone needs this, here's what I did.

    I used AsterNET fastAGI and created my service script, which does whatever checks I need and calls HangUp() when needed, else just returns and lets the call go through. Then I called the fastAGI script in the dial plan and it's working perfectly.