コード例 #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 }
                });
            }
        }
コード例 #2
0
ファイル: PlayerEvents.cs プロジェクト: SynapseSL/SynapseOld
        internal static void InvokeSpeakEvent(DissonanceUserSetup dissonance, ref bool intercom, ref bool radio,
                                              ref bool scp939, ref bool scpChat, ref bool spectator)
        {
            if (SpeakEvent == null)
            {
                return;
            }

            var ev = new PlayerSpeakEvent
            {
                IntercomTalk        = intercom,
                RadioTalk           = radio,
                Scp939Talk          = scp939,
                ScpChat             = scpChat,
                SpectatorChat       = spectator,
                DissonanceUserSetup = dissonance,
                Player = dissonance.gameObject.GetPlayer()
            };

            SpeakEvent.Invoke(ev);

            intercom  = ev.IntercomTalk;
            radio     = ev.RadioTalk;
            scp939    = ev.Scp939Talk;
            scpChat   = ev.ScpChat;
            spectator = ev.SpectatorChat;
        }
コード例 #3
0
 public static async Task ProcessEvent(SpeakEvent ev, UrlHelper url, HttpContextBase context, dynamic viewBag)
 {
     if (ev.Status != "done")
     {
         return;
     }
     await ProcessPlaybackEvent(viewBag, ev.Tag);
 }
コード例 #4
0
 public static async Task ProcessEvent(SpeakEvent ev, UrlHelper url, HttpContextBase context)
 {
     Trace.WriteLine("SpeakEvent", "Events");
     if (ev.Status != "done")
     {
         return;
     }
     var call = new Call {
         Id = ev.CallId
     };
     await call.HangUp();
 }
コード例 #5
0
 public async static Task ProcessEvent(SpeakEvent ev, UrlHelper url, HttpContextBase context)
 {
     if (ev.Status != "done")
     {
         return;
     }
     Trace.WriteLine("Bridged-SpeakEvent", "Events");
     if (ev.Tag.StartsWith("warning"))
     {
         var otherCallId = ev.Tag.Split(':').LastOrDefault();
         await Bridge.Create(new Dictionary <string, object>
         {
             { "callIds", new[] { otherCallId } }
         });
     }
 }
コード例 #6
0
        private async Task ProcessCatapultFromEvent(SpeakEvent ev)
        {
            if (ev.Status != "done")
            {
                return;
            }
            //a messages was spoken to "from" number. calling to "to" number
            var c = await Call.Create(Client, new Dictionary <string, object>
            {
                { "from", PhoneNumberForCallbacks },
                { "to", ev.Tag },
                { "callbackUrl", BaseUrl + Url.Action("CatapultToCallback") },
                { "tag", ev.CallId }
            });

            Debug.WriteLine("Call Id to {0} is {1}", ev.Tag, c.Id);
        }
コード例 #7
0
        public async static Task ProcessEvent(SpeakEvent ev, UrlHelper url, HttpContextBase context)
        {
            if (ev.Status != "done")
            {
                return;
            }

            Trace.WriteLine("SpeakEvent", "Events");

            var call = new Call {
                Id = ev.CallId
            };

            switch (ev.Tag)
            {
            case "gather_complete":
                await Call.Create(new Dictionary <string, object>
                {
                    { "from", Common.Caller },
                    { "to", Common.BridgeCallee },
                    { "callbackUrl", string.Format("http://{0}{1}", Common.Domain, url.Action("Bridged", "Events")) },
                    { "tag", string.Format("other-leg:{0}", call.Id) }
                });

                break;

            case "terminating":
                await call.HangUp();

                break;

            case "hello-state":
                await call.PlayAudio(new Dictionary <string, object>
                {
                    { "fileUrl", string.Format("http://{0}/content/dolphin.mp3", Common.Domain) },
                    { "tag", "dolphin-state" }
                });

                break;
            }
        }
コード例 #8
0
        public async static Task ProcessEvent(SpeakEvent ev, UrlHelper url, HttpContextBase context)
        {
            if (ev.Status != "done" || ev.Tag == "notification")
            {
                return;
            }
            Trace.WriteLine("FirstMember-SpeakEvent", "Events");
            var call = new Call {
                Id = ev.CallId
            };
            var conferenceUrl = string.Format("http://{0}{1}", Common.Domain, url.Action("Conference", "Events"));
            var conference    = await Conference.Create(new Dictionary <string, object>
            {
                { "from", Common.ConferenceNumber },
                { "callbackUrl", conferenceUrl }
            });

            await conference.CreateMember(new Dictionary <string, object>
            {
                { "callId", call.Id },
                { "joinTone", true },
                { "leavingTone", true }
            });
        }
コード例 #9
0
 private async Task ProcessCalledToOwnerEvent(SpeakEvent ev, TinyIoCContainer container)
 {
     if (ev.Status != "done")
     {
         return;
     }
     var call = new Call {Id = ev.CallId};
     switch (ev.Tag)
     {
         case "start-recording-message":
             await call.PlayAudio(new Dictionary<string, object>
             {
                 {"fileUrl", $"{Context.Items["baseUrl"]}/Content/beep.mp3"},
                 {"tag", "start-recording"}
             });
             break;
     }
 }