Ejemplo n.º 1
0
        public void CreateAndVerifyConferenceStatusCallbackTest()
        {
            ConferenceStatusCallback cs = ConferenceStatusCallback.fromJson("{\"accountId\":\"AC766bc3fb87212042619f41ac6344feef2f1b0d00\",\"callId\":\"CA98fed82dfb2295fdd9f4a8c102c321cb6cedace6\",\"callStatus\":\"inProgress\",\"conferenceId\":\"CFa31a223c04ac99576d14ce3e50815449fe673bde\",\"direction\":\"inbound\",\"from\":\"1000000051\",\"parentCallId\":null,\"queueId\":null,\"to\":\"+11112223333\",\"status\":\"inProgress\"}");

            Assert.IsNotNull(cs);
            Assert.AreEqual(cs.getAccountId, "AC766bc3fb87212042619f41ac6344feef2f1b0d00");
            Assert.AreEqual(cs.getConferenceId, "CFa31a223c04ac99576d14ce3e50815449fe673bde");
            Assert.AreEqual(cs.getStatus, EConferenceStatus.InProgress);
        }
        public ActionResult ConferenceCreated(ConferenceStatusCallback request)
        {
            // Make OutDial request once conference has been created
            PerCLScript script = new PerCLScript();
            Say         say    = new Say();

            say.setText("Please wait while we attempt to connect you to an agent.");
            script.Add(say);
            string confId = request.getConferenceId;
            // implementation of lookupAgentPhoneNumber() is left up to the developer
            string agentPhoneNumber = lookupAgentPhoneNumber();
            // Make OutDial request once conference has been created
            var     outdialActionUrl    = AppUrl + $"/voice/OutboundCallMade?conferenceId={confId}";
            var     outdialConnectedUrl = AppUrl + $"/voice/OutboundCallConnected?conferenceId={confId}";
            OutDial outDial             = new OutDial(agentPhoneNumber, outdialConnectedUrl);

            outDial.setCallingNumber(request.getFrom);
            outDial.setActionUrl(outdialActionUrl);
            outDial.setIfMachine(com.freeclimb.EIfMachine.Hangup);
            script.Add(outDial);
            return(Content(script.toJson(), "application/json"));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (From != null)
            {
                p.Add(new KeyValuePair <string, string>("From", From.ToString()));
            }

            if (To != null)
            {
                p.Add(new KeyValuePair <string, string>("To", To.ToString()));
            }

            if (StatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallback", StatusCallback.ToString()));
            }

            if (StatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallbackMethod", StatusCallbackMethod.ToString()));
            }

            if (StatusCallbackEvent != null)
            {
                p.AddRange(StatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("StatusCallbackEvent", prop)));
            }

            if (Timeout != null)
            {
                p.Add(new KeyValuePair <string, string>("Timeout", Timeout.Value.ToString()));
            }

            if (Record != null)
            {
                p.Add(new KeyValuePair <string, string>("Record", Record.Value.ToString()));
            }

            if (Muted != null)
            {
                p.Add(new KeyValuePair <string, string>("Muted", Muted.Value.ToString()));
            }

            if (Beep != null)
            {
                p.Add(new KeyValuePair <string, string>("Beep", Beep));
            }

            if (StartConferenceOnEnter != null)
            {
                p.Add(new KeyValuePair <string, string>("StartConferenceOnEnter", StartConferenceOnEnter.Value.ToString()));
            }

            if (EndConferenceOnExit != null)
            {
                p.Add(new KeyValuePair <string, string>("EndConferenceOnExit", EndConferenceOnExit.Value.ToString()));
            }

            if (WaitUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("WaitUrl", WaitUrl.ToString()));
            }

            if (WaitMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("WaitMethod", WaitMethod.ToString()));
            }

            if (EarlyMedia != null)
            {
                p.Add(new KeyValuePair <string, string>("EarlyMedia", EarlyMedia.Value.ToString()));
            }

            if (MaxParticipants != null)
            {
                p.Add(new KeyValuePair <string, string>("MaxParticipants", MaxParticipants.Value.ToString()));
            }

            if (ConferenceRecord != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceRecord", ConferenceRecord));
            }

            if (ConferenceTrim != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceTrim", ConferenceTrim));
            }

            if (ConferenceStatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceStatusCallback", ConferenceStatusCallback.ToString()));
            }

            if (ConferenceStatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceStatusCallbackMethod", ConferenceStatusCallbackMethod.ToString()));
            }

            if (ConferenceStatusCallbackEvent != null)
            {
                p.AddRange(ConferenceStatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("ConferenceStatusCallbackEvent", prop)));
            }

            if (RecordingChannels != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingChannels", RecordingChannels));
            }

            if (RecordingStatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingStatusCallback", RecordingStatusCallback.ToString()));
            }

            if (RecordingStatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingStatusCallbackMethod", RecordingStatusCallbackMethod.ToString()));
            }

            if (SipAuthUsername != null)
            {
                p.Add(new KeyValuePair <string, string>("SipAuthUsername", SipAuthUsername));
            }

            if (SipAuthPassword != null)
            {
                p.Add(new KeyValuePair <string, string>("SipAuthPassword", SipAuthPassword));
            }

            if (Region != null)
            {
                p.Add(new KeyValuePair <string, string>("Region", Region));
            }

            if (ConferenceRecordingStatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceRecordingStatusCallback", ConferenceRecordingStatusCallback.ToString()));
            }

            if (ConferenceRecordingStatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceRecordingStatusCallbackMethod", ConferenceRecordingStatusCallbackMethod.ToString()));
            }

            return(p);
        }
Ejemplo n.º 4
0
        public ActionResult ConferenceStatus([FromQuery(Name = "roomCode")] string roomCode, ConferenceStatusCallback request)
        {
            PerCLScript       script       = new PerCLScript();
            EConferenceStatus status       = request.getStatus;
            String            conferenceId = request.getConferenceId;
            // find which conference room the conference belongs to
            ConferenceRoom room = conferenceRooms[roomCode];

            if (room == null)
            {
                // Handle case where callback is called for a room that does not exist
            }
            if (status == EConferenceStatus.Empty && room.canConferenceTerminate)
            {
                try {
                    terminateConference(conferenceId);
                    room.conferenceId = null;
                } catch (FreeClimbException pe) {
                    // Handle error when terminateConference fails
                }
            }
            // after first EMPTY status update conference can be terminated
            room.canConferenceTerminate = true;
            return(Content(script.toJson(), "application/json"));
        }