Skip to content

Commit

Permalink
influxdbc: added functions to push string and double values
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Feb 1, 2024
1 parent 4efd1fc commit ff94b5a
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/modules/influxdbc/influxdbc_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ static int w_influxdbc_measure(sip_msg_t *msg, char *pname, char *p2);
static int w_influxdbc_measureend(sip_msg_t *msg, char *p1, char *p2);
static int w_influxdbc_push(sip_msg_t *msg, char *p1, char *p2);
static int w_influxdbc_long(sip_msg_t *msg, char *pname, char *pvalue);
static int w_influxdbc_string(sip_msg_t *msg, char *pname, char *pvalue);
static int w_influxdbc_double(sip_msg_t *msg, char *pname, char *pvalue);

static int mod_init(void);
static int child_init(int);
Expand All @@ -64,6 +66,10 @@ static cmd_export_t cmds[] = {
0, 0, 0, ANY_ROUTE},
{"influxdbc_long", (cmd_function)w_influxdbc_long,
2, fixup_spve_igp, 0, ANY_ROUTE},
{"influxdbc_string", (cmd_function)w_influxdbc_string,
2, fixup_spve_spve, 0, ANY_ROUTE},
{"influxdbc_double", (cmd_function)w_influxdbc_double,
2, fixup_spve_spve, 0, ANY_ROUTE},

{0, 0, 0, 0, 0, 0}
};
Expand Down Expand Up @@ -195,6 +201,53 @@ static int w_influxdbc_long(sip_msg_t *msg, char *pname, char *pvalue)
return 1;
}

/**
*
*/
static int w_influxdbc_string(sip_msg_t *msg, char *pname, char *pvalue)
{
str sname;
str sval;

if(fixup_get_svalue(msg, (gparam_t *)pname, &sname) != 0) {
LM_ERR("unable to get name parameter\n");
return -1;
}
if(fixup_get_svalue(msg, (gparam_t *)pvalue, &sval) != 0) {
LM_ERR("unable to get value parameter\n");
return -1;
}

ic_string(sname.s, sval.s);

return 1;
}


/**
*
*/
static int w_influxdbc_double(sip_msg_t *msg, char *pname, char *pvalue)
{
str sname;
str sval;
double dval = 0.0;

if(fixup_get_svalue(msg, (gparam_t *)pname, &sname) != 0) {
LM_ERR("unable to get name parameter\n");
return -1;
}
if(fixup_get_svalue(msg, (gparam_t *)pvalue, &sval) != 0) {
LM_ERR("unable to get value parameter\n");
return -1;
}

ic_double(sname.s, dval);

return 1;
}


/**
*
*/
Expand Down

0 comments on commit ff94b5a

Please sign in to comment.