[OpenSIPS-Users] uac_replace_from and global (display name) variables

Ben Newlin Ben.Newlin at genesys.com
Thu Dec 5 13:02:40 EST 2019

The quotes are not being added because of the way you are calling the method, the quotes are part of the From Display Name and as such are included in the $fn variable. If you don't want them you have to strip them out. We use a regex substitution to do so:

$(fn{re.subst, /^"(.*)"$/\1/});

It is a bit unintuitive that the quotes are included in the variable and I have wondered if there is a reason for hat, but those answers will not come from me. (

Ben Newlin 

´╗┐On 12/5/19, 12:07 PM, "Users on behalf of Andreas Sikkema" <users-bounces at lists.opensips.org on behalf of h323 at ramdyne.nl> wrote:

    Because of $reasons (customer equipment misbehaving,
    interoperability,etc)I have to change the From header in an
    (apparently) not often used way.
    I started wanting to add the URI and display name of the P-Asserted-Id
    header to the From header. The URI is the only part of the
    P-Asserted-Id header available as a global variable. But I would
    rather like the display part of the From header also filled in. In
    this particular case I knew  I could use the display name part of the
    existing From header.
    So I had something like this:
    if (..) {
        uac_replace_from("$fn", "$ai")
    but this results in an invalid From header:
    From: ""+31123456789"" <sip:+31123456789 at>
    So I (naively) changed the relevant config line into:
    if (..) {
        uac_replace_from($fn, "$a"i)
    Which results in a syntax error.
    If I want to spend a little more time on this I can probably grab the
    display name part from the P-Asserted-Id into a variable and use that,
    but I was surprised that it was this easy to create an invalid From
    header using standard OpenSIPS constructs.
    Or am I overlooking something obvious?
    Andreas Sikkema
    Users mailing list
    Users at lists.opensips.org

More information about the Users mailing list