private void SearchTextBox_KeyUp(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e) { if (e.Key == Windows.System.VirtualKey.Enter) { CallList.Focus(Windows.UI.Xaml.FocusState.Programmatic); } }
public void GetAllCall() { callTable.Clear(); CallList.Clear(); string sql = "select * from CallLogTable where CallType=0 or CallType=2"; callTable = AccessHelper.Adapter(sql, null); for (int i = callTable.Rows.Count - 1; i >= 0; i--) { try { var dm = new DataModel(); dm.SetData(callTable.Rows[i]); if (dm.CallerID == "") { continue; } CallList.Add(dm); } catch (Exception ex) { Log4Helper.Error(this.GetType(), "数据库存在异常数据", ex); continue; } } }
/// <summary> /// /// </summary> /// <param name="strCampaignDBConn"></param> /// <param name="objOtherParameter"></param> /// <returns>OtherParameter</returns> public static CallList CallListInsertUpdate(Campaign campaign, CallList objCallList) { try { SqlParameter[] sparam_s = new SqlParameter[] { new SqlParameter("@CallListID", objCallList.CallListID), new SqlParameter("@AgentID", objCallList.AgentID), new SqlParameter("@ResultCodeID", objCallList.ResultCodeID), new SqlParameter("@PhoneNumber", objCallList.PhoneNumber), new SqlParameter("@CallDate", objCallList.CallDate), new SqlParameter("@CallTime", objCallList.CallTime), new SqlParameter("@CallDuration", objCallList.CallDuration), new SqlParameter("@CallCompletionTime", objCallList.CallCompletionTime), new SqlParameter("@CallWrapTime", objCallList.CallWrapTime), new SqlParameter("@DateCreated", DateTime.Now.Date), new SqlParameter("@DateModified", DateTime.Now.Date) }; objCallList.CallListID = (long)SqlHelper.ExecuteScalar(campaign.CampaignDBConnString, CommandType.StoredProcedure, "InsUpd_CallList", sparam_s); } catch (Exception ex) { throw ex; } return(objCallList); }
/// <summary> /// Replace call ids /// </summary> /// <param name="newid"></param> /// <param name="oldid"></param> private void OnCallReplaced(int oldid, int newid) { IStateMachine call = CallList[oldid]; _calls.Remove(oldid); call.Session = newid; CallList.Add(newid, call); }
public void ThenMethod(string input) { CallList.Add(new InvocationInformation() { InvocationTime = DateTime.Now, StackTrace = Environment.StackTrace, InvocationTarget = "ThenMethod" }); }
public void BeforeEach() { CallList.Add(new InvocationInformation() { InvocationTime = DateTime.Now, StackTrace = Environment.StackTrace, InvocationTarget = "BeforeEach" }); }
public void Register() { CallList.Add(new InvocationInformation() { InvocationTime = DateTime.Now, StackTrace = Environment.StackTrace, InvocationTarget = "Register" }); }
public void GetCallListTest() { try { CallsRequester callsRequester = new CallsRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da"); Type callsRequesterType = typeof(CallsRequester); MethodInfo persyUrlMethodInfo = callsRequesterType.GetMethod("setPersyUrl", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[] { typeof(System.String) }, null); persyUrlMethodInfo.Invoke(callsRequester, new Object[] { "http://GetCallListTest:3000" }); WebRequest.RegisterPrefix("http://GetCallListTest:3000", new TestWebRequestCreate()); TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK, "{\"total\":3,\"start\":0,\"end\":1,\"page\":0,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls?cursor=492dc883a811bd0204204ea9047122f93a2788a2\",\"calls\":[{\"uri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd883b\",\"revision\":1,\"dateCreated\":\"Mon, 28 Mar 2016 19:58:21 GMT\",\"dateUpdated\":\"Mon, 28 Mar 2016 19:58:21 GMT\",\"callId\":\"CAfe92a5efbaf90f04bbec946a0d74dad520dd883b\",\"parentCallId\":null,\"accountId\":\"ACabe7063197551fe51671f9ac3a9708e9dad51c4d\",\"from\":\"847655770\",\"to\":\"+11112223333\",\"phoneNumberId\":null,\"status\":\"completed\",\"startTime\":\"Mon, 28 Mar 2016 19:58:21 GMT\",\"endTime\":\"Mon, 28 Mar 2016 19:58:30 GMT\",\"duration\":9,\"direction\":\"inbound\",\"answeredBy\":null,\"callerName\":null,\"subresourceUris\":{\"notifications\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd883b/Notifications\",\"recordings\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd883b/Recordings\"}},{\"uri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CA25c3c744acdedcdb92a44dbae42d486bf20028ab\",\"revision\":1,\"dateCreated\":\"Mon, 28 Mar 2016 20:03:42 GMT\",\"dateUpdated\":\"Mon, 28 Mar 2016 20:03:42 GMT\",\"callId\":\"CA25c3c744acdedcdb92a44dbae42d486bf20028ab\",\"parentCallId\":null,\"accountId\":\"ACabe7063197551fe51671f9ac3a9708e9dad51c4d\",\"from\":\"847655770\",\"to\":\"+11112223333\",\"phoneNumberId\":null,\"status\":\"completed\",\"startTime\":\"Mon, 28 Mar 2016 20:03:42 GMT\",\"endTime\":\"Mon, 28 Mar 2016 20:03:50 GMT\",\"duration\":8,\"direction\":\"inbound\",\"answeredBy\":null,\"callerName\":null,\"subresourceUris\":{\"notifications\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CA25c3c744acdedcdb92a44dbae42d486bf20028ab/Notifications\",\"recordings\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CA25c3c744acdedcdb92a44dbae42d486bf20028ab/Recordings\"}}]}"); CallList callList = callsRequester.get(); Assert.IsNotNull(callList); Assert.AreEqual(callList.getLocalSize, 2); Assert.AreEqual((callList.export()).Count, 2); Call call = callList.get(0) as Call; Assert.IsNotNull(call); Assert.AreEqual(call.getCallId, "CAfe92a5efbaf90f04bbec946a0d74dad520dd883b"); Type type = typeof(APIRequester); FieldInfo fieldInfo = type.GetField("persyUrl", BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { fieldInfo.SetValue(callList, "http://GetCallListTest:3000"); } TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK, "{\"total\":3,\"start\":2,\"end\":2,\"page\":1,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":null,\"calls\":[{\"uri\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd884b\",\"revision\":1,\"dateCreated\":\"Mon, 28 Mar 2016 19:58:21 GMT\",\"dateUpdated\":\"Mon, 28 Mar 2016 19:58:21 GMT\",\"callId\":\"CAfe92a5efbaf90f04bbec946a0d74dad520dd884b\",\"parentCallId\":null,\"accountId\":\"ACabe7063197551fe51671f9ac3a9708e9dad51c4d\",\"from\":\"847655770\",\"to\":\"+11112223333\",\"phoneNumberId\":null,\"status\":\"completed\",\"startTime\":\"Mon, 28 Mar 2016 19:58:21 GMT\",\"endTime\":\"Mon, 28 Mar 2016 19:58:30 GMT\",\"duration\":9,\"direction\":\"inbound\",\"answeredBy\":null,\"callerName\":null,\"subresourceUris\":{\"notifications\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd883b/Notifications\",\"recordings\":\"/Accounts/ACabe7063197551fe51671f9ac3a9708e9dad51c4d/Calls/CAfe92a5efbaf90f04bbec946a0d74dad520dd883b/Recordings\"}}]}"); callList.loadNextPage(); Assert.IsNotNull(callList); Assert.AreEqual(callList.getLocalSize, 3); Assert.AreEqual((callList.export()).Count, 3); call = callList.get(2) as Call; Assert.IsNotNull(call); Assert.AreEqual(call.getCallId, "CAfe92a5efbaf90f04bbec946a0d74dad520dd884b"); } catch (PersyException pe) { Assert.Fail(pe.Message); } }
public void InputsWithDefault(string input1, int input2, string defaultVal = "default") { CallList.Add(new InvocationInformation() { InvocationTime = DateTime.Now, StackTrace = Environment.StackTrace, InvocationTarget = "InputsWithDefault", AdditionalData = $"input1={input1},input2={input2},input3={defaultVal}" }); }
public string ReturnBar() { CallList.Add(new InvocationInformation() { InvocationTime = DateTime.Now, StackTrace = Environment.StackTrace, InvocationTarget = "ReturnBar" }); return("ReturnFoo"); }
public void Inputs(string input1, int input2) { CallList.Add(new InvocationInformation() { InvocationTime = DateTime.Now, StackTrace = Environment.StackTrace, InvocationTarget = "Inputs", AdditionalData = $"input1={input1},input2={input2}" }); }
private void initDelegates() { vRecordList = new CallList(); vRecordList.NewRecord += OnListViewNewCall; vCallGenerator = new CallGenerator(3000, new GenerateCallDelegate(vRecordList.AddRecord)); vKickOffCallGenerator = new EventHandler(OnInitCallGenerator); vKickOffCallGenerator.Invoke(this, null); }
public byte GetNextFloor() { switch (currentState) { case States.up: for (int i = maxFloor - 1; i >= 0; i--) { if (CallList[i]) { targetFloor = Convert.ToByte(i + 1); return(Convert.ToByte(i + 1)); } } break; case States.down: for (int i = currentFloor - 1; i >= 0; i--) { if (CallList[i]) { targetFloor = Convert.ToByte(i + 1); return(Convert.ToByte(i + 1)); } } break; case States.doorsOpen: break; case States.doorsClose: break; case States.wait: if (CallList.All(p => !p)) { return(0); } int floor = Array.FindIndex(CallList, w => w); if (floor < currentFloor) { currentState = States.down; } else { currentState = States.up; } return(GetNextFloor()); default: return(minFloor); } return(minFloor); }
public async Task AsyncWait() { AsyncTask = Task.Run(() => Thread.Sleep(1500)); await AsyncTask; CallList.Add(new InvocationInformation() { InvocationTime = DateTime.Now, StackTrace = Environment.StackTrace, InvocationTarget = "AsyncWait" }); }
public CallList MakeCall(string senderName, string recieverName, int duration) { TermianlMessageEvent?.Invoke("\nBeep beep.."); IsConnected = TerminalState.calling; //Terminal switches to 'calling' state during the call TermianlMessageEvent?.Invoke("\nCall Started"); CallList CallInfo = new CallList(); Thread.Sleep(duration * 1000); //Sleep imitates process of calling TermianlMessageEvent?.Invoke("\nCall Finished\n"); IsConnected = TerminalState.connected; //Terminal switches back after call return(CallInfo); }
public void DropCall(CallList call) { CommandMsg msg = this.GetCommandMsg(USRSTRUCTS.DROP_CALL_REQ, call); byte[] bytes = util.GetBytes(msg); try { client.Send(bytes, bytes.Length); } catch (SocketException ex) { util.WriteLog(ex.ErrorCode, ex.Message.ToString()); } }
public HomeViewModel Home() { var urlForOMI = new CallList("If our action is employing OMIOMO (One Model In, One Model Out) we can derive a Url based on that input model."); urlForOMI.Calls.Add(x => x.UrlFor(new BookFindRequestModel())); urlForOMI.Calls.Add(x => x.UrlFor<BookFindRequestModel>()); var urlForZMI = new CallList("Alternatively we can derive Urls based on the action name, especially useful if no input model is being used (ZMIOMO - Zero Model In, One Model Out)."); urlForZMI.Calls.Add(x => x.UrlFor<BookController>(a => a.FindBook(new BookFindRequestModel()))); return new HomeViewModel( new List<CallList>() { urlForOMI, urlForZMI }); }
public DeCaire_Search_Result(CallList searchList) { InitializeComponent(); string output = "Search Results\r\n\r\n"; foreach (Call call in searchList) { if (!string.IsNullOrEmpty(call.code)) { output += "Code: " + call.code + "\r\n"; output += "Airport: " + call.name + "\r\n"; output += "Location: " + call.location + "\r\n"; output += "\r\n"; } } textBox1.Text = output; textBox1.Select(0, 0); }
public void Reset() { CallList.Clear(); InitializeBehavior = MockBehavior.DoNothing; InitializeResetBehavior = MockBehavior.DoNothing; StartBehavior = MockBehavior.DoNothing; StopBehavior = MockBehavior.DoNothing; ResetBehavior = MockBehavior.DoNothing; DeinitializeBehavior = MockBehavior.DoNothing; InitializeTrigger.Reset(); InitializeResetTrigger.Reset(); StartTrigger.Reset(); StopTrigger.Reset(); ResetTrigger.Reset(); DeinitializeTrigger.Reset(); }
public void CallList_Add_AddNewCallShouldEndUpAsFirstInTheList() { //Arrange CallList myCallList = new CallList(); Contact jacob = new Contact(1, "Jacob", 12341234, 234523456, 23452346); Contact anne = new Contact(1, "Anne", 23452345); Contact jesper = new Contact(1, "Jesper", 34563456, 34563457); myCallList.AddIncommingCall(new Call(jacob, 12341234, DateTime.Now.Add(new TimeSpan(-3, 0, 0)))); myCallList.AddIncommingCall(new Call(anne, 234523456, DateTime.Now.Add(new TimeSpan(-2, 0, 0)))); myCallList.AddIncommingCall(new Call(jesper, 34563456, DateTime.Now.Add(new TimeSpan(-1, 0, 0)))); //Act var newCall = new Call(jacob, 12341234, DateTime.Now.Add(new TimeSpan(0, 0, 0))); myCallList.AddIncommingCall(newCall); //Assert Assert.AreEqual(myCallList.incommingCallList[0], newCall); }
static void Main(string[] args) { string freeClimbAccountId = System.Environment.GetEnvironmentVariable("ACCOUNT_ID"); string freeClimbApiKey = System.Environment.GetEnvironmentVariable("API_KEY"); FreeClimbClient client = new FreeClimbClient(freeClimbAccountId, freeClimbApiKey); CallList callList = client.getCallsRequester.get(); if (callList.getTotalSize > 0) { while (callList.getLocalSize < callList.getTotalSize) { callList.loadNextPage(); } LinkedList <IFreeClimbCommon> commonList = callList.export(); foreach (IFreeClimbCommon element in commonList) { Call call = element as Call; Console.WriteLine(call.getCallId); } } }
public void CallList_Remove_RemoveNewestCallOthersShouldMoveUpOnTheList() { //Arrange CallList myCallList = new CallList(); Contact jacob = new Contact(1, "Jacob", 12341234, 234523456, 23452346); Contact anne = new Contact(1, "Anne", 23452345); Contact jesper = new Contact(1, "Jesper", 34563456, 34563457); var call1 = new Call(jacob, 12341234, DateTime.Now.Add(new TimeSpan(-3, 0, 0))); myCallList.AddIncommingCall(call1); var call2 = new Call(anne, 234523456, DateTime.Now.Add(new TimeSpan(-2, 0, 0))); myCallList.AddIncommingCall(call2); var call3 = new Call(jesper, 34563456, DateTime.Now.Add(new TimeSpan(-1, 0, 0))); myCallList.AddIncommingCall(call3); //Act myCallList.RemoveIncommingCall(call3); //Assert Assert.AreEqual(myCallList.incommingCallList[0], call2); }
public override async Task SetUpGameAsync(bool isBeginning) { LoadControls(); if (FinishUpAsync == null) { throw new BasicBlankException("The loader never set the finish up code. Rethink"); } CustomBasicList <int> CardList = _rs !.GenerateRandomList(75); SaveRoot !.CallList.Clear(); SaveRoot.BingoBoard.ClearBoard(_model); //i think. CardList.ForEach(x => { CurrentInfo = new BingoItem(); CurrentInfo.WhatValue = x; CurrentInfo.Vector = new Vector(0, MatchNumber(x)); CurrentInfo.Letter = WhatLetter(CurrentInfo.Vector.Column); SaveRoot.CallList.Add(SaveRoot.CallList.Count + 1, CurrentInfo); }); CreateBingoCards(); await FinishUpAsync(isBeginning); await CallNextNumberAsync(); //maybe i can have here this time. }
/// <summary> /// Handles the current call based on the configured behavior /// </summary> /// <param name="behavior">method behavior</param> /// <param name="resetEvent">related reset event</param> /// <param name="cancellationToken">cancellation token</param> /// <param name="callerName">caller name</param> private Task HandleBehavior(MockBehavior behavior, ManualResetEvent resetEvent, CancellationToken cancellationToken, string callerName) { // Add this call to the list CallList.Add(callerName); // Trigger event resetEvent.Set(); // Handle the behavior switch (behavior) { case MockBehavior.DoNothing: return(Task.CompletedTask); case MockBehavior.ThrowException: throw new NotSupportedException("based on behavior"); case MockBehavior.WaitForCancel: return(Task.Delay(TimeSpan.FromSeconds(10), cancellationToken)); default: throw new ArgumentOutOfRangeException(); } }
private void Couplemodeclient_CallTerminatedEvent(object obj, CommandMsg msg) { SetMessage(string.Empty); SetNumber(string.Empty); if (callstate == CALL_STATES.CONNECTED) { //CallLists calllist = new CallLists(); //curCall.Enddate = DateTime.Now; //calllist.modify(curCall); Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate { if (pb.calls == null) { pb.calls = new CallLists(); } curCall.Enddate = DateTime.Now; try { pb.calls.modify(curCall); CallList cl = pb.dgridCustCallList.SelectedItem as CallList; if (cl == null) { var items = pb.dgridCustCallList.ItemsSource as CallLists; cl = items.FirstOrDefault(x => x.Idx == curCall.Idx); } if (cl != null) { cl.Enddate = curCall.Enddate; } cl = pb.dgCallList.SelectedItem as CallList; if (cl == null) { var items = pb.dgCallList.ItemsSource as CallLists; cl = items.FirstOrDefault(x => x.Idx == curCall.Idx); } if (cl != null) { cl.Enddate = curCall.Enddate; } } catch (FbException e) { util.WriteLog(e.ErrorCode, e.Message); } })); } if (recorder != null) { recorder.Close(); recorder.Dispose(); recorder = null; IsRecording = false; } if (curCall != null) { curCall = null; } this.UIChanging(msg.status); }
private void UIChanging(byte status) { // return; Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate { switch (status) { case USRSTRUCTS.STATUS_CALL_RINGING: btnsatate.RedialBtn = (Style)Application.Current.FindResource("btnRedial_off"); btn_redial.IsEnabled = false; btnsatate.PullBtn = (Style)Application.Current.FindResource("btnCallPull_off"); btn_callpull.IsEnabled = false; callstate = CALL_STATES.RING; break; case USRSTRUCTS.STATUS_CALL_CONNECTED: btnsatate.TransferBtn = (Style)Application.Current.FindResource("btnCallPush_down"); btn_callpush.IsEnabled = true; btnsatate.RecordBtn = (Style)Application.Current.FindResource("btnREC_down"); btnRecord.IsEnabled = true; btnCall.IsEnabled = false; callstate = CALL_STATES.CONNECTED; break; case USRSTRUCTS.STATUS_CALL_TERMINATED: if (!string.IsNullOrEmpty(lastcallnumber)) { btnsatate.RedialBtn = (Style)Application.Current.FindResource("btnRedial_down"); btn_redial.IsEnabled = true; } btnsatate.PullBtn = (Style)Application.Current.FindResource("btnCallPull_down"); btn_callpull.IsEnabled = true; btnsatate.TransferBtn = (Style)Application.Current.FindResource("btnCallPush_off"); btn_callpush.IsEnabled = false; btnsatate.RecordBtn = (Style)Application.Current.FindResource("btnREC_off"); btnRecord.IsEnabled = false; btnCall.IsEnabled = true; btnCall.Content = "☎"; btnCall.ToolTip = "Call"; curCall = null; callstate = CALL_STATES.NONE; IsTransfer = false; IsHold = false; break; } })); }
public CommandMsg GetCommandMsg(byte st, CallList call) { CommandMsg msg = new CommandMsg() { cmd = st }; switch (st) { case USRSTRUCTS.REGISTER_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.userid = string.Empty; break; case USRSTRUCTS.UNREGISTER_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.userid = string.Empty; break; case USRSTRUCTS.MAKE_CALL_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.userid = CoupleModeInfo.userid; break; case USRSTRUCTS.DROP_CALL_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; break; case USRSTRUCTS.PICKUP_CALL_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_INCOMING; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; // msg.userid = CoupleModeInfo.userid; break; case USRSTRUCTS.TRANSFER_CALL_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; msg.userid = CoupleModeInfo.userid; msg.ip = DistinguishIpBlock.IpAddress2Int(); msg.port = localport; break; case USRSTRUCTS.HOLD_CALL_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; msg.userid = CoupleModeInfo.userid; msg.ip = DistinguishIpBlock.IpAddress2Int(); msg.port = localport; break; case USRSTRUCTS.ACTIVE_CALL_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; msg.userid = CoupleModeInfo.userid; msg.ip = DistinguishIpBlock.IpAddress2Int(); msg.port = localport; break; case USRSTRUCTS.ENABLE_CALL_RECORD_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; msg.ip = DistinguishIpBlock.IpAddress2Int(); msg.port = 21010; break; case USRSTRUCTS.ENABLE_NAT_CALL_RECORD_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; msg.ip = DistinguishIpBlock.IpAddress2Int(); msg.port = 21010; break; case USRSTRUCTS.DISABLE_CALL_RECORD_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; msg.ip = DistinguishIpBlock.IpAddress2Int(); msg.port = 21010; break; } return msg; }
private void Couplemodeclient_CallRingInEvent(object obj, CommandMsg msg) { if (curCall != null) return; curCall = new CallList() { Direction = 1, Cust_Tel = msg.from_ext, Startdate = DateTime.Now, ext = msg.from_ext, to_ext = msg.to_ext }; Customer cust = pb.GetCustomerByTel(msg.from_ext); string strmsg = string.Empty; if (cust.Idx < 1) { pb.CUSTOMERSTATE = CUSTOMER_STATE.ADD; cust.Group_Idx = 0; cust.Cellular = msg.from_ext; strmsg = Application.Current.FindResource("MSG_CALL_IN").ToString(); } else { pb.CUSTOMERSTATE = CUSTOMER_STATE.MODIFY; curCall.Cust_Idx = cust.Idx; curCall.Name = cust.Name; strmsg = string.Format(Application.Current.FindResource("MSG_CALL_IN2").ToString(), cust.Name); } SetMessage(strmsg); SetNumber(msg.from_ext); // CallLists calllists = new CallLists(); // calllists.add(curCall); Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate { if (startpopup) { if (pb == null) { pb = new PhoneBook(); pb.Owner = this; } // pb.Show(); } SearchCondition1 con = new SearchCondition1(); con.StartDate = pb.sdate.Value; con.EndDate = pb.edate.Value; con.Number = string.IsNullOrEmpty(pb.txtNumber.Text.Trim()) == false ? string.Format("%{0}%", pb.txtNumber.Text.Trim()) : string.Empty; if (pb.calls == null) { pb.calls = new CallLists(con); pb.dgCallList.ItemsSource = pb.calls; } pb.calls.add(curCall); if (pb.Visibility == Visibility.Collapsed || pb.Visibility == Visibility.Hidden) { pb.tabs.SelectedIndex = 1; pb.dgridCustCallList.ItemsSource = pb.GetCallListByCustIdx(cust.Idx, curCall.Cust_Tel); pb.btnCustMemo.Visibility = Visibility.Visible; pb.FlyCustomer = cust; pb.flyCustomer.Header = Application.Current.FindResource("PB_FLYOUT_TITLE_CUST_INFO").ToString(); pb.flyCustomer.IsOpen = true; if (startpopup) { pb.Visibility = Visibility.Visible; } } else { pb.tabs.SelectedIndex = 1; pb.dgridCustCallList.ItemsSource = pb.GetCallListByCustIdx(cust.Idx, curCall.Cust_Tel); pb.btnCustMemo.Visibility = Visibility.Visible; pb.FlyCustomer = cust; pb.flyCustomer.Header = Application.Current.FindResource("PB_FLYOUT_TITLE_CUST_INFO").ToString(); if (startpopup) { pb.flyCustomer.IsOpen = true; } } })); this.UIChanging(msg.status); }
private void Couplemodeclient_CallTerminatedEvent(object obj, CommandMsg msg) { SetMessage(string.Empty); SetNumber(string.Empty); if (callstate == CALL_STATES.CONNECTED) { //CallLists calllist = new CallLists(); //curCall.Enddate = DateTime.Now; //calllist.modify(curCall); Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate { if (pb.calls == null) pb.calls = new CallLists(); curCall.Enddate = DateTime.Now; try { pb.calls.modify(curCall); CallList cl = pb.dgridCustCallList.SelectedItem as CallList; if (cl == null) { var items = pb.dgridCustCallList.ItemsSource as CallLists; cl = items.FirstOrDefault(x => x.Idx == curCall.Idx); } if (cl != null) cl.Enddate = curCall.Enddate; cl = pb.dgCallList.SelectedItem as CallList; if (cl == null) { var items = pb.dgCallList.ItemsSource as CallLists; cl = items.FirstOrDefault(x => x.Idx == curCall.Idx); } if (cl != null) cl.Enddate = curCall.Enddate; } catch (FbException e) { util.WriteLog(e.ErrorCode, e.Message); } })); } if (recorder != null) { recorder.Close(); recorder.Dispose(); recorder = null; IsRecording = false; } if (curCall != null) curCall = null; this.UIChanging(msg.status); }
public void DropCall(CallList curcall) { client.DropCall(curcall); }
private void Couplemodeclient_CallRingInEvent(object obj, CommandMsg msg) { if (curCall != null) { return; } curCall = new CallList() { Direction = 1, Cust_Tel = msg.from_ext, Startdate = DateTime.Now, ext = msg.from_ext, to_ext = msg.to_ext }; Customer cust = pb.GetCustomerByTel(msg.from_ext); string strmsg = string.Empty; if (cust.Idx < 1) { pb.CUSTOMERSTATE = CUSTOMER_STATE.ADD; cust.Group_Idx = 0; cust.Cellular = msg.from_ext; strmsg = Application.Current.FindResource("MSG_CALL_IN").ToString(); } else { pb.CUSTOMERSTATE = CUSTOMER_STATE.MODIFY; curCall.Cust_Idx = cust.Idx; curCall.Name = cust.Name; strmsg = string.Format(Application.Current.FindResource("MSG_CALL_IN2").ToString(), cust.Name); } SetMessage(strmsg); SetNumber(msg.from_ext); // CallLists calllists = new CallLists(); // calllists.add(curCall); Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate { if (startpopup) { if (pb == null) { pb = new PhoneBook(); pb.Owner = this; } // pb.Show(); } SearchCondition1 con = new SearchCondition1(); con.StartDate = pb.sdate.Value; con.EndDate = pb.edate.Value; con.Number = string.IsNullOrEmpty(pb.txtNumber.Text.Trim()) == false ? string.Format("%{0}%", pb.txtNumber.Text.Trim()) : string.Empty; if (pb.calls == null) { pb.calls = new CallLists(con); pb.dgCallList.ItemsSource = pb.calls; } pb.calls.add(curCall); if (pb.Visibility == Visibility.Collapsed || pb.Visibility == Visibility.Hidden) { pb.tabs.SelectedIndex = 1; pb.dgridCustCallList.ItemsSource = pb.GetCallListByCustIdx(cust.Idx, curCall.Cust_Tel); pb.btnCustMemo.Visibility = Visibility.Visible; pb.FlyCustomer = cust; pb.flyCustomer.Header = Application.Current.FindResource("PB_FLYOUT_TITLE_CUST_INFO").ToString(); pb.flyCustomer.IsOpen = true; if (startpopup) { pb.Visibility = Visibility.Visible; } } else { pb.tabs.SelectedIndex = 1; pb.dgridCustCallList.ItemsSource = pb.GetCallListByCustIdx(cust.Idx, curCall.Cust_Tel); pb.btnCustMemo.Visibility = Visibility.Visible; pb.FlyCustomer = cust; pb.flyCustomer.Header = Application.Current.FindResource("PB_FLYOUT_TITLE_CUST_INFO").ToString(); if (startpopup) { pb.flyCustomer.IsOpen = true; } } })); this.UIChanging(msg.status); }
private void MenuItem_Click_13(object sender, RoutedEventArgs e) { // CALL LIST // 메모 MenuItem menuitem = (MenuItem)e.Source; ContextMenu cm = (ContextMenu)menuitem.Parent; DataGrid view = (DataGrid)cm.PlacementTarget; CallList item = (CallList)view.SelectedItem; CallList tmp = new CallList() { IsSelected = item.IsSelected, IsChecked = item.IsChecked, Idx = item.Idx, Cust_Idx = item.Cust_Idx, Name = item.Name, Direction = item.Direction, Cust_Tel = item.Cust_Tel, Startdate = item.Startdate, Enddate = item.Enddate, Memo = item.Memo }; flyCustMemo.DataContext = tmp; flyCustMemo.Header = string.Format(Application.Current.FindResource("PB_FLYOUT_TITLE_CUST_MEMO").ToString(), item.Cust_Tel); flyCustMemo.IsOpen = true; }
/// <summary> /// /// </summary> /// <param name="callId"></param> /// <param name="callState"></param> private void OnCallStateChanged(int callId, ESessionState callState, string info) { if (callState == ESessionState.SESSION_STATE_INCOMING) { IStateMachine incall = Factory.createStateMachine(); // couldn't create new call instance (max calls?) if (incall.IsNull) { // check if CFB, activate redirection if (Config.CFBFlag == true) { // get stack proxy ICallProxyInterface proxy = StackProxy.createCallProxy(); // assign callid to the proxy... //proxy.SessionId = callId; proxy.serviceRequest((int)EServiceCodes.SC_CFB, Config.CFBNumber); return; } } // save session parameters incall.Session = callId; // check if callID already exists!!! if (CallList.ContainsKey(callId)) { // shouldn't be here // release the call CallList[callId].State.endCall(); return; } // add call to call table _calls.Add(callId, incall); return; } IStateMachine call = this[callId]; if (call.IsNull) { return; } switch (callState) { case ESessionState.SESSION_STATE_CALLING: //sm.getState().onCalling(); break; case ESessionState.SESSION_STATE_EARLY: call.State.onAlerting(); break; case ESessionState.SESSION_STATE_CONNECTING: call.State.onConnect(); break; case ESessionState.SESSION_STATE_DISCONNECTED: call.State.onReleased(); break; } }
public CommandMsg GetCommandMsg(byte st, CallList call) { CommandMsg msg = new CommandMsg() { cmd = st }; switch (st) { case USRSTRUCTS.REGISTER_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.userid = string.Empty; break; case USRSTRUCTS.UNREGISTER_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.userid = string.Empty; break; case USRSTRUCTS.MAKE_CALL_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.userid = CoupleModeInfo.userid; break; case USRSTRUCTS.DROP_CALL_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; break; case USRSTRUCTS.PICKUP_CALL_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_INCOMING; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; // msg.userid = CoupleModeInfo.userid; break; case USRSTRUCTS.TRANSFER_CALL_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; msg.userid = CoupleModeInfo.userid; msg.ip = DistinguishIpBlock.IpAddress2Int(); msg.port = localport; break; case USRSTRUCTS.HOLD_CALL_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; msg.userid = CoupleModeInfo.userid; msg.ip = DistinguishIpBlock.IpAddress2Int(); msg.port = localport; break; case USRSTRUCTS.ACTIVE_CALL_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; msg.userid = CoupleModeInfo.userid; msg.ip = DistinguishIpBlock.IpAddress2Int(); msg.port = localport; break; case USRSTRUCTS.ENABLE_CALL_RECORD_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; msg.ip = DistinguishIpBlock.IpAddress2Int(); msg.port = 21010; break; case USRSTRUCTS.ENABLE_NAT_CALL_RECORD_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; msg.ip = DistinguishIpBlock.IpAddress2Int(); msg.port = 21010; break; case USRSTRUCTS.DISABLE_CALL_RECORD_REQ: msg.type = USRSTRUCTS.TYPE_COUPLEPHONE; msg.direct = USRSTRUCTS.DIRECT_OUTGOING; msg.from_ext = CoupleModeInfo.userid; msg.to_ext = call.to_ext; msg.ip = DistinguishIpBlock.IpAddress2Int(); msg.port = 21010; break; } return(msg); }
private void dgridCustCallList_MouseDoubleClick(object sender, MouseButtonEventArgs e) { // CALL LIST // 메모 DataGrid view = (DataGrid)e.Source; if (view.Items.Count < 1) return; CallList item = (CallList)view.SelectedItem; if (item == null) return; CallList tmp = new CallList() { IsSelected = item.IsSelected, IsChecked = item.IsChecked, Idx = item.Idx, Cust_Idx = item.Cust_Idx, Name = item.Name, Direction = item.Direction, Cust_Tel = item.Cust_Tel, Startdate = item.Startdate, Enddate = item.Enddate, Memo = item.Memo }; flyCustMemo.DataContext = tmp; flyCustMemo.Header = string.Format(Application.Current.FindResource("PB_FLYOUT_TITLE_CUST_MEMO").ToString(), item.Cust_Tel); flyCustMemo.IsOpen = true; }