Bug fix in mms_billing_shell.c - honour return value of script
This commit is contained in:
parent
05d1910723
commit
7efbee12b7
|
@ -33,7 +33,7 @@ static int mms_billingmodule_fini(void *module_data)
|
||||||
return module_data ? fclose(module_data) : -1;
|
return module_data ? fclose(module_data) : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static double mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data)
|
static int mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ typedef struct MmsBillingFuncStruct {
|
||||||
/* Bills a message. Returns >= 0 if billed ok, -1 if message should be rejected,
|
/* Bills a message. Returns >= 0 if billed ok, -1 if message should be rejected,
|
||||||
* -2 on internal (temporary) error.
|
* -2 on internal (temporary) error.
|
||||||
*/
|
*/
|
||||||
double (*mms_billmsg)(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data);
|
int (*mms_billmsg)(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data);
|
||||||
|
|
||||||
int (*mms_billingmodule_fini)(void *module_data);
|
int (*mms_billingmodule_fini)(void *module_data);
|
||||||
} MmsBillingFuncStruct;
|
} MmsBillingFuncStruct;
|
||||||
|
|
|
@ -33,7 +33,7 @@ static int mms_billingmodule_fini(void *module_data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static double mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data)
|
static int mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -43,8 +43,12 @@ static double mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr
|
||||||
Octstr *s;
|
Octstr *s;
|
||||||
s = octstr_format("%s '%s' '%s'", octstr_get_cstr(script), octstr_get_cstr(from), octstr_get_cstr(list_get(to, i)));
|
s = octstr_format("%s '%s' '%s'", octstr_get_cstr(script), octstr_get_cstr(from), octstr_get_cstr(list_get(to, i)));
|
||||||
if (s) {
|
if (s) {
|
||||||
system(octstr_get_cstr(s));
|
int ret = system(octstr_get_cstr(s));
|
||||||
octstr_destroy(s);
|
octstr_destroy(s);
|
||||||
|
if (ret < 0)
|
||||||
|
return -2;
|
||||||
|
else if (WEXITSTATUS(ret) != 0)
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue