Пример #1
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/user/account
        string AccountSid   = "{{ account_sid }}";
        string AuthToken    = "{{ auth_token }}";
        string WorkspaceSid = "{{ workspace_sid }}";
        string TaskSid      = "{{ task_sid }}";
        var    client       = new TaskRouterClient(AccountSid, AuthToken);

        Task task = client.GetTask(WorkspaceSid, TaskSid);

        Console.WriteLine(task.Attributes);

        // alternatively
        Dictionary <string, string> fetchedAttributes = task.ParseAttributes();
        string value = fetchedAttributes["foo"];

        Console.WriteLine(value);
    }
Пример #2
0
        private dynamic UpdateReservation(string workerSid, string taskSid, string reservationSid, string status)
        {
            var reservation = client.UpdateReservation(
                settings.TaskRouter.Workspace.Sid, taskSid, reservationSid, status, settings.TaskRouter.Activities.Offline.Sid);

            string taskWorkspaceSid = reservation.WorkspaceSid;
            string taskTaskSid      = reservation.TaskSid;

            if (string.IsNullOrWhiteSpace(taskWorkspaceSid))
            {
                taskWorkspaceSid = settings.TaskRouter.Workspace.Sid;
            }

            if (string.IsNullOrWhiteSpace(taskTaskSid))
            {
                taskTaskSid = taskSid;
            }
            var task  = client.GetTask(taskWorkspaceSid, taskTaskSid);
            var model = CreateTaskModel(task);

            return(model);
        }