-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathProgram.cs
More file actions
85 lines (69 loc) · 2.29 KB
/
Copy pathProgram.cs
File metadata and controls
85 lines (69 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using PortSIP;
using SoftPhone;
namespace SIPSample
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static SoftPhone.SoftPhone thisPhone = new SoftPhone.SoftPhone();
private static bool isStarted = false;
public static bool isActive = true;
[STAThread]
static void Main(string[] args)
{
if (!isStarted)
{
thisPhone.StartPhone(args);
isStarted = true;
}
while (isActive)
{
var inputString = Console.ReadLine();
if (inputString.StartsWith("quit"))
{
Console.WriteLine("Exiting");
thisPhone.deRegisterFromServer();
break;
}
else {
ProccessInput(inputString);
}
}
}
static void ProccessInput(string inputString)
{
var tempString = inputString.Split(' ');
try
{
if (tempString[0].Length > 1 && tempString[1].Length > 1)
{
var cmd = tempString[0];
var subject = tempString[1];
switch (cmd)
{
case "call":
thisPhone.makeCall(subject.Trim());
break;
case "end":
thisPhone.EndCall();
break;
default:
Console.WriteLine("command not found [" + cmd + "]", Console.ForegroundColor = ConsoleColor.Red);
break;
}
}else{
Console.WriteLine("COULD NOT PROCCESS THIS COMMAND [" + inputString + "]", Console.ForegroundColor=ConsoleColor.Red);
}
}
catch (Exception) {
// Console.WriteLine(e);
}
}
}
}