<div dir="ltr">Hi Brandon, <div><br><div>The problem is that I need to remove the headers only if we are going to send the call outside of our platform, and that always happens after a delivery try internally.</div></div><div><br></div><div>Something along:</div><div><br></div><div>Try 1: Caller (adds X- headers) --> Kamailio (forwards X- headers without touching them) --> media srv (requires the X- headers that Caller added)</div><div>Try 2: If media srv rejects the call --> Hits failure_route in kamailio ---> We send to external server.</div><div><br></div><div>Now, in the first try (when we send the call to the media srv), we need the headers, if that try fails, we then send the call to an external server, and we don't want to send all the X- headers. Problem is, we are in the failure_route at that point, so either it's too late or I'm not doing this the way it has to be done.</div><div><br></div><div>I was thinking of trying:</div><div><br></div><div>1- remove the X-headers in request route</div><div>2- create a new branch_route and add them again in there</div><div>3- If required, remove them from failure route... (as they were added in branch_route, maybe it works?)</div><div><br></div><div>Not 100% sure though...</div><div><br></div><div>What do you think?</div><div><br></div><div><br></div><div>Thanks!</div><div>Joel.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 17, 2017 at 12:43 PM, Brandon Armstead <span dir="ltr"><<a href="mailto:brandon@cryy.com" target="_blank">brandon@cryy.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Why do you not remove the headers in request_route {} ?<br>
<br>
Check and see where the call is uri or destination is going and add or<br>
remove as desired?<br>
<div><div class="h5"><br>
On Tue, Oct 17, 2017 at 12:36 PM, Joel Serrano <<a href="mailto:joel@gogii.net">joel@gogii.net</a>> wrote:<br>
> Hi,<br>
><br>
> After some research it all seems to come down to "you cannot remove headers<br>
> in failure_route that where added in request route".<br>
><br>
> But, is there a way to remove headers in failure_route that came in the<br>
> initial INVITE? (so we didn't add anything, but we do want to remove before<br>
> sending out).<br>
><br>
> Any ideas?<br>
><br>
> Thanks,<br>
> Joel.<br>
><br>
> On Fri, Oct 13, 2017 at 11:35 AM, Joel Serrano <<a href="mailto:joel@gogii.net">joel@gogii.net</a>> wrote:<br>
>><br>
>> Hi all,<br>
>><br>
>> I have the following scenario:<br>
>><br>
>><br>
>> Client -> Kamailio (adds X-CallSource hdr) -> Media Server -> Kamailio<br>
>> (removes all "X-" headers) -> Carrier<br>
>><br>
>> Carrier doesn't get any X- headers. All works.<br>
>><br>
>><br>
>> Now for example, if the media server replies with a non-OK status, like:<br>
>><br>
>> Client -> Kamailio (adds X-CallSource hdr) <-> Media Server (480<br>
>> Temporarily Unavailable)<br>
>>           Kamailio (in failure_route, removes all "X-" headers) -><br>
>> External Voicemail Service<br>
>><br>
>> External Voicemail Service gets the X- headers.<br>
>><br>
>><br>
>> Basically, on the first example, it is a regular call, all handled from<br>
>> request route.<br>
>><br>
>> On the second example, call goes to media server, media server replies<br>
>> with a 480, reaches kamailio's failure route, in there we run the same<br>
>> remove_hf_re.<br>
>><br>
>> In the captures I can see that the X-CallSource header (added at the very<br>
>> beginning) is still there.<br>
>><br>
>><br>
>> I have tried different combinations in the failure route:<br>
>><br>
>> a) Tried removing exactly the header: remove_hf("X-CallSource")<br>
>> b) Tried removing any X- header: remove_hf_re("X-")<br>
>><br>
>> Those didn't work, then I tried:<br>
>><br>
>> c) append_hf("X-CallSource: Test")<br>
>>     remove_hf("X-CallSource")<br>
>><br>
>> The result was now two X-CallSource headers, the add worked, the remove<br>
>> didn't.<br>
>><br>
>> I thought maybe "msg_apply_changes()" could help, but it isn't valid<br>
>> inside failure_route.<br>
>><br>
>><br>
>><br>
>> So what is the deal here? Am I doing something completely wrong or is it<br>
>> just that you cannot remove headers (but you can add) in failure route?<br>
>> According to the doc:<br>
>><br>
>><br>
>> <a href="https://www.kamailio.org/docs/modules/devel/modules/textops.html#textops.f.remove_hf_re" rel="noreferrer" target="_blank">https://www.kamailio.org/docs/<wbr>modules/devel/modules/textops.<wbr>html#textops.f.remove_hf_re</a><br>
>> -----> This function can be used from ANY_ROUTE.<br>
>><br>
>> OS: Debian 8<br>
>> Kamailio: 4.4.5 (installed from deb repo)<br>
>><br>
>> # kamailio -v<br>
>> version: kamailio 4.4.5 (x86_64/linux)<br>
>> flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE,<br>
>> USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC,<br>
>> TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT,<br>
>> USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST,<br>
>> HAVE_RESOLV_RES<br>
>> ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16,<br>
>> MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB<br>
>> poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.<br>
>> id: unknown<br>
>> compiled with gcc 4.9.2<br>
>><br>
>><br>
>> Any suggestions?<br>
>><br>
>> Thanks<br>
>> Joel.<br>
>><br>
>><br>
>><br>
><br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> Kamailio (SER) - Users Mailing List<br>
> <a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br>
> <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><br>
><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Sincerely,<br>
Brandon Armstead<br>
CTO / CRYY.com<br>
<br>
______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><br>
</font></span></blockquote></div><br></div>