public void DeleteParticipantTest()
        {
            try
            {
                ConferencesRequester confRequester = new ConferencesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type       confRequesterType      = typeof(ConferencesRequester);
                MethodInfo freeClimbUrlMethodInfo = confRequesterType.GetMethod("SetFreeClimbUrl",
                                                                                BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                                null,
                                                                                new Type[] { typeof(System.String) },
                                                                                null);
                freeClimbUrlMethodInfo.Invoke(confRequester, new Object[] { "http://DeleteParticipantTest:3000" });

                WebRequest.RegisterPrefix("http://DeleteParticipantTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK);

                confRequester.deleteParticipant("CFbbe46ff1274e283f7e3ac1df0072ab39", "CA386025c9bf5d6052a1d1ea42b4d16662");
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void UpdateConferenceRequestTest()
        {
            try
            {
                ConferencesRequester confRequester = new ConferencesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type       confRequesterType      = typeof(ConferencesRequester);
                MethodInfo freeClimbUrlMethodInfo = confRequesterType.GetMethod("SetFreeClimbUrl",
                                                                                BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                                null,
                                                                                new Type[] { typeof(System.String) },
                                                                                null);
                freeClimbUrlMethodInfo.Invoke(confRequester, new Object[] { "http://UpdateConferenceRequestTest:3000" });

                WebRequest.RegisterPrefix("http://UpdateConferenceRequestTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe46ff1274e283f7e3ac1df0072ab39\", \"revision\" : 2, \"dateCreated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"dateUpdated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"conferenceId\" : \"CFbbe46ff1274e283f7e3ac1df0072ab39\", \"accountId\" : \"AC142c48f2ee663e214c19ea459516068c\", \"alias\" : \"API\", \"playBeep\": \"never\", \"record\": true, \"waitUrl\": null, \"statusCallbackUrl\": null, \"status\" : \"empty\", \"subresourceUris\" : { \"participants\" : \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe46ff1274e283f7e3ac1df0072ab39/Participants\", \"recordings\" : \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe46ff1274e283f7e3ac1df0072ab39/Recordings\"}}");

                Conference conference = confRequester.update("CFbbe46ff1274e283f7e3ac1df0072ab39");

                Assert.IsNotNull(conference);
                Assert.AreEqual(conference.getUri, "/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe46ff1274e283f7e3ac1df0072ab39");
                Assert.AreEqual(conference.getSubresourceUris.Count, 2);
                Assert.AreEqual(conference.getRevision, 2);
                Assert.IsNotNull(conference.getDateCreated);
                Assert.IsNotNull(conference.getDateUpdated);
                Assert.AreEqual(conference.getPlayBeep, EPlayBeep.Never);
                Assert.AreEqual(conference.getRecord, EBool.True);
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void GetParticipantRequestTest()
        {
            try
            {
                ConferencesRequester confRequester = new ConferencesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type       confRequesterType      = typeof(ConferencesRequester);
                MethodInfo freeClimbUrlMethodInfo = confRequesterType.GetMethod("SetFreeClimbUrl",
                                                                                BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                                null,
                                                                                new Type[] { typeof(System.String) },
                                                                                null);
                freeClimbUrlMethodInfo.Invoke(confRequester, new Object[] { "http://GetParticipantRequestTest:3000" });

                WebRequest.RegisterPrefix("http://GetParticipantRequestTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe4632a3c49700934481addd5ce1659/Participants/CA386025c9bf5d6052a1d1ea42b4d16662\", \"revision\" : 1, \"dateCreated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"dateUpdated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"callId\" : \"CA386025c9bf5d6052a1d1ea42b4d16662\", \"conferenceId\" : \"CFbbe4632a3c49700934481addd5ce1659\", \"accountId\" : \"AC142c48f2ee663e214c19ea459516068c\", \"talk\" : true, \"listen\" : true, \"startConfOnEnter\" : false}");

                Participant participant = confRequester.getParticipant("CFbbe4632a3c49700934481addd5ce1659", "CA386025c9bf5d6052a1d1ea42b4d16662");

                Assert.IsNotNull(participant);
                Assert.AreEqual(participant.getUri, "/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe4632a3c49700934481addd5ce1659/Participants/CA386025c9bf5d6052a1d1ea42b4d16662");
                Assert.AreEqual(participant.getTalk, EBool.True);
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        public void MakeADefaultConferenceRequesterTest()
        {
            try
            {
                ConferencesRequester req = new ConferencesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Assert.AreEqual(req.getAccountId, "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");
                Assert.AreEqual(req.getAuthToken, "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5");
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        /// <summary>
        /// This constructor allows one to create a PersyClient that authenticates
        /// with one set of credentials but acts as a second account (i.e. a sub
        /// account).
        /// </summary>
        /// <param name="credAccountId">The Account ID to use in your credentials for the Persephony API.</param>
        /// <param name="credAuthToken">The Auth Token to use in your credentials for the Persephony API. This should be the matching Auth Token to the credAccountId parameter.</param>
        /// <param name="accountId">The Account ID of the account you want to act as. This should either be the same Account ID ass credAccountId or the id of a sub-account to the credAccountId's account.</param>
        /// <exception cref="PersyException">Thrown upon failed request.</exception>
        public PersyClient(string credAccountId, string credAuthToken, string accountId)
        {
            this.credAccountId = credAccountId;
            this.credAuthToken = credAuthToken;
            this.accountId     = accountId;

            calls                 = new CallsRequester(credAccountId, credAuthToken, accountId);
            recordings            = new RecordingsRequester(credAccountId, credAuthToken, accountId);
            conferences           = new ConferencesRequester(credAccountId, credAuthToken, accountId);
            queues                = new QueuesRequester(credAccountId, credAuthToken, accountId);
            applications          = new ApplicationsRequester(credAccountId, credAuthToken, accountId);
            logs                  = new LogsRequester(credAccountId, credAuthToken, accountId);
            availablePhoneNumbers = new AvailablePhoneNumbersRequester(credAccountId, credAuthToken, accountId);
            incomingPhoneNumbers  = new IncomingPhoneNumbersRequester(credAccountId, credAuthToken, accountId);
            callingNumbers        = new CallingNumbersRequester(credAccountId, credAuthToken, accountId);
            accounts              = new AccountsRequester(credAccountId, credAuthToken);
        }
Beispiel #6
0
        public void MakeAInitialConferenceRequestTest()
        {
            try
            {
                ConferencesRequester confRequester = new ConferencesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type       confRequesterType  = typeof(ConferencesRequester);
                MethodInfo persyUrlMethodInfo = confRequesterType.GetMethod("setPersyUrl",
                                                                            BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                            null,
                                                                            new Type[] { typeof(System.String) },
                                                                            null);
                persyUrlMethodInfo.Invoke(confRequester, new Object[] { "http://MakeAInitialConferenceRequestTest:3000" });

                WebRequest.RegisterPrefix("http://MakeAInitialConferenceRequestTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe46ff1274e283f7e3ac1df0072ab39\", \"revision\" : 1, \"dateCreated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"dateUpdated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"conferenceId\" : \"CFbbe46ff1274e283f7e3ac1df0072ab39\", \"accountId\" : \"AC142c48f2ee663e214c19ea459516068c\", \"alias\" : \"API\", \"status\" : \"empty\", \"subresourceUris\" : { \"participants\" : \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe46ff1274e283f7e3ac1df0072ab39/Participants\", \"recordings\" : \"/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe46ff1274e283f7e3ac1df0072ab39/Recordings\"}}");

                ConferenceCreateOptions options = new ConferenceCreateOptions();
                options.setAlias("API");

                Conference conference = confRequester.create(options);

                Assert.IsNotNull(conference);
                Assert.AreEqual(conference.getUri, "/Accounts/AC142c48f2ee663e214c19ea459516068c/Conferences/CFbbe46ff1274e283f7e3ac1df0072ab39");
                Assert.AreEqual(conference.getSubresourceUris.Count, 2);
                Assert.AreEqual(conference.getRevision, 1);
                Assert.IsNotNull(conference.getDateCreated);
                Assert.IsNotNull(conference.getDateUpdated);
                Assert.AreEqual(conference.getStatus, EConferenceStatus.Empty);
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }