//retrieve profiles list of ext
FwdProfile[] fps = ex.FwdProfiles;
// Available, Custom 1, CustomHours, Exceptions, Custom 2, Away, Out of office (random order)
//change profile
if (fps.Length > 0)
{
string newprofile = "";
switch (changeto)
{
case "avail": newprofile = "Available"; break;
case "away": newprofile = "Away"; break;
case "oof": newprofile = "Out of office"; break;
case "custom1": newprofile = "Custom 1"; break;
case "custom2": newprofile = "Custom 2"; break;
}
if (newprofile.Length > 0)
for (int i = 0; i < fps.Length; i++)
{
if (fps[i].Name == newprofile)
{
ex.CurrentProfile = fps[i];
ex.Save();
//reload to display last state
ex = ps.GetDNByNumber(extension.ToString()) as Extension;
break;
}
}
}
pj3cx said:Hi there,
Here's a c# sample I had ready which changes the current profile of an extension, thus the forwarding rules of the new profile will apply when dialing ext.
Code://retrieve profiles list of ext FwdProfile[] fps = ex.FwdProfiles; // Available, Custom 1, CustomHours, Exceptions, Custom 2, Away, Out of office (random order) //change profile if (fps.Length > 0) { string newprofile = ""; switch (changeto) { case "avail": newprofile = "Available"; break; case "away": newprofile = "Away"; break; case "oof": newprofile = "Out of office"; break; case "custom1": newprofile = "Custom 1"; break; case "custom2": newprofile = "Custom 2"; break; } if (newprofile.Length > 0) for (int i = 0; i < fps.Length; i++) { if (fps[i].Name == newprofile) { ex.CurrentProfile = fps[i]; ex.Save(); //reload to display last state ex = ps.GetDNByNumber(extension.ToString()) as Extension; break; } } }
Founded in 2005, when VoIP was an emerging technology, 3CX has gone on to establish itself as a global leader in business communications.