Simple setting of Forward profile

Discussion in 'Call Flow Designer' started by zweimeter2, Jan 22, 2018.

Thread Status:
Not open for further replies.
  1. zweimeter2

    Joined:
    Jan 22, 2018
    Messages:
    2
    Likes Received:
    1
    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
     
  2. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,361
    Likes Received:
    109
    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,
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. zweimeter2

    Joined:
    Jan 22, 2018
    Messages:
    2
    Likes Received:
    1
    For anyone interested in this, attached you'll find a sample project for that. Kudos to @edossantos
     

    Attached Files:

    Marc Mohring likes this.
  4. SY

    SY Well-Known Member
    3CX Support

    Joined:
    Jan 26, 2007
    Messages:
    1,825
    Likes Received:
    2
    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)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Thread Status:
Not open for further replies.