Hi,
After some research it all seems to come down to "you cannot remove headers
in failure_route that where added in request route".
But, is there a way to remove headers in failure_route that came in the
initial INVITE? (so we didn't add anything, but we do want to remove before
sending out).
Any ideas?
Thanks,
Joel.
On Fri, Oct 13, 2017 at 11:35 AM, Joel Serrano <joel(a)gogii.net> wrote:
Hi all,
I have the following scenario:
Client -> Kamailio (adds X-CallSource hdr) -> Media Server -> Kamailio
(removes all "X-" headers) -> Carrier
Carrier doesn't get any X- headers. All works.
Now for example, if the media server replies with a non-OK status, like:
Client -> Kamailio (adds X-CallSource hdr) <-> Media Server (480
Temporarily Unavailable)
Kamailio (in failure_route, removes all "X-" headers) ->
External Voicemail Service
External Voicemail Service gets the X- headers.
Basically, on the first example, it is a regular call, all handled from
request route.
On the second example, call goes to media server, media server replies
with a 480, reaches kamailio's failure route, in there we run the same
remove_hf_re.
In the captures I can see that the X-CallSource header (added at the very
beginning) is still there.
I have tried different combinations in the failure route:
a) Tried removing exactly the header: remove_hf("X-CallSource")
b) Tried removing any X- header: remove_hf_re("X-")
Those didn't work, then I tried:
c) append_hf("X-CallSource: Test")
remove_hf("X-CallSource")
The result was now two X-CallSource headers, the add worked, the remove
didn't.
I thought maybe "msg_apply_changes()" could help, but it isn't valid
inside failure_route.
So what is the deal here? Am I doing something completely wrong or is it
just that you cannot remove headers (but you can add) in failure route?
According to the doc:
https://www.kamailio.org/docs/modules/devel/modules/textops.
html#textops.f.remove_hf_re -----> This function can be used from
ANY_ROUTE.
OS: Debian 8
Kamailio: 4.4.5 (installed from deb repo)
# kamailio -v
version: kamailio 4.4.5 (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.
id: unknown
compiled with gcc 4.9.2
Any suggestions?
Thanks
Joel.