-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserver.js
34 lines (25 loc) · 999 Bytes
/
server.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
var restify = require('restify'),
JSEPGateway = require('./lib/jsep-to-sip'),
request = require('request'),
logger = require('./lib/logwinston');
var env = process.env.NODE_ENV || 'development';
var config = require('./config/conftool').getConf();
var server = restify.createServer({
name: 'jsep-to-sip-gateway',
version: '0.0.1'
});
require('./lib/registrar_db').connect();
server.use(restify.acceptParser(server.acceptable));
server.use(restify.queryParser());
server.use(restify.bodyParser({mapParams: false}));
var jsepSession = require('./controllers/session');
var user = require('./controllers/user');
//inbound calls
server.post('/session', jsepSession.create);
server.put('/session/:uuid', jsepSession.add);
server.del('/session/:uuid', jsepSession.remove);
//registration
server.post('/registration', user.register);
server.listen(config.httpport, function () {
logger.log('info', 'JSEP to Sip Gateway ' + server.name + 'listening at '+ server.url);
});