Dismiss Notice
We would like to remind you that we’re updating our login process for all 3CX forums whereby you will be able to login with the same credentials you use for the Partner or Customer Portal. Click here to read more.

3CX V14SP2 - Phone Templates + Conditional Statements

Discussion in '3CX Phone System - General' started by Futureweb, Dec 22, 2015.

Thread Status:
Not open for further replies.
  1. Futureweb

    Futureweb New Member

    Joined:
    Jun 29, 2015
    Messages:
    163
    Likes Received:
    17
    Hello,
    is it possible to query for Extension Number within Phone Templates?

    I tried it like:
    Code:
    {IF extension_number=7400}
    here commands ...
    {ENDIF}
    {IF %%extension_number%%=7400}
    here commands ...
    {ENDIF}
    
    {IF mac_address=000000000000}
    here commands ...
    {ENDIF}
    {IF %%mac_address%%=000000000000}
    here commands ...
    {ENDIF}
    
    But it won't work ... What's in the IF will never be in the final Template ...
    Hope someone can help me on this?

    Thx, bye from Austria
    Andreas Schnederle-Wagner
     
  2. lneblett

    lneblett Well-Known Member

    Joined:
    Sep 7, 2010
    Messages:
    2,086
    Likes Received:
    65
    Re: 3CX V14SP2 - Phone Templates

    The templates constitute a form in which variables are applied in order to get the phone to respond to actions that have preprogrammed functionalities. The phones are not able to respond to anything other than what the firmware allows, so they will not respond to a set of programmed logic such as that as you have outlined.

    WHat extension are you wanting to query? What phone make and model?
     
  3. Futureweb

    Futureweb New Member

    Joined:
    Jun 29, 2015
    Messages:
    163
    Likes Received:
    17
    Re: 3CX V14SP2 - Phone Templates

    Hi lneblett,

    I'm not asking about the Phone Capabilities to understand conditional statements - I'm asking if the Template Parser of 3CX is capable of doing this.

    I know it's working with some Variables ... as those work:
    Code:
    {IF network=LOCALLAN} ... {ENDIF}
    {IF network=REMOTESTUN} ... {ENDIF}
    {IF network=REMOTESPM} ... {ENDIF}
    
    But no chance to get it to work with mac_address, extension_number or any other of those Variables ...
    And I want to know if I'm doing anything wrong here or if the Template Parser simply is to dumb to understand such conditional statements.

    Andreas
     
  4. NickD_3CX

    NickD_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Jun 2, 2014
    Messages:
    1,380
    Likes Received:
    84
    Re: 3CX V14SP2 - Phone Templates

    Hey Andreas,

    Its no a case of if the Template Parser is dumb or not, it simply was not programmed to read other parameters other than the ones you see.
    I can understand what you want to do it, not why however as I would just create a new custom template for each Group of extensions, but sadly I cannot either find or think of a way to do this.
     
  5. Futureweb

    Futureweb New Member

    Joined:
    Jun 29, 2015
    Messages:
    163
    Likes Received:
    17
    Re: 3CX V14SP2 - Phone Templates

    Hi Nick,

    there would be several Usecases for conditional Statements within Phone TPLs - just a few:

    - Phone Lock PINs
    - several Departements got 100% identical Phone Templates - we would just need to set the Unlock Pin different for some Phones ... not really practicable to use a dedicated TPL for each Phone ... would be Horror to maintain if something changes within TPL and I need to correct it in dozens of TPLs ...
    - Softkey Configuration
    - identically for most of the Phones - except for 2 or 3 which need *Lock Keypad* as Softkey (Hotel-Reception) - if i could query for MAC / IP or EXT this could be solved more pretty
    - External Phonebook
    - Reception needs other Phonebook than Office than Management ... right now we need 3 Templates for this Scenario - if i could Query for Extension-Group I would just need 1 Template
    - Network Settings
    - Reception Phones need to be VLAN Tagged - Office/Management Phones not as they are in a seperate Network - again multiple Templates which could be reduced to 1 if we would have conditional Statements

    There are dozens of useful things one could do with conditional Statements within the Templates. And since your TPL-Parser is already capable of understanding conditional Statements (if/else) it would just need to be able to access those additional Variables ... ;-)

    bye from Austria
    Andreas
     
  6. NickD_3CX

    NickD_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Jun 2, 2014
    Messages:
    1,380
    Likes Received:
    84
    Re: 3CX V14SP2 - Phone Templates

    Well, I was pretty much thinking of the same things you indicated and personally I would still do it with different templates even if I had the choice, the only thing you would loose is if you had to make a change one thing that is common for all, in that case yes, it would be convenient.

    Unfortunately though, the option is not there though...
     
  7. ifbbmi

    Joined:
    Jan 12, 2016
    Messages:
    8
    Likes Received:
    1
    Re: 3CX V14SP2 - Phone Templates

    Hi all,

    also for me its an important request. Thanks Futureweb for the listing of some examples.

    The most important advantage is the unification of different provision tempates to one.

    The chance to do something wrong is high, if we need to maintain a couple of templates for one phone type. The difference between the provision templates ar mostly marginal. It is not usefull to have two templates, in which only 1 value is different.

    We only talk about conditional statements and not about loops (which could be also very nice).

    If you just want to test something you can use one developement template. I Think that is not a problem. It's quite easy to switch the templates of one developement phone.

    I hope you can consider to expand the conditional statements in the phone templates.

    thanks
     
  8. Futureweb

    Futureweb New Member

    Joined:
    Jun 29, 2015
    Messages:
    163
    Likes Received:
    17
    Re: 3CX V14SP2 - Phone Templates

    I already opened a Feature Request for that - you can comment / upvote it here: http://www.3cx.com/forums/phone-emplates-conditional-statements-43782.html

    Hope they see the advantages of conditional Statements within Templates .... ;-)

    Andreas
     
  9. NickD_3CX

    NickD_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Jun 2, 2014
    Messages:
    1,380
    Likes Received:
    84
    Re: 3CX V14SP2 - Phone Templates

    I was just writing the same thing Futureweb wrote.

    I can see this is getting quite a few hits, so yes, up-vote this.
     
  10. Frank D

    Frank D New Member

    Joined:
    Oct 6, 2014
    Messages:
    215
    Likes Received:
    6
    great idea,

    i was thinking about this for some time, too.

    Maybe for the time being you could repurpose some parameters which currently are processed for IF statements.

    So you add additional option values, like for BLFs or for codecs. And than you use those.

    This would work, wouldn't it? Of course it makes understanding and maintaining the template more confusing.

    For Yealink phones there is another work around: You can use the common-template to manage general settings (which you would have to create manually and not have created by the template as it currently is) and the MAC specific file with different templates for different goup of phones. This way you still have several templates, but you have one common one, to change things, which effect all phones.

    Best regards Frank
     
Thread Status:
Not open for further replies.