How to use Alarm Receiver eventcmd

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

How to use Alarm Receiver eventcmd

Postby edatsecure » Tue Jan 26, 2016 12:22 am

I have been trying to create a program (in C) to read events from Alarm Receiver. The documentation states that
Once the panel hangs up, the application will run the command line specified by the eventcmd setting in alarmreceiver.conf and pipe the events to the standard input of the application.
However, when I run my program nothing is piped to it.

I know my program runs because it creates a file and I know that Alarm Receiver is logging events because it creates the event log. My test program is below. Am I misinterpreting how the event is sent to the program, or just writing my program incorrectly? Any help with this would be appreciated.

Code: Select all
#include <stdio.h>

int main(int argc, char *argv[]){
   FILE *fp;
   char str[100];
   
   fp=fopen("/tmp/testEventLog.txt", "a");
   
   while(scanf("%s", str) != -1){
      fprintf(fp, "%s\n", str);
   }
   fprintf(fp, "---\n");
   fclose(fp);
}


Thank you very much,
-ED
edatsecure
Newsterisk
 
Posts: 3
Joined: Tue Jan 12, 2016 11:13 pm

Return to Asterisk Support

Who is online

Users browsing this forum: Google [Bot] and 15 guests