Example #1
0
        public SIPEventDialog(string id, string state, SIPDialogue sipDialogue)
        {
            ID    = id;
            State = state;

            if (sipDialogue != null)
            {
                CallID    = sipDialogue.CallId;
                LocalTag  = sipDialogue.LocalTag;
                RemoteTag = sipDialogue.RemoteTag;
                Direction = (sipDialogue.Direction == SIPCallDirection.In) ? SIPEventDialogDirectionEnum.recipient : SIPEventDialogDirectionEnum.initiator;
                Duration  = Convert.ToInt32((DateTimeOffset.UtcNow - sipDialogue.Inserted).TotalSeconds % Int32.MaxValue);
                //LocalParticipant = new SIPEventDialogParticipant(sipDialogue.LocalUserField.Name, sipDialogue.LocalUserField.URI, null, sipDialogue.CSeq, sipDialogue.SDP);
                LocalParticipant = new SIPEventDialogParticipant(sipDialogue.LocalUserField.Name, sipDialogue.LocalUserField.URI, null, sipDialogue.CSeq);
                //RemoteParticipant = new SIPEventDialogParticipant(sipDialogue.RemoteUserField.Name, sipDialogue.RemoteUserField.URI, sipDialogue.RemoteTarget, sipDialogue.CSeq, sipDialogue.RemoteSDP);
                RemoteParticipant = new SIPEventDialogParticipant(sipDialogue.RemoteUserField.Name, sipDialogue.RemoteUserField.URI, sipDialogue.RemoteTarget, sipDialogue.CSeq);
                BridgeID          = (sipDialogue.BridgeId != Guid.Empty) ? sipDialogue.BridgeId.ToString() : null;

                if (sipDialogue.Direction == SIPCallDirection.In)
                {
                    RemoteParticipant.CRMPersonName  = sipDialogue.CRMPersonName;
                    RemoteParticipant.CRMCompanyName = sipDialogue.CRMCompanyName;
                    RemoteParticipant.CRMPictureURL  = sipDialogue.CRMPictureURL;
                }
                else if (sipDialogue.Direction == SIPCallDirection.Out)
                {
                    LocalParticipant.CRMPersonName  = sipDialogue.CRMPersonName;
                    LocalParticipant.CRMCompanyName = sipDialogue.CRMCompanyName;
                    LocalParticipant.CRMPictureURL  = sipDialogue.CRMPictureURL;
                }
            }
        }
        public SIPEventDialog(string id, string state, SIPDialogue sipDialogue)
        {
            ID = id;
            State = state;

            if (sipDialogue != null)
            {
                CallID = sipDialogue.CallId;
                LocalTag = sipDialogue.LocalTag;
                RemoteTag = sipDialogue.RemoteTag;
                Direction = (sipDialogue.Direction == SIPCallDirection.In) ? SIPEventDialogDirectionEnum.recipient : SIPEventDialogDirectionEnum.initiator;
                Duration = Convert.ToInt32((DateTimeOffset.UtcNow - sipDialogue.Inserted).TotalSeconds % Int32.MaxValue);
                //LocalParticipant = new SIPEventDialogParticipant(sipDialogue.LocalUserField.Name, sipDialogue.LocalUserField.URI, null, sipDialogue.CSeq, sipDialogue.SDP);
                LocalParticipant = new SIPEventDialogParticipant(sipDialogue.LocalUserField.Name, sipDialogue.LocalUserField.URI, null, sipDialogue.CSeq);
                //RemoteParticipant = new SIPEventDialogParticipant(sipDialogue.RemoteUserField.Name, sipDialogue.RemoteUserField.URI, sipDialogue.RemoteTarget, sipDialogue.CSeq, sipDialogue.RemoteSDP);
                RemoteParticipant = new SIPEventDialogParticipant(sipDialogue.RemoteUserField.Name, sipDialogue.RemoteUserField.URI, sipDialogue.RemoteTarget, sipDialogue.CSeq);
                BridgeID = (sipDialogue.BridgeId != Guid.Empty) ? sipDialogue.BridgeId.ToString() : null;
                SwitchboardOwner = (sipDialogue.SwitchboardOwner != null) ? sipDialogue.SwitchboardOwner : null;

                if (sipDialogue.Direction == SIPCallDirection.In)
                {
                    RemoteParticipant.SwitchboardCallerDescription = sipDialogue.SwitchboardCallerDescription;
                    LocalParticipant.SwitchboardDescription = sipDialogue.SwitchboardDescription;
                }
                else if (sipDialogue.Direction == SIPCallDirection.Out)
                {
                    LocalParticipant.SwitchboardCallerDescription = sipDialogue.SwitchboardCallerDescription;
                    RemoteParticipant.SwitchboardDescription = sipDialogue.SwitchboardDescription;
                }
            }
        }