예제 #1
0
        public async static Task ProcessEvent(SpeakEvent ev, UrlHelper url, HttpContextBase context)
        {
            if (ev.Status != "done")
            {
                return;
            }
            Trace.WriteLine("Other-SpeakEvent", "Events");
            var call = new Call {
                Id = ev.CallId
            };

            if (ev.Tag == "terminating")
            {
                await call.HangUp();
            }
            else
            {
                if (ev.Tag == "notification")
                {
                    return;
                }
                var conferenceId = ev.Tag.Split(':').LastOrDefault();
                var conference   = new Conference {
                    Id = conferenceId
                };
                await conference.CreateMember(new Dictionary <string, object>
                {
                    { "callId", call.Id },
                    { "joinTone", true }
                });
            }
        }
 private async Task ProcessConferenceEvent(ConferenceEvent ev, TinyIoCContainer container)
 {
     if (ev.Status == "created")
     {
         var conference = new Conference {Id = ev.ConferenceId};
         CurrentConference = conference;
         CurrentConferenceMember =
             await
                 conference.CreateMember(new Dictionary<string, object>
                 {
                     {"callId", CurrentCall.Id}
                 });
         await Call.Create(new Dictionary<string, object>
         {
             {"from", Context.Items["servicePhoneNumber"]},
             {"to", ContactPhoneNumber},
             {"recordingEnabled", true},
             {"callbackUrl", $"{Context.Items["baseUrl"]}/called-to-contact"}
         });
     }
     else
     {
         CurrentConference = null;
     }
 }