Hi john, thanks for your answer. I'm using this in route[EVAPIRESPONSE] because of async request with evapi.
I tried what you said too with no success. #$var(first) = 0; #while ($var(i) < $var(contacts_len)){ # jansson_get("contacts[$var(i)]", "$var(evmsg)", "$var(contact)"); # if ($var(first) == 0){ # $ru = $var(contact); # $var(first) = 1; # } # append_branch($var(contact), "0.5"); # $var(i) = $var(i) + 1; #} remove_hf('Contact'); append_hf('Contact: <1111@188.111.111.113>'); send_reply("302", "Moved Temporarily"); exit; The result is ONLY the original uri in the contact. *Contact: <1111@188.111.111.112 <1111@188.111.111.112>>* Diego 2017-11-02 22:22 GMT-03:00 John Petrini <jpetr...@coredial.com>: > remove_hf('Contact') and then append_hf($var(contact)) should work. What > was the problem you were having? Were you using it in a branch route? > > > John > > John Petrini | Platforms Engineer > > jpetr...@coredial.com > > 215.297.440 <215-297-4400>0 > > 751 Arbor Way, Hillcrest I, Suite 150 > Blue Bell, PA 19422 > > www.coredial.com <https://coredial.com/> > <https://twitter.com/coredial> > <https://www.linkedin.com/company/coredial-llc> > <https://plus.google.com/+Coredial> <https://success.coredial.com/blog> > > The information transmitted is intended only for the person or entity to > which it is addressed and may contain confidential and/or privileged > material. Any review, retransmission, dissemination or other use of, or > taking of any action in reliance upon, this information by persons or > entities other than the intended recipient is prohibited. If you received > this in error, please contact the sender and delete the material from any > computer. > > On Thu, Nov 2, 2017 at 6:40 PM, Diego Nadares <dnada...@gmail.com> wrote: > >> Hi again, >> >> I found a work around . Modifying $ru changes de first contact uri. >> >> if($var(routing)=~"redirect"){ >> jansson_get("contacts_len", "$var(evmsg)", >> "$var(contacts_len)"); >> xlog("L_INFO", "Contacts len $var(contacts_len)"); >> $var(i) = 0; >> >> *$var(first) = 0;* >> while ($var(i) < $var(contacts_len)){ >> jansson_get("contacts[$var(i)]", "$var(evmsg)", >> "$var(contact)"); >> if ($var(first) == 0){ >> * $ru = $var(contact);* >> * $var(first) = 1;* >> } >> #Appending anyway because of the q param >> append_branch($var(contact), "0.5"); >> $var(i) = $var(i) + 1; >> } >> send_reply("302", "Moved Temporarily"); >> exit; >> } >> >> Contact: *<1111@188.111.111.112 <sip%3A1111@188.111.111.112>>*, < >> sip:1111@188.111.111.112>;q=0.5, <sip:1111@188.111.111.112>;q=0.5 >> >> >> I think this is not the better way. Any suggestion will be very >> appreciated. >> >> Thanks again. >> >> Diego >> >> >> 2017-11-02 18:11 GMT-03:00 Diego Nadares <dnada...@gmail.com>: >> >>> Hi Guys, >>> >>> I'm generating a 302 reply from kamailio. In this 302 I append new >>> branches with new >>> contacts. >>> >>> if($var(routing)=~"redirect"){ >>> jansson_get("contacts_len", "$var(evmsg)", >>> "$var(contacts_len)"); >>> xlog("L_INFO", "Contacts len $var(contacts_len)"); >>> $var(i) = 0; >>> while ($var(i) < $var(contacts_len)){ >>> jansson_get("contacts[$var(i)]", "$var(evmsg)", >>> "$var(contact)"); >>> append_branch($var(contact), "0.5"); >>> $var(i) = $var(i) + 1; >>> } >>> send_reply("302", "Moved Temporarily"); >>> exit; >>> } >>> >>> The problem i'm facing is that I can't delete the original contact >>> *<sip:1111@188.111.111.111:5060 >>> <http://sip:1111@188.111.111.111:5060>>* >>> >>> The resulting conctact: >>> >>> Contact: *<sip:1111@188.111.111.111:5060 >>> <http://sip:1111@188.111.111.111:5060>>*, <sip:1111@188.111.111.112>;q=0.5, >>> <sip:1111@188.111.111.112>;q=0.5 >>> >>> I all ready tried with remove_hf('Contact') and adding the new ones >>> after that but it doesn't worke either. >>> >>> The problem is that one gw takes the first contact over and over again >>> and never the other two. >>> >>> Thanks in advance. >>> >>> Diego. >>> >>> >>> >>> >>> >> >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >> >> > > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users > >
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users