Quick calling via names

Hello

I have FreePBX with Sangoma S500 Handsets.

Is it possible to setup FreePBX to allow finding a contact via picking up the handset and then using the number pad, start to spell out their name instead of their extension number.

For example, if I want to call Steve I would pick up the handset and then press the number 7, this would then filter my internal contacts to all names beginning with “S”. Then I keep going on press the number 8, this would then filter the list to all internal contacts with names beginning with “St”.

Is this possible?

Thanks

Does anyone know if this can be done?

My main reason to ask about this is to try and help my users dial other staff members without having to remember their extension number and without having to go through the phone contact book.

Anyone have any recommendation?

I didn’t test it, but if it’s not working like this, then open a feature request.

We also use Sangoma S500/S700, but most users are using UCP to place calls. Much easier than searching on the phone.

I was hoping moving to VOIP would help eliminate the need to print out extension lists.

Not that way.

Unlike old POTS phones, the number dialed isn’t sent to the server until the digit timeout is expired or the user hits “dial”.

What you could do it have them dial the “Name Directory” (or set up q quick-dial button for them) and have them interact with that.

I know this is old news but… I use a little bit of PHP on a web server to run a SQL query against my Asterisk database and display the data in the format Cisco phones want to see.
I also have it generate an .xml dialplan for polycom phones that will update the phone’s local directory when the polycom phone reboots.

We don’t use Sangoma headsets but I’m sure either method could be adapted to whatever Sangoma expects for its directory.

Additionally, we use an edited version of the Cisco PHP file as an actual internal website where users can go to see the up-to-date corporate directory.

That, with a little craftiness in naming our administrative and other non-user extensions with a prefix like "ADMIN - " so we can filter them out works quite well for us. I’m happy to share some of the cleansed .php in a minute once I can pull identifying information out of it.

Also, FreePBX does, as far as I am aware, allow you to create a directory that you can call and do exactly what you described. It says something like ‘enter the first three letters of the employees last name’ and then it reads you a list. We don’t use it but I have experimented with it before.

Here is an example of the PHP we use:

<?php

echo "Employee Directory \n";
// Edit the mysql_connect lines below with your freepbx mysql server, username and password
// for the database with extensions

// This example assumes you have more than one location with its own FreePBX server, but wish to have one global directory

// Server 1
mysql_connect("localhost","username","password");  //In this example, this PHP is hosted on one of the FreePBX servers
// Callout asterisk database
$db1='asterisk';
mysql_select_db($db1);
// Our SQL Query to get name and extension columns
$sGetUsers = "select extension, name from users where name not like 'ADMIN -%' and name not like 'RG -%' and name not like 'Available%' union select grpnum as 'extension', description as 'name' from ringgroups where description not like 'ADMIN -%' and description not like '%RG' order by name asc;";
//This query example includes ring groups, in case you have users with one extension for multiple phones.
//It also excludes extensions or ring groups preceded by 'ADMIN -' or 'RG -' so that you can filter out non-user extensions and ring groups
$sGetUsersR = mysql_query($sGetUsers) or die("Could not load users:$sGetUsers" . mysql_error());

// Server 2
mysql_connect("XXX.XXX.XXX.XXX","username","password"); //This example is a remote server. Replace XXX.XXX.XXX.XXX with the server's IP address. Ensure that remote SQL connections are allowed from this server
// Callout asterisk database
$db2='asterisk';
mysql_select_db($db2);
// Our SQL Query to get name and extension columns
$sGetUsersSEA = "select extension, name from users where name not like 'ADMIN -%' and name not like 'RG -%' and name not like 'Available%' union select grpnum as 'extension', description as 'name' from ringgroups where description not like 'ADMIN -%' and description not like '%RG' and description not like '%DID' order by name asc;";
//This query example includes ring groups, in case you have users with one extension for multiple phones.
//It also excludes extensions or ring groups preceded by 'ADMIN -' or 'RG -' so that you can filter out non-user extensions and ring groups
$sGetUsersRSEA = mysql_query($sGetUsersSEA) or die("Could not load users:$sGetUsersSEA" . mysql_error());

// Init the variables we need $aUsers = array(); $line = "";
// Step through the results of our SQL query
while ($line = mysql_fetch_array($sGetUsersR, MYSQL_ASSOC)) { extract($line);
{
$aUsers[$extension] = "$name"; }
}

while ($line = mysql_fetch_array($sGetUsersRSEA, MYSQL_ASSOC)) { extract($line);
{
$aUsers[$extension] = "$name"; }
}



// asort preserves our key/index 
asort($aUsers);
// Step through the array we built from our SQL and write our XML tagging
foreach($aUsers as $ext => $name) { echo " $name $ext \n"; } echo " ";
// We're done!

?>

This script runs via cron once a day as the ‘asterisk’ user, and it will update the default directory template and any existing web directory for any registered polycom device in your tftproot.

Again, not exactly what you asked for but might be able to be modified for Sangoma

#!/bin/bash

# Author: Thyrus Gorges
# Date: 2015/03/04
# Modified by: Mike Stanley
# Modified Date: 2018/02/07

#The MIT License (MIT)

#Copyright (c) <2015> <Thyrus Gorges>

#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:

#The above copyright notice and this permission notice shall be included in
#all copies or substantial portions of the Software.

#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#THE SOFTWARE.


# Build a Polycom Directory XML file
# by pulling the usernames and extensions of all SIP users

# Set so we can loop on newlines instead of spaces
IFS=$'\n'

# MySQL Creds
SQLUSER="username"
SQLPASS="password"

# Create Directory Files for phones that don't have them
# This will look in your TFTP root folder for Polycom MAC address reg.cfg files to determine what phones it should create these for.
# BE SURE TO CHANGE THE TFTPBOOT LOCATION IF YOURS IS DIFFERENT

declare -a extensionlist=($(ls /var/lib/tftpboot/ | grep "reg.cfg" | cut -c 1-12))

for i in "${extensionlist[@]}"
do
   if [[ ! -e /var/lib/tftpboot/polycom/contacts/"$i"-directory.xml ]];
   then
   echo "Creating New Directory File for $i"
   touch /var/lib/tftpboot/polycom/contacts/"$i"-directory.xml
   else
   echo "$i already has a directory"
   fi
done

# Get our File List Array

declare -a filelist=($(ls /var/lib/tftpboot/polycom/contacts/ | grep "\-directory.xml"))

# Edit All Directory Files Open Loop ---------------------------------------------------------------------------------

for i in "${filelist[@]}"
do

#Validation

echo "Updating $i"

# Declare our file
FILE="/var/lib/tftpboot/polycom/contacts/$i"             

# Remove old file
rm $FILE

# ReCreate our file
touch $FILE


# Write the header of the file
# Passing the -e option to echo allows us to use tabs
echo -e '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' >> $FILE
echo -e '<!-- $RCSfile: "$i"-directory~.xml,v $  $Revision: 1.3 $ -->' >> $FILE
echo -e '<directory>' >> $FILE
echo -e "\t<item_list>" >> $FILE    


# Query Database Users
# We pass -N to MySQL so it doens't print headers
# CS:  Original command below, modified to remove password
# for i in $( mysql -u $SQLUSER -p$SQLPASS -N -e "use asterisk; select extension, name from users;" ); do
for i in $( mysql -u $SQLUSER -N -e "use asterisk; select extension, name from users where name not like 'ADMIN -%' and name not like 'RG -%' and name not like 'Available%' order by name asc;" ); do
        # Assign Variables to each field
        EXTEN=`echo $i | cut -f1`
        FN=`echo $i | cut  -f2 | cut -d" " -f1`         
        LN=`echo $i | cut -d" " -f2`
        # The item tag is the beginning of a contact
        echo -e "\t\t<item>" >> $FILE
        echo -e "\t\t\t<ln> $LN </ln>" >> $FILE
        echo -e "\t\t\t<fn> $FN </fn>" >> $FILE
        echo -e "\t\t\t<ct> $EXTEN </ct>" >> $FILE
        echo -e "\t\t</item>" >> $FILE
done

# Query Database Ring Groups
# We pass -N to MySQL so it doens't print headers
# CS:  Original command below, modified to remove password
# for i in $( mysql -u $SQLUSER -p$SQLPASS -N -e "use asterisk; select extension, name from users;" ); do
for i in $( mysql -u $SQLUSER -N -e "use asterisk; select grpnum, description from ringgroups where description not like 'ADMIN -%' and description not like '%RG' order by description asc;" ); do
for i in $( mysql -u $SQLUSER -N -e "use asterisk; select grpnum, description from ringgroups where description not like 'ADMIN -%' and description not like '%RG' order by description asc;" ); do
        # Assign Variables to each field
        EXTEN=`echo $i | cut -f1`
        FN=`echo $i | cut  -f2 | cut -d" " -f1`
        LN=`echo $i | cut -d" " -f2`
        # The item tag is the beginning of a contact
        echo -e "\t\t<item>" >> $FILE
        echo -e "\t\t\t<ln> $LN </ln>" >> $FILE
        echo -e "\t\t\t<fn> $FN </fn>" >> $FILE
        echo -e "\t\t\t<ct> $EXTEN </ct>" >> $FILE
        echo -e "\t\t</item>" >> $FILE
done

#_____ADD REMOTE SERVER_____

# Query Database Users
# We pass -N to MySQL so it doens't print headers
# CS:  Original command below, modified to remove password
# REPLACE XXX.XXX.XXX.XXX WITH REMOTE SERVER IP

# for i in $( mysql -u $SQLUSER -p$SQLPASS -N -e "use asterisk; select extension, name from users;" ); do
for i in $( mysql -u $SQLUSER -h XXX.XXX.XXX.XXX -N -e "use asterisk; select extension, name from users where name not like 'ADMIN -%' and name not like 'RG -%' and name not like 'Available%' order by name asc;" ); do
        # Assign Variables to each field
        EXTEN=`echo $i | cut -f1`
        FN=`echo $i | cut  -f2 | cut -d" " -f1`         
        LN=`echo $i | cut -d" " -f2`
        # The item tag is the beginning of a contact
        echo -e "\t\t<item>" >> $FILE
        echo -e "\t\t\t<ln> $LN </ln>" >> $FILE
        echo -e "\t\t\t<fn> $FN </fn>" >> $FILE
        echo -e "\t\t\t<ct> $EXTEN </ct>" >> $FILE
        echo -e "\t\t</item>" >> $FILE
done

# Query Database Ring Groups
# We pass -N to MySQL so it doens't print headers
# CS:  Original command below, modified to remove password
# REPLACE XXX.XXX.XXX.XXX WITH REMOTE SERVER IP

# for i in $( mysql -u $SQLUSER -p$SQLPASS -N -e "use asterisk; select extension, name from users;" ); do
for i in $( mysql -u $SQLUSER -h XXX.XXX.XXX.XXX -N -e "use asterisk; select grpnum, description from ringgroups where description not like 'ADMIN -%' and description not like '%RG' and description not like '%DID' order by description asc;" ); do
        # Assign Variables to each field
        EXTEN=`echo $i | cut -f1`
        FN=`echo $i | cut  -f2 | cut -d" " -f1`
        LN=`echo $i | cut -d" " -f2`
        # The item tag is the beginning of a contact
        echo -e "\t\t<item>" >> $FILE
        echo -e "\t\t\t<ln> $LN </ln>" >> $FILE
        echo -e "\t\t\t<fn> $FN </fn>" >> $FILE
        echo -e "\t\t\t<ct> $EXTEN </ct>" >> $FILE
        echo -e "\t\t</item>" >> $FILE
done


#_____END REMOTE SERVER_____

# Write file endings
echo -e "\t</item_list>" >> $FILE
echo -e "</directory>" >> $FILE         

# Edit All Directory Files Close Loop -----------------------------------------------------------------------------------

done
1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.