diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-12-10 16:14:17 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-12-10 16:14:17 +0000 |
commit | 61fc37e467bafe8b1178ec35daf0655049b3cc73 (patch) | |
tree | fd47305db5a3d6d8f08514d0c1620628b35495a2 /contrib/jitsimeetbridge/unjingle/unjingle.js | |
parent | import Image as PIL.Image. (diff) | |
parent | point the entry_point for synapse-homeserver at the right method (diff) | |
download | synapse-61fc37e467bafe8b1178ec35daf0655049b3cc73.tar.xz |
Merge branch 'develop' into media_repository
Diffstat (limited to 'contrib/jitsimeetbridge/unjingle/unjingle.js')
-rw-r--r-- | contrib/jitsimeetbridge/unjingle/unjingle.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/contrib/jitsimeetbridge/unjingle/unjingle.js b/contrib/jitsimeetbridge/unjingle/unjingle.js new file mode 100644 index 0000000000..3dfe759914 --- /dev/null +++ b/contrib/jitsimeetbridge/unjingle/unjingle.js @@ -0,0 +1,48 @@ +var strophe = require("./strophe/strophe.js").Strophe; + +var Strophe = strophe.Strophe; +var $iq = strophe.$iq; +var $msg = strophe.$msg; +var $build = strophe.$build; +var $pres = strophe.$pres; + +var jsdom = require("jsdom"); +var window = jsdom.jsdom().parentWindow; +var $ = require('jquery')(window); + +var stropheJingle = require("./strophe.jingle.sdp.js"); + + +var input = ''; + +process.stdin.on('readable', function() { + var chunk = process.stdin.read(); + if (chunk !== null) { + input += chunk; + } +}); + +process.stdin.on('end', function() { + if (process.argv[2] == '--jingle') { + var elem = $(input); + // app does: + // sess.setRemoteDescription($(iq).find('>jingle'), 'offer'); + //console.log(elem.find('>content')); + var sdp = new stropheJingle.SDP(''); + sdp.fromJingle(elem); + console.log(sdp.raw); + } else if (process.argv[2] == '--sdp') { + var sdp = new stropheJingle.SDP(input); + var accept = $iq({to: '%(tojid)s', + type: 'set'}) + .c('jingle', {xmlns: 'urn:xmpp:jingle:1', + //action: 'session-accept', + action: '%(action)s', + initiator: '%(initiator)s', + responder: '%(responder)s', + sid: '%(sid)s' }); + sdp.toJingle(accept, 'responder'); + console.log(Strophe.serialize(accept)); + } +}); + |