main.cpp
1.57 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
//
// Created bxc on 2022/11/25.
//
#include "SipServer.h"
#include <thread>
#include <chrono>
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
ServerInfo info(
"SY_SipServer",
"12345678",
"192.168.60.179",
15061,
30026,
"34020000002000000002",
"3402000000",
"sy123456",
1800,
3600);
SipServer sipServer;
sipServer.Init(info);
sipServer.Start();
std::this_thread::sleep_for(std::chrono::seconds(5));
std::map<std::string, Client*> client_map;
std::vector< DeviceInfo > vec_device;
char oper = 'g';
while (oper != 'q') {
oper = getchar();
switch (oper)
{
case 'g':
client_map = sipServer.GetClientMap();
if (client_map.size() <= 0)
{
cout << "no IPC" << endl;
}
else {
cout << "client size:" << client_map.size() << endl;
}
break;
case 'i':
vec_device = sipServer.GetDeviceList();
if (vec_device.size() <= 0)
{
cout << "no device" << endl;
break;
}
if (client_map.size() <= 0)
{
cout << "no IPC" << endl;
}
else {
auto it = client_map.begin();
sipServer.RequestInvite(it->second, vec_device[0]);
}
break;
case 'b':
break;
case 'c':
if (client_map.size() <= 0)
{
cout << "no IPC" << endl;
}
else {
auto it = client_map.begin();
sipServer.RequestCatlog(it->second);
}
break;
default:
break;
}
}
return 0;
}