|
|
@@ -1,27 +1,18 @@
|
|
1
|
|
- var outgoingSession = null;
|
|
2
|
|
- var incomingSession = null;
|
|
3
|
|
- var currentSession = null;
|
|
4
|
|
- var timeStrart=false;
|
|
5
|
|
- var timeReg=false;
|
|
6
|
|
- var thjsTel=false;
|
|
7
|
|
- var videoView = document.getElementById('videoView');
|
|
8
|
|
-
|
|
9
|
|
- var constraints = {
|
|
10
|
|
- audio: true,
|
|
11
|
|
- video: false,
|
|
12
|
|
- mandatory: {
|
|
13
|
|
- maxWidth: 640,
|
|
14
|
|
- maxHeight: 360
|
|
15
|
|
- }
|
|
16
|
|
- };
|
|
17
|
|
-
|
|
|
1
|
+ var outgoingSession = null,incomingSession = null,currentSession = null,
|
|
|
2
|
+ timeStrart=false,thjsTel=false,timeReg,
|
|
|
3
|
+ videoView = document.getElementById('videoView'),
|
|
|
4
|
+ localStream = null,userAgent = null,
|
|
|
5
|
+ constraints = {
|
|
|
6
|
+ audio: true,
|
|
|
7
|
+ video: false,
|
|
|
8
|
+ mandatory: {
|
|
|
9
|
+ maxWidth: 640,
|
|
|
10
|
+ maxHeight: 360
|
|
|
11
|
+ }
|
|
|
12
|
+ };
|
|
18
|
13
|
URL = window.URL || window.webkitURL;
|
|
19
|
14
|
|
|
20
|
|
- var localStream = null;
|
|
21
|
|
- var userAgent = null;
|
|
22
|
|
-
|
|
23
|
15
|
function testStart() {
|
|
24
|
|
-
|
|
25
|
16
|
var sip_uri_ = huayi.config.sip_uri_.toString();
|
|
26
|
17
|
var sip_password_ = huayi.config.sip_password_.toString();
|
|
27
|
18
|
var ws_uri_ = huayi.config.ws_uri_.toString();
|
|
|
@@ -35,7 +26,10 @@
|
|
35
|
26
|
uri: sip_uri_,
|
|
36
|
27
|
password: sip_password_,
|
|
37
|
28
|
register: true,
|
|
38
|
|
- session_timers: true
|
|
|
29
|
+ session_timers: true,
|
|
|
30
|
+ contact_uri: 'sip:'+$.cookie("extno")+'@'+huayi.config.socket_ip+';transport=ws',
|
|
|
31
|
+ authorization:$.cookie("extno"),
|
|
|
32
|
+ display_name:$.cookie("extno")
|
|
39
|
33
|
};
|
|
40
|
34
|
|
|
41
|
35
|
userAgent = new JsSIP.UA(configuration);
|
|
|
@@ -64,7 +58,7 @@
|
|
64
|
58
|
//注册超时
|
|
65
|
59
|
userAgent.on('registrationExpiring', function() {
|
|
66
|
60
|
if (!timeStrart) {
|
|
67
|
|
- $(".tooltip_text").text("注册超时...")
|
|
|
61
|
+ //$(".tooltip_text").text("注册超时...")
|
|
68
|
62
|
}
|
|
69
|
63
|
timeStrart=false;
|
|
70
|
64
|
console.warn("registrationExpiring");
|
|
|
@@ -98,7 +92,9 @@
|
|
98
|
92
|
});
|
|
99
|
93
|
data.session.on('confirmed', function(data) {
|
|
100
|
94
|
$(".tooltip_text").text("通话中...") //呼入建立
|
|
101
|
|
- $(".hwzt").text('通话中');
|
|
|
95
|
+ if (signState) {
|
|
|
96
|
+ $(".hwzt").text('通话中');
|
|
|
97
|
+ }
|
|
102
|
98
|
thjsTel=true;
|
|
103
|
99
|
calling();
|
|
104
|
100
|
// if(stringHr_1){
|
|
|
@@ -137,7 +133,6 @@
|
|
137
|
133
|
};
|
|
138
|
134
|
});
|
|
139
|
135
|
});
|
|
140
|
|
-
|
|
141
|
136
|
userAgent.on('newMessage', function(data) {
|
|
142
|
137
|
if(data.originator == 'local') {
|
|
143
|
138
|
console.info('onNewMessage , OutgoingRequest - ', data.request);
|
|
|
@@ -145,32 +140,22 @@
|
|
145
|
140
|
console.info('onNewMessage , IncomingRequest - ', data.request);
|
|
146
|
141
|
}
|
|
147
|
142
|
});
|
|
148
|
|
-
|
|
149
|
143
|
userAgent.start();
|
|
150
|
144
|
}
|
|
|
145
|
+ //外呼状态
|
|
151
|
146
|
var eventHandlers = {
|
|
152
|
147
|
'progress': function(e) {
|
|
153
|
148
|
$(".tooltip_text").text("呼出振铃...");
|
|
154
|
149
|
},
|
|
155
|
150
|
'failed': function(e) {
|
|
156
|
151
|
$(".tooltip_text").text("呼叫失败...");
|
|
157
|
|
- //layer.msg('呼叫失败', e);
|
|
158
|
152
|
},
|
|
159
|
153
|
'ended': function(e) {
|
|
160
|
|
- debugger
|
|
161
|
|
- $(".tooltip_text").text("通话结束...");
|
|
162
|
154
|
clearInter();
|
|
163
|
|
-// timeStrart=true;
|
|
164
|
|
-// timeReg=true;
|
|
165
|
|
-// testStart();
|
|
166
|
|
-// setTimeout(function () {
|
|
167
|
|
-// reg();
|
|
168
|
|
-// }, 2000)
|
|
169
|
|
-
|
|
|
155
|
+ $(".tooltip_text").text("通话结束...");
|
|
170
|
156
|
},
|
|
171
|
157
|
'confirmed': function(e) {
|
|
172
|
158
|
$(".tooltip_text").text("呼叫建立...");
|
|
173
|
|
- //layer.msg('呼叫建立');
|
|
174
|
159
|
}
|
|
175
|
160
|
};
|
|
176
|
161
|
function inCall () {
|
|
|
@@ -224,33 +209,26 @@ function inCall () {
|
|
224
|
209
|
console.log('register----------->');
|
|
225
|
210
|
userAgent.register();
|
|
226
|
211
|
}
|
|
227
|
|
- regTime();
|
|
|
212
|
+ //定时注册
|
|
|
213
|
+ //regTime();
|
|
228
|
214
|
function regTime(){
|
|
229
|
215
|
setInterval(function() {
|
|
230
|
216
|
timeStrart=true;
|
|
231
|
217
|
timeReg=true;
|
|
232
|
|
- //testStart();
|
|
233
|
218
|
reg();
|
|
234
|
|
-// setTimeout(function () {
|
|
235
|
|
-// reg();
|
|
236
|
|
-// }, 2000)
|
|
237
|
219
|
}, 1000*60);
|
|
238
|
220
|
}
|
|
239
|
|
-
|
|
240
|
|
-
|
|
|
221
|
+//注销
|
|
241
|
222
|
function unReg() {
|
|
242
|
223
|
$(".td-call").hide();
|
|
243
|
224
|
$(".tooltip_text").text("注销...");
|
|
244
|
225
|
//console.log('unregister----------->');
|
|
245
|
226
|
userAgent.unregister(true);
|
|
246
|
227
|
}
|
|
247
|
|
-
|
|
|
228
|
+//挂断
|
|
248
|
229
|
function hangup() {
|
|
249
|
|
- debugger
|
|
250
|
|
- //clearInter();
|
|
251
|
230
|
//window.frames[1].clearInter();
|
|
252
|
231
|
$(".tooltip_text").text("挂断...");
|
|
253
|
|
- //console.log('hangup----------->');
|
|
254
|
232
|
obj.Type = "DropCall";
|
|
255
|
233
|
Send();
|
|
256
|
234
|
userAgent.terminateSessions();
|