1
0
Fork 0
mbuni/mbuni/mmlib/mms_billing_shell.c

49 lines
953 B
C

#include <stdio.h>
#include <stdlib.h>
#include "mms_billing.h"
static Octstr *script = NULL;
static void *mms_billingmodule_init(char *settings)
{
script = octstr_create(settings);
return NULL;
}
static int mms_billingmodule_fini(void *module_data)
{
return 0;
}
static double mms_billmsg(Octstr *from, List *to, unsigned long msg_size, void *module_data)
{
int i;
if (script == NULL || octstr_len(script) == 0)
return 0;
for (i=0;i<list_len(to);i++) {
Octstr *s;
s = octstr_format("%s '%s' '%s'", octstr_get_cstr(script), octstr_get_cstr(from), octstr_get_cstr(list_get(to, i)));
if (s) {
system(octstr_get_cstr(s));
octstr_destroy(s);
}
}
return 0;
}
static int mms_logcdr(MmsCdrStruct *cdr)
{
return 0;
}
/* The function itself. */
MmsBillingFuncStruct mms_billfuncs = {
mms_billingmodule_init,
mms_logcdr,
mms_billmsg,
mms_billingmodule_fini
};