-
Notifications
You must be signed in to change notification settings - Fork 0
/
VOIPForCSharpe.cpp
56 lines (52 loc) · 1.36 KB
/
VOIPForCSharpe.cpp
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
#include "stdafx.h"
#include "VOIPForCSharpe.h"
#include "CStarRTCMenuDialog.h"
#include "CUserManager.h"
#include "CLogin.h"
#include "CVoipDlg.h"
#include "Resource.h"
#include "YpVoip.h"
CUserManager* m_pUserManager;
YpVoip *ypip;
BOOL YPLogin(char* localuserid) {
m_pUserManager = new CUserManager();
CLogin login(m_pUserManager);
//bool bRead = login.readConfig();
//if (!bRead)fdf
//{
// //OnClose();
// return FALSE;
//}
m_pUserManager->m_ServiceParam.m_strUserId = localuserid;
if (ypip == NULL) {
ypip = new YpVoip(m_pUserManager);
}
bool bSuccess = login.logIn();
if (bSuccess)
{
//AfxMessageBox("登录成功");
//login.startIMServer((char*)m_pUserManager->m_strIMServerIp.c_str(), m_pUserManager->m_nIMServerPort, (char*)m_pUserManager->m_ServiceParam.m_strUserId.c_str(), (char*)m_pUserManager->m_ServiceParam.m_strAgentId.c_str(), (char*)m_pUserManager->m_strTokenId.c_str());
}
else
{
AfxMessageBox("登录失败,请检查配置信息");
}
return TRUE;
}
int VoipCallPerson(char* targetId, char* str) {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (ypip == NULL) {
ypip = new YpVoip(m_pUserManager);
}
string string_targetId;
string_targetId = targetId;
ypip->callPerson(string_targetId);
return 1;
}
int DeleteVoip() {
if (ypip != NULL) {
delete ypip;
ypip = NULL;
}
return 1;
}