Unable to provision display name correctly on Yealink SIP-T46G

I’m trying to use endpoint to configure these phones, and I’ve run up against a problem. I don’t know if it’s a bug or something I’m doing wrong. The situation is this: Users will often have more than one phone, for example, a softphone and a desk phone. Their three-digit extension is XXX, but that extension has a follow-me to 4XXX, 5XXX, etc. I’ve set up an Asterisk “CID Num Alias” of “XXX” for each of the extensions. So the user never actually sees the 4XXX and 5XXX extensions.

When using endpoint with the Yealink SIP-T46G, I would like to configure the line key to display the “CID Num Alias” from FreePBX, or at the very least, to display the user’s configured name. However, whether I select “Name” or “Extension” on the template page, it always displays the 4XXX extension, which is the actual extension of the phone. If I change it to Name-Extension, then it seems to work correctly and displays Name-4XXX. But again, I would really like to hide the 4XXX extension from the user.

Is the template for that phone somehow broken? Is it something I can fix by looking at the back-end code? I’ve tried messing with the Basefile editing. account.1.display_name and account.1.label are both set to %line1Name% but that variable seems to be pulling from the actual template, not from FreePBX.

Ideally, I would love it if there were a variable in Endpoint for the “CID Number Alias,” however, I don’t believe that would be possible without code changes. I could live with just displaying the user’s name.

Please let me know what additional information might be required. Thanks!

I should also like to add that I’m using EPM version 2.11.0.1.74. I know there was recently a change which may have directly impacted this issue. In fact, I could have sworn to you that it worked when I first set it up.

All other pieces of this server are completely up-to-date. I’m hoping to deploy it this week, so I can still do reboots on demand. :slight_smile: I’ve run yum-update, updated all modules, and updated FreePBX-Distro as much as I can.

It’s definitely the value account.1.label that the phone is displaying on the soft keys. Somehow, I need to be able to get account.1.label to be set to the “CID Num Alias” in FreePBX (most preferred) or the “Display Name,” which I believe is what it’s supposed to be. Of course, I can go through and hand-edit all the files, or write a bash script that would do a find/replace, but that seems like an awful lot of hassle… :wink:

Let’s see… watch files for changes. Each time a file is updated by EPM, have the script search the file for account.1.label = 4XXX and change it to account.1.label = XXX. It would work…

OK, community, here’s my hack. It’s not the prettiest thing, but it works, for now. :smile:

Created /tftpboot/scripts/update.display.sh

#!/bin/bash

find /tftpboot -name "$1" -print | xargs sed -i -r "s/^account\.1\.label = 4([[:digit:]]{3})/account\.1\.label = \1/g"

then added the following to incrontab:

/tftpboot IN_CLOSE_WRITE,IN_NO_LOOP /tftpboot/scripts/update.display.sh $#

In practical terms. this watches all files in the /tftpboot folder, and if any of them are changed, it runs the script, which searches for the account.1.label = 4XXX string, and turns it into account.1.label = XXX.

I am completely open to criticism if this is a bad idea, or if it could cause other problems. I believe it will always trigger the script when the files are written out, and should change them correctly. I’m going to do some more testing tomorrow, and maybe a better idea will come to me while I sleep…

Looks like the issue was silently addressed, but I liked my idea about using the CID Num Alias so much that I’m keeping my script. :slight_smile: I updated it to also address the issue that the user’s voicemail exists on their “virtual extension” rather than the one provisioned for the phone. The script below (used in conjunction with icrontab) should do two things:

  1. It replaces the voicemail number on account 1 for 4XXX with *98XXX, which should make it behave exactly if the button was pressed for extension XXX
  2. It updates the display on ALL accounts to use CID Num Alias, even if it’s not account 1.

I’m not a bash expert, but this seems to do the trick without fail. If anyone has any suggestions, I’m open. Also, if the devs ever enter an EPM variable for CID Num Alias, this will all become moot…

#!/bin/bash

#####################################################################
#
# Script to update extension to virtual extension number when changed
#
# Created by Craig Hamm - 2014-06-17
# Script should be located in /tftpboot/scripts/update.display.sh
#
#  Modified - 2104-06-18
#       Modified script to work with any account, not just account.1
#       Added logic to also update the dialed voicemail number to include the virtual extension
#
#  For this script to work, it must be invoked via incrond
#  From a shell, run incrontab -e and add the follwing line:
#
#  /tftpboot IN_CLOSE_WRITE,IN_NO_LOOP /tftpboot/scripts/update.display.sh $#
#
#
#####################################################################

HARDEXT=$(grep -m 1 -h "^account\.1\.user\_name = [4-8][0-9]\{3\}$" $1 | grep -o '[4-8][0-9]\{3\}')
VIRTEXT=$(sed -e "s/4\([0-9]\{3\}\)/\1/g" <<< $HARDEXT)

sed -i -r "s/^voice\_mail\.number\.1 = \*97/voice\_mail\.number\.1 = \*98$VIRTEXT/" $1
sed -i -r "s/^account\.([0-9])\.label = 4([[:digit:]]{3})/account\.\1\.label = \2/" $1

Cheers!

Be careful as anything in incrontab will be blown off on upgrades of sysadmin in FreePBX.

Oooh… that’s important to know… thank you! Is there any way to make persistent entries into the incrontab table? It wouldn’t be too difficult to remember to update incrontab after sysadmin upgrades, but it would be even more helpful if I could figure out a way to re-populate it automatically…

There are a few alternatives to incron, but I’m not sure if there’s anything included in the FreePBX Distro repository. I’ve thus far been able to avoid installing any binaries that aren’t in the repo…

Not sure of your options. I suggest more opening feature request in EPM to allow us to give the option to use SIP Allias as that would be easy enough to do.

If I create a incrond table for the asterisk user, will that get blown away as well?

I like the idea of having an EPM variable for SIP Num Alias, but if I put in a feature request, are those typically handled in minutes, hours, days, weeks, months or years? :smile:

All depends. Some are days some are weeks or months.

I’ve put in a feature request. I’ll keep an eye on my incrontab. I could figure out a cron job to check for the existence of the line in the incrontab table, and create it if it’s missing, but then I’ll need another cron job to check for the cron job, and another one to check for that… :smile:

Thanks for all your help!