void SearchRecordFile(CallStatus target) { if (RecordsList != null) { var callID = GetPart(":" + target.CallID, ':', ':'); for (var i = 0; i < RecordsList.Count; i++) { var recID = GetPart(RecordsList[i].FileName, '(', ')'); if (callID == recID) { target.DisplayDate = RecordsList[i].DisplayDate; target.FileName = RecordsList[i].FileName; } } } }
private void callHandler_OnMyPhoneStatusChanged(object sender, MyPhonePlugins.MyPhoneStatus status) { if (status == MyPhonePlugins.MyPhoneStatus.LoggedIn) { this.extensionInfo = sender as MyPhonePlugins.IExtensionInfo; } var onMyPhoneStatusChanged = new OnMyPhoneStatusChanged(); try { var _sender = sender as MyPhonePlugins.IMyPhoneCallHandler; fillCallHandler_1(_sender, onMyPhoneStatusChanged.CallHandler); onMyPhoneStatusChanged.Status = status.ToString(); foreach (var call in _sender.ActiveCalls) { var newCall = new CallStatus(); fillCallStatus(call, newCall); onMyPhoneStatusChanged.CallHandler.ActiveCalls.Add(newCall); } foreach (var profile in _sender.Profiles) { var newProfile = new UserProfileStatus(); fillProfiles(profile, newProfile); onMyPhoneStatusChanged.CallHandler.Profiles.Add(newProfile); } } catch { onMyPhoneStatusChanged = null; } LogHelper.Log(Environment.SpecialFolder.ApplicationData, "CallTriggerCmd.log", String.Format("MyPhoneStatusChanged - Status='{0}' - Extension='{1}'", status, extensionInfo == null ? String.Empty : extensionInfo.Number)); Callback(channel => channel.MyPhoneStatusChanged(onMyPhoneStatusChanged)); }
public CallStatus BeginTransfer(string callId, string destination) { try { var status = callHandler.BeginTransfer(callId, destination); if (status != null) { var callStatus = new CallStatus(); fillCallStatus(status, callStatus); return(callStatus); } return(null); // (status != null) ? status.CallID : String.Empty; } catch { return(null); } }
public CallStatus MakeCallEx(string destination, MakeCallOptions options) { try { var status = callHandler.MakeCall(destination, ConvertMakeCallOptions(options)); if (status != null) { var callStatus = new CallStatus(); fillCallStatus(status, callStatus); return(callStatus); } } catch (Exception exc) { LogHelper.Log(Environment.SpecialFolder.ApplicationData, "CallTriggerCmd.log", "Error executing callHandler.MakeCall(" + destination + "): " + exc.ToString()); } return(null); }
private void callHandler_OnCallStatusChanged(object sender, MyPhonePlugins.CallStatus callInfo) { LogHelper.Log(Environment.SpecialFolder.ApplicationData, "CallTriggerCmd.log", String.Format("CallStatusChanged - CallID='{0}' - Incoming='{1}' - OtherPartyNumber='{2}' - State='{3}'", callInfo.CallID, callInfo.Incoming, callInfo.OtherPartyNumber, callInfo.State)); var onCallStatusChanged = new OnCallStatusChanged(); try { var _sender = sender as MyPhonePlugins.IMyPhoneCallHandler; fillCallHandler_1(_sender, onCallStatusChanged.CallHandler); fillCallStatus(callInfo, onCallStatusChanged.CallStatus); foreach (var call in _sender.ActiveCalls) { var newCall = new CallStatus(); fillCallStatus(call, newCall); onCallStatusChanged.CallHandler.ActiveCalls.Add(newCall); } foreach (var profile in _sender.Profiles) { var newProfile = new UserProfileStatus(); fillProfiles(profile, newProfile); onCallStatusChanged.CallHandler.Profiles.Add(newProfile); } } catch { onCallStatusChanged = null; } Callback(channel => channel.CallStatusChanged(onCallStatusChanged)); }
public string _BeginTransfer(string callId, string destination) { CallStatus callStatus = Service.BeginTransfer(callId, destination); return(convertToJSON(callStatus, typeof(CallStatus))); }
void fillCallStatus(MyPhonePlugins.CallStatus source, CallStatus target) { target.CallID = source.CallID; target.Incoming = source.Incoming; target.IsHold = (bool)getValueFildDynamicObjectByName(source, "IsHold"); target.IsMuted = (bool)getValueFildDynamicObjectByName(source, "IsMuted"); target.Originator = source.Originator; target.OriginatorName = source.OriginatorName; target.OriginatorType = source.OriginatorType.ToString(); target.OtherPartyName = source.OtherPartyName; target.OtherPartyNumber = source.OtherPartyNumber; target.State = source.State.ToString(); target.Tag3cx = (string)getValueFildDynamicObjectByName(source, "tag3cx"); //if (target.State == "Connected") //{ // Thread.Sleep(150); //} //var debugCount = 0; //if (target.State == "Connected") //{ // var sw = Stopwatch.StartNew(); // while (true) // { // debugCount++; // if (RecordsList != null) // { // var callID = GetPart(":" + target.CallID, ':', ':'); // for (var i = 0; i < RecordsList.Count; i++) // { // var recID = GetPart(RecordsList[i].FileName, '(', ')'); // if (callID == recID) // { // target.DisplayDate = RecordsList[i].DisplayDate; // target.FileName = RecordsList[i].FileName; // break; // } // } // } // var ms = sw.ElapsedMilliseconds; // if (ms > 100) // { // break; // } // Thread.Yield(); // } //} //var recordsList = GetRecordsList(); if (target.State == "Connected") { SearchRecordFile(target); if (target.FileName == null && !RecordsListConfirm.Contains(target.CallID + target.OtherPartyNumber)) { Thread.Sleep(150); RecordsList = GetRecordsList(); RecordsListConfirm.Add(target.CallID + target.OtherPartyNumber); SearchRecordFile(target); } } }
public OnCallStatusChanged() { CallHandler = new CallHandler(); CallStatus = new CallStatus(); }