-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpopup.js
61 lines (51 loc) · 2.01 KB
/
popup.js
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
requirejs.config({
baseUrl: '',
paths: {
react: "node_modules/react/dist/react-with-addons",
reactdom: "node_modules/react-dom/dist/react-dom",
'google-client-api': "node_modules/google-client-api/index",
'scriptjs': "node_modules/google-client-api/node_modules/scriptjs/dist/script.min",
'promise': "node_modules/google-client-api/node_modules/promise/index",
ui: "generated-jsx/ui",
contact: "generated-jsx/contact",
contactdetails: "generated-jsx/contactdetails",
buttons: "generated-jsx/buttons",
phonestatebar: "generated-jsx/phonestatebar",
langHelper: "helper/lang",
contactHelper: "helper/contact",
helper: "helper/all",
}
});
requirejs(['ui', 'reactdom'], function (ui, reactdom) {
var dialer = reactdom.render(ui, window.document.getElementById("container"));
var globals = chrome.extension.getBackgroundPage().globals;
var userAgent = globals["userAgent"];
var audio = globals["audio"];
var addStream = globals["addStream"];
globals["dialStatePopupHandler"] = function(dialState, callInfo) {
dialer.setDialState(dialState, callInfo);
};
globals["registerStatePopupHandler"] = function(registerState) {
dialer.setRegisterState(registerState);
};
dialer.setStateStore(function(state) {
globals["popupState"] = state;
});
dialer.restoreState(globals["popupState"]);
dialer.setDialState(globals["dialState"], globals["callInfo"]);
dialer.setRegisterState(globals["registerState"]);
dialer.setHandler("onDial", function (number) {
globals["call"]('sip:' + number + '@sipgate.de');
});
dialer.setHandler("onHangup", function () {
//userAgent.terminateSessions();
globals["hangup"]();
});
dialer.setHandler("onAccept", function () {
globals["answer"]();
});
dialer.setHandler("onReject", function () {
globals["reject"]();
});
dialer.setContacts(globals["contacts"]);
});