Global Variables In Global Variables

Home » Asterisk Users » Global Variables In Global Variables
Asterisk Users 13 Comments

Hi.

I have a very old dialplan (ie: a dialplan for a very old version of Asterisk)
which I’ve just transferred to Asterisk 16.28.0

The [globals] section of that dialplan includes:

Kphones=SIP/KC470IP&SIP/KSnom870
Sphones=SIP/SYealinkT38G&SIP/SGC610IP
Allphones=${Kphones}&${Sphones}

In the old system, this results in ${Allphones} containing:

SIP/KC470IP&SIP/KSnom870&SIP/SYealinkT38G&SIP/SGC610IP

I can use this is a dial() command.

On the new system, the variable Allphones ends up containing:

${Kphones}&${Sphones}

(ie: the unexpanded variable names, not the content of those (previously-
defined) variables.)

This fairly obviously does not work in a dial() command.

a) is this a deliberate backward incompatiblity at some stage in the development of Asterisk?

b) if not, is this a known bug?

c) is there some other way I’m supposed to be doing this now, to be able to define a global variable including the value of another global variable?

d) if not, is there some workaround?

Thanks,

Antony.


Most people are aware that the Universe is big.

– Paul Davies, Professor of Theoretical Physics

Please reply to the list;
please *don’t* CC me.

13 thoughts on - Global Variables In Global Variables

  • Hi.

    I have a very old dialplan (ie: a dialplan for a very old version of Asterisk)
    which I’ve just transferred to Asterisk 16.28.0

    The [globals] section of that dialplan includes:

    Kphones=SIP/KC470IP&SIP/KSnom870
    Sphones=SIP/SYealinkT38G&SIP/SGC610IP
    Allphones=${Kphones}&${Sphones}

    In the old system, this results in ${Allphones} containing:

    SIP/KC470IP&SIP/KSnom870&SIP/SYealinkT38G&SIP/SGC610IP

    I can use this in a dial() command.

    On the new system, the variable Allphones ends up containing:

    ${Kphones}&${Sphones}

    (ie: the unexpanded variable names, not the content of those previously-
    defined variables.)

    This fairly obviously does not work in a dial() command.

    a) is this a deliberate backward incompatiblity at some stage in the development of Asterisk?

    b) if not, is this a known bug?

    c) is there some other way I’m supposed to be doing this now, to be able to define a global variable including the value of another global variable?

    d) if not, is there some workaround?

    Thanks,

    Antony.


    Most people are aware that the Universe is big.

    – Paul Davies, Professor of Theoretical Physics

    Please reply to the list;
    please *don’t* CC me.

  • Hi.

    I have a very old dialplan (ie: a dialplan for a very old version of Asterisk)
    which I’ve just transferred to Asterisk 16.28.0

    The [globals] section of that dialplan includes:

    Kphones=SIP/KC470IP&SIP/KSnom870
    Sphones=SIP/SYealinkT38G&SIP/SGC610IP
    Allphones=${Kphones}&${Sphones}

    In the old system, this results in ${Allphones} containing:

    SIP/KC470IP&SIP/KSnom870&SIP/SYealinkT38G&SIP/SGC610IP

    I can use this in a dial() command.

    On the new system, the variable Allphones ends up containing:

    ${Kphones}&${Sphones}

    (ie: the unexpanded variable names, not the content of those previously-
    defined variables.)

    This fairly obviously does not work in a dial() command.

    a) is this a deliberate backward incompatiblity at some stage in the development of Asterisk?

    b) if not, is this a known bug?

    c) is there some other way I’m supposed to be doing this now, to be able to define a global variable including the value of another global variable?

    d) if not, is there some workaround?

    Thanks,

    Antony.


    Most people are aware that the Universe is big.

    – Paul Davies, Professor of Theoretical Physics

    Please reply to the list;
    please *don’t* CC me.

  • Hi.

    I have a very old dialplan (ie: a dialplan for a very old version of Asterisk)
    which I’ve just transferred to Asterisk 16.28.0

    The [globals] section of that dialplan includes:

    Kphones=SIP/KC470IP&SIP/KSnom870
    Sphones=SIP/SYealinkT38G&SIP/SGC610IP
    Allphones=${Kphones}&${Sphones}

    In the old system, this results in ${Allphones} containing:

    SIP/KC470IP&SIP/KSnom870&SIP/SYealinkT38G&SIP/SGC610IP

    I can use this in a dial() command.

    On the new system, the variable ${Allphones} ends up containing:

    ${Kphones}&${Sphones}

    (ie: the unexpanded variable names, not the content of those previously-
    defined variables.)

    This fairly obviously does not work in a dial() command.

    a) is this a deliberate backward incompatiblity at some stage in the development of Asterisk?

    b) if not, is this a known bug?

    c) is there some other way I’m supposed to be doing this now, to be able to define a global variable including the value of another global variable?

    d) if not, is there some workaround?

    Thanks,

    Antony.


    Most people are aware that the Universe is big.

    – Paul Davies, Professor of Theoretical Physics

    Please reply to the list;
    please *don’t* CC me.

  • You have posted the same message several times in the last few days!!

    I would assume no one has an answer to your question, at least on this list. It seems most have migrated to another (UGH!) venue, so the few that are left can’t help.

    JMO

    John Novack

    Antony Stone wrote:

  • I think it has become clear that I did this not because I was getting no answers, but because my question was not appearing on the list.

    I await the repair of whatever has been delaying messages on the list, and then I am optimistic that someone will have replied, even if it takes some days for that reply to become apparent.

    Antony.


    I thought of going into banking, until I lost interest.

    Please reply to the list;
    please *don’t* CC me.

  • Le 25/01/2023 à 11:06, Antony Stone a écrit :
    […]

    I do the same concatenation with Asterisk 18 & 20 and there is no problem.

    BTW you should move to asterisk community lots more people there.

    Daniel

  • Really?

    You have something like:

    Allphones=${Kphones}&${Sphones}

    and specifically *in the [globals] section* of the dialplan?

    Thanks – will get round to signing up and selecting email mode sometime soon.

    Antony.


    “Remember: the S in IoT stands for Security.”

    – Jan-Piet Mens

    Please reply to the list;
    please *don’t* CC me.

  • Thanks, I’ll try that and report back.

    Antony.


    I just got a new mobile phone, and I called it Titanic. It’s already syncing.

    Please reply to the list;
    please *don’t* CC me.

  • Le 25/01/2023 à 17:56, Antony Stone a écrit :

    Asterisk 20.1.0

    [globals]
    Sphones=SIP/SYealinkT38G&SIP/SGC610IP

    Kphones=SIP/KC470IP&SIP/KSnom870

    Allphones=${Sphones}&${Kphones}

    -s*CLI> dialplan show globals Allphones=SIP/KC470IP&SIP/KSnom870&SIP/SYealinkT38G&SIP/SGC610IP
    Sphones=SIP/SYealinkT38G&SIP/SGC610IP
    Kphones=SIP/KC470IP&SIP/KSnom870

    0

    Daniel Huhardeaux
    +33.368460088@tootai.net sip:820@sip.tootai.net
    +41.445532125@swiss-itech.ch tootaiNET

  • Thank you very much.

    I have now established that this works provided it’s in extensions.conf or some included file.

    It does not work if it’s written in AEL – assigning global variables works, but the above does not.

    I shall keep my global assignments out of AEL in future.

    Thanks,

    Antony.


    Just when you think you’re done, a cat floats by with buttered toast strapped to its back.

    – Steve Krug, “Don’t make me think”

    Please reply to the list;
    please *don’t* CC me.

  • T24gMS8yNi8yMDIzIDU6MTYgQU0sIEFudG9ueSBTdG9uZSB3cm90ZToKCj4gSXQgZG9lcyBub3Qg d29yayBpZiBpdCdzIHdyaXR0ZW4gaW4gQUVMIC0gYXNzaWduaW5nIGdsb2JhbCB2YXJpYWJsZXMg d29ya3MsCj4gYnV0IHRoZSBhYm92ZSBkb2VzIG5vdC4KCkkndmUgY3JlYXRlZCBhIEpJUkEgaXNz dWVbMV0gZm9yIHRoaXMgYXMgd2VsbCBhcyBhIHByb3Bvc2VkIHBhdGNoWzJdLiBBc3N1bWluZyBh bGwgZ29lcyB3ZWxsIHRoaXMgc2hvdWxkIHdvcmsgaW4gZnV0dXJlIHJlbGVhc2VzLgoKS2luZCBy ZWdhcmRzLApTZWFuCgoxLiBodHRwczovL2lzc3Vlcy5hc3Rlcmlzay5vcmcvamlyYS9icm93c2Uv QVNURVJJU0stMzA0MDYKMi4gaHR0cHM6Ly9nZXJyaXQuYXN0ZXJpc2sub3JnL2MvYXN0ZXJpc2sv Ky8xOTc5Ng=

  • Thank you indeed 🙂

    Antony.


    “There has always been an underlying argument that we should open up our source code more broadly. The fact is that we are learning from open source and we are opening our code more broadly through Shared Source.

    Is there value to providing source code? The answer is unequivocally yes.”

    – Jason Matusow, head of Microsoft’s Shared Source Program, in response to leaks of Windows source code on the Internet.

    Please reply to the list;
    please *don’t* CC me.