Hi..
we recently had a support request on Telekom Tropo conferencing and node.js . Our colleague Daniel Roth (you can find his pretty black website here 🙂 ) solved it. He did not use the Tropo package but did it rather from scratch. Well, customer’s wish is our command…
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 |
var https = require('https'); confId = '123456789'; //conference Id MUST be the same for the two conference partners, could also be a random number here. numberToDial = '+49....'; numberToDial2 = '+49....'; var body = JSON.stringify({ 'action': 'create', 'token': 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'numberToDial': numberToDial, 'conferenceId': confId, }); var body2 = JSON.stringify({ 'action': 'create', 'token': 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'numberToDial': numberToDial2, 'conferenceId': confId, }); var options = { host: 'tropo.developergarden.com', path: '/api/sessions', method: "POST", rejectUnauthorized: false, requestCert: true, agent: false, headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Content-Length': body.length, } }; var options2 = { host: 'tropo.developergarden.com', path: '/api/sessions', method: "POST", rejectUnauthorized: false, requestCert: true, agent: false, headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Content-Length': body2.length, } }; var request = https.request(options, function(res) { res.on('error', function(err) { console.log(err); }); var data = ''; res.on('data', function(d) { data += d; }); res.on('end', function() { console.log(data); }); }); request.write(body); request.end(); request.on('error', function(err) { console.log(err); }); var request2 = https.request(options2, function(res) { res.on('error', function(err) { console.log(err); }); var data = ''; res.on('data', function(d) { data += d; }); res.on('end', function() { console.log(data); }); }); request2.write(body2); request2.end(); request2.on('error', function(err) { console.log(err); }); |
The exact same thing if you are using Telekom Tropo scripting:
1 2 3 |
call(numberToDial); say('Welcome to the conference'); conference(conferenceId); |
The world famous 3 lines of code…
Thanks to Daniel… you: Have fun!!!
CU
0xff