DN property - department

ArneDery

Platinum Partner
Advanced Certified
Joined
Jul 28, 2021
Messages
268
Reaction score
404
Hi,

I'm looking to extract the depertment of a user in a call script.
The reason why I want to do this, is to create a emergency script, if user call the CF extenstion then, the flow checks from which
department the call is started and it routes the call to the correct internal reponse team.

Is there a way to do this? Without the need of the configuration API to extract the data?

Thanks in advance for pointing in the right direction
 
  • Like
Reactions: JorisC
If you use a CFD app for this, you can use a C# Script to get this. You will need to pass the session.ani as parameter, which contains the extension number from which the CFD App is being called. Then this script will give you the department:
C#:
var dn = PhoneSystem.Root.GetDNByNumber(extension);
var departments = dn.GroupMembers;
return departments.First().Group.Name;

Please note that in case an extension belongs to multiple groups, it will return the name of the first one.
 
You may be interested in our 3CX Emergency Notifier tool. It has a wealth of features, including what you are trying to do, plus:
  • Notifications by phone, email, SMS text, desktop popup (with text-to-speech for the visually impaired)
  • Notifications to specific people based on location of the emergency
  • Panic buttons (one-time alert and repeating alarms)
  • Real-time location service for staff that work in multiple locations
  • Logging of who was notified (when and how)
  • Ability to add notes to an event for historical reference about what happened and what actions were taken
  • Precise location: Building, floor, room, etc.
  • Automated tests (periodic test to ensure everything is working)
  • Internal-only emergencies as well as external PSAP notifications
  • Include local police in list of automatic notifications
You can build a solution as you propose, but it would be very difficult to replicate what we offer.
 
  • Like
Reactions: ArneDery
If you use a CFD app for this, you can use a C# Script to get this. You will need to pass the session.ani as parameter, which contains the extension number from which the CFD App is being called. Then this script will give you the department:
C#:
var dn = PhoneSystem.Root.GetDNByNumber(extension);
var departments = dn.GroupMembers;
return departments.First().Group.Name;

Please note that in case an extension belongs to multiple groups, it will return the name of the first one.
Thanks for this info. could not find the correct DN property.
Love how the 3CX community keeps on providing.
 
Yes, this is not a DN property actually, but it's there. You need a C# script to get the information. More details on the C# object model can be found here:
https://www.3cx.com/docs/call-api-linux/
 

Forum statistics

Threads
111,972
Messages
590,068
Members
164,888
Latest member
Tim Cook