|
@@ -44,6 +44,7 @@ static int geoip2_rpc_init(void);
|
|
|
|
|
|
static int w_geoip2_match(struct sip_msg* msg, char* str1, char* str2);
|
|
|
static int geoip2_match(sip_msg_t *msg, str *tomatch, str *pvclass);
|
|
|
+static int geoip2_resid_param(modparam_t type, void* val);
|
|
|
|
|
|
static pv_export_t mod_pvs[] = {
|
|
|
{ {"gip2", sizeof("gip2")-1}, PVT_OTHER, pv_get_geoip2, 0,
|
|
@@ -51,7 +52,6 @@ static pv_export_t mod_pvs[] = {
|
|
|
{ {0, 0}, 0, 0, 0, 0, 0, 0, 0 }
|
|
|
};
|
|
|
|
|
|
-
|
|
|
static cmd_export_t cmds[]={
|
|
|
{"geoip2_match", (cmd_function)w_geoip2_match, 2, fixup_spve_spve,
|
|
|
0, ANY_ROUTE},
|
|
@@ -59,7 +59,8 @@ static cmd_export_t cmds[]={
|
|
|
};
|
|
|
|
|
|
static param_export_t params[]={
|
|
|
- {"path", PARAM_STRING, &geoip2_path},
|
|
|
+ {"path", PARAM_STRING, &geoip2_path},
|
|
|
+ {"resid", PARAM_STR|PARAM_USE_FUNC, &geoip2_resid_param},
|
|
|
{0, 0, 0}
|
|
|
};
|
|
|
|
|
@@ -76,7 +77,6 @@ struct module_exports exports = {
|
|
|
mod_destroy /* module destroy function */
|
|
|
};
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* init module function
|
|
|
*/
|
|
@@ -113,6 +113,19 @@ static void mod_destroy(void)
|
|
|
geoip2_destroy_pv();
|
|
|
}
|
|
|
|
|
|
+static int geoip2_resid_param(modparam_t type, void* val)
|
|
|
+{
|
|
|
+ str rname;
|
|
|
+
|
|
|
+ rname = *((str*)val);
|
|
|
+ if(sr_geoip2_add_resid(&rname) < 0) {
|
|
|
+ LM_ERR("failed to register result container with id: %.*s\n",
|
|
|
+ rname.len, rname.s);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
static int geoip2_match(sip_msg_t *msg, str *tomatch, str *pvclass)
|
|
|
{
|
|
|
geoip2_pv_reset(pvclass);
|
|
@@ -192,4 +205,4 @@ static sr_kemi_t sr_kemi_geoip2_exports[] = {
|
|
|
int mod_register(char *path, int *dlflags, void *p1, void *p2) {
|
|
|
sr_kemi_modules_add(sr_kemi_geoip2_exports);
|
|
|
return 0;
|
|
|
-}
|
|
|
+}
|