sfree (fm);
} /* void fs_match_free */
+static void fs_command_free (fs_command_t *fc)
+{
+ if (fc == NULL)
+ return;
+
+ sfree (fc->line);
+ sfree (fc->instance);
+ sfree (fc->buffer);
+ fs_match_free (fc->matches);
+ fs_command_free (fc->next);
+ sfree (fc);
+} /* void fs_command_free */
+
static int fs_config_add_match_dstype (int *dstype_ret, oconfig_item_t *ci)
{
DEBUG ("freeswitch plugin: in fs_config_add_match_dstype");
command->line = NULL;
command->line = strdup (ci->values[0].value.string);
+
if (command->line == NULL)
{
ERROR ("freeswitch plugin: strdup failed.");
break;
}
+ if (status != 0)
+ {
+ fs_command_free (command);
+ return (status);
+ }
+
/* Add the new command to the linked list */
if (fs_commands_g == NULL)
fs_commands_g = command;
} /* int fs_complex_config */
static void fs_submit (const fs_command_t *fc,
- const fs_match_t *fm, const cu_match_value_t *fmv)
+ const fs_match_t *fm, const cu_match_value_t *mv)
{
DEBUG ("freeswitch plugin: in fs_submit");
DEBUG ("fm->type");
DEBUG (fm->type);
- DEBUG ("fmv->value");
- DEBUG (fmv->value);
+ DEBUG ("mv->value");
+ //DEBUG (mv->value);
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- values[0] = fmv->value;
+ values[0] = mv->value;
vl.values = values;
vl.values_len = 1;
DEBUG ("freeswitch plugin: output from esl (truncated):\n%s\n\n", esl_handle.last_sr_event->body);
sfree(fc->buffer);
fc->buffer = strdup(esl_handle.last_sr_event->body);
- fc->buffer_fill = 1; // ??
+ fc->buffer_size = strlen(fc->buffer);
+ fc->buffer_fill = 1;
}
for (fm = fc->matches; fm != NULL; fm = fm->next)
{
DEBUG ("freeswitch plugin: disconnecting");
esl_disconnect(&esl_handle);
+ fs_command_free (fs_commands_g);
+ fs_commands_g = NULL;
return (0);
} /* int fs_shutdown */