Module: kamailio
Branch: master
Commit: ff1a1d0adef9dbfeb9a523297027a162c2f644ea
URL:
https://github.com/kamailio/kamailio/commit/ff1a1d0adef9dbfeb9a523297027a16…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-01-31T17:30:07+01:00
core: dset - added function to set contact alias parameter name
---
Modified: src/core/dset.c
Modified: src/core/dset.h
---
Diff:
https://github.com/kamailio/kamailio/commit/ff1a1d0adef9dbfeb9a523297027a16…
Patch:
https://github.com/kamailio/kamailio/commit/ff1a1d0adef9dbfeb9a523297027a16…
---
diff --git a/src/core/dset.c b/src/core/dset.c
index f682cede71..26530c2769 100644
--- a/src/core/dset.c
+++ b/src/core/dset.c
@@ -873,6 +873,30 @@ int msg_get_src_addr(sip_msg_t *msg, str *uri, int mode)
return 0;
}
+
+/**
+ * set name of alias parameter used for contact/r-uri src/rcv address encoding
+ */
+int ksr_contact_alias_set_name(str *aname)
+{
+ _ksr_contact_salias.s = (char*)pkg_malloc(aname->len + 3);
+ if(_ksr_contact_salias.s==NULL) {
+ PKG_MEM_ERROR;
+ return -1;
+ }
+ _ksr_contact_salias.s[0] = ';';
+ memcpy(_ksr_contact_salias.s + 1, aname->s, aname->len);
+ _ksr_contact_salias.s[aname->len+1] = '=';
+ _ksr_contact_salias.s[aname->len+2] = '\0';
+ _ksr_contact_salias.len = aname->len + 2;
+ _ksr_contact_alias.s = _ksr_contact_salias.s + 1;
+ _ksr_contact_alias.len = _ksr_contact_salias.len - 1;
+ LM_DBG("new contact alias parameter expression [%.*s]\n",
+ _ksr_contact_salias.len, _ksr_contact_salias.s);
+
+ return 0;
+}
+
/**
* add alias parameter with encoding of source address
* - nuri->s must point to a buffer of nuri->len size
diff --git a/src/core/dset.h b/src/core/dset.h
index 56ffe953eb..b661fc7c84 100644
--- a/src/core/dset.h
+++ b/src/core/dset.h
@@ -285,6 +285,7 @@ int getbflagsval(unsigned int branch, flag_t* res);
*/
int setbflagsval(unsigned int branch, flag_t val);
+int ksr_contact_alias_set_name(str *aname);
int uri_add_rcv_alias(sip_msg_t *msg, str *uri, str *nuri);
int uri_restore_rcv_alias(str *uri, str *nuri, str *suri);
int uri_trim_rcv_alias(str *uri, str *nuri);