<div dir="ltr">Hi all, <div><br></div><div>I have the following scenario:</div><div><br></div><div><div><br></div><div><font face="monospace, monospace">Client -> Kamailio (adds X-CallSource hdr) -> Media Server -> Kamailio (removes all "X-" headers) -> Carrier</font></div><div><br></div><div>Carrier doesn't get any X- headers. All works.</div><div><br></div><div><br></div><div>Now for example, if the media server replies with a non-OK status, like:</div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Client -> Kamailio (adds X-CallSource hdr) <-> Media Server (480 Temporarily Unavailable) </font></div><div><font face="monospace, monospace">          Kamailio (in failure_route, removes all "X-" headers) -> External Voicemail Service</font></div><div><br></div><div>External Voicemail Service gets the X- headers.</div><div><br></div></div><div><br></div><div>Basically, on the first example, it is a regular call, all handled from request route.</div><div><br></div><div>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.</div><div><br></div><div>In the captures I can see that the X-CallSource header (added at the very beginning) is still there.</div><div><br></div><div><br></div><div>I have tried different combinations in the failure route:</div><div><br></div><div>a) Tried removing exactly the header: remove_hf("X-CallSource")</div><div>b) Tried removing any X- header: remove_hf_re("X-")</div><div><br></div><div>Those didn't work, then I tried:</div><div><br></div><div>c) append_hf("X-CallSource: Test")</div><div>    remove_hf("X-CallSource")</div><div><br></div><div>The result was now two X-CallSource headers, the add worked, the remove didn't.</div><div><br></div><div>I thought maybe "msg_apply_changes()" could help, but it isn't valid inside failure_route.</div><div><br></div><div><br></div><div><br></div><div>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:</div><br><a href="https://www.kamailio.org/docs/modules/devel/modules/textops.html#textops.f.remove_hf_re">https://www.kamailio.org/docs/modules/devel/modules/textops.html#textops.f.remove_hf_re</a> -----> This function can be used from ANY_ROUTE.<div><br></div><div>OS: Debian 8</div><div>Kamailio: 4.4.5 (installed from deb repo)</div><div><br></div><div><div># kamailio -v</div><div>version: kamailio 4.4.5 (x86_64/linux)</div><div>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</div><div>ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB</div><div>poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.</div><div>id: unknown</div><div>compiled with gcc 4.9.2</div><div><br></div><div><br></div><div>Any suggestions?</div><div><br></div><div>Thanks </div><div>Joel.</div><div><br></div><div><br></div><div><br></div></div></div>