public void Log( Device device, Line line, Call call, DateTime starttime, DateTime endtime ) { lock (this) { string strFile = ""; try { strFile = System.Configuration.ConfigurationManager.AppSettings["callLogFile"]; } catch (System.Configuration.SettingsPropertyNotFoundException) { strFile = System.Environment.CurrentDirectory + "\\calls.log"; } if (strFile == "") { strFile = System.Environment.CurrentDirectory + "\\calls.log"; } else { strFile = System.Environment.CurrentDirectory + "\\" + strFile; } StreamWriter objLogFile = File.AppendText(strFile); string strLine = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss.ffffff"); string phone = "unknown"; if (call.Type == CallType.Inbound) { phone = line.LastCallerNumber; } else { phone = line.LastCalledNumber; } strLine += "," + device.Name + "," + call.Name + "," + line.Name + "," + call.Type.ToString() +"," + phone + "," + starttime + "," + endtime + "," + call.Duration; objLogFile.WriteLine(strLine); objLogFile.Close(); } }
public DevicePropertyChange( Device device, String property, String changedFrom, String changedTo ) { mDevice = device; mProperty = property; mChangedFrom = changedFrom; mChangedTo = changedTo; }
public CallRecord( Device device, Line line, Call call, DateTime startTime, DateTime endTime) { Device = device; Line = line; Call = call; StartTime = startTime; EndTime = endTime; }
public TAPIDeviceMonitor(String name) { mName = name; // We know there will one line for the device, which may have up to 10 calls. For now we will just support a single call. mDeviceState = new Device(name, new Line[] { new Line( "1", new Call[] { new Call( "1" ) } ), }); }
public LinksysPAP2DeviceMonitor( String name ) { mName = name; // We know there will be two lines for the device, each with // two calls. mDeviceState = new Device( name, new Line[] { new Line( "Line 1", new Call[] { new Call( "Call 1" ), new Call( "Call 2" ) } ), new Line( "Line 2", new Call[] { new Call( "Call 1" ), new Call( "Call 2" ) } ) } ); }
public SipuraSPA3000DeviceMonitor( String name ) { mName = name; // There's only one line for the device, as its second line is // a PSTN failover. mDeviceState = new Device( name, new Line[] { new Line( "Line 1", new Call[] { new Call( "Call 1" ), new Call( "Call 2" ) } ) //new Line( "PSTN Line", new Call[] { new Call( "Call 1" ), new Call( "Call 2" ) } ) } ); }
// Helper functions for linking states. public IDeviceMonitor GetMonitor( Device deviceState ) { foreach( DeviceMonitorControl control in DeviceMonitorControls ) if( control.DeviceMonitor.GetDeviceState() == deviceState ) return control.DeviceMonitor; throw new DomainObjectNotFoundException( "Couldn't find a monitor owning the specified device." ); }