Caller ID name change via command or API call

Status
Not open for further replies.

EvilMeasures

New Member
Nov 8, 2023
7
0
1
35
Hey guys,

I am heavily looking for an easy command to change the caller ID name of an extension via CLI command or API. I can't imagine there is not such an easy possibility to do it, but I cant find anything in the internet or documentation. Is here anyone who can help me on this?

Kind Regards,
Florian
 

EvilMeasures

New Member
Nov 8, 2023
7
0
1
35
I request an extensionlist with names of employees from a foreign API and want to sync this list with my users (change caller id name).
So I would need a lua script that loops through the API reponse and performs the name change command until the end of the API response again and again. It's for an hospitality feature to sync guest/patient names with the extensions.
 
Last edited:

agree

Member
Aug 26, 2018
135
24
18
Unless I don't understand what you're trying to do, this should be very simple. Caller IDs are set by setting origination_caller_id_name or effective_caller_id_name. you can do it from lua with session:setVariable().
 

EvilMeasures

New Member
Nov 8, 2023
7
0
1
35
I Understood session:setVariable() is only during a call.
What I need is a full synchronization between a third party system and my user directory.
My user directory should reflect the name of the actual guest in that hotel room. Synchronization should be done every 5 minutes.
 

agree

Member
Aug 26, 2018
135
24
18
So why do you need a lua script for this? Call the API from any external script, update the fusionpbx v_extensions table with the new caller id values, and flush the fusionpbx file cache.
 

EvilMeasures

New Member
Nov 8, 2023
7
0
1
35
this is exactly what I was looking for. Now I only need to know the easiest way to execute the sql statement. I can't access the postgres user. Is there a way through the fs_cli ? And can you help me with the command to flush the cache?
 
Last edited:

whut

Member
Dec 23, 2022
191
18
18
I would be interested in hearing more details about the foreign API for gathering the updated list of guests/patients information.

I would recommend creating a update_extensions.sh, or similar named script, which will contain database password and your SQL update v_extensions statement. Make sure to add many where clauses so you very specifically only touch the domain and extensions desired.

Remember to make the shell/bash script executable and test it carefully in a test environment.

Then you could add the script to a crontab job running at any interval you wish.

You can reference the cron.daily fusion maintenance script for the database password and SQL statements. But, hardcoding the password is a poor idea for multiple reasons. It is recommended to get the password dynamically.

Look at the PHP code for the flush cache button and add the flush after the SQL update in your script. It may be a "remove*.*" command of the cache directory.
 
  • Like
Reactions: EvilMeasures
Status
Not open for further replies.