1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
//
// Filename: mfe.c
//
#define Version "000"
//
// Edit date: 2010-03-30
//
// Facility: Asterisk
//
// Abstract: My First Externalivr
//
// Environment: Asterisk
//
// Author: Steven L. Edwards
//
// Modified by
//
// 000 2010-03-30 SLE Create.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
int main(int argc, char **argv)
{
auto char event[256];
auto int idx;
// Set the syslog ident
openlog("mfe", LOG_PID, LOG_USER);
// announce ourselves
syslog(LOG_ERR, "Starting.");
// show how we were executed
idx = 0;
syslog(LOG_ERR, "argc = %d", argc);
while (idx < argc)
{
syslog(LOG_ERR
, "arg[%d] = \"%s\""
, idx
, argv[idx]
);
++idx;
}
// play a file
printf("S,demo-congrats\n");
fflush(stdout);
// read events
while (NULL != fgets(event, sizeof(event), stdin))
{
syslog(LOG_ERR, event);
if ('#' == *event)
{
break;
}
}
// Function exit
return(EXIT_SUCCESS); // return function status
}
// end of main()
// (end of mfe.c)
|