Extension ForwardingRules via API

Status
Not open for further replies.

stefano.corradini

Forum User
Joined
May 6, 2019
Messages
3
Reaction score
1
I need to modify via API the internal number of forwarding rule if user is busy or my phone is unregistered. How can i do?

I tried:

CurrentProfile.ForwardingRules[0].Forward.Internal=[a spcific extension], but this setting was not saved.
 
Are you invoking Extension.Save() after you make this change?
 
Are you invoking Extension.Save() after you make this change?

i use this code (you can see extensiont save at the end):

PhoneSystem ps = PhoneSystem.Root;

Extension destExt=null;

// get Forward destination Extension with Nunber "5755"
foreach (Extension ext in ps.GetTenants()[0].GetExtensions())
{
if (ext.Number == "5755")
{
destExt = ext;
}

}

// update Forward Internal for Extensione Number "5851" if External Calls - PhoneNotRegistered
foreach (Extension a in ps.GetTenants()[0].GetExtensions())
{
if (a.Number == "5851") {

a.OutboundCallerID = "0462222";

foreach (ExtensionRule fr in a.CurrentProfile.ForwardingRules)
{

string ct = fr.Conditions.CallType.Description;
string tp = fr.Conditions.Condition.Type.ToString();

if (ct == "External Calls Only")
{
if (tp == "PhoneNotRegistered")
{

fr.Forward.Internal = destExt;
}
}
}

a.Save();

}

}
 
  • Like
Reactions: Charlito
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,324
Messages
591,897
Members
165,475
Latest member
lastshadow