private void SendDTMF(object o)
        {
            string key = o as string;

            if (key == null ||
                key.Length != 1)
            {
                return;
            }
            InputKey += key;
            if (CurrentCall == null)
            {
                return;
            }
            if (!CurrentCall.IsSendingDTMFEnabled)
            {
                Output("Current call not support sending DTMF.");
                return;
            }
            CurrentCall.SendDtmf(key, r =>
            {
                if (r.IsSuccess)
                {
                    Output($"Send DTMF[{key}] Success!");
                }
                else
                {
                    Output($"Send DTMF[{key}] Fail!");
                }
            });
        }
Example #2
0
        /// <summary>
        /// Push call of given name and generator to call stack
        /// </summary>
        /// <param name="name">Name of pushed method</param>
        /// <param name="generator">Generator which instructions will be pushed</param>
        /// <param name="argumentValues">Arguments of pushed call</param>
        internal void PushCall(MethodID name, GeneratorBase generator, Instance[] argumentValues)
        {
            var callTransformProvider = Edits == null ? null : Edits.TransformProvider;
            var isDirty = generator == null || argumentValues.Any((value) => value.IsDirty);

            if (isDirty)
            {
                //For dirty call we will propagate dirty flag
                foreach (var argumentValue in argumentValues)
                {
                    argumentValue.IsDirty = true;
                }
                LastReturnValue         = Machine.CreateDirectInstance("DirtyReturn");
                LastReturnValue.IsDirty = true;
                //and call wont be pushed
                return;
            }

            var call = new CallContext(this, name, callTransformProvider, generator, argumentValues);

            if (_entryContext == null)
            {
                _entryContext = call;
            }
            else
            {
                if (CurrentCall != null)
                {
                    CurrentCall.RegisterCall(call);
                }
            }

            _callStack.Push(call);
        }
        /// <summary>
        /// Ends the current call, saving it if necessary. If askForSave is true, it will prompt the user before
        /// saving the call.
        /// </summary>
        /// <param name="askForSave"></param>
        public void TerminateCall(bool askForSave)
        {
            if (CurrentCall != null)
            {
                bool _needsSave = true;
                notesGrid.SaveNote();
                if (askForSave)
                {
                    if (MessageBox.Show(this, "Would you like to save the call in progress?", "Save Current Call", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        DeleteCurrentCall();
                        _needsSave = false;
                    }
                }


                if (_needsSave)
                {
                    CurrentCall.Save();
                }


                btnLogCall.Text                    = "Log Call";
                currentCallNode.NodeFont           = new Font(tvwCall.Font, FontStyle.Regular);
                currentCallNode.ImageIndex         = 0;
                currentCallNode.SelectedImageIndex = 0;
            }

            IsCallInProgress      = false;
            btnHoldCall.Enabled   = false;
            notesGrid.CurrentCall = null;
        }
Example #4
0
 /// <summary>
 /// Set value for variable of given name
 /// </summary>
 /// <param name="targetVaraiable">Name of variable</param>
 /// <param name="value">Value that will be set to variable</param>
 public void SetValue(VariableName targetVaraiable, Instance value)
 {
     if (value != null)
     {
         value.HintID(targetVaraiable.Name, this);
     }
     CurrentCall.SetValue(targetVaraiable, value);
 }
 public void UpdateRemoteVideoView()
 {
     if (CurrentCall == null)
     {
         return;
     }
     Application.Current.Dispatcher.Invoke(() =>
     {
         CurrentCall.RefreshRemoteView(curCallView.RemoteViewHandle);
     });
 }
Example #6
0
        /// <summary>
        /// Get next available instrution.
        /// </summary>
        /// <returns>Instruction that is on turn to be processed, if end of execution returns null</returns>
        internal InstructionBase NextInstruction()
        {
            InstructionBase instrution = null;

            while (!IsExecutionEnd && (instrution = CurrentCall.NextInstrution()) == null)
            {
                popContext();
            }

            return(instrution);
        }
Example #7
0
        public override void Dispose()
        {
            CharacterEntity character = CurrentClient.GetAccountEntity().CharacterEntity;

            if (ReferenceEquals(character.CurrentInteractive, this))
            {
                character.CurrentInteractive = null;
            }
            CurrentCall?.Dispose();
            NAPI.ColShape.DeleteColShape(ColShape);
            NAPI.Entity.DeleteEntity(Marker);
        }
 private void EndCall(object o)
 {
     if (this.CurrentCall != null)
     {
         CurrentCall.Hangup(result =>
         {
             if (!result.IsSuccess)
             {
                 Output("Hangup failed.");
             }
         });
     }
     ApplicationController.Instance.CurCallView = null;
 }
 public void Reject()
 {
     if (CurrentCall == null)
     {
         return;
     }
     RegisterCallEvent();
     CurrentCall.Reject(result =>
     {
         if (!result.IsSuccess)
         {
             Output($"Error: {result.Error?.ErrorCode.ToString()} {result.Error?.Reason}");
         }
     });
 }
 public void Answer()
 {
     if (CurrentCall == null)
     {
         return;
     }
     RegisterCallEvent();
     CurrentCall.Answer(MediaOption.AudioVideoShare(curCallView.LocalViewHandle, curCallView.RemoteViewHandle, curCallView.RemoteShareViewHandle), result =>
     {
         if (!result.IsSuccess)
         {
             Output($"Error: {result.Error?.ErrorCode.ToString()} {result.Error?.Reason}");
         }
     });
 }
Example #11
0
        public override void Spawn()
        {
            base.Spawn();
            NAPI.TextLabel.CreateTextLabel($"~y~BUDKA\n~w~Numer: {Data.Number}",
                                           new Vector3(Data.Position.Position.X, Data.Position.Position.Y, Data.Position.Position.Z + 1),
                                           7f, 1f, 1, new Color(255, 255, 255));

            ColShape = NAPI.ColShape.CreateCylinderColShape(Data.Position.Position, 1f, 2f);

            Marker = NAPI.Marker.CreateMarker(1, Data.Position.Position,
                                              new Vector3(0, 0, 0), new Vector3(1f, 1f, 1f),
                                              1f, new Color(100, 255, 0, 100));

            ColShape.OnEntityEnterColShape += (shape, entity) =>
            {
                if (CurrentCall != null && CurrentCall.Accepted)
                {
                    // Budka jest używana
                    entity.SendWarning("Ta budka obecnie jest używana.");
                }
                else if (CurrentCall != null)
                {
                    //Budka nie jest używana i dzwoni
                    CurrentClient = NAPI.Player.GetPlayerFromHandle(entity);
                    CurrentCall?.Open();
                }
                else if (CurrentClient == null)
                {
                    //Budka nie jest używana i nie dzwoni
                    CurrentClient = NAPI.Player.GetPlayerFromHandle(entity);
                    CurrentClient.GetAccountEntity().CharacterEntity.CurrentInteractive = this;
                    NAPI.ClientEvent.TriggerClientEvent(CurrentClient, "OnPlayerEnteredTelephonebooth");
                }
            };

            ColShape.OnEntityExitColShape += (shape, entity) =>
            {
                if (CurrentCall != null && ReferenceEquals(entity, CurrentClient))
                {
                    //Opuszczanie budki kiedy dzwoni
                    CurrentClient.GetAccountEntity().CharacterEntity.CurrentInteractive = null;
                    CurrentClient = null;
                    CurrentCall?.Dispose();
                }
            };
        }
        private void StopShare(object o)
        {
            if (CurrentCall == null)
            {
                return;
            }

            if (!CurrentCall.IsSendingShare)
            {
                return;
            }

            CurrentCall.StopShare(r =>
            {
                if (r.IsSuccess)
                {
                    IfShowStopShareButton = false;
                }
            });
        }
        public void Save()
        {
            CurrentCall.AddClaim(LinkedClaim);

            if ((chkSetRevisitDate.Checked) || (cmbStatus.SelectedIndex > -1))
            {
                DateTime?    newRevisit = null;
                claim_status newStatus;

                if (chkSetRevisitDate.Checked)
                {
                    newRevisit = ctlRevisitDate.CurrentDate;
                }
                else
                {
                    newRevisit = null;
                }

                if (cmbStatus.SelectedIndex > -1)
                {
                    newStatus = (claim_status)cmbStatus.SelectedItem;
                }
                else if (LinkedClaim.status_id > 0)
                {
                    newStatus = LinkedClaim.LinkedStatus;
                }
                else
                {
                    newStatus = null;
                }

                LinkedClaim.SetStatusAndRevisitDate(newStatus, newRevisit);
            }

            ActiveUser.LogAction(ActiveUser.ActionTypes.ChangeClaimMultiClaim, LinkedClaim.id, "");
        }
Example #14
0
 public Instruction NextInstruction() => CurrentCall.NextInstruction();
Example #15
0
 /// <summary>
 /// Test that variable is contained in current call
 /// </summary>
 /// <param name="targetVariable">Tested variable</param>
 /// <returns><c>true</c> if variable is present, <c>false</c> otherwise</returns>
 public bool Contains(VariableName targetVariable)
 {
     return(CurrentCall.Contains(targetVariable));
 }
Example #16
0
 public void BeginCall()
 {
     CurrentCall.Start();
 }
Example #17
0
 public void BeginCall(string args)
 {
     SetCallArguments(args);
     CurrentCall.Start();
 }
Example #18
0
 public void WaitForExit()
 {
     CurrentCall.WaitForExit();
 }
Example #19
0
 public void EndCall()
 {
     CurrentCall.Kill();
 }
 private void DeleteCurrentCall()
 {
     CurrentCall.Delete();
     CurrentCall = null;
     tvwCall.Nodes.Remove(currentCallNode);
 }
 private void SendFeedBack(object o)
 {
     this.IfShowRatingView = false;
     CurrentCall?.SendFeedbackWith(this.RatingValue, this.Comment, this.IfIncludeLog);
 }
Example #22
0
 /// <summary>
 /// Get current instance stored in variable of given name
 /// </summary>
 /// <param name="variable">Name of variable</param>
 /// <returns>Stored instance</returns>
 public Instance GetValue(VariableName variable)
 {
     return(CurrentCall.GetValue(variable));
 }
        public void TerminateCall()
        {
            if (CurrentCall != null)
            {
                ngDisplay.SaveNote();

                CurrentCall.OnHoldSeconds   = System.Convert.ToInt32(holdTime.TotalSeconds);
                CurrentCall.DurationSeconds = System.Convert.ToInt32(callTime.TotalSeconds);
                CurrentCall.talked_to_human = chkTalkedWithPerson.Checked;
                if (ctlStatusHandler._category != null)
                {
                    CurrentCall.call_status = ctlStatusHandler._category.id;
                }
                CurrentCall.Save();

                /* Additional data tabs not currently on this form
                 * // Remove any additional info tabs that might still have information
                 *
                 * foreach (VerifyDataViewer vdv in additionalDataTabs)
                 * {
                 *  if (!tbcNewCallData.TabPages.Contains(vdv))
                 *  {
                 *      foreach (choice aChoice in vdv.DataViewer.Choices)
                 *      {
                 *          aChoice.Delete();
                 *      }
                 *  }
                 * }
                 */


                ActiveUser.LogAction(ActiveUser.ActionTypes.EndCall, LinkedClaim.id, CurrentCall.id, "");
            }



            ShowNewCallControls(true, true);



            CurrentCall = null;


            ctlDataVerification.Initialize();
            mainQuestionViewer.ClearAllCategories();

            /* Additional data tabs not currently on this form
             * additionalDataTabs.Clear();
             */
            callTimer.Stop();
            onHold = false;
            UpdateHoldTimerLabel();

            /* Additional data tabs not currently on this form
             * foreach (TabPage aTab in tbcNewCallData.TabPages)
             * {
             *  if (aTab is VerifyDataViewer)
             *  {
             *      tbcNewCallData.TabPages.Remove(aTab);
             *      aTab.Dispose();
             *  }
             * }
             */

            Minimize();
            lblHoldTime.Text = "0:00:00";
            lblCallTime.Text = "0:00:00";
        }
Example #24
0
 /// <summary>
 /// Jump with instruction pointer at given target
 /// </summary>
 /// <param name="target">Target of jump</param>
 internal void Jump(Label target)
 {
     CurrentCall.Jump(target);
 }