Trunk dialing failure

I noticed with pleasure the addition to trunks to allow executing a custom AGI script if a dialout on that trunk failed. I ginned up a quick script to send a basic email, and installed it. Then, I started thinking - it would be much nicer if this was integrated into the system somehow. I’d be happy to take a crack at that, but was wondering if the cleanest way to do this is with a separate module, or in the core module (or freepbx framework module?)

I put it in there as a hook, as different people have different needs. I have a script that logs to a database, sends email if you want and also pushes an event out to nagios. The only problem with it is that it is written in php and on my system, I have yet to find a way to make php copletely fork so the agi script returns right away. I’ve written a stub in ruby and with ruby I can close all the neccessary connections so asterisk keeps going…

anyhow - there may be a place for a module that takes advantage of that - but as mentioned, there are a lot of use models that people may want to do with it.

What am I missing under Trunks there is a relatively new feature Monitor Trunk Failures. From what little info there is on this its my understanding that Trixbox now has a process running where ‘in the event of a failure’ it will run a script. This means that we don’t have to write the process just the action Trixbox does the rest i.e. all I would need is a script that sends an email maybe with a string value for the trunk so I can use the same script for each trunk without modification.

If this is so easy why can’t I find a copy of the script anywhere? I am not at all familiar with AGI which seems to be one of the requirements. Does anybody have this script and would they mind posting it?

Thank you.

There is a discussion of monitoring PRI failures and a script provided to do such as a benefit of the
OTTS seminar. Which I highly recommend for anyone who is involved in FreePBX beyond the hobbiest level.