Module: kamailio
Branch: 5.5
Commit: 304ac124e6ad86b60071b6c5ecf861e03b7e492b
URL:
https://github.com/kamailio/kamailio/commit/304ac124e6ad86b60071b6c5ecf861e…
Author: Henning Westerholt <hw(a)skalatan.de>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-07-12T15:36:10+02:00
topos: fix missing xavu_field_contact_host evaluation for contact_mode 0
- fix missing xavu_field_contact_host evaluation for contact_mode 0
- it works currently only for contact_mode 1 and 2, but not for default mode
(cherry picked from commit 4c6abaf9066aebbd304391dd6730cad7ee592611)
---
Modified: src/modules/topos/tps_storage.c
---
Diff:
https://github.com/kamailio/kamailio/commit/304ac124e6ad86b60071b6c5ecf861e…
Patch:
https://github.com/kamailio/kamailio/commit/304ac124e6ad86b60071b6c5ecf861e…
---
diff --git a/src/modules/topos/tps_storage.c b/src/modules/topos/tps_storage.c
index 6e88b35af3..b94a960340 100644
--- a/src/modules/topos/tps_storage.c
+++ b/src/modules/topos/tps_storage.c
@@ -411,13 +411,23 @@ int tps_storage_fill_contact(sip_msg_t *msg, tps_data_t *td, str
*uuid, int dir,
*td->cp = '@';
td->cp++;
- if (_tps_contact_host.len) {
- /* using configured hostname in the contact header */
- memcpy(td->cp, _tps_contact_host.s, _tps_contact_host.len);
- td->cp += _tps_contact_host.len;
+ /* contact_host xavu takes preference */
+ if (_tps_xavu_cfg.len>0 && _tps_xavu_field_contact_host.len>0) {
+ vavu = xavu_get_child_with_sval(&_tps_xavu_cfg,
+ &_tps_xavu_field_contact_host);
+ }
+ if(vavu!=NULL && vavu->val.v.s.len>0) {
+ memcpy(td->cp, vavu->val.v.s.s, vavu->val.v.s.len);
+ td->cp += vavu->val.v.s.len;
} else {
- memcpy(td->cp, puri.host.s, puri.host.len);
- td->cp += puri.host.len;
+ if (_tps_contact_host.len) {
+ /* using configured hostname in the contact header */
+ memcpy(td->cp, _tps_contact_host.s, _tps_contact_host.len);
+ td->cp += _tps_contact_host.len;
+ } else {
+ memcpy(td->cp, puri.host.s, puri.host.len);
+ td->cp += puri.host.len;
+ }
}
if(puri.port.len>0) {
*td->cp = ':';