zhitong.yu
2024-05-11 b72f8f8d58417eb6fb29672d8ac17cfafa46775c
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
var _urlHeadAjax;
var _authRstData;
 
function auth(serverUrl, account, passwd, serverKey){
    _urlHeadAjax = serverUrl + "/rest/";
    
    var jsonObj = {"account":account,
        "passwd": passwd
    };
    sessionStorage.setItem("serverKey", serverKey);
    _authRstData = {};
    sessionStorage.removeItem("ipocid");
    sessionStorage.removeItem("apiKey");
    chatRequest("ctcpsEx/auth.json", null, jsonObj, __processAuth);
}
 
function __processAuth(data) {
    if (data.resultCode == 200){
        _authRstData = data;
        sessionStorage.setItem("ipocid", data.ipocid);
        sessionStorage.setItem("apiKey", data.api_key);
        
        account_login(data.wsServerIp, data.ipocid, data.ipocpwd);
    } else {
        authCallBack(data);
    }
}
 
function logout(){
    sessionStorage.removeItem("serverKey");
    sessionStorage.removeItem("ipocid");
    sessionStorage.removeItem("apiKey");
    account_logout();
}
 
function changePassword(serverUrl, account, orgPasswd, newPasswd, serverKey){
    _urlHeadAjax = serverUrl + "/rest/";
    
    var jsonObj = {"account":account,
        "orgPasswd": orgPasswd,
        "newPasswd": newPasswd
    };
    
    chatRequest("ctcpsEx/changePassword.json", null, jsonObj, function (data){
        if (typeof changePasswordCallBack === "function"){
            changePasswordCallBack(data);
        }
    });
}
 
function sesGroupEnter(groupId){
    session_channel_enter(groupId);
}
 
function sesGroupExit(groupId){
    session_channel_exit(groupId);
}
 
function sesCallIncomingAccept(groupId){
    session_call_incoming_accept(groupId);
}
 
function sesCallIncomingReject(groupId){
    session_call_incoming_reject(groupId);
}
 
function sesCallInitiate(userNumberArr){
    session_id_generate(userNumberArr);
}
 
function session_id_generate2(userNumberArr){
    var jsonObj = {aid: sessionStorage.getItem("ipocid"),
            aids: userNumberArr};
    chatRequest("ctcpsEx/querySessionId.json", "POST", jsonObj, __sesIdGenerateCallBack2);
}
 
function __sesIdGenerateCallBack2(data){
    if (data.resultCode == 200){
        session_call_make(data.sid);
    }
}
 
function __sesIdGenerateCallBack(sessionId){
    session_call_make(sessionId);
}
 
function sesCallHangup(sessionId){
    session_call_bye(sessionId);
}
 
function sesLock(sessionId, islock){
    session_lock_opt(sessionId, islock);
}
 
function sesTalkRequest(sessionId){
    session_talk_request(sessionId);
}
 
function sesTalkRelease(){
    session_talk_release();
}
 
function sesMsgSend(sessionId, msgType, msgContent){
    session_message_send(sessionId, msgType, msgContent);
}
 
function sesMsgRecPlayStart(code, resId){
    session_message_rec_play_start(code, resId);
}
 
function sesMsgRecPlayStop(){
    session_message_rec_play_stop();
}
 
function accountPresenceSubscribe(sJson){
    account_presence_subscribe(1, sJson);
}
 
function accountPresenceUnsubscribe(){
    account_presence_unsubscribe();
}
 
function sdkVersion(versionFunc){
    sdk_version(versionFunc);    
}