Simple setting of Forward profile

Status
Not open for further replies.

zweimeter2

Free User
Joined
Jan 22, 2018
Messages
4
Reaction score
2
Hi!

Is it possible to set forward profile of another extension via set dn ?

So forward profile is not a variable in dn?

Or only via Call Control API?

thanks
Martin
 
Hi Martin!

The component to set a DN property will not help you with this. That is to set a property in a key-value dictionary, but not to set the C# properties of the objects. So you need to do this using the 3CX Call Control API.

Kind regards,
 
For anyone interested in this, attached you'll find a sample project for that. Kudos to @edossantos
 

Attachments

  • Like
Reactions: Marc Mohring
Few comments regarding setStatus.cs.
1. remove call to Refresh() method. It is not necessary and executes expensive procedure which does nothing helpful in the method.
2. The snapshot, which is taken from PhoneSystem.GetDNByNumber(), is used locally. So the snapshot can be disposed right after Save(). better to change code to something started with
try
{
using(var dn=PhoneSystem.Root.GetDNByNumber(extension))
{
///cast to the extension assign new profile, call to save
return true;
}
}
catch
{
}
return false;

3. use try ... catch ... to avoid the unnecessary handling of the exceptions in user code. "upcast" of DN to Extension, usage of First() and the call to DN.Save() method are potentially generate an exceptions which may unexpectedly interrupt script which calls setStatus. I think that it is enough to return true/false to inform caller whether the current status was applied. (see above)
 
Status
Not open for further replies.

Members Online Now

Forum statistics

Threads
111,832
Messages
589,284
Members
164,662
Latest member
DejanMDS