Hi Brett,

I think using script variables should work - http://www.opensips.org/Resources/DocsCoreVar#varscript.

Regards,
Anca

On 10/13/2010 01:31 AM, Brett Woollum wrote:
Hi Anca,

I figured out the solution that you were referring to. I added the local_route section and changed the header in there, and it works.

The only problem now is that the AVP variable I set in route doesn't seem to be persistent into the new request inside local_route. This is a problem because I need some way to send the variables to local_route so that I can put them into the new request. Is there a way to make an AVP variable persistent into the local_route as well? Or maybe there is a better way to make these variables accessible from inside local_route?

Here is my working code (with statically set caller id. I need to make this dynamic):
local_route {
    if (is_method("INVITE")) {
        remove_hf("From");
        append_hf("From: \"TEST3\" <sip:12...@1.2.3.4>;tag=$ft\r\n");
        #exit;
    }
    if (is_method("BYE") ) {
        acc_log_request("internally generated BYE");
    }
}

Brett Woollum
br...@woollum.com


----- Original Message -----
From: "Anca Vamanu" <a...@opensips.org>
To: users@lists.opensips.org
Sent: Tuesday, October 12, 2010 2:37:55 AM GMT -08:00 US/Canada Pacific
Subject: Re: [OpenSIPS-Users] B2BUA "From" Header & Caller-ID Question

Hi Brett,

The b2bua generates a new request with the info from the received one. The problem is with the changes upon a request not being visible to the following functions called from the script.
So you have to change the header on the generated one, in local route.

Regards,
Anca


On 10/12/2010 10:24 AM, Brett Woollum wrote:

    In addition, the uac_replace_from(display,uri); function does not
    seem to work either. I tested this function by putting:

    uac_replace_from("TEST", "sip:12...@1.2.3.4");

    immediately above the call to B2B_INIT_REQUEST and the outbound
    "From:" header remains unchanged (incorrect).

    Brett Woollum
    br...@woollum.com


    ----- Original Message -----
    From: "Brett Woollum" <br...@woollum.com>
    To: "users-request" <users@lists.opensips.org>
    Sent: Monday, October 11, 2010 11:53:39 PM GMT -08:00 US/Canada
    Pacific
    Subject: [OpenSIPS-Users] B2BUA "From" Header & Caller-ID Question

    Hello,

    I have a working implementation of the B2BUA modules for OpenSIPS.
    One problem I am having is that the B2BUA module doesn't seem to
    respect the "From:" header that I updated before B2B_INIT was
    called (at the end of the script). Before I call B2B_INIT, my
    script looks up the correct caller-id from a database and replaces
    the "From:" header with the new information. Here is that code:

    xlog("This is an external call...");
    avp_db_query("select id from subscriber where username=\"$fU\" AND
    domain=\"1.2.3.4\"", "$avp(s:subscriber_id)");
    if(is_avp_set("$avp(s:subscriber_id)")){
                                avp_db_query("select
    external_cid_name,external_cid_uri,external_cid_uri_domain from
    cid where subscriber_id=\"$avp(s:subscriber_id)\"",
    
"$avp(s:external_cid_name);$avp(s:external_cid_uri);$avp(s:external_cid_uri_domain)");
                                remove_hf("From");
                                append_hf("From:
    \"$avp(s:external_cid_name)\"
    
<sip:$avp(s:external_cid_uri)@$avp(s:external_cid_uri_domain)>;tag=$ft\r\n");
    }

    The resulting "From": header is perfect (it includes the new
    caller-id information) and works without problems when I don't use
    the B2BUA module. It seems as though the B2BUA module (which is
    called last in the script) does not respect the new header, and
    instead processes the call using whatever was in $fu when the
    script started. Unfortunately $fu is not writable, so I can't
    directly change it.

    What are some possible work-arounds to get the B2BUA module to
    create the new call but include the "From:" header that I've
    updated earlier in the script?

    Any ideas are greatly appreciated!

    Brett Woollum
    br...@woollum.com


    _______________________________________________ Users mailing list
    Users@lists.opensips.org
    http://lists.opensips.org/cgi-bin/mailman/listinfo/users


    _______________________________________________
    Users mailing list
    Users@lists.opensips.org
    http://lists.opensips.org/cgi-bin/mailman/listinfo/users


--
Anca Vamanu
www.voice-system.ro
_______________________________________________ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


--
Anca Vamanu
www.voice-system.ro

_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to