Module: kamailio
Branch: master
Commit: d5030adfaab5627791ea31a26141719349dba4b2
URL:
https://github.com/kamailio/kamailio/commit/d5030adfaab5627791ea31a26141719…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-12-13T16:09:03+01:00
rr: new function rr_next_hop_route()
- return 1 (true) if there is a route header for next hop address
---
Modified: src/modules/rr/loose.c
Modified: src/modules/rr/rr_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d5030adfaab5627791ea31a26141719…
Patch:
https://github.com/kamailio/kamailio/commit/d5030adfaab5627791ea31a26141719…
---
diff --git a/src/modules/rr/loose.c b/src/modules/rr/loose.c
index 1440b6da98..28bc700941 100644
--- a/src/modules/rr/loose.c
+++ b/src/modules/rr/loose.c
@@ -893,6 +893,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
uri.len, ZSW(uri.s));
return RR_ERROR;
}
+ _m->msg_flags |= FL_ROUTE_ADDR;
} else {
#ifdef ENABLE_USER_CHECK
/* check if it the ignored user */
diff --git a/src/modules/rr/rr_mod.c b/src/modules/rr/rr_mod.c
index 5b742223f9..fa8345e36c 100644
--- a/src/modules/rr/rr_mod.c
+++ b/src/modules/rr/rr_mod.c
@@ -80,6 +80,7 @@ static int w_add_rr_param(struct sip_msg *,char *, char *);
static int w_check_route_param(struct sip_msg *,char *, char *);
static int w_is_direction(struct sip_msg *,char *, char *);
static int w_remove_record_route(sip_msg_t*, char*, char*);
+static int w_rr_next_hop_route(sip_msg_t *, char *, char *);
/* PV functions */
static int pv_get_route_uri_f(struct sip_msg *, pv_param_t *, pv_value_t *);
static int pv_get_from_tag_initial(sip_msg_t *msg, pv_param_t *param,
@@ -113,6 +114,8 @@ static cmd_export_t cmds[] = {
REQUEST_ROUTE},
{"remove_record_route", w_remove_record_route, 0, 0, 0,
REQUEST_ROUTE|FAILURE_ROUTE},
+ {"rr_next_hop_route", (cmd_function)w_rr_next_hop_route, 0, 0, 0,
+ ANY_ROUTE},
{"load_rr", (cmd_function)load_rr, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0}
};
@@ -756,6 +759,26 @@ static int pv_get_rdir(sip_msg_t *msg, pv_param_t *param, pv_value_t
*res)
}
}
+
+/**
+ *
+ */
+static int ki_rr_next_hop_route(sip_msg_t *msg)
+{
+ if(msg->msg_flags & FL_ROUTE_ADDR) {
+ return 1;
+ }
+ return -1;
+}
+
+/**
+ *
+ */
+static int w_rr_next_hop_route(sip_msg_t *msg, char *p1, char *p2)
+{
+ return ki_rr_next_hop_route(msg);
+}
+
/**
*
*/
@@ -806,6 +829,11 @@ static sr_kemi_t sr_kemi_rr_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("rr"), str_init("next_hop_route"),
+ SR_KEMIP_INT, ki_rr_next_hop_route,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
};
/* clang-format on */