//------------------------------------------------------------------------------------------ private SipAccount HandleSectionSipTypeUser(SipAccount sipaccount, string propertyname, string propertyvalue) { switch (propertyname) { case "canreinvite": sipaccount.CanReinvite = (propertyvalue == "yes"); break; case "context": sipaccount.Context = propertyvalue; break; case "dtmfmode": sipaccount.DTMFMode = propertyvalue; break; case "fromuser": sipaccount.FromUser = propertyvalue; break; case "fromdomain": sipaccount.FromDomain = propertyvalue; break; case "host": sipaccount.Host = propertyvalue; break; case "insecure": sipaccount.Insecure = propertyvalue; break; case "nat": sipaccount.Nat = (propertyvalue == "yes"); break; case "secret": sipaccount.Secret = "*****"; //propertyvalue; break; case "username": sipaccount.UserName = propertyvalue; break; } return sipaccount; }
//------------------------------------------------------------------------------------------ private void HandleSectionData(string sectionname, NameValueCollection sectiondata) { for (int i = 0; i < sectiondata.Count; i++) { if (sectiondata.Keys[i] == "type") { switch (sectiondata[i]) { case "friend": break; case "peer": break; case "user": SipAccount sipaccount = new SipAccount(); for (int x = 0; x < sectiondata.Count; x++) { sipaccount.SectionName = sectionname; sipaccount = HandleSectionSipTypeUser(sipaccount, sectiondata.Keys[x], sectiondata[x]); } Users.Add(sipaccount); break; } } } }
//------------------------------------------------------------------------------------------- public SipAccount Add(SipAccount sipaccount) { List.Add(sipaccount); return sipaccount; }
//------------------------------------------------------------------------------------------- public int IndexOf(SipAccount sipaccount) { return List.IndexOf(sipaccount); }
//------------------------------------------------------------------------------------------- public SipAccount Add() { SipAccount sipaccount = new SipAccount(); return Add(sipaccount); }