From 28f00b4452f329c9f5b08abb0d7abaf31cc41fca Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Thu, 9 Jan 2020 17:09:28 +0100 Subject: [PATCH] keepalive: use dedicated wrappers for kemi exports --- src/modules/keepalive/keepalive_mod.c | 28 +++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/modules/keepalive/keepalive_mod.c b/src/modules/keepalive/keepalive_mod.c index 8355b6c4f9d..3a10a44868c 100644 --- a/src/modules/keepalive/keepalive_mod.c +++ b/src/modules/keepalive/keepalive_mod.c @@ -188,6 +188,18 @@ static int w_add_destination(sip_msg_t *msg, char *uri, char *owner) return ka_add_dest(&suri, &sowner, 0, 0, 0); } + +/*! + * + */ +static int ki_add_destination(sip_msg_t *msg, str *uri, str *owner) +{ + if(ka_alloc_destinations_list() < 0) + return -1; + + return ka_add_dest(uri, owner, 0, 0, 0); +} + /*! * @function w_del_destination_f * @abstract deletes given sip uri in allocated destination stack as named ka_alloc_destinations_list @@ -214,6 +226,14 @@ static int w_del_destination(sip_msg_t *msg, char *uri, char *owner) return ka_del_destination(&suri, &sowner); } +/*! + * + */ +static int ki_del_destination(sip_msg_t *msg, str *uri, str *owner) +{ + return ka_del_destination(uri, owner); +} + /* * Function callback executer per module param "destination". * Is just a wrapper to ka_add_dest() api function @@ -290,12 +310,12 @@ static sr_kemi_t sr_kemi_keepalive_exports[] = { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } }, { str_init("keepalive"), str_init("add_destination"), - SR_KEMIP_INT, ka_add_dest, - { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT, - SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE } + SR_KEMIP_INT, ki_add_destination, + { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } }, { str_init("keepalive"), str_init("del_destination"), - SR_KEMIP_INT, ka_del_destination, + SR_KEMIP_INT, ki_del_destination, { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } },