Email when call flow toggled

FreePBX 13.0.190.7

I’ve searched but found nothing.

Is there a way to to send an email when a call flow is toggled?

Great idea you should put in a feature request. This would be pretty easy to implement and I believe quite useful.

I’m not sure what he’s asking for, so a Feature Request is probably going to need some “clarification” from here.

The problem I see is that there are two ways to interpret that sentence, and both of them require sysdamin privileges - unless he means something like a day/night mode keypress, but that’s usually reserved for Receptionist and Admin phones anyway.

I’m sure there is a simple, elegant way to do what he’s hoping for, I’m just not sure what he’s hoping for…

It is a little convoluted, you have time-conditions, time-groups and feature-codes, the sum of all that sets “states” in the asterisk sqlite3 database , try watching as the states change:-

rasterisk -x ‘database show’|grep CustomDevstate/TC*

The various states are triggered/updated by default every minute by the context tc-maint, programmable with the global variable TCINTERVAL., and of course by any override feature codes

So the problem here is that the logic that detects the “state change” is in various contexts like [timeconditions] an[app-daynight-toggle] which you are “not allowed” to modify. It also just updates the status every time it is called, not a problem with a lamp but a noisy solution for email notification.

I would suggest a call to an AGI in [app-daynight-toggle-custom] would pretty well follow any change of light/state but you would need to preserve the “state” of the time-conditions in a location that the script running as Asterisk can get to, so you can compare it to the last known “state”

If I did that, there would be some sql queries as I would need to decide which timecodes to watch and match them to extensions/email-addresses to send the “change” to.

JM2CWAE

I stand corrected. It does not sound as though it would be any easy implementation

@dicko is talking about time conditions, but OP asked about Call Flow controls. The same techniques can be used:

[root@lgaetzdev2 ~]# rasterisk -x 'database show'|grep DAYNIGHT/
/DAYNIGHT/C0                                      : NIGHT
/DAYNIGHT/C1                                      : DAY

Then refine for specific entry:

rasterisk -x 'database get DAYNIGHT C1'
Value: DAY

One dbase entry per flow control. You can cron a task that monitors the database entries for change and sends notifications.

cynjut… yes, I am looking for a way to be emailed when a “day/night mode keypress” transpires.

I have been playing around with the dial plan and I am able to have a text file showing a date/time stamp and the status (day or night) shown whenever the call flow code is activated or deactivated. But I would like to be emailed at the time that this event takes place.

And for those of you who are asking Why?

The receptionist presses this button whenever she is not at her desk (out for a smoke, or not at office)… which sends incoming calls to my cell (we are in different cities and I am typically not in the office). I want to know when this happens so I know to expect calls and to know how often this occurs. Why not just have the receptionist text you when the button is pressed. Been there, tried that…

The cron job seems viable. Will work on a script.

If anyone has another implementation, please let me know.

Thanks

I sounds like @dicko is on the right track. See if you can add something in the extensions_custom.conf file to expand the functionality of the [app-daynight-toggle-custom] dialplan entry. There was a topic here a couple of weeks ago about sending e-mail from a custom dial plan entry.

The shortcoming with this approach, apart from the difficult of splicing the existing context, is that the dialplan is only triggered when you dial *28x, and not when call flow is changed by UCP (or the REST Phone App).

The reason to follow the devstate is that all the above changes are followed so your email would be synchronous ONLY with a change of the lamps.The php code that triggers the tc÷maint ‘callfile’ is essentially a corn job and the toggle is also called with a feature key. The only code that is allowed to be changed is the _custom.conf, thus both events are covered.

No doubt everything you said is true.

Not to detract from your concerns - I was just trying to get him to start on a relatively simple first step and see what else he needed done. If the receptionist always uses a *28x code (based on a BLF no doubt), then something simple like what he was asking for should be doable without a lot of groveling around in the rest of the code.

Now, the cut and paste of the existing context is going to be a challenge, but it’s one that he is probably going to need to take on at some point.

Well, I went the @lgaetz way and cronned it , it is just a bash script and there is no modification to your system, I won’t post it here, but if there. Is any interest . . .

Sorry for delay to this post… time flies when you’re neck deep in alligators…

I am interested in this script.

I sent you it in a PM

Thank you so much.

I will try it out as soon as I get back in town.