Signed-off-by: Jan Janak <[email protected]>
@@ -174,3 +174,29 @@ int print_rr_body(struct hdr_field *iroute, str *oroute, int order,
error:
return -1;
}
+
+/*!
+ * Path must be available. Function returns the first uri
+ * from Path without any duplication.
+ */
+int get_path_dst_uri(str *_p, str *_dst)
+{
+ rr_t *route = 0;
+ LM_DBG("path for branch: '%.*s'\n", _p->len, _p->s);
+ if(parse_rr_body(_p->s, _p->len, &route) < 0) {
+ LM_ERR("failed to parse Path body\n");
+ return -1;
+ }
+ if(!route) {
+ LM_ERR("failed to parse Path body no head found\n");
+ *_dst = route->nameaddr.uri;
+ free_rr(&route);
+ return 0;
+}
@@ -17,5 +17,6 @@ struct sip_uri* parse_from_uri(struct sip_msg* msg);
int print_rr_body(struct hdr_field *iroute, str *oroute, int order,
unsigned int * nb_recs);
+int get_path_dst_uri(str *_p, str *_dst);
#endif /* _PARSER_HELPERS_H */