Ejemplo n.º 1
0
        async public Task TestCallChild()
        {
            var scotchMode = ScotchMode.Replaying;
            var client     = HttpClients.NewHttpClient("IntegrationTests/Cassettes/CallChildTests.json", scotchMode);

            string tokenKey    = "key";
            string tokenSecret = "secret";
            string host        = "https://dvfoa3pu2rxx6.cloudfront.net/api/v1/";

            OmnigageClient.Init(tokenKey, tokenSecret, host, client);
            OmnigageClient.IsTesting = true;

            CallResource parentCall = new CallResource();

            parentCall.To     = "+18332676094";
            parentCall.Action = CallAction.Dial;

            await parentCall.Create();

            while (true)
            {
                if (parentCall.Status == "in-progress")
                {
                    break;
                }
                else
                {
                    await parentCall.Reload();
                }
            }

            CallResource childCall = new CallResource();

            childCall.To         = "+14076413749";
            childCall.Action     = CallAction.Dial;
            childCall.ParentCall = parentCall;
            childCall.CallerId   = new CallerIdResource
            {
                Id = "yL9vQaWrSqg5W8EFEpE6xZ"
            };

            await childCall.Create();
        }