How To: Updating Trixbox to support additional multi purpose lines (Grandstream)

This example is for a Grandstream GXP2010. The basic logic behind it applies to the other Grandstream phones as well (GXP2000, 2020, etc). You can extend this further to include the ability to program extension modules as well.

Step 1: Update the device edit page
nano /var/www/html/maint/modules/endpointcfg/templates/endpoint_Grandstream_edit.tpl

Add the following code to increase 7 multi purpose keys to 18 keys


{translation charString = $MULTIPURPOSEKEY8 language = $trixbox_language} {translation charString = $MODE language = $trixbox_language}:{html_options name=key8_mode options=$key_mode_list selected=$phone.key8_mode} {translation charString = $NAME language = $trixbox_language}:
{translation charString = $NUMBER language = $trixbox_language}:
{translation charString = $MULTIPURPOSEKEY9 language = $trixbox_language} {translation charString = $MODE language = $trixbox_language}:{html_options name=key9_mode options=$key_mode_list selected=$phone.key9_mode} {translation charString = $NAME language = $trixbox_language}:
{translation charString = $NUMBER language = $trixbox_language}:
{translation charString = $MULTIPURPOSEKEY10 language = $trixbox_language} {translation charString = $MODE language = $trixbox_language}:{html_options name=key10_mode options=$key_mode_list selected=$phone.key10_mode} {translation charString = $NAME language = $trixbox_language}:
{translation charString = $NUMBER language = $trixbox_language}:
{translation charString = $MULTIPURPOSEKEY11 language = $trixbox_language} {translation charString = $MODE language = $trixbox_language}:{html_options name=key11_mode options=$key_mode_list selected=$phone.key11_mode} {translation charString = $NAME language = $trixbox_language}:
{translation charString = $NUMBER language = $trixbox_language}:
{translation charString = $MULTIPURPOSEKEY12 language = $trixbox_language} {translation charString = $MODE language = $trixbox_language}:{html_options name=key12_mode options=$key_mode_list selected=$phone.key12_mode} {translation charString = $NAME language = $trixbox_language}:
{translation charString = $NUMBER language = $trixbox_language}:
{translation charString = $MULTIPURPOSEKEY13 language = $trixbox_language} {translation charString = $MODE language = $trixbox_language}:{html_options name=key13_mode options=$key_mode_list selected=$phone.key13_mode} {translation charString = $NAME language = $trixbox_language}:
{translation charString = $NUMBER language = $trixbox_language}:
{translation charString = $MULTIPURPOSEKEY14 language = $trixbox_language} {translation charString = $MODE language = $trixbox_language}:{html_options name=key14_mode options=$key_mode_list selected=$phone.key14_mode} {translation charString = $NAME language = $trixbox_language}:
{translation charString = $NUMBER language = $trixbox_language}:
{translation charString = $MULTIPURPOSEKEY15 language = $trixbox_language} {translation charString = $MODE language = $trixbox_language}:{html_options name=key15_mode options=$key_mode_list selected=$phone.key15_mode} {translation charString = $NAME language = $trixbox_language}:
{translation charString = $NUMBER language = $trixbox_language}:
{translation charString = $MULTIPURPOSEKEY16 language = $trixbox_language} {translation charString = $MODE language = $trixbox_language}:{html_options name=key16_mode options=$key_mode_list selected=$phone.key16_mode} {translation charString = $NAME language = $trixbox_language}:
{translation charString = $NUMBER language = $trixbox_language}:
{translation charString = $MULTIPURPOSEKEY18 language = $trixbox_language} {translation charString = $MODE language = $trixbox_language}:{html_options name=key18_mode options=$key_mode_list selected=$phone.key18_mode} {translation charString = $NAME language = $trixbox_language}:
{translation charString = $NUMBER language = $trixbox_language}:
{translation charString = $MULTIPURPOSEKEY18 language = $trixbox_language} {translation charString = $MODE language = $trixbox_language}:{html_options name=key18_mode options=$key_mode_list selected=$phone.key18_mode} {translation charString = $NAME language = $trixbox_language}:
{translation charString = $NUMBER language = $trixbox_language}:

Step 2: Update SQL tables. This works best if you remove all phones first, otherwise it gets a bit complicated.

Use this to dump:mysqldump -c -u root -ppassw0rd endpoints Grandstream > endpoints.Grandstream.sql

Edit the file you just made by adding the following (should be obvious where):

`key8_mode` varchar(255) NOT NULL default '',
`key8_name` varchar(255) NOT NULL default '',
`key8_userid` varchar(255) NOT NULL default '',
`key9_mode` varchar(255) NOT NULL default '',
`key9_name` varchar(255) NOT NULL default '',
`key9_userid` varchar(255) NOT NULL default '',
`key10_mode` varchar(255) NOT NULL default '',
`key10_name` varchar(255) NOT NULL default '',
`key10_userid` varchar(255) NOT NULL default '',
`key11_mode` varchar(255) NOT NULL default '',
`key11_name` varchar(255) NOT NULL default '',
`key11_userid` varchar(255) NOT NULL default '',
`key12_mode` varchar(255) NOT NULL default '',
`key12_name` varchar(255) NOT NULL default '',
`key12_userid` varchar(255) NOT NULL default '',
`key13_mode` varchar(255) NOT NULL default '',
`key13_name` varchar(255) NOT NULL default '',
`key13_userid` varchar(255) NOT NULL default '',
`key14_mode` varchar(255) NOT NULL default '',
`key14_name` varchar(255) NOT NULL default '',
`key14_userid` varchar(255) NOT NULL default '',
`key15_mode` varchar(255) NOT NULL default '',
`key15_name` varchar(255) NOT NULL default '',
`key15_userid` varchar(255) NOT NULL default '',
`key16_mode` varchar(255) NOT NULL default '',
`key16_name` varchar(255) NOT NULL default '',
`key16_userid` varchar(255) NOT NULL default '',
`key17_mode` varchar(255) NOT NULL default '',
`key17_name` varchar(255) NOT NULL default '',
`key17_userid` varchar(255) NOT NULL default '',
`key18_mode` varchar(255) NOT NULL default '',
`key18_name` varchar(255) NOT NULL default '',
`key18_userid` varchar(255) NOT NULL default '',

and this (also rather obvious):

, `key8_mode`, `key8_name`, `key8_userid`, `key9_mode`, `key9_name`, `key9_userid`, `key10_mode`, `key10_name`, `key10_userid`, `key11_mode`, `key11_name`, `key11_userid`, `key12_mode`, `key12_name`, `key12_userid`, `key13_mode`, `key13_name`, `key13_userid`, `key14_mode`, `key14_name`, `key14_userid`, `key15_mode`, `key15_name`, `key15_userid`, `key16_mode`, `key16_name`, `key16_userid`, `key17_mode`, `key17_name`, `key17_userid`, `key18_mode`, `key18_name`, `key18_userid`

Use this to restore the table: mysql -u root -ppassw0rd endpoints < endpoints.Grandstream.sql

Step 3: Update Grandstream defaults:

nano /tftpboot/Grandstream_GXP2010_Default.txt

Add:

# Multi Purpose Key 8
# ------------------------------------------

# Account. 0 - Account 1, 1 - Account 2, 2 - Account 3, 3 - Account 4
P354 = 0

# Multi Purpose Key 9
# ------------------------------------------

# Account. 0 - Account 1, 1 - Account 2, 2 - Account 3, 3 - Account 4
P358 = 0

# Multi Purpose Key 10
# ------------------------------------------

# Account. 0 - Account 1, 1 - Account 2, 2 - Account 3, 3 - Account 4
P362 = 0

# Multi Purpose Key 11
# ------------------------------------------

# Account. 0 - Account 1, 1 - Account 2, 2 - Account 3, 3 - Account 4
P366 = 0

# Multi Purpose Key 12
# ------------------------------------------

# Account. 0 - Account 1, 1 - Account 2, 2 - Account 3, 3 - Account 4
P370 = 0

# Multi Purpose Key 13
# ------------------------------------------

# Account. 0 - Account 1, 1 - Account 2, 2 - Account 3, 3 - Account 4
P374 = 0

# Multi Purpose Key 14
# ------------------------------------------

# Account. 0 - Account 1, 1 - Account 2, 2 - Account 3, 3 - Account 4
P378 = 0

# Multi Purpose Key 15
# ------------------------------------------

# Account. 0 - Account 1, 1 - Account 2, 2 - Account 3, 3 - Account 4
P382 = 0

# Multi Purpose Key 16
# ------------------------------------------

# Account. 0 - Account 1, 1 - Account 2, 2 - Account 3, 3 - Account 4
P386 = 0

# Multi Purpose Key 17
# ------------------------------------------

# Account. 0 - Account 1, 1 - Account 2, 2 - Account 3, 3 - Account 4
P390 = 0

# Multi Purpose Key 18
# ------------------------------------------

# Account. 0 - Account 1, 1 - Account 2, 2 - Account 3, 3 - Account 4
P394 = 0

Step 4: Edit global variables for Grandstream conversion

edit /var/www/html/maint/modules/endpointcfg/libs/trixbox.php and add the following:
$GrandstreamConvert[‘key8_mode’] = 353 ;
$GrandstreamConvert[‘key8_name’] = 355 ;
$GrandstreamConvert[‘key8_userid’] = 356 ;
$GrandstreamConvert[‘key9_mode’] = 357 ;
$GrandstreamConvert[‘key9_name’] = 359 ;
$GrandstreamConvert[‘key9_userid’] = 360 ;
$GrandstreamConvert[‘key10_mode’] = 361 ;
$GrandstreamConvert[‘key10_name’] = 363 ;
$GrandstreamConvert[‘key10_userid’] = 364 ;
$GrandstreamConvert[‘key11_mode’] = 365 ;
$GrandstreamConvert[‘key11_name’] = 367 ;
$GrandstreamConvert[‘key11_userid’] = 368 ;
$GrandstreamConvert[‘key12_mode’] = 369 ;
$GrandstreamConvert[‘key12_name’] = 371 ;
$GrandstreamConvert[‘key12_userid’] = 372 ;
$GrandstreamConvert[‘key13_mode’] = 373 ;
$GrandstreamConvert[‘key13_name’] = 375 ;
$GrandstreamConvert[‘key13_userid’] = 376 ;
$GrandstreamConvert[‘key14_mode’] = 377 ;
$GrandstreamConvert[‘key14_name’] = 379 ;
$GrandstreamConvert[‘key14_userid’] = 380 ;
$GrandstreamConvert[‘key15_mode’] = 381 ;
$GrandstreamConvert[‘key15_name’] = 383 ;
$GrandstreamConvert[‘key15_userid’] = 384 ;
$GrandstreamConvert[‘key16_mode’] = 385 ;
$GrandstreamConvert[‘key16_name’] = 387 ;
$GrandstreamConvert[‘key16_userid’] = 388 ;
$GrandstreamConvert[‘key17_mode’] = 389 ;
$GrandstreamConvert[‘key17_name’] = 391 ;
$GrandstreamConvert[‘key17_userid’] = 392 ;
$GrandstreamConvert[‘key18_mode’] = 393 ;
$GrandstreamConvert[‘key18_name’] = 395 ;
$GrandstreamConvert[‘key18_userid’] = 396 ;

Now add your devices and reboot your phones… The same logic can be used to add functionality for extension modules and newer Grandstream phones (the newest GXP2010 added several multi purpose buttons)

One Reply to “How To: Updating Trixbox to support additional multi purpose lines (Grandstream)”

  1. One item missed was the language files so that the labels are correct. Edit the /var/www/html/maint/modules/endpointcfg/language/english.php
    file and add the following lines. The placement should be obvious.

    $smarty->assign(‘MULTIPURPOSEKEY8’, ‘Multi Purpose Key 8’);
    $smarty->assign(‘MULTIPURPOSEKEY9’, ‘Multi Purpose Key 9’);
    $smarty->assign(‘MULTIPURPOSEKEY10’, ‘Multi Purpose Key 10’);
    $smarty->assign(‘MULTIPURPOSEKEY11’, ‘Multi Purpose Key 11’);
    $smarty->assign(‘MULTIPURPOSEKEY12’, ‘Multi Purpose Key 12’);
    $smarty->assign(‘MULTIPURPOSEKEY13’, ‘Multi Purpose Key 13’);
    $smarty->assign(‘MULTIPURPOSEKEY14’, ‘Multi Purpose Key 14’);
    $smarty->assign(‘MULTIPURPOSEKEY15’, ‘Multi Purpose Key 15’);
    $smarty->assign(‘MULTIPURPOSEKEY16’, ‘Multi Purpose Key 16’);
    $smarty->assign(‘MULTIPURPOSEKEY17’, ‘Multi Purpose Key 17’);
    $smarty->assign(‘MULTIPURPOSEKEY18’, ‘Multi Purpose Key 18’);

    This will add the labels to the endpoint manager.

Leave a Reply

Your email address will not be published. Required fields are marked *