### Description
Kamailio with TOPOS enabled acts as a proxy between SIP client and SBC.
When client sends "180 Ringing" without Contact header - kamailio does not forward it to SBC.
If Contact header exists in "180 Ringing" - all works as expected.
### Troubleshooting
#### Reproduction
Load and configure topos module
Make call with "180 Ringing" without Contact header - kamailio will not forward it.
#### Log Messages
```
ERROR: topos [tps_storage.c:340]: tps_storage_link_msg(): bad sip message or missing Contact hdr
```
#### SIP Traffic
```
SIP/2.0 180 Ringing
Via: SIP/2.0/TLS 1.2.3.4:5061;branch=z9hG4bKef45.8c75f0bae8a59dfaec6ff533ff0f3b2d.0
From: <sip:1111@1.2.3.4:5061>;tag=02000879948559
To: <sip:2.2.2.2@5.6.7.8:5061;transport=tls;user=phone>;tag=SDbsq8499-y2pMOVV
Call-ID: apdW7374315131g0bcGhEfDjFof
CSeq: 988207425 INVITE
User-Agent: agent
Supported: replaces, outbound
Content-Length: 0
```
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.1.6 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select
```
* **Operating System**:
```
Red Hat Enterprise Linux Server 7.3
3.10.0-514.el7.x86_64 #1 SMP Wed Oct 19 11:24:13 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1720
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [x] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
#### Description
<!-- Describe your changes in detail -->
if index is 0 there were no way to know if the index was there
$x_hdr(A) = "value" needs to append a value
$(x_hdr(A)[0]) = "value" needs to set the value
pv_parse_spec(str *s, pv_spec_p p) was always setting p->pvp.pvi.type
to 0 == PV_IDX_INT
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2341
-- Commit Summary --
* core: PV_IDX_NONE to point that pv had no index
-- File Changes --
M src/core/pvapi.c (7)
M src/core/pvar.h (1)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2341.patchhttps://github.com/kamailio/kamailio/pull/2341.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2341
Module: kamailio
Branch: master
Commit: 7bb2669528a819ec29a8193eebc9c641edd69993
URL: https://github.com/kamailio/kamailio/commit/7bb2669528a819ec29a8193eebc9c64…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2020-06-05T08:54:17+02:00
core: PV_IDX_NONE to point that pv had no index
if index is 0 there were no way to know if the index was there
$x_hdr(A) = "value" needs to append a value
$(x_hdr(A)[0]) = "value" needs to set the value
pv_parse_spec(str *s, pv_spec_p p) was always setting p->pvp.pvi.type
to 0 == PV_IDX_INT
---
Modified: src/core/pvapi.c
Modified: src/core/pvar.h
---
Diff: https://github.com/kamailio/kamailio/commit/7bb2669528a819ec29a8193eebc9c64…
Patch: https://github.com/kamailio/kamailio/commit/7bb2669528a819ec29a8193eebc9c64…
---
diff --git a/src/core/pvapi.c b/src/core/pvapi.c
index 0148578315..30b2a7cdfe 100644
--- a/src/core/pvapi.c
+++ b/src/core/pvapi.c
@@ -857,6 +857,7 @@ char* pv_parse_spec2(str *in, pv_spec_p e, int silent)
tr = 0;
pvstate = 0;
memset(e, 0, sizeof(pv_spec_t));
+ e->pvp.pvi.type = PV_IDX_NONE;
p = in->s;
p++;
if(*p==PV_LNBRACKET)
@@ -1369,6 +1370,12 @@ int pv_get_spec_index(struct sip_msg* msg, pv_param_p ip, int *idx, int *flags)
*idx = ip->pvi.u.ival;
return 0;
}
+ if(ip->pvi.type == PV_IDX_NONE)
+ {
+ *flags = PV_IDX_NONE;
+ *idx = ip->pvi.u.ival;
+ return 0;
+ }
/* pvar */
if(pv_get_spec_value(msg, (pv_spec_p)ip->pvi.u.dval, &tv)!=0)
diff --git a/src/core/pvar.h b/src/core/pvar.h
index 1415f84af0..155b0125fb 100644
--- a/src/core/pvar.h
+++ b/src/core/pvar.h
@@ -61,6 +61,7 @@
#define PV_IDX_PVAR 1
#define PV_IDX_ALL 2
#define PV_IDX_ITR 3
+#define PV_IDX_NONE 4
/*! if PV name is dynamic, integer, or str */
#define pv_has_dname(pv) ((pv)->pvp.pvn.type==PV_NAME_PVAR)