From a23ede7247b52ddc53dc0186810923dc1ae8c51c Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Thu, 14 Apr 2022 12:11:37 +0200 Subject: [PATCH] corex: added forward_reply() function - forward received reply on demand --- src/modules/corex/corex_mod.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/modules/corex/corex_mod.c b/src/modules/corex/corex_mod.c index 765bedf5f19..3c6b6a59f41 100644 --- a/src/modules/corex/corex_mod.c +++ b/src/modules/corex/corex_mod.c @@ -34,6 +34,7 @@ #include "../../core/str_list.h" #include "../../core/events.h" #include "../../core/onsend.h" +#include "../../core/forward.h" #include "../../core/dns_cache.h" #include "../../core/parser/parse_uri.h" #include "../../core/parser/parse_param.h" @@ -47,6 +48,7 @@ MODULE_VERSION static int nio_intercept = 0; +static int w_forward_reply(sip_msg_t *msg, char *p1, char *p2); static int w_append_branch(sip_msg_t *msg, char *su, char *sq); static int w_send_udp(sip_msg_t *msg, char *su, char *sq); static int w_send_tcp(sip_msg_t *msg, char *su, char *sq); @@ -105,6 +107,8 @@ static tr_export_t mod_trans[] = { }; static cmd_export_t cmds[]={ + {"forward_reply", (cmd_function)w_forward_reply, 0, 0, + 0, CORE_ONREPLY_ROUTE }, {"append_branch", (cmd_function)w_append_branch, 0, 0, 0, REQUEST_ROUTE | FAILURE_ROUTE }, {"append_branch", (cmd_function)w_append_branch, 1, fixup_spve_null, @@ -249,6 +253,7 @@ static int child_init(int rank) return 0; } + /** * destroy module function */ @@ -256,6 +261,15 @@ static void mod_destroy(void) { } +/** + * forward reply based on via + */ +static int w_forward_reply(sip_msg_t *msg, char *p1, char *p2) +{ + forward_reply(msg); + return 1; +} + /** * config wrapper for append branch */