Auto sync User man names to extension names?

Is there a way to automatically sync user man names to match the extension names when the extension names are changed? As far as I can tell it is a manual change. Thanks!

Try this from a shell

mysql asterisk -e 'UPDATE userman_users INNER JOIN users  ON userman_users.username = users.extension  SET  displayname = users.name'
/user/sbin/fwconsole reload

If it works use it in a cronjob or figure out an incron job if you are impatient

P.s. you should only do this if you are sure your backup/restore system works perfectly in case I screwed up :wink:

2 Likes

Aside from the /user/sbin reload part, that worked. Can we get this query to also update the description with the name as well?

Thanks Dicko

just add more SET assignments , separate them with , (commas)

If you have misplaced your fwconsole which fwconsole will find it for you, cronjobs run under sh whose path doesn’t include /usr/sbin so you will need the full path if it is infact at /usr/sbin/fwconsole

Thanks. This is super helpful. Last question, i cant seem to find the email value in the users table, do you know which table its in? The email value under the extension, in voicemail. Thanks

I believe it is stored in the third database that FreePBX uses, /etc/asterisk/voicemail.conf you can extract it with

export EXT=(theinterestingextension)
grep ^${EXT}= /etc/asterisk/voicemail.conf|cut -d ',' -f3

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