//public Dictionary<Guid, object> Load(XmlDocument dom) //{ // return SIPAssetXMLPersistor<SIPDialogueAsset>.LoadAssetsFromXMLRecordSet(dom); //} #endif public void Load(XElement dialogueElement) { SIPDialogue = new SIPDialogue(); SIPDialogue.Id = new Guid(dialogueElement.Element("id").Value); SIPDialogue.Owner = dialogueElement.Element("owner").Value; SIPDialogue.AdminMemberId = dialogueElement.Element("adminmemberid").Value; SIPDialogue.LocalTag = dialogueElement.Element("localtag").Value; SIPDialogue.RemoteTag = dialogueElement.Element("remotetag").Value; SIPDialogue.LocalUserField = SIPUserField.ParseSIPUserField(dialogueElement.Element("localuserfield").Value); SIPDialogue.RemoteUserField = SIPUserField.ParseSIPUserField(dialogueElement.Element("remoteuserfield").Value); SIPDialogue.CallId = dialogueElement.Element("callid").Value; SIPDialogue.CSeq = Convert.ToInt32(dialogueElement.Element("cseq").Value); SIPDialogue.BridgeId = new Guid(dialogueElement.Element("bridgeid").Value); SIPDialogue.RemoteTarget = SIPURI.ParseSIPURI(dialogueElement.Element("remotetarget").Value); SIPDialogue.RouteSet = (dialogueElement.Element("routeset") != null && !dialogueElement.Element("routeset").Value.IsNullOrBlank()) ? SIPRouteSet.ParseSIPRouteSet(dialogueElement.Element("routeset").Value) : null; SIPDialogue.ProxySendFrom = (dialogueElement.Element("proxysipsocket") != null) ? dialogueElement.Element("proxysipsocket").Value : null; SIPDialogue.CDRId = new Guid(dialogueElement.Element("cdrid").Value); SIPDialogue.CallDurationLimit = (dialogueElement.Element("calldurationlimit") != null) ? Convert.ToInt32(dialogueElement.Element("calldurationlimit").Value) : 0; SIPDialogue.Direction = (dialogueElement.Element("direction") != null) ? (SIPCallDirection)Enum.Parse(typeof(SIPCallDirection), dialogueElement.Element("direction").Value, true) : SIPCallDirection.None; Inserted = DateTimeOffset.Parse(dialogueElement.Element("inserted").Value); TransferMode = dialogueElement.Element("transfermode").Value; SDP = dialogueElement.Element("sdp").Value; RemoteSDP = dialogueElement.Element("remotesdp").Value; //SIPDialogue.SwitchboardCallerDescription = (dialogueElement.Element("switchboardcallerdescription") != null) ? dialogueElement.Element("switchboardcallerdescription").Value : null; //SIPDialogue.SwitchboardDescription = (dialogueElement.Element("switchboarddescription") != null) ? dialogueElement.Element("switchboarddescription").Value : null; SIPDialogue.SwitchboardOwner = (dialogueElement.Element("switchboardowner") != null) ? dialogueElement.Element("switchboardowner").Value : null; SIPDialogue.SwitchboardLineName = (dialogueElement.Element("switchboardlinename") != null) ? dialogueElement.Element("switchboardlinename").Value : null; SIPDialogue.CRMPersonName = (dialogueElement.Element("crmpersonname") != null) ? dialogueElement.Element("crmpersonname").Value : null; SIPDialogue.CRMCompanyName = (dialogueElement.Element("crmcompanyname") != null) ? dialogueElement.Element("crmcompanyname").Value : null; SIPDialogue.CRMPictureURL = (dialogueElement.Element("crmpictureurl") != null) ? dialogueElement.Element("crmpictureurl").Value : null; }
public void Load(DataRow row) { SIPDialogue = new SIPDialogue(); SIPDialogue.Id = new Guid(row["id"] as string); SIPDialogue.Owner = row["owner"] as string; SIPDialogue.AdminMemberId = row["adminmemberid"] as string; SIPDialogue.LocalTag = row["localtag"] as string; SIPDialogue.RemoteTag = row["remotetag"] as string; SIPDialogue.LocalUserField = SIPUserField.ParseSIPUserField(row["localuserfield"] as string); SIPDialogue.RemoteUserField = SIPUserField.ParseSIPUserField(row["remoteuserfield"] as string); SIPDialogue.CallId = row["callid"] as string; SIPDialogue.CSeq = Convert.ToInt32(row["cseq"]); SIPDialogue.BridgeId = new Guid(row["bridgeid"] as string); SIPDialogue.RemoteTarget = SIPURI.ParseSIPURI(row["remotetarget"] as string); SIPDialogue.RouteSet = (row["routeset"] != null && row["routeset"] != DBNull.Value && !(row["routeset"] as string).IsNullOrBlank()) ? SIPRouteSet.ParseSIPRouteSet(row["routeset"] as string) : null; SIPDialogue.ProxySendFrom = (row["proxysipsocket"] != null && row["proxysipsocket"] != DBNull.Value) ? row["proxysipsocket"] as string : null; SIPDialogue.CDRId = new Guid(row["cdrid"] as string); SIPDialogue.CallDurationLimit = (row["calldurationlimit"] != null && row["calldurationlimit"] != DBNull.Value) ? Convert.ToInt32(row["calldurationlimit"]) : 0; SIPDialogue.Direction = (row["direction"] != null) ? (SIPCallDirection)Enum.Parse(typeof(SIPCallDirection), row["direction"] as string, true) : SIPCallDirection.None; Inserted = DateTimeOffset.Parse(row["inserted"] as string); TransferMode = row["transfermode"] as string; SDP = row["sdp"] as string; RemoteSDP = row["remotesdp"] as string; //SIPDialogue.SwitchboardCallerDescription = (row["switchboardcallerdescription"] != null && row["switchboardcallerdescription"] != DBNull.Value) ? row["switchboardcallerdescription"] as string : null; //SIPDialogue.SwitchboardDescription = (row["switchboarddescription"] != null && row["switchboarddescription"] != DBNull.Value) ? row["switchboarddescription"] as string : null; SIPDialogue.SwitchboardOwner = (row["switchboardowner"] != null && row["switchboardowner"] != DBNull.Value) ? row["switchboardowner"] as string : null; SIPDialogue.SwitchboardLineName = (row["switchboardlinename"] != null && row["switchboardlinename"] != DBNull.Value) ? row["switchboardlinename"] as string : null; SIPDialogue.CRMPersonName = (row["crmpersonname"] != null && row["crmpersonname"] != DBNull.Value) ? row["crmpersonname"] as string : null; SIPDialogue.CRMCompanyName = (row["crmcompanyname"] != null && row["crmcompanyname"] != DBNull.Value) ? row["crmcompanyname"] as string : null; SIPDialogue.CRMPictureURL = (row["crmpictureurl"] != null && row["crmpictureurl"] != DBNull.Value) ? row["crmpictureurl"] as string : null; }
public void ParseSIPRouteSetTest() { Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name); string routeSetString = "<sip:127.0.0.1:5434;lr>,<sip:10.0.0.1>,<sip:192.168.0.1;ftag=12345;lr=on>"; SIPRouteSet routeSet = SIPRouteSet.ParseSIPRouteSet(routeSetString); Console.WriteLine(routeSet.ToString()); Assert.IsTrue(routeSet.Length == 3, "The parsed route set had an incorrect length."); Assert.IsTrue(routeSet.ToString() == routeSetString, "The parsed route set did not produce the same string as the original parsed value."); SIPRoute topRoute = routeSet.PopRoute(); Assert.IsTrue(topRoute.Host == "127.0.0.1:5434", "The first route host was not parsed correctly."); Assert.IsFalse(topRoute.IsStrictRouter, "The first route host was not correctly recognised as a loose router."); topRoute = routeSet.PopRoute(); Assert.IsTrue(topRoute.Host == "10.0.0.1", "The second route host was not parsed correctly."); Assert.IsTrue(topRoute.IsStrictRouter, "The second route host was not correctly recognised as a strict router."); topRoute = routeSet.PopRoute(); Assert.IsTrue(topRoute.Host == "192.168.0.1", "The third route host was not parsed correctly."); Assert.IsFalse(topRoute.IsStrictRouter, "The third route host was not correctly recognised as a loose router."); Assert.IsTrue(topRoute.URI.Parameters.Get("ftag") == "12345", "The ftag parameter on the third route was not correctly parsed."); }
public SIPDialogue ToSIPDialogue() { SIPDialogue dialogue = new SIPDialogue(); dialogue.Id = ID; dialogue.CDRId = CDRID.GetValueOrDefault(); dialogue.LocalTag = LocalTag; dialogue.RemoteTag = RemoteTag; dialogue.CallId = CallID; dialogue.CSeq = CSeq; dialogue.BridgeId = BridgeID; dialogue.RemoteTarget = SIPURI.ParseSIPURIRelaxed(RemoteTarget); dialogue.LocalUserField = SIPUserField.ParseSIPUserField(LocalUserField); dialogue.RemoteUserField = SIPUserField.ParseSIPUserField(RemoteUserField); dialogue.ProxySendFrom = ProxySendFrom; dialogue.RouteSet = string.IsNullOrWhiteSpace(RouteSet) ? null : SIPRouteSet.ParseSIPRouteSet(RouteSet); dialogue.CallDurationLimit = CallDurationLimit.GetValueOrDefault(); dialogue.Direction = Enum.Parse <SIPCallDirection>(Direction, true); dialogue.Inserted = Inserted; dialogue.RemoteSIPEndPoint = (RemoteSocket != null) ? SIPEndPoint.ParseSIPEndPoint(RemoteSocket) : null; return(dialogue); }