<div dir="ltr"><div><div><div>Hi,<br><br></div>First of all, changing From\To headers on proxy breaks the RFC =) So that's the initial problem of your set up I guess.<br><br></div>About your qustion, check out the wiki about failure_route:<br>
> Note that in 'failure_route' is processed the request that initiated the transaction, not the reply.<br><br></div>The only workaround you may want to check is to update the request and apply lumps before you create a transaction.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-08-25 16:03 GMT+04:00 Yuriy Gorlichenko <span dir="ltr"><<a href="mailto:ovoshlook@gmail.com" target="_blank">ovoshlook@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hello. At first- I think header of my message doesn't explain my porblem but I can not say about it with different terms)</div>
<div><br></div><div>So. I have construction Asterisk --> Kamailio --> Providers</div>
<div><br></div><div>My provisers registered with UAC modure and stored at UACREG table.</div><div><br></div><div>Problem scenario is:</div><div><br></div><div>I ring from asterisk to provider</div><div><br></div><div>Asterisk --> Kamailio --> Providers</div>

<div><br></div><div>Call from asterisk come to kamailio with </div><div>furi(Asterisk_clinet_local_number@asterisk)</div><div>turi(external_number@kamailio)</div><div><br></div><div>Then, to forward INVITE to provider that Needed I use some manipulations to choose provider (it does not matter, it is only sql_queryes to some tables), and then modify invite with this code:</div>

<div><br></div><div>#$var(prov) - my.provider.ip</div><div>#$var(trunk) - name_of_trunk </div><div><br></div><div>$rd=$var(prov);</div><div>$rp="5060";</div><div><span style="white-space:pre-wrap">                      </span></div>

<div>$fU=$var(trunk);</div><div>$fd=$var(prov);</div><div>$td=$var(prov);</div><div><br></div><div>remove_hf("Contact");</div><div>append_hf("Contact:<$var(trunk)@my.kamailio.domain:5068>\n","Contact");</div>

<div><br></div><div><br></div><div>So -after this manipulation I have write packet, that goues to my provider.</div><div><br></div><div>Then Provier sends me 407 answer and packet goes to failure_route</div><div><br></div>

<div>if (t_check_status("401|407")){</div><div>        xlog("L_INFO", "Reply from provider on failure: $rs");</div><div>        </div><div>        if  (uac_auth()){</div><div>                     #my query to get avp for uac</div>

<div>                     #modparam("uac","auth_realm_avp","$avp(s:realm)")</div><div>                     #modparam("uac","auth_username_avp","avp(s:uname)")</div>

<div>                     #modparam("uac","auth_password_avp","$avp(s:passwd))") </div><div><span style="white-space:pre-wrap">                                     </span> </div><div><span style="white-space:pre-wrap">                                       </span> sql_pvquery("ca","select auth_username, auth_password, realm from uacreg where auth_username='$fU'","$var(uname), $var(passwd), $var(realm)");        </div>

<div><span style="white-space:pre-wrap">  </span>                 xlog("L_INFO", "username=$var(uname), password=$var(passwd), realm=$var(realm) for {$fU}");</div><div><br></div><div><span style="white-space:pre-wrap">                      </span>pv_printf("$avp(s:uname)","$var(uname)");</div>

<div>                      pv_printf("$avp(s:passwd)","$var(passwd)");</div><div>                      pv_printf("$avp(s:realm)","$var(realm)");</div><div><span style="white-space:pre-wrap">                                      </span> </div>

<div><br></div><div>                      xlog("L_INFO", "UAC_AUTH(): $rs"); </div><div>                       append_branch();</div><div>                       t_relay();</div><div>        </div><div>

            }</div><div>        }</div><div><span style="white-space:pre-wrap">       </span>if (t_is_canceled()) {</div><div><span style="white-space:pre-wrap">           </span>exit;</div><div><span style="white-space:pre-wrap">    </span>}</div>

<div><span style="white-space:pre-wrap">  </span></div><div><span style="white-space:pre-wrap"> </span>So After changes Before Provider answer 407 my $fU = name_of_trunk, but at failure route my fU is Asterisk_clinet_local_number and it so strange because I see this packet at TCPDUMP and it have trunkname at fU</div>

<div>Because of It I can not take from table needed vars for auth and avp`s Have 0.</div><div><br></div><div>So packet for Auth (407) goes to Asterisk (with trunkname!!!! at fU), but t must stops at kamailio and must be ralayed to provider.</div>

<div><br></div><div>So this my problem- I can not understand: Why fU at reply 407 have old parameters?</div><br><br></div></div></div>
<br>_______________________________________________<br>
sr-dev mailing list<br>
<a href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div><div>Best regards,<br>Alekzander Spiridonov</div><br></div>
</div>