Module: kamailio
Branch: master
Commit: d75e10f983e7afaa7779e8fde6524d7eccdfd497
URL:
https://github.com/kamailio/kamailio/commit/d75e10f983e7afaa7779e8fde6524d7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-03-20T16:07:16+01:00
pvtpl: renamed pvtpl_apply() to pvtpl_render()
---
Modified: src/modules/pvtpl/doc/pvtpl_admin.xml
Modified: src/modules/pvtpl/pvtpl_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d75e10f983e7afaa7779e8fde6524d7…
Patch:
https://github.com/kamailio/kamailio/commit/d75e10f983e7afaa7779e8fde6524d7…
---
diff --git a/src/modules/pvtpl/doc/pvtpl_admin.xml
b/src/modules/pvtpl/doc/pvtpl_admin.xml
index 8ccfb8f9a23..8ca0174d3c4 100644
--- a/src/modules/pvtpl/doc/pvtpl_admin.xml
+++ b/src/modules/pvtpl/doc/pvtpl_admin.xml
@@ -105,24 +105,22 @@ modparam("pvtpl", "tpl",
"name=tpl2;fpath=/etc/kamailio/tpl2.pvtpl;bsize=256;")
<section>
<title>Functions</title>
- <section id="pvtpl.f.pvtpl_apply">
+ <section id="pvtpl.f.pvtpl_render">
<title>
- <function moreinfo="none">pvtpl_apply(tplname, res)</function>
+ <function moreinfo="none">pvtpl_render(tplname, res)</function>
</title>
<para>
- Encrypts the text with the key using AES256 ECB encryption algorithm.
- The result is encoded in base64 format and stored in res. The parameter
- res must be a read-write variables. The parameters text and key can
- be static strings or strings with variables (dynamic strings).
+ Render the template 'tplname' using config variables, setting the result
+ in the variable specified by 'res'.
</para>
<para>
This function can be used from ANY_ROUTE.
</para>
<example>
- <title><function>gcrypt_aes_encrypt</function> usage</title>
+ <title><function>pvtpl_render</function> usage</title>
<programlisting format="linespecific">
...
-gcrypt_aes_encrypt("$rb", "my-secret-key",
"$var(encrypted)");
+pvtpl_render("t1", "$var(out)")
...
</programlisting>
</example>
diff --git a/src/modules/pvtpl/pvtpl_mod.c b/src/modules/pvtpl/pvtpl_mod.c
index 15ee74b6838..9862a225236 100644
--- a/src/modules/pvtpl/pvtpl_mod.c
+++ b/src/modules/pvtpl/pvtpl_mod.c
@@ -42,7 +42,7 @@ static int mod_init(void);
static int child_init(int);
static void mod_destroy(void);
-static int w_pvtpl_apply(sip_msg_t *msg, char *ptplname, char *popv);
+static int w_pvtpl_render(sip_msg_t *msg, char *ptplname, char *popv);
/* clang-format off */
typedef struct pvtpl_item {
@@ -61,7 +61,7 @@ static pvtpl_item_t *_pvtpl_list = NULL;
/* clang-format off */
static cmd_export_t cmds[]={
- {"pvtpl_apply", (cmd_function)w_pvtpl_apply, 2, fixup_spve_pvar,
+ {"pvtpl_render", (cmd_function)w_pvtpl_render, 2, fixup_spve_pvar,
fixup_free_spve_pvar, ANY_ROUTE},
{0, 0, 0, 0, 0, 0}
@@ -278,7 +278,7 @@ static int pvtpl_tpl_param(modparam_t type, void *val)
/**
*
*/
-static int pvtpl_apply(sip_msg_t *msg, str *tplname, pv_spec_t *dst)
+static int pvtpl_render(sip_msg_t *msg, str *tplname, pv_spec_t *dst)
{
pvtpl_item_t *it;
pv_value_t val;
@@ -313,7 +313,7 @@ static int pvtpl_apply(sip_msg_t *msg, str *tplname, pv_spec_t *dst)
/**
*
*/
-static int ki_pvtpl_apply(sip_msg_t *msg, str *tplname, str *opv)
+static int ki_pvtpl_render(sip_msg_t *msg, str *tplname, str *opv)
{
pv_spec_t *dst;
@@ -324,13 +324,13 @@ static int ki_pvtpl_apply(sip_msg_t *msg, str *tplname, str *opv)
return -1;
}
- return pvtpl_apply(msg, tplname, dst);
+ return pvtpl_render(msg, tplname, dst);
}
/**
*
*/
-static int w_pvtpl_apply(sip_msg_t *msg, char *ptplname, char *popv)
+static int w_pvtpl_render(sip_msg_t *msg, char *ptplname, char *popv)
{
str tplname;
pv_spec_t *dst;
@@ -341,7 +341,7 @@ static int w_pvtpl_apply(sip_msg_t *msg, char *ptplname, char *popv)
}
dst = (pv_spec_t *)popv;
- return pvtpl_apply(msg, &tplname, dst);
+ return pvtpl_render(msg, &tplname, dst);
}
/**
@@ -349,8 +349,8 @@ static int w_pvtpl_apply(sip_msg_t *msg, char *ptplname, char *popv)
*/
/* clang-format off */
static sr_kemi_t sr_kemi_pvtpl_exports[] = {
- { str_init("pvtpl"), str_init("pvtpl_apply"),
- SR_KEMIP_INT, ki_pvtpl_apply,
+ { str_init("pvtpl"), str_init("pvtpl_render"),
+ SR_KEMIP_INT, ki_pvtpl_render,
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},