forked from Montesuma80/3cx-web-API
-
Notifications
You must be signed in to change notification settings - Fork 1
/
atttrans.cs
43 lines (41 loc) · 1.33 KB
/
atttrans.cs
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
using System;
using System.Collections.Generic;
using System.Text;
using TCX.Configuration;
using TCX.PBXAPI;
using System.Threading;
using System.IO;
using System.Reflection;
using System.Linq;
using System.Net;
namespace WebAPI
{
public class atttrans
{
public static string dotrans(string args1)
{
var dn = PhoneSystem.Root.GetDNByNumber(args1);
ActiveConnection[] activeConnectionArray = dn.GetActiveConnections();
Logger.WriteLine(activeConnectionArray.Length.ToString());
if (activeConnectionArray.Length == 2)
{
var activeConnection = activeConnectionArray[0];
var activeConnection2 = activeConnectionArray[1];
foreach (var r in dn.GetRegistrarContactsEx())
{
string result = $"{r.UserAgent}-{r.Contact}-{r.ID}";
Logger.WriteLine(result);
if (result.Contains("3CXPhone for Windows"))
{
PhoneSystem.Root.JoinCalls(args1, r.Contact , activeConnection, activeConnection2);
}
}
}
else
{
return("false");
}
return ("true");
}
}
}