[OpenSIPS-Users] uac_replace_from/to
Антон Ершов
suharik71 at gmail.com
Tue Feb 4 11:17:23 EST 2020
omg! of course. thx!
вт, 4 февр. 2020 г. в 18:54, Bogdan-Andrei Iancu <bogdan at opensips.org>:
> Hi Anton,
>
> by default, the module does auto restore of the FROM/TO hdr. The restoring
> is done in the traffic flowing in the opposite direction than the initial
> request. So, the uac_restore_xx() is NOT an uac_undo_xx() !
>
> As I understand, you do serial forking and for you want to do different,
> or not to do, uac_replaces for each branch. If this is the case, you need
> to do the uac_replace_xx() in the branch_route - by doing this, the change
> will impact only that branch, without any effect on the other branches.
>
>
> branch_route[change_from]
> {
> if ($avp(furi)!=NULL)
> uac_replace_from("$avp(furi)");
> }
>
> route {
> $avp(furi) = "...";
> t_on_branch("change_from");
> t_on_failure("missed_call");
> }
>
>
> failure_route[missed_call]
> {
> $ru = "..";
>
> $avp(furi) = "..."; # if you want a different FROM URI
> $avp(furi) = NULL; # if you want to keep the original URI
>
> ....
> }
>
> Regards,
>
> Bogdan-Andrei Iancu
>
> OpenSIPS Founder and Developer
> https://www.opensips-solutions.com
> OpenSIPS Summit, Amsterdam, May 2020
> https://www.opensips.org/events/Summit-2020Amsterdam/
> OpenSIPS Bootcamp, Miami, March 2020
> https://opensips.org/training/OpenSIPS_Bootcamp_2020/
>
> On 2/4/20 3:39 PM, Антон Ершов wrote:
>
> Hello friends
> Help me to understand. In request_route i make replace from and to
> fields.
> After an unsuccessful attempt to invite, I try to direct the call to
> another place and again I need to replace the from and to fields. But
> instead of replacing, new values are simply added
>
> route {
> ...
> route(rewrite_header);
> ...
> }
> failure_route[missed_call] {
> setflag(need_uac_restore);
> ...
> route(rewrite_header);
> }
> route[rewrite_header] {
> if (isflagset(need_uac_restore)) {
> xlog("L_INFO", "[ $ci ] - restore from and to fields\n");
> uac_restore_from();
> uac_restore_to();
> }
> uac_replace_from("","sip:$avp(fromuser)@$avp(fromdomain)");
> uac_replace_to("","sip:$avp(touser)@$avp(todomain)");
> }
>
> in the end I get such fields
>
> From: <sip:2220222 at 10.10.10.10><sip:5274274 at sipofon.loc>
> ;tag=fe654d87-7565-408f-9925-98a5bac99e1c
> To: <sip:3865071 at 10.10.10.10><sip:3865071 at sipofon.loc>
>
> it simply appends the new value to the old and does not replace it
> changing replace modes in uac module does not change behavior
> in debug log i see this
>
> DBG:uac:replace_uri: uri to replace [<sip:2220222 at 10.23.100.40>],
> replacement is [<sip:79385274274 at multifon.ru>]
> DBG:dialog:new_dlg_val: inserting <739823>=<<sip:5274274 at sipofon.loc>>
> DBG:dialog:store_dlg_value_unsafe: var found-> <<sip:2220222 at 10.10.10.10
> >>!
> DBG:uac:replace_uri: uri to replace [<sip:3865071 at 10.100.100.100>],
> replacement is [<sip:3865071 at sipofon.loc>]
> DBG:dialog:new_dlg_val: inserting <739824>=<<sip:3865071 at sipofon.loc>>
> DBG:dialog:store_dlg_value_unsafe: var found-> <<sip:3865071 at 10.10.10.10
> >>!
>
> 10.23.100.40 - call initiator
> 10.10.10.10 - where should the call go first
> 10.100.100.100 - opensips
> sipofon.loc - where should the call go after failure_route has worked
>
>
>
>
>
>
> _______________________________________________
> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200204/b90dcc10/attachment-0001.html>
More information about the Users
mailing list