FreePBX | Register | Issues | Wiki | Portal | Support

E911 Notification - Dashboard widget / Email / SMS text / Paging

(Avayax) #21

I get the error too, but the dial plan executes fine I receive an email each time.

(Greg) #22

Well, still no joy on mine. It throws the error, text never gets sent out.

(Greg) #23


Changing it from “System” to “SHELL” also had the same error.

This is most certainly a bug; it shouldn’t be interpreting the line, just passing it to the OS.

(Dave Burgess) #24

Have you tried escaping the pipe character?

(Greg) #25

I did try escaping it… I"m going to try setting the command with a SET then executing it…

(Greg) #26

WOW… even if I SET the variable, then SHELL(variable), it STILL gives the same error.

(Greg) #27

ONE FINAL THING I could try doing… passing ${AMPUSER} and ${AMPUSERCID} as parameters, then have a bash script that accepts those parameters, and sends the mail.

What a complete PITA though…

At least then, it’s just calling a shell script and passing parameters to it.

(Dave Burgess) #28

One last suggestion:

Wrap the echo command in quotes and escape the quotes inside the system() function.

exten => s,1,ExecIf($["${OUTNUM}"=“xxxxx”]?System(“echo \“Ext ${AMPUSER} - ${AMPUSERCIDNAME} just placed a 911 emergency call on ${STRFTIME(%C%m%d%y%H%M)}\” | mailx -r \“\” -s \“911 Alert from ext ${AMPUSER} - ${AMPUSERCIDNAME}\””))

(Tom Ray) #29

The System() application use to be called on as System(command|args|args) now it is System(command), piping out to a command via System() is going to trigger that warning not error about having old syntax in your dialplan.

Personally, I feel this is one of those old methods (from way back in the day) that people just used for quick and dirty execution. I do something like this myself

exten => s,1,ExecIf($["${OUTNUM}"=“xxxxx”]?System(/var/lib/scripts/911alert.php ${AMPUSER} ${AMPUSERCIDNAME} ${STRFTIME(%C%m%d%y%H%M)})

Allowing me more flexibility to compose the email, do any database or other actions and send the email to multiple people.

You could, of course, use your preferred language to do such a thing. Like I said though, echoing text out to the STDOUT and piping into another system program is rather antiquated. To me at least.

(Greg) #30

I resolved it by writing a little shell script and passing the {AMPUSER} and {AMPUSERCIDNAME} to it.

As far as piping being antiquated, so am I. XD I’ve been using some form of *NIX since 1986.

Old dogs… new tricks… etc.

(Greg) #31

So, final thoughts on this.

  1. Yes, you’re right… it throws a warning, not an error.
  2. I forgot that I pre-pend a 1 onto 10-digit calls, so it probably WOULD have worked, had I put the 1 in front of my test number.
  3. I ended up writing a little shell script and passing the parameters to it, which also didn’t work, until I put the 1 in front of my test number… so, as I said, in #2, it probably would have worked, just thrown a warning.
  4. I feel like an idiot. LOL

(Avayax) #32

It certainly would have.