Using default setting variables

Status
Not open for further replies.

nhwebforge

New Member
Sep 16, 2024
12
0
1
47
Evening all

I've created some default setting entries under the Provisioning category.

Let's take these examples:

yealink_t46g_wallpaper = https://{$domain_name}/custom/wallpaper.png
yealink_t46s_wallpaper = https://{$domain_name}/custom/wallpaper.png
yealink_t46g_wallpaper_filename = wallpaper.png
yealink_t46s_wallpaper_filename = wallpaper.png

All works perfectly as it should and the wallpaper is provisioned correctly. But there's a lot of repetition and it takes a while to make all the changes, should I wish to simply change the filename.

Now these both have the same filename (the screens are the same size) so rather than have to define it twice (actually four times as the URL also needs the filename), can I create another entry called "yealink_480x272_wallpaper" and reference it in the previous four entries?

Example, something like:

yealink_480x272_wallpaper = wallpaper.png
yealink_t46g_wallpaper = https://{$domain_name}/custom/${yealink_480x272_wallpaper}
yealink_t46s_wallpaper = https://{$domain_name}/custom/${yealink_480x272_wallpaper}
yealink_t46g_wallpaper_filename = ${yealink_480x272_wallpaper}
yealink_t46s_wallpaper_filename = ${yealink_480x272_wallpaper}

I've tried one dollar sign, two dollar signs, the dollar sign in the curly brackets, but I can't seem to work out how to reference a default setting entry. Should I be defining the 'yealink_480x272_wallpaper' in variables rather than default settings? And how to then reference?

As always, thanks in advance!

Nick
 

voipBull

Member
Dec 3, 2023
89
17
8
Aha....nested default settings. Sorry, I don't know if it's possible or not, but I do like the idea though.
 

whut

Member
Dec 23, 2022
228
22
18
I believe you could use the freeswitch variables as you are thinking, but I have not tried it. As an example of how you may need to reference the variables you create in freeswitch variables I would filter them on 'us-ring'. You will see the 'us-ring' variable is defined in Ringtones but then is referenced as `$${us-ring}` in the Default section as 'ringback' and 'transfer_ringback' variables. I believe it would work to define your own freeswitch variables category. But, it would probably be safer to define your variables in an existing category. I would suggest the Defaults category then.

I wonder if part of your issue in defining your 'yealink_480x272_wallpaper' variable is how you could ensure this variable gets evaluated before your other variables that are referencing this newly created variable.

I would prefer to define your parent variables in default settings.
 

whut

Member
Dec 23, 2022
228
22
18
All of this is conjecture and you will need to test the suggestions!
 

markjcrane

Active Member
Staff member
Jul 22, 2018
499
177
43
49
You want to use default settings in category: provision if you have a setting as yealink_480x272_wallpaper then in the provisioning template if you look around for a variable you will see the syntax looks like this. {$yealink_480x272_wallpaper} The template engine uses PHP Smarty so it requires the template syntax used by Smarty.

Advanced -> Variables will not work those are only meant for FreeSWITCH and these days those only are used by the SIP profiles.
 
Status
Not open for further replies.