public static Parse ( System.Xml.Linq.XElement participantElement ) : |
||
participantElement | System.Xml.Linq.XElement | |
return |
public static SIPEventDialogParticipant Parse(XElement participantElement)
{
XNamespace ns = m_dialogXMLNS;
XNamespace ss = m_sipsorceryXMLNS;
SIPEventDialogParticipant participant = new SIPEventDialogParticipant();
XElement identityElement = participantElement.Element(ns + "identity");
if (identityElement != null)
{
participant.DisplayName = (identityElement.Attribute("display-name") != null) ? identityElement.Attribute("display-name").Value : null;
participant.URI = SIPURI.ParseSIPURI(identityElement.Value);
}
XElement targetElement = participantElement.Element(ns + "target");
if (targetElement != null)
{
participant.TargetURI = SIPURI.ParseSIPURI(targetElement.Attribute("uri").Value);
}
participant.CSeq = (participantElement.Element(ns + "cseq") != null) ? Convert.ToInt32(participantElement.Element(ns + "cseq").Value) : 0;
//participant.SwitchboardDescription = (participantElement.Element(ss + "switchboarddescription") != null) ? participantElement.Element(ss + "switchboarddescription").Value : null;
//participant.SwitchboardCallerDescription = (participantElement.Element(ss + "switchboardcallerdescription") != null) ? participantElement.Element(ss + "switchboardcallerdescription").Value : null;
participant.SwitchboardLineName = (participantElement.Element(ss + "switchboardlinename") != null) ? participantElement.Element(ss + "switchboardlinename").Value : null;
participant.CRMPersonName = (participantElement.Element(ss + "crmpersonname") != null) ? participantElement.Element(ss + "crmpersonname").Value : null;
participant.CRMCompanyName = (participantElement.Element(ss + "crmcompanyname") != null) ? participantElement.Element(ss + "crmcompanyname").Value : null;
participant.CRMPictureURL = (participantElement.Element(ss + "crmpictureurl") != null) ? participantElement.Element(ss + "crmpictureurl").Value : null;
return participant;
}
SIPEventDialogParticipant::Parse ( string participantXMLStr ) : |
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.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); }