public FunctionWrapper GenerateFuncWrapper(string qualifiedMethodName, string typeMapping, Dictionary <string, Delegate> defaultHandlers) { // Validate default handlers. foreach (KeyValuePair <string, Delegate> defaultHandler in defaultHandlers) { FunctionCall.ValidateHandler(defaultHandler.Key, defaultHandler.Value); } return((FunctionWrapper) delegate(object[] parameters) { int callID = NextCallID++; List <object> callMessage = new List <object>(); callMessage.Add("call"); callMessage.Add(callID); callMessage.Add(qualifiedMethodName); callMessage.AddRange(parameters); Connection.Send(JsonConvert.SerializeObject(callMessage)); if (IsOneWay(qualifiedMethodName)) { return null; } FunctionCall callObj = new FunctionCall(); foreach (KeyValuePair <string, Delegate> defaultHandler in defaultHandlers) { callObj.On(defaultHandler.Key, defaultHandler.Value); } ActiveCalls.Add(callID, callObj); return callObj; }); }
/// <summary> /// /// </summary> /// <param name="url"></param> public void TestIncomingAudioCall(string number) { Debug.Console(1, this, "TestIncomingAudioCall from {0}", number); var call = new CodecActiveCallItem() { Name = number, Id = number, Number = number, Type = eCodecCallType.Audio, Direction = eCodecCallDirection.Incoming }; ActiveCalls.Add(call); SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Ringing, call); }
//******************************************************** // SIMULATION METHODS /// <summary> /// /// </summary> /// <param name="url"></param> public void TestIncomingVideoCall(string url) { Debug.Console(1, this, "TestIncomingVideoCall from {0}", url); var call = new CodecActiveCallItem() { Name = url, Id = url, Number = url, Type = eCodecCallType.Video, Direction = eCodecCallDirection.Incoming }; ActiveCalls.Add(call); SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Ringing, call); //OnCallStatusChange(eCodecCallStatus.Unknown, eCodecCallStatus.Ringing, call); }
/// <summary> /// Dials, yo! /// </summary> public override void Dial(string number) { Debug.Console(1, this, "Dial: {0}", number); var call = new CodecActiveCallItem() { Name = number, Number = number, Id = number, Status = eCodecCallStatus.Dialing, Direction = eCodecCallDirection.Outgoing, Type = eCodecCallType.Video }; ActiveCalls.Add(call); OnCallStatusChange(call); //ActiveCallCountFeedback.FireUpdate(); // Simulate 2-second ring, then connecting, then connected new CTimer(o => { call.Type = eCodecCallType.Video; SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Connecting, call); new CTimer(oo => SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Connected, call), 1000); }, 2000); }
public override void Dial(string number) { if (!IsInCall) { Debug.Console(1, this, "Dial: {0}", number); var call = new CodecActiveCallItem() { Name = "Mock Outgoing Call", Number = number, Type = eCodecCallType.Audio, Status = eCodecCallStatus.Connected, Direction = eCodecCallDirection.Outgoing, Id = "mockAudioCall-1" }; ActiveCalls.Add(call); OnCallStatusChange(call); } else { Debug.Console(1, this, "Already in call. Cannot dial new call."); } }
public static void AddNewCall(LocationalCall call) { ActiveCalls.Add(call); }