typedef struct fs_command_s fs_command_t;
struct fs_command_s
{
- char *line; // "api sofia status profile res-public"
- char *instance; // "profile-sofia-res-public"
- char *buffer; // <output from esl command as a char*>
- size_t buffer_size; // strlen(*buffer)+3
- size_t buffer_fill; // 0 or 1
+ char *line; /* "api sofia status profile res-public" */
+ char *instance; /* "profile-sofia-res-public" */
+ char *buffer; /* <output from esl command as a char*> */
+ size_t buffer_size; /* strlen(*buffer)+3 */
+ size_t buffer_fill; /* 0 or 1 */
fs_match_t *matches;
fs_command_t *next;
};
static char *fs_pass = NULL;
static esl_handle_t esl_handle = {{0}};
-// static int thread_running = 0; // for when subscribing to esl events
+/* static int thread_running = 0; for when subscribing to esl events */
/*
* Private functions
} /* while (status == 0) */
if (status != 0)
- return (status);
+ return (status);
fs_match->match = match_create_simple (fs_match->regex, fs_match->dstype);
if (fs_match->match == NULL)
{
oconfig_item_t *child = ci->children + i;
+ /* FIXME: Don't simply dereference the
+ * child->values[0].value.string pointer! */
if (strcasecmp ("Host", child->key) == 0)
{
- if (fs_host != NULL) free (fs_host);
+ if (fs_host != NULL)
+ free (fs_host);
fs_host = strdup(child->values[0].value.string);
}
else if (strcasecmp ("Port", child->key) == 0)
{
- if (fs_port != NULL) free (fs_port);
+ if (fs_port != NULL)
+ free (fs_port);
fs_port = strdup(child->values[0].value.string);
}
else if (strcasecmp ("Password", child->key) == 0)
{
- if (fs_pass != NULL) free (fs_pass);
+ if (fs_pass != NULL)
+ free (fs_pass);
fs_pass = strdup(child->values[0].value.string);
}
else if (strcasecmp ("Command", child->key) == 0)
else
errors++;
}
+ /* FIXME: This plugin should have a `Interval' option. */
else
{
- WARNING ("freeswitch plugin: Option '%s' not allowed here.", child->key);
+ WARNING ("freeswitch plugin: Option '%s' not allowed here.",
+ child->key);
errors++;
}
}
return (0);
} /* int fs_read */
-/*
+#if 0
static void *msg_thread_run(esl_thread_t *me, void *obj)
{
esl_handle_t *esl_handle = (esl_handle_t *) obj;
thread_running = 1;
- // Maybe do some more in this loop later, like receive subscribed events,
- // and create statistics of them
- // see fs_cli.c function static void *msg_thread_run(), around line 198
+ /* Maybe do some more in this loop later, like receive subscribed
+ * events, and create statistics of them see fs_cli.c function static
+ * void *msg_thread_run(), around line 198 */
while (thread_running && esl_handle->connected)
{
esl_status_t status = esl_recv_event_timed(esl_handle, 10, 1, NULL);
if (status == ESL_FAIL)
{
- //DEBUG ("Disconnected [%s]\n", ESL_LOG_WARNING); // todo fixit
+ /* TODO FIXME
+ DEBUG ("Disconnected [%s]\n", ESL_LOG_WARNING);
+ */
DEBUG ("Disconnected [%s]\n", "ESL_LOG_WARNING");
thread_running = 0;
}
thread_running = 0;
return (NULL);
} */ /* void *msg_thread_run */
+#endif
static int fs_init (void)
{
if (fs_pass == NULL) fs_pass = FS_DEF_PASS;
/* Connect to FreeSWITCH over ESL */
- DEBUG ("freeswitch plugin: making ESL connection to %s %s %s\n", fs_host, fs_port, fs_pass);
+ DEBUG ("freeswitch plugin: making ESL connection to %s %s %s\n",
+ fs_host, fs_port, fs_pass);
if (esl_connect(&esl_handle, fs_host, atoi(fs_port), fs_pass))
{
- ERROR ("freeswitch plugin: connection failed [%s]", esl_handle.err);
+ ERROR ("freeswitch plugin: connection failed [%s]",
+ esl_handle.err);
return (-1);
}
/* Start a seperate thread for incoming events here */
- //esl_thread_create_detached(msg_thread_run, &esl_handle);
+ /* esl_thread_create_detached(msg_thread_run, &esl_handle); */
return(0);
} /* int fs_init */
static int fs_shutdown (void)
{
DEBUG ("freeswitch plugin: disconnecting");
- if (esl_handle.connected) esl_disconnect(&esl_handle);
+ if (esl_handle.connected)
+ esl_disconnect(&esl_handle);
fs_command_free (fs_commands_g);
fs_commands_g = NULL;
return (0);