ICallHandlerStart Method

Script entry point. Executes call handling this method is called by scripting core when:
1. Call is arriving on the CallFlow routing point
2. When other script switches processing to the script SwitchTo(String)
3. When other script used Call(String, ActionBoolean, DictionaryString, String) to the script
4. Can be called before the media channel is ready in case if RoutePoint is configured with DNProperty 'AUTOANSWER' set to '1'

Definition

Namespace: CallFlow
Assembly: 3CX.CallFlow (in 3CX.CallFlow.dll) Version: 20.0.1
C#
void Start()

Remarks

Script should be stateless and use Caller object to store (or get) call processing data:
a) Script instance is not the "storage of call information", because Caller connection is playing this role

b) Script instance is not the "call tracker" - Scripting host detaches script instance from the call once call is switched to another call flow script or routed to another destination
c) Script instance is not the "application which monitors state of PBX" because it managed by scripting host.
d) Script instance is allowed to perform wrapup action after it was detached from the call.

Example

C#
using CallFlow;
//namespase will be substituted according to the DN.Number assigned to RoutePoint
namespace dummy
{
    public class MyCallHandler : ScriptBase<MyCallHandler>
    {
        public override async void Start()
        {
            scriptCompleted = false;
            try
            {
                await Task.Run(() =>
                {
                    try
                    {
                        //
                    }
                    catch
                    {
                        MyCall.Error("Unexcpected failure");
                        scriptCompleted = false;
                    }
                    finally
                    {
                        MyCall.Return(scriptCompleted);
                    }
                });

           }
           catch
           {
               MyCall.Critical("Cannot execute call handler");
               MyCall.Return(false);
           }
        }
    }
}

See Also