Change From on failure_route fails to work

classic Classic list List threaded Threaded
3 messages Options
CDR
Reply | Threaded
Open this post in threaded view
|

Change From on failure_route fails to work

CDR
failure_route[FAILOVER] {
        if(t_check_status("487")) {
                xlog("L_INFO", "Request was cancelled");
                exit;
        }
                 uac_replace_from("0000000000)","[hidden email]");
        $rd = "2.2.2.2";
        $rp = 5060; 
        t_relay();
        exit;
}
The code above fails because the old data does not get replaced with the new one, but the new one is appended.
Is there a workaround? I need to do this for business reasons.
I tried removing the From header and creating a new one with the same tag and the new name, but it fails, since the From cannot be treated as a new user-header.



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Change From on failure_route fails to work

Ben Newlin

I am guessing you are also calling uac_replace_from from the request_route during initial message processing. This is altering the original request, so that when you try to do so again in failure_route (which processes the original request, not the response) you get a double value.

 

You should be doing the uac_replace_from actions in a branch route, so that the changes they make to the From header are specific to the branch. This way when you end up in failure_route you have the original request with the original From, not a previously altered version, and you can then make new changes in a branch route for the new branch.

 

Ben Newlin

 

From: Users <[hidden email]> on behalf of Saint Michael <[hidden email]>
Reply-To: OpenSIPS users mailling list <[hidden email]>
Date: Sunday, February 23, 2020 at 5:29 AM
To: "[hidden email]" <[hidden email]>
Subject: [OpenSIPS-Users] Change From on failure_route fails to work

 

failure_route[FAILOVER] {
        if(t_check_status("487")) {
                xlog("L_INFO", "Request was cancelled");
                exit;
        }
                 uac_replace_from("0000000000)","[hidden email]");
        $rd = "2.2.2.2";
        $rp = 5060; 
        t_relay();
        exit;
}

The code above fails because the old data does not get replaced with the new one, but the new one is appended.

Is there a workaround? I need to do this for business reasons.

I tried removing the From header and creating a new one with the same tag and the new name, but it fails, since the From cannot be treated as a new user-header.

 

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
CDR
Reply | Threaded
Open this post in threaded view
|

Re: Change From on failure_route fails to work

CDR
Would you consider altering my script for a fee?
I am having to use two computers for what I should need only one.
I can pay you via Paypal.
If the first attempt fails I need to alter the "From" and then try the failover route.
Please contact me via email [hidden email]

Philip







On Sun, Feb 23, 2020 at 10:55 AM Ben Newlin <[hidden email]> wrote:

I am guessing you are also calling uac_replace_from from the request_route during initial message processing. This is altering the original request, so that when you try to do so again in failure_route (which processes the original request, not the response) you get a double value.

 

You should be doing the uac_replace_from actions in a branch route, so that the changes they make to the From header are specific to the branch. This way when you end up in failure_route you have the original request with the original From, not a previously altered version, and you can then make new changes in a branch route for the new branch.

 

Ben Newlin

 

From: Users <[hidden email]> on behalf of Saint Michael <[hidden email]>
Reply-To: OpenSIPS users mailling list <[hidden email]>
Date: Sunday, February 23, 2020 at 5:29 AM
To: "[hidden email]" <[hidden email]>
Subject: [OpenSIPS-Users] Change From on failure_route fails to work

 

failure_route[FAILOVER] {
        if(t_check_status("487")) {
                xlog("L_INFO", "Request was cancelled");
                exit;
        }
                 uac_replace_from("0000000000)","[hidden email]");
        $rd = "2.2.2.2";
        $rp = 5060; 
        t_relay();
        exit;
}

The code above fails because the old data does not get replaced with the new one, but the new one is appended.

Is there a workaround? I need to do this for business reasons.

I tried removing the From header and creating a new one with the same tag and the new name, but it fails, since the From cannot be treated as a new user-header.

 

 

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users