Updating asterisk phonebook database VIA ssh unattended
Post ReplyUpdating asterisk phonebook database VIA ssh unattendedPosted: Thursday, October 12, 2017 [07:54:32] - 1
If you run contact database on a server other than asterisk server (FreePBX or any other) and want to update Asterisk Phonebook which could be used as CID lookup source. Asterisk uses the following commands: database del - Removes database key/value database deltree - Removes database keytree/values database get - Gets database value database put - Adds/updates database value database show - Shows database contents database show key - Shows database contents Add database value: Updated database successfully Retrieve data: Value: Asterisk Delete data: Database entry removed. If you want to remove the entire family of cidname values: Database entries removed. If you want to see all the values for a particular family, you can use the command “database show” like this: /cidname/12345678 : Asterisk If using SSH with auto login - string should be: or ssh root@IP_ADDRESS 'asterisk -rx \'database put cidname NXXXXXXXXX "Contact Name"\'' but it won't work as escaping single quotes(') will 'couse CLI to fail. What works is a cron job or any other daemon to run SSH command. A here-doc with quoted delimiter works great: or asterisk -rx 'database put cidname NXXXXXXXXX "Contact Name"' EOF the -T option prevents ssh complaining about not allocating a pseudo-terminal You may want to include full path for ssh and/or asterisk commands, i.e. /usr/sbin/asterisk Always check your code before deploying. |
RE: Updating asterisk phonebook database VIA ssh unattendedPosted: Friday, April 13, 2018 [13:13:20] - 2
When database updated, program besides updating Asterisk database, creates XML file for Grandstream DP750 phonebook accessible on LAN. Grandstream checks the file every 12 hours making both phonebooks synchronized. Also program creates a vCard file (VCF) on a LAN which is accessible and used by Android phone or iPhone. In one shot all phonebook files updated. |