From 2e5b49d9f210a8a1cc8253e9a7ed31921fe0d853 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Thu, 12 Apr 2018 12:12:23 +0200 Subject: [PATCH] corex: added via_add_srvid() function --- src/modules/corex/corex_mod.c | 38 ++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/modules/corex/corex_mod.c b/src/modules/corex/corex_mod.c index c78ba1bb229..e8ce8787fc7 100644 --- a/src/modules/corex/corex_mod.c +++ b/src/modules/corex/corex_mod.c @@ -54,6 +54,7 @@ static int w_setxflag(struct sip_msg *msg, char *flag, char *s2); static int w_set_send_socket(sip_msg_t *msg, char *psock, char *p2); static int w_set_recv_socket(sip_msg_t *msg, char *psock, char *p2); static int w_set_source_address(sip_msg_t *msg, char *paddr, char *p2); +static int w_via_add_srvid(sip_msg_t *msg, char *pflags, char *p2); static int fixup_file_op(void** param, int param_no); @@ -111,6 +112,8 @@ static cmd_export_t cmds[]={ 0, ANY_ROUTE }, {"set_source_address", (cmd_function)w_set_source_address, 1, fixup_spve_null, 0, ANY_ROUTE }, + {"via_add_srvid", (cmd_function)w_via_add_srvid, 1, fixup_igp_null, + 0, ANY_ROUTE }, {0, 0, 0, 0, 0, 0} }; @@ -120,7 +123,7 @@ static param_export_t params[]={ (void*)corex_alias_subdomains_param}, {"network_io_intercept", INT_PARAM, &nio_intercept}, {"min_msg_len", INT_PARAM, &nio_min_msg_len}, - {"msg_avp", PARAM_STR, &nio_msg_avp_param}, + {"msg_avp", PARAM_STR, &nio_msg_avp_param}, {0, 0, 0} }; @@ -687,6 +690,34 @@ static int w_set_source_address(sip_msg_t *msg, char *paddr, char *p2) return ki_set_source_address(msg, &saddr); } +/** + * + */ +static int ki_via_add_srvid(sip_msg_t *msg, int fval) +{ + if(msg==NULL) + return -1; + if(fval) { + msg->msg_flags |= FL_ADD_SRVID; + } else { + msg->msg_flags &= ~(FL_ADD_SRVID); + } + return 1; +} + +/** + * + */ +static int w_via_add_srvid(sip_msg_t *msg, char *pflags, char *s2) +{ + int fval=0; + if(fixup_get_ivalue(msg, (gparam_t*)pflags, &fval)!=0) { + LM_ERR("no flag value\n"); + return -1; + } + return ki_via_add_srvid(msg, fval); +} + /** * */ @@ -737,6 +768,11 @@ static sr_kemi_t sr_kemi_corex_exports[] = { { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } }, + { str_init("corex"), str_init("via_add_srvid"), + SR_KEMIP_INT, ki_via_add_srvid, + { SR_KEMIP_INT, 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 } } };