bridging asterisk to the matrix ecosystemmatthew/2015-10-15 matrix astricon.pdf · bridging...
TRANSCRIPT
![Page 2: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/2.jpg)
The problem:
![Page 3: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/3.jpg)
What does it mean to"call someone via WebRTC"?
3
![Page 4: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/4.jpg)
4
![Page 5: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/5.jpg)
5
![Page 6: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/6.jpg)
Why should I have to use Tsahi's app?
6
![Page 7: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/7.jpg)
Why should I trustTsahi's app?
7
![Page 8: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/8.jpg)
Why should the data for this call get trapped in Tsahi's
app?
8
![Page 9: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/9.jpg)
How do I know how to contact Tsahi in future?
9
![Page 10: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/10.jpg)
![Page 11: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/11.jpg)
Users are locked into proprietary communication
apps.
They have no control over their data or their privacy.
![Page 12: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/12.jpg)
Their conversations and contacts are fragmented.
![Page 13: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/13.jpg)
I want to communicate with the apps and services I trust.
13
![Page 14: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/14.jpg)
Not be forced into specific services chosen by my
contacts.
14
![Page 15: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/15.jpg)
If email gives me that flexibility, why not VoIP and
IM?
15
![Page 16: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/16.jpg)
Isn’t SIP meant to fix this?
16
![Page 17: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/17.jpg)
SIP is great and all, but:
17
• It cargo-cults the PSTN
• It’s (almost) all 1:1 communication
• Chat, file transfer etc is clunky
• No synced conversation history
• etc…
![Page 18: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/18.jpg)
Enter Matrix
18
![Page 19: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/19.jpg)
OpenDecentralisedPersistentEventually ConsistentCryptographically SecureMessaging Databasewith JSON-over-HTTP API.
19
![Page 20: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/20.jpg)
Matrix is for:Group Chat (and 1:1)WebRTC SignallingBridging Comms SilosInternet of Things Data
…and anything else which needs to pubsub persistent data to the world.
20
![Page 21: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/21.jpg)
Matrix was built to liberate your scrollback.
21
![Page 22: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/22.jpg)
1st law of Matrix:Conversation history and Group comms are the 1st
class citizens.
22
![Page 23: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/23.jpg)
2nd law of Matrix:No single party own your conversations – they are
shared over all participants.
23
![Page 24: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/24.jpg)
3rd law of Matrix:All conversations may be
end-to-end encrypted.
(real soon now)
24
![Page 25: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/25.jpg)
Matrix is:• Non-profit Open Source Project• De-facto Open Standard HTTP APIs:
– Client <-> Server– Server <-> Server– Application Services <-> Server
• Apache-Licensed Open Source Reference Impls– Server (Python/Twisted)– Client SDKs (iOS, Android, JS, Angular, Python, Perl)– Clients (Web, iOS, Android)– Application Services (IRC, SIP, XMPP, Lync bridges)
• A whole ecosystem of 3rd party servers, clients & services 25
![Page 26: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/26.jpg)
What does it look like?
26
![Page 27: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/27.jpg)
Demo time!
http://matrix.org/blog/try-matrix-now
27
![Page 28: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/28.jpg)
The Matrix Ecosystem
The Matrix Specification (Client/Server API)
client-‐sideserver-‐side
Other Servers and Services
Synapse(Reference Matrix
Server)
Matrix Application Services
Other Clients
Matrix iOSConsole
MatrixKit (iOS)
matrix-‐ios-‐sdk
Matrix Web
Console
matrix-‐angular-‐sdk
matrix-‐js-‐sdk
Android Console
matrix-‐android-‐sdk
matrix-‐react-‐sdk
![Page 29: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/29.jpg)
Matrix Architecture
Clients
Home Servers
IdentityServers
ApplicationServers
![Page 30: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/30.jpg)
Functional Responsibility• Clients: Talks simple HTTP APIs to homeservers to
push and pull messages and metadata. May be as thin or thick a client as desired.
• Homeservers: Stores all the data for a user - the history of the rooms in which they participate; their public profile data.
• Application Services: Optional; delivers application layer logic on top of Matrix (Gateways, Conferencing, Archiving, Search etc). Can actively intercept messages if required.
• Identity Servers: Trusted clique of servers (think DNS root servers): maps 3rd party IDs to matrix IDs.
30
![Page 31: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/31.jpg)
How does it work?
31
http://matrix.org/#about
![Page 32: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/32.jpg)
The client-server APITo send a message:
curl -‐XPOST -‐d '{"msgtype":"m.text", "body":"hello"}' "https://alice.com:8448/_matrix/client/api/v1/rooms/ROOM_ID/send/m.room.message?access_token=ACCESS_TOKEN"
{"event_id": "YUwRidLecu"
}
32
![Page 33: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/33.jpg)
The client-server APITo set up a WebRTC call:
curl -‐XPOST –d '{\"version": 0, \"call_id": "12345”, \"offer": {"type" : "offer”,"sdp" : "v=0\r\no=-‐ 658458 2 IN IP4 127.0.0.1…"
}}' "https://alice.com:8448/_matrix/client/api/v1/rooms/ROOM_ID/send/m.call.invite?access_token=ACCESS_TOKEN"
{ "event_id": "ZruiCZBu” } 33
![Page 34: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/34.jpg)
Basic 1:1 VoIP Matrix Signalling
Caller Calleem.call.invite -‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐>m.call.candidate -‐-‐-‐-‐-‐-‐-‐-‐>[more candidates events]
User answers call<-‐-‐-‐-‐-‐-‐ m.call.answer
[media flows]<-‐-‐-‐-‐-‐-‐ m.call.hangup
34
![Page 35: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/35.jpg)
The client-server APITo persist some MIDI:
curl -‐XPOST –d '{\"note": "71",\"velocity": 68,\"state": "on",\"channel": 1,\"midi_ts": 374023441\
}' "https://alice.com:8448/_matrix/client/api/v1/rooms/ROOM_ID/send/org.matrix.midi?access_token=ACCESS_TOKEN"
{ "event_id": “ORzcZn2” }
35
![Page 36: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/36.jpg)
The client-server API…or to persist some tap gestures for animating an Avatar…
curl -‐XPOST –d '{"thumbnail":
"http://matrix.org:8080/_matrix/content/QGtlZ2FuOm1hdHJpeC5vcmcvNupjfhmFhjxDPquSZGaGlYj.aW1hZ2UvcG5n.png",
"actions": [{"x": "0.5521607", "y": "6.224353", "t": "0.9479785"},{"x": "0.5511537", "y": "6.220354", "t": "0.9701037"},{"x": "0.5510949", "y": "6.214756", "t": "0.9804187"},{"x": "0.5499267", "y": "6.213634", "t": "0.9972034"},{"x": "0.5492241", "y": "6.210211", "t": "1.013744"},{"x": "0.5486694", "y": "6.206304", "t": "1.030284"},{"x": "0.5482137", "y": "6.201648", "t": "1.046764"},
...{"x": "0.9997056", "y": "4.022976", "t": "8.970592"},{"x": "0.9995697", "y": "4.043199", "t": "8.987072"}
]}' "https://alice.com:8448/_matrix/client/api/v1/rooms/ROOM_ID/send/org.matrix.demos.unity.stickmen?access_token=ACCESS_TOKEN"
{ "event_id": “ORzcZn2” } 36
![Page 37: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/37.jpg)
The server-server APIcurl –XPOST –H ‘Authorization: X-‐Matrix origin=matrix.org,key=”898be4…”,sig=“j7JXfIcPFDWl1pdJz…”’ –d ‘{
"ts": 1413414391521,"origin": "matrix.org","destination": "alice.com","prev_ids": ["e1da392e61898be4d2009b9fecce5325"],"pdus": [{
"age": 314,"content": {
"body": "hello world","msgtype": "m.text"
},"context": "!fkILCTRBTHhftNYgkP:matrix.org","depth": 26,"hashes": {
"sha256": "MqVORjmjauxBDBzSyN2+Yu+KJxw0oxrrJyuPW8NpELs"},"is_state": false,"origin": "matrix.org","pdu_id": "rKQFuZQawa","pdu_type": "m.room.message","prev_pdus": [
["PaBNREEuZj", "matrix.org"]],"signatures": {
"matrix.org": {"ed25519:auto": "jZXTwAH/7EZbjHFhIFg8Xj6HGoSI+j7JXfIcPFDWl1pdJz+JJPMHTDIZRha75oJ7lg7UM+CnhNAayHWZsUY3Ag"
}},"origin_server_ts": 1413414391521,"user_id": "@matthew:matrix.org"
}]}’ https://alice.com:8448/_matrix/federation/v1/send/916d630ea616342b42e98a3be0b74113 37
![Page 38: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/38.jpg)
Hang on, what about Asterisk?!
38
![Page 39: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/39.jpg)
Application Services (AS)• Extensible custom application logic• They have privileged access to the server (granted
by the admin).• They can subscribe to wide ranges of server
traffic (e.g. events which match a range of rooms, or a range of users)
• They can masquerade as 'virtual users'.• They can lazy-create 'virtual rooms'• They can receive traffic by push.
39
![Page 40: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/40.jpg)
Uses for AS API• Gateways to other comms platforms• Data manipulation
– Filtering– Translation– Indexing– Mining– Visualisation– Orchestration
• Application Logic (e.g. bots, IVR services)• …
40
![Page 41: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/41.jpg)
A trivial application serviceimport json, requests # we will use this laterfrom flask import Flask, jsonify, requestapp = Flask(__name__)
@app.route("/transactions/<transaction>", methods=["PUT"])def on_receive_events(transaction):
events = request.get_json()["events"]for event in events:
print "User: %s Room: %s" % (event["user_id"], event["room_id"])print "Event Type: %s" % event["type"]print "Content: %s" % event["content"]
return jsonify({})
if __name__ == "__main__":app.run()
41
![Page 42: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/42.jpg)
42
Matrix Bridging with ASes
Existing App
ApplicationService
3rd partyServer
3rd partyClients
![Page 43: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/43.jpg)
43
Matrix to IRC
matrix-appservice-irc
ircd(e.g. Freenode)
IRC clients
![Page 44: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/44.jpg)
44
Matrix to
matrix-appservice-irc
slack.com
Slackclients
![Page 45: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/45.jpg)
45
Matrix to
OpenMarketMatrix
Gateway
OpenMarketSMS Gateway
The PSTN
![Page 46: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/46.jpg)
46
Matrix to Skype, Lync, Facebook, AIM, ICQ…?!
matrix-appservice-
purple
skype
skypeclients
![Page 47: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/47.jpg)
Matrix Bridge Stack
47
matrix-‐appservice-‐
irc
matrix-‐appservice-‐bridge
matrix-‐appservice-‐node
matrix-‐js-‐sdk
Node JS
matrix-‐appservice-‐
slack
matrix-‐appservice-‐purple …
![Page 48: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/48.jpg)
No really,what about Asterisk?!!!
48
![Page 49: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/49.jpg)
How to bridge to Asterisk?
49
![Page 50: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/50.jpg)
…in 24 hours?!
50
![Page 51: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/51.jpg)
51
Thought process:
• Write chan_matrix!
• …seek inspiration…
• …need a modern HTTP asterisk channel driver…
• …ask Digium for suggestions…
• “Take a look at chan_respoke”
![Page 52: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/52.jpg)
52
to
asterisk+
chan_respoke
SIP, IAX, H.323, PRI
socket.ioJSON-over-
HTTP transport
![Page 53: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/53.jpg)
53
Taking a look at chan_respoke:
• Really robust asterisk module!
• ~7000 lines of ‘nice’ C
• Respoke’s signaling looks very similar to Matrix, but still would need a rewrite of all the fine detail.
![Page 54: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/54.jpg)
54
Options:
• Fork chan_respoke (not going to happen in 24 hours, alas)
• …or why not just build a bridge?
![Page 55: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/55.jpg)
55
Matrix to Asterisk
matrix-appservice-
respoke
Asterisk+
chan_respoke
SIP, IAX, H.323, PRI
etc
socket.ioJSON-over-
HTTP transport
![Page 56: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/56.jpg)
56
matrix-appservice-respoke
• VERY basic proof of concept
• 478 lines of Node.js
• …plus an SDP stack (393 lines)
• Works with vanilla chan_respoke –just point the transport at the matrix bridge rather than api.respoke.io
![Page 57: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/57.jpg)
matrix-appservice-respokeDemo!
57
![Page 58: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/58.jpg)
Matrix <-> AsteriskMatrix Client Matrix HS matrix-‐bridge-‐respoke chan_respoke
| | | || | |<-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐ { /endpoints/$endpoint/connnections }| | |-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐> { connnection details }| | | |
m.call.invite -‐-‐-‐-‐-‐-‐-‐>|-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐>| |m.call.candidate -‐-‐-‐-‐>|-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐>| |
| | |-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐> { signal ‘offer’ + parsed SDP }| | |<-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐ { signal ‘answer’ + parsed SDP }
m.call.answer-‐-‐-‐-‐-‐-‐-‐-‐-‐|<-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐|| | |-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐> { message: success }| | |-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐> { signal ‘connected’ }| | | ||<===================== [media flows] =================>|| | | |
m.call.hangup -‐-‐-‐-‐-‐-‐-‐>|-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐>| || | |-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐> { signal ‘bye’ }
58
![Page 59: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/59.jpg)
59
The end goal:
Asterisk
Skype
…
Hangouts
![Page 60: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/60.jpg)
60
Matrix to IOT…
Janus WebRTC Gateway(from MeetEcho)
Parrot BebopDrone
Web Matrix exampleclient (Firefox)
synapse(on laptop)
synapse(on laptop)
![Page 61: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/61.jpg)
Current Progress• Funded: May 2014• Launched alpha: Sept 2014• Entered beta: Dec 2014• Stable v0.9 Beta: May 2015• Crypto & React SDK, Jul 2015• Aug/Sept 2015: Bridges, Perf, Spec,
Conferencing…
61
![Page 62: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/62.jpg)
What's next?• Landing V2 APIs• Use 3rd party IDs by default• Rolling out E2E encryption• Lots more Application Services• Yet more performance work• Spec polishing• New server implementations!
62
![Page 63: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/63.jpg)
We need help!!
63
![Page 64: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/64.jpg)
• We need people to try running their own servers and join the federation.
• We need people to run gateways to their existing services
• We need feedback on the APIs.• Consider native Matrix support for new
apps• Follow @matrixdotorg and spread the
word!
64
![Page 66: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/66.jpg)
matrix-react-sdk• All new web client SDK!• Sensible separation of:– HTTP API wrapper–Matrix client state machine– UI business logic– UI look & feel (skin)• Either customise per-component• …or fork your own skin.
66
![Page 67: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/67.jpg)
matrix-react-sdk
67
matrix-‐react-‐skin
matrix-‐react-‐sdk
matrix-‐js-‐sdk
Browser
matrix-‐react-‐console
Vector
Your App Here!!App
Skin (Views)
Controllers
ReactAPI
![Page 68: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/68.jpg)
Introducing Olm
68
https://matrix.org/git/olm
![Page 69: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/69.jpg)
End to End Encryption with Olm• Apache License C++11 implementation of
an Axolotl-style ratchet, exposing a C API.
• Axolotl is Open Whisper System's better-than-OTR cryptographic ratchet, as used by TextSecure, Pond, WhatsApp etc.
• Supports encrypted asynchronous group communication.
• 130KB x86-64 .so, or 208KB of asm.js69
![Page 70: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/70.jpg)
70
Olm C API
Account• Keys
Session• Initial Key Exchange
Ratchet
• Encrypt• Decrypt
Crypto
• Curve25519• AES• SHA256
![Page 71: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/71.jpg)
Alice BobAlice and Bob both generate identity (I) & ephemeral (E) elliptic curve key pairs
Initial Shared Secret (ISS) =ECDH(Ea, Ib) +ECDH(Ia, Eb) +ECDH(Ea, Eb)
Discard EaDerive chain key from ISS (HMAC)Derive message key (K0) from chain key (HMAC)Derive new chain key ß hash ratchetM0 = Message plaintextC0 = Authenticated Encryption of (M0, K0)Ra0 = generate random ratchet key pairJa0 = incremental counter for each hashratchet advancement
Ia, Ea, Eb, Ra0, Ja0, C0
An Axolotl-style ratchet.Kinda sorta.
![Page 72: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/72.jpg)
Alice BobCompute same Initial Shared Secret =
ECDH(Ea, Ib) +ECDH(Ia, Eb) +ECDH(Ea, Eb)
Compute same K0M0 = Authenticated decryption of (C0, K0)
To respond, B starts new ratchet chain:Rb1 = generate random ratchet key pairNew Initial Shared Secret =
ECDH(Ra0, Rb1) ß ECDH Ratchet
C0 = Authenticated Encryption of (M, K0)Ra0 = generate random ratchet keyJa0 = incremental counter for each hashratchet advancement
Rb1, Jb1, C1
An Axolotl-style ratchet.Kinda sorta.
![Page 73: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/73.jpg)
73
Alice
Sending | Receiving
MK CK RK CK MK-- -- -- -- --
ECDH(A0,B0)||
ECDH(A1,B0) +/|/ |
/ + ECDH(A1,B1)CK-A1-B0 |\
| | \MK-0 ----+ | \
| | CK-A1-B1MK-1 ----+ | |
| | +---- MK-0MK-2 ----+ | |
| +---- MK-1ECDH(A2,B1) +
/|/ |
/ |CK-A2-B1 |
| + ECDH(A2,B2)MK-0 ----+ \
\\CK-A2-B2
|+---- MK-0|+---- MK-1
![Page 74: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/74.jpg)
Demo!
74
http://matrix.org/~markjh/olm/javascript/demo.html
![Page 75: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/75.jpg)
Group chat• Adds a 3rd type of ratchet, used to
encrypt group messages.
• Establish 'normal' 1:1 ratchets between all participants in order to exchange the initial secret for the group ratchet.
• All receivers share the same group ratchet state to decrypt the room.
75
![Page 76: Bridging Asterisk to the Matrix Ecosystemmatthew/2015-10-15 Matrix Astricon.pdf · Bridging Asterisk to the Matrix Ecosystem ... Dec 2014 • Stable v0.9 Beta: May 2015 ... 2015-10-15](https://reader031.vdocuments.us/reader031/viewer/2022022006/5abeb1ee7f8b9a8e3f8d5a40/html5/thumbnails/76.jpg)
Flexible privacy with Olm• Users can configure rooms to have:– No ratchet (i.e. no crypto)– Full PFS ratchet– Selective ratchet• Deliberately re-use ratchet keys to support
paginating partial eras of history.
• Up to participants to trigger the ratchet (e.g. when a member joins or leaves the room)
– Per-message type ratchets76