Voip in Python
Voip in Python
Raphal Slinckx
File Transfer
...a few simple things
File Transfer
...a few simple things
Nudges!!
Each project
reinvents the wheel.
Each client
lives in its own tiny world.
Telepathy
WTF??
2. An ecosystem
Logger
VoIP UI
D-Bus
SIP
Backend
XMPP
Backend
Logger
VoIP UI
Telepathy
SIP
Backend
XMPP
Backend
Advantages
DBus
Desktop
Logger
Language independence
Keeps the programmers happy
Language independence
Keeps the programmers happy
License independence
Keeps the lawyers happy
Object-oriented specification
1. The spec
Object hierarchy
Connection
Managers
XMPP
CM
SIP
CM
Connections
user@
gmail.com
contact@
jabber.org
+3212345
Channels
Text
with foo@
gmail.com
Text
with bar@
gmail.com
StreamedMedia
with
sip:baz@sip.be
Connection Manager
Connection
user@gmail.com connected on Google Talk
Presence Interface
Get / Set own presence. Get contacts presence.
Capabilities Interface
Set own capabilities. Has video? Has voice?
Channels
user@gmail.com chatting with contact@gmail.com
Text Channel
Password Interface
Join password protected IRC chatrooms
StreamedMedia Channel
DTMF Interface
Emit key tones on a SIP conversation
2. The ecosystem
Connection Managers
Gabble
Salut
Jabber
XMPP
Link Local
XMPP
(bonjour)
SIP
Idle
IRC
Stream Engine
StreamedMedia Channel
Signalling
NAT Traversal
RTP Streaming
Audio sink
Video sink
Libraries
telepathy-python Implement CM and clients in python
libtelepathy Implement clients in C+glib
telepathy-glib Implement CM in C+glib
libempathy Higher level objects to build clients
libempathy-gtk GTK widgets to build graphical clients
Desktop integration
Desktop integration
Mission Control
Connection
Managers
XMPP
CM
SIP
CM
Connections
user@
gmail.com
contact@
jabber.org
+3212345
Channels
Text
with foo@
gmail.com
Text
with bar@
gmail.com
StreamedMedia
with
sip:baz@sip.be
Mission
Control
Connection
Managers
Mission
Control
XMPP
CM
SIP
CM
Connections
user@
gmail.com
contact@
jabber.org
+3212345
Channels
Text
with foo@
gmail.com
Text
with bar@
gmail.com
StreamedMedia
with
sip:baz@sip.be
Connection aggregation
Change my presence from offline to online
Account management
Store account credentials centrally.
Clients can connect without asking for config
Channel dispatch
Open a chat window talking to user@gmail.com
Desktop integration
Empathy
Gossip
Jabber-only
Monolithic
Gossip Telepathy
Any Telepathy protocol
Monolithic
+VoIP support
Empathy
Any Telepathy protocol
Small components
Desktop integration
Summer of Code
Jokosher Integration
Contacts as instruments
Live radio interviews with VoIP
Michael Sheldon
VoIP/Video Widgets
Augment libempathy(-gtk) with
VoIP related widgets
Elliot Fairweather
File Transfer
Add link-local file transfer to empathy
Marco Barisione
Collaborative applications
Telepathy Tubes
Whats a tube?
Arbitrary data exchange
TCP/UDP/D-Bus behavior
Perform NAT traversal
D-Bus Tubes
Virtual D-Bus
Abiword
GetText()
Internet
GetText()
Abiword
GetText()
Abiword
GetText()
Abiword
D-Bus Tubes
Virtual D-Bus
Abiword
P2P
D-Bus
CM
Protocol
Connections
CM
P2P
D-Bus
Abiword
CM
P2P
D-Bus
Abiword
CM
P2P
D-Bus
Abiword
Stream Tubes
Virtual TCP/UDP Connection
Socket
VNC
Server
Socket
Internet
Socket
Socket
VNC
Viewer
VNC
Viewer
VNC
Viewer
Stream Tubes
Virtual TCP/UDP Connection
VNC
Server
Socket
CM
Protocol
Connections
CM
Socket
CM
Socket
CM
Socket
VNC
Viewer
VNC
Viewer
VNC
Viewer
Code Samples
libempathy
import gtk, empathy
def on_contact_notify(contact):
print "Alias:", contact.get_name()
print "Presence:", contact.get_status()
def on_contact_added(manager, contact):
contact.connect('notify', on_contact_notify)
manager = empathy.ContactManager()
manager.setup()
manager.connect("contact-added", on_contact_added)
contacts = manager.get_members()
for contact in contacts:
on_contact_added(manager, contact)
gtk.main()
Code Samples
libempathy-gtk
import gtk, empathy, gtkempathy
manager = empathy.ContactManager()
manager.setup()
store = gtkempathy.ContactListStore(manager)
view = gtkempathy.ContactListView(store)
view.show()
w = gtk.Window()
w.add(view)
w.show()
gtk.main()
Code Samples
libmission-control / Presence applet
import telepathy, dbus
bus = dbus.Bus()
mc = bus.get_object(
'org.freedesktop.Telepathy.MissionControl',
'/org/freedesktop/Telepathy/MissionControl')
mc_presence = dbus.Interface(mc,
'org.freedesktop.Telepathy.MissionControl')
def on_presence_changed(presence):
print "Presence changed to:", presence
mc_presence.connect_to_signal("PresenceStatusActual",presence_changed)
mc_presence.SetPresence(PRESENCE_AVAILABLE, "At GUADEC")
Code Samples
telepathy-python / VoIP and Video call
import telepathy, dbus
bus = dbus.Bus()
reg = telepathy.client.ManagerRegistry()
reg.LoadManagers()
mgr = reg.GetManager("gabble")
name, path = mgr[CONN_MGR_INTERFACE].RequestConnection(
"jabber", "user@gmail.com")
connection = telepathy.client.Connection(name, path)
connection[CONN_INTERFACE].Connect()
contact = connection[CONN_INTERFACE].RequestHandles(
CONNECTION_HANDLE_TYPE_CONTACT, ["user@gmail.com"])[0]
Code Samples
telepathy-python / Tubes
room = conn.RequestHandles(
CONNECTION_HANDLE_TYPE_ROOM,
["test@conference.olpc.collabora.co.uk"])[0]
tube = conn.request_channel(
CHANNEL_TYPE_TUBES, CONNECTION_HANDLE_TYPE_ROOM,
room, True)
id = tube[CHANNEL_TYPE_TUBES].OfferTube(
TUBE_TYPE_DBUS, "org.freedesktop.Telepathy.Tube.Connect4", {})
addr = tube[CHANNEL_TYPE_TUBES].GetDBusServerAddress(id)
p2pbus = _dbus_bindings.Connection(addr)