Ejemplo n.º 1
0
        public static SIPEventDialog Parse(XElement dialogElement)
        {
            XNamespace ns = m_dialogXMLNS;
            XNamespace ss = m_sipsorceryXMLNS;

            SIPEventDialog eventDialog = new SIPEventDialog();

            eventDialog.ID        = dialogElement.Attribute("id").Value;
            eventDialog.CallID    = (dialogElement.Attribute("call-id") != null) ? dialogElement.Attribute("call-id").Value : null;
            eventDialog.LocalTag  = (dialogElement.Attribute("local-tag") != null) ? dialogElement.Attribute("local-tag").Value : null;
            eventDialog.RemoteTag = (dialogElement.Attribute("remote-tag") != null) ? dialogElement.Attribute("remote-tag").Value : null;
            eventDialog.Direction = (dialogElement.Attribute("direction") != null) ? (SIPEventDialogDirectionEnum)Enum.Parse(typeof(SIPEventDialogDirectionEnum), dialogElement.Attribute("direction").Value, true) : SIPEventDialogDirectionEnum.none;

            XElement stateElement = dialogElement.Element(ns + "state");

            eventDialog.State      = stateElement.Value;
            eventDialog.StateCode  = (stateElement.Attribute("code") != null) ? Convert.ToInt32(stateElement.Attribute("code").Value) : 0;
            eventDialog.StateEvent = (stateElement.Attribute("event") != null) ? SIPEventDialogStateEvent.Parse(stateElement.Attribute("event").Value) : SIPEventDialogStateEvent.None;

            eventDialog.Duration         = (dialogElement.Element(ns + "duration") != null) ? Convert.ToInt32(dialogElement.Element(ns + "duration").Value) : 0;
            eventDialog.BridgeID         = (dialogElement.Element(ss + "bridgeid") != null) ? dialogElement.Element(ss + "bridgeid").Value : null;
            eventDialog.SwitchboardOwner = (dialogElement.Element(ss + "switchboardowner") != null) ? dialogElement.Element(ss + "switchboardowner").Value : null;

            eventDialog.LocalParticipant  = (dialogElement.Element(ns + "local") != null) ? SIPEventDialogParticipant.Parse(dialogElement.Element(ns + "local")) : null;
            eventDialog.RemoteParticipant = (dialogElement.Element(ns + "remote") != null) ? SIPEventDialogParticipant.Parse(dialogElement.Element(ns + "remote")) : null;

            return(eventDialog);
        }
Ejemplo n.º 2
0
 public SIPEventDialog(string id, string state, int stateCode, SIPEventDialogStateEvent stateEvent, int duration)
 {
     ID         = id;
     State      = state;
     StateCode  = stateCode;
     StateEvent = stateEvent;
     Duration   = duration;
 }
Ejemplo n.º 3
0
 public static bool AreEqual(SIPEventDialogStateEvent x, SIPEventDialogStateEvent y)
 {
     return(x == y);
 }