writing a im/voip client in 20 lines of...

84
Raphaël Slinckx Writing a IM/Voip client in 20 lines of python

Upload: others

Post on 19-Mar-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Raphaël Slinckx

Writing a IM/Voip client in 20 lines of python

Page 2: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

GNOME Communication stack

Page 3: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

A good client only needs...

Page 4: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

A good client only needs...

...a few simple things

Page 5: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Link LocalA good client only needs...

...a few simple things

Page 6: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Link LocalA good client only needs...

...a few simple things

File Transfer

Page 7: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Link LocalA good client only needs...

...a few simple things

File Transfer

Video Calls

Page 8: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Link LocalA good client only needs...

...a few simple things

File Transfer

Video Calls

NAT Traversal

Page 9: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Link Local

MSN

A good client only needs...

...a few simple things

OSCAR/AIM

File Transfer

Video Calls

NAT Traversal

Page 10: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Link Local

MSN

A good client only needs...

...a few simple things

Contact ListPresence

Smileys

OSCAR/AIM

File Transfer

Video Calls

NAT Traversal

Page 11: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Link Local

MSN

A good client only needs...

...a few simple things

Contact ListPresence

Smileys

OSCAR/AIM

File Transfer

SIP

Yahoo!

Video Calls

Voice CallsNAT Traversal

Jabber

Page 12: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Link Local

MSN

A good client only needs...

...a few simple things

Contact ListPresence

Smileys

OSCAR/AIM

File Transfer

SIP

Yahoo!

Video Calls

Voice CallsNAT Traversal

Jabber

Nudges!!

Page 13: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Each projectreinvents the wheel.

Page 14: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Each clientlives in its own tiny world.

Page 15: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Telepathy

WTF??

Page 16: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages
Page 17: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

1. D-Bus API specification

Page 18: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

2. An ecosystem

Page 19: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

D-Bus

Chat UILogger

VoIP UI

SIP

BackendXMPP

Backend

The big picture

Page 20: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Telepathy

Chat UILogger

VoIP UI

SIP

BackendXMPP

Backend

The big picture

Page 21: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Advantages

Page 22: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Keep the butterfly trapped

Page 23: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

DBusConnection

[email protected] Desktop

Connections are shared

Abiword

Chat

Logger

Page 24: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Do one thing and do it well

Unix

Approved

Page 25: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Language independenceKeeps the programmers happy

Page 26: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Language independenceKeeps the programmers happy

License independenceKeeps the lawyers happy

Page 27: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Object-oriented specification

Page 28: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

1. The spec

Page 30: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Connection Manager

Page 32: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Presence InterfaceGet / Set own presence. Get contacts’ presence.

Page 33: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Capabilities InterfaceSet own capabilities. Has video? Has voice?

Page 35: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Contact List ChannelGroup Interface

Get / Add members. Members changed signal

Page 36: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Text ChannelPassword Interface

Join password protected IRC chatrooms

Page 37: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

StreamedMedia ChannelDTMF Interface

Emit key tones on a SIP conversation

Page 38: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

2. The ecosystem

Page 39: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Connection Managers

Gabble Salut SIP IdleJabberXMPP

Link LocalXMPP

(bonjour)

IRC

Page 40: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Stream EngineStreamedMedia Channel

SignallingNAT TraversalRTP Streaming

Audio sink Video sink

Page 41: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Librariestelepathy-python Implement CM and clients in python

libtelepathy Implement clients in C+glibtelepathy-glib Implement CM in C+glib

libempathy Higher level objects to build clientslibempathy-gtk GTK widgets to build graphical clients

Page 42: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Desktop integration

Page 43: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Desktop integrationMission Control

Page 46: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Connection aggregationChange my presence from offline to online

Page 47: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Account managementStore account credentials centrally.

Clients can connect without asking for config

Page 48: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Channel dispatchOpen a chat window talking to [email protected]

Page 49: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Desktop integrationEmpathy

Page 50: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Jabber-only

Gossip

Monolithic

Page 51: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages
Page 52: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Any Telepathy protocol

Gossip Telepathy

Monolithic

+VoIP support

Page 53: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages
Page 54: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages
Page 55: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Any Telepathy protocol

Empathy

Small components

Page 56: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages
Page 57: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Same great UI.A lot less hairy code.

Page 58: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Desktop integrationSummer of Code

Page 59: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Jokosher IntegrationContacts as instruments

Live radio interviews with VoIPMichael Sheldon

Page 60: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages
Page 61: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

VoIP/Video WidgetsAugment libempathy(-gtk) with

VoIP related widgetsElliot Fairweather

Page 62: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

File TransferAdd link-local file transfer to empathy

Marco Barisione

Page 63: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages
Page 64: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages
Page 65: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages
Page 66: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Collaborative applicationsTelepathy Tubes

Page 67: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

If I can chat with a contact,why can’t applications?

Page 68: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

What’s a tube?

Arbitrary data exchange

Perform NAT traversal

TCP/UDP/D-Bus behavior

Page 69: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

D-Bus Tubes

Abiword Abiword

Abiword

Abiword

“Virtual” D-Bus

InternetGetText()

GetText()

GetText()

GetText()

Page 70: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

D-Bus Tubes

Abiword Abiword

Abiword

Abiword

“Virtual” D-Bus

CM

CM

CM

CMProtocolConnections

P2PD-Bus

P2PD-Bus

P2PD-Bus

P2PD-Bus

Page 71: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Stream Tubes

VNCServer

VNCViewer

VNCViewer

VNCViewer

“Virtual” TCP/UDP Connection

InternetSocket

Socket

Socket

Socket

Page 72: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Stream Tubes

VNCServer

VNCViewer

VNCViewer

VNCViewer

“Virtual” TCP/UDP Connection

CM

CM

CM

CMProtocolConnections

Socket

Socket

Socket

Socket

Page 73: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Where to use Tubes?If an application can be used through a D-Bus API

Page 74: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Where to use Tubes?If an application can be used through a D-Bus APIIt can be shared by exposing the API on a D-Tube

Page 75: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Where to use Tubes?If an application can be used through a D-Bus APIIt can be shared by exposing the API on a D-Tube

Pick a contact, start collaborating!

Page 76: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages
Page 77: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Code Sampleslibempathy

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()

Page 78: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Code Sampleslibempathy-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()

Page 79: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Code Sampleslibmission-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")

Page 80: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

Code Samplestelepathy-python / VoIP and Video call

import telepathy, dbusbus = dbus.Bus()reg = telepathy.client.ManagerRegistry()reg.LoadManagers()

mgr = reg.GetManager("gabble")name, path = mgr[CONN_MGR_INTERFACE].RequestConnection("jabber", "[email protected]")

connection = telepathy.client.Connection(name, path)connection[CONN_INTERFACE].Connect()

contact = connection[CONN_INTERFACE].RequestHandles(CONNECTION_HANDLE_TYPE_CONTACT, ["[email protected]"])[0]

Page 81: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

telepathy-python / VoIP and Video callpath = connection[CONN_INTERFACE].RequestChannel(CHANNEL_TYPE_STREAMED_MEDIA, CONNECTION_HANDLE_TYPE_NONE, 0, True)

channel = Channel(conn.service_name, path)

se = bus.get_object('org.freedesktop.Telepathy.StreamEngine','/org/freedesktop/Telepathy/StreamEngine')

se_handler = dbus.Interface(se,'org.freedesktop.Telepathy.ChannelHandler'

se_handler.HandleChannel( connection.service_name, connection.object_path, CHANNEL_TYPE_STREAMED_MEDIA, channel.object_path, CONNECTION_HANDLE_TYPE_NONE, 0)

channel[CHANNEL_INTERFACE_GROUP].AddMembers([contact], "")

channel[CHANNEL_TYPE_STREAMED_MEDIA].RequestStreams(contact, [MEDIA_STREAM_TYPE_AUDIO, MEDIA_STREAM_TYPE_VIDEO])

Page 82: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

telepathy-python / VoIP and Video call

# When connectedconnection[CONN_INTERFACE_CAPABILITIES].AdvertiseCapabilities( [(CHANNEL_TYPE_STREAMED_MEDIA, CREATE|INVITE)], [])

# On incoming channel of type StreamedMedia pending = channel[CHANNEL_INTERFACE_GROUP].GetLocalPendingMembers()channel[CHANNEL_INTERFACE_GROUP].AddMembers(pending, "")

Page 83: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages

room = conn.RequestHandles( CONNECTION_HANDLE_TYPE_ROOM, ["[email protected]"])[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)

Code Samplestelepathy-python / Tubes

Page 84: Writing a IM/Voip client in 20 lines of pythonraphael.slinckx.net/files/telepathy-guadec-2007.pdf · Telepathy Chat UI Logger VoIP UI SIP Backend XMPP Backend The big picture. Advantages