|
@@ -60,7 +60,7 @@ static cmd_export_t cmds[]={
|
|
|
{"jsonrpc_notification", (cmd_function)jsonrpc_notification, 2, fixup_notification, 0, ANY_ROUTE},
|
|
|
{0, 0, 0, 0, 0, 0}
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
|
|
|
/*
|
|
|
* Script Parameters
|
|
@@ -71,23 +71,23 @@ static param_export_t mod_params[]={
|
|
|
{ 0,0,0 }
|
|
|
};
|
|
|
|
|
|
-
|
|
|
+
|
|
|
/*
|
|
|
* Exports
|
|
|
*/
|
|
|
struct module_exports exports = {
|
|
|
- "jsonrpcc", /* module name */
|
|
|
- DEFAULT_DLFLAGS, /* dlopen flags */
|
|
|
- cmds, /* Exported functions */
|
|
|
- mod_params, /* Exported parameters */
|
|
|
- 0, /* exported statistics */
|
|
|
- 0, /* exported MI functions */
|
|
|
- 0, /* exported pseudo-variables */
|
|
|
- 0, /* extra processes */
|
|
|
- mod_init, /* module initialization function */
|
|
|
- 0, /* response function*/
|
|
|
- 0, /* destroy function */
|
|
|
- child_init /* per-child init function */
|
|
|
+ "jsonrpcc", /* module name */
|
|
|
+ DEFAULT_DLFLAGS, /* dlopen flags */
|
|
|
+ cmds, /* Exported functions */
|
|
|
+ mod_params, /* Exported parameters */
|
|
|
+ 0, /* exported statistics */
|
|
|
+ 0, /* exported MI functions */
|
|
|
+ 0, /* exported pseudo-variables */
|
|
|
+ 0, /* extra processes */
|
|
|
+ mod_init, /* module initialization function */
|
|
|
+ 0, /* response function*/
|
|
|
+ 0, /* destroy function */
|
|
|
+ child_init /* per-child init function */
|
|
|
};
|
|
|
|
|
|
|
|
@@ -97,12 +97,14 @@ static int mod_init(void) {
|
|
|
/* load the tm functions */
|
|
|
if ( !(load_tm=(load_tm_f)find_export("load_tm", NO_SCRIPT, 0)))
|
|
|
{
|
|
|
- LOG(L_ERR, "ERROR:jsonrpc:mod_init: cannot import load_tm\n");
|
|
|
+ LM_ERR("failed find tm - cannot import load_tm\n");
|
|
|
return -1;
|
|
|
}
|
|
|
/* let the auto-loading function load all TM stuff */
|
|
|
- if (load_tm( &tmb )==-1)
|
|
|
+ if (load_tm( &tmb )==-1) {
|
|
|
+ LM_ERR("failed to bind to tm api\n");
|
|
|
return -1;
|
|
|
+ }
|
|
|
|
|
|
if (servers_param == NULL) {
|
|
|
LM_ERR("servers parameter missing.\n");
|
|
@@ -130,8 +132,10 @@ static int child_init(int rank)
|
|
|
return 0;
|
|
|
|
|
|
pid=fork_process(PROC_NOCHLDINIT, "jsonrpc io handler", 1);
|
|
|
- if (pid<0)
|
|
|
+ if (pid<0) {
|
|
|
+ LM_ERR("failed to fork jsonrpc io handler\n");
|
|
|
return -1; /* error */
|
|
|
+ }
|
|
|
if(pid==0){
|
|
|
/* child */
|
|
|
close(pipe_fds[1]);
|
|
@@ -144,7 +148,7 @@ static int child_init(int rank)
|
|
|
|
|
|
static int fixup_request(void** param, int param_no)
|
|
|
{
|
|
|
- if (param_no <= 4) {
|
|
|
+ if (param_no <= 4) {
|
|
|
return fixup_spve_null(param, 1);
|
|
|
} else if (param_no == 5) {
|
|
|
return fixup_pvar_null(param, 1);
|
|
@@ -155,7 +159,7 @@ static int fixup_request(void** param, int param_no)
|
|
|
|
|
|
static int fixup_notification(void** param, int param_no)
|
|
|
{
|
|
|
- if (param_no <= 2) {
|
|
|
+ if (param_no <= 2) {
|
|
|
return fixup_spve_null(param, 1);
|
|
|
}
|
|
|
LM_ERR("jsonrpc_notification takes exactly 2 parameters.\n");
|
|
@@ -164,7 +168,7 @@ static int fixup_notification(void** param, int param_no)
|
|
|
|
|
|
static int fixup_request_free(void** param, int param_no)
|
|
|
{
|
|
|
- if (param_no <= 4) {
|
|
|
+ if (param_no <= 4) {
|
|
|
return 0;
|
|
|
} else if (param_no == 5) {
|
|
|
return fixup_free_pvar_null(param, 1);
|