name mode size
..
doc 040000
LICENSE 100644 17.99kB
Makefile 100644 300B
README 100644 6.63kB
clientaccount.c 100644 2.42kB
clientaccount.h 100644 998B
clientops.c 100644 1.97kB
clientops.h 100644 1.02kB
clientpipe.c 100644 8.88kB
clientpipe.h 100644 950B
clientsig.c 100644 6.8kB
clientsig.h 100644 857B
defines.h 100644 964B
hashtable.c 100644 1.91kB
hashtable.h 100644 963B
mapping.c 100644 8.54kB
mapping.h 100644 1.25kB
miniclient.c 100644 5.92kB
miniclient.h 100644 1.05kB
namespaces.h 100644 1.02kB
purple.c 100644 14.06kB
purple.h 100644 1.59kB
purple_sip.c 100644 6.8kB
purple_sip.h 100644 1.07kB
purplepipe.c 100644 3.95kB
purplepipe.h 100644 1.26kB
utils.c 100644 1.77kB
utils.h 100644 1.06kB
README
Purple Module Eric Ptak Atos Worldline <eric.ptak@atosorigin.com> Edited by Eric Ptak <eric.ptak@atosorigin.com> Copyright � 2008 Atos Worldline __________________________________________________________ Table of Contents 1. Admin Guide 1.1. Overview 1.2. Dependencies 1.2.1. Kamailio Modules 1.2.2. External Libraries or Applications 1.3. Database 1.4. Exported Parameters 1.4.1. db_url (str) 1.4.2. db_table (str) 1.4.3. httpProxy_host (str) 1.4.4. httpProxy_port (int) 1.5. Exported Functions 1.5.1. purple_send_message() 1.5.2. purple_handle_publish() 1.5.3. purple_handle_subscribe() List of Examples 1.1. Database table description 1.2. Database sample records 1.3. MySQL create script 1.4. Set db_url parameter 1.5. Set db_table parameter 1.6. Set httpProxy_host parameter 1.7. Set httpProxy_port parameter 1.8. purple_send_message usage 1.9. purple_handle_publish usage 1.10. purple_handle_subscribe usage Chapter 1. Admin Guide 1.1. Overview Purple module is a multi-protocol instant-messaging gateway module which use libpurple, the library on bottom of Pidgin (ex-gaim). This plugin was wrote in order to proof the concept of gateway between SIP and MSN/Live networks. As libpurple is written to code multi-protocol graphic IM clients, it provides a high level API in order to manipulate accounts, contacts, contacts lists, conversations and more. So this module provides a multi-protocol IM/Presence client running inside Kamailio with an account for each protocols used by each SIP user whereas libpurple is designed for a graphic client for only one user. It's no really adapted to a production environment with a huge user count but can be used in order to demonstrate the concept or to use it in SOHO environment. By default, there's some undefined symbol errors with libpurple shared object when using inside Kamailio. To solve it, you have to force preload of the library by setting up LD_PRELOAD environment variable. Before starting Kamailio use (adapt the path to your environment): export LD_PRELOAD=$LD_PRELOAD:/usr/local/lib/libpurple.so Limitations: doesn't implement authorization requests from external accounts to SIP. 1.2. Dependencies 1.2.1. Kamailio Modules The following modules must be loaded before this module: * presence*. * pua. * database driver module (db_mysql, ...). 1.2.2. External Libraries or Applications The following libraries or applications must be installed before running Kamailio with this module loaded: * libpurple, e.g. from pidgin 2.5.2. 1.3. Database The database is used to map SIP URIs with external accounts (eg. MSN). Example 1.1. Database table description ... +----------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+------------------+------+-----+---------+----------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | sip_user | varchar(128) | NO | | NULL | | | ext_user | varchar(128) | NO | | NULL | | | ext_prot | varchar(16) | NO | | NULL | | | ext_pass | varchar(64) | YES | | NULL | | +----------+------------------+------+-----+---------+----------------+ ... The meaning of columns: * sip_user user's SIP URI. * ext_user user's external account login. * ext_prot purple plugin id to use, except for gtalk. * ext_pass user's external account password. Example 1.2. Database sample records ... +----+------------------+-----------------+----------------+----------+ | id | sip_user | ext_user | ext_prot | ext_pass | +----+------------------+-----------------+----------------+----------+ | 1 | sip:alice@domain | alice@live.com | prpl-msn-pecan | password | | 2 | sip:bob@domain | bob@live.com | prpl-msn-pecan | password | | 3 | sip:alice@domain | alice@gmail.com | gtalk | password | | 4 | sip:bob@domain | bob@gmail.com | gtalk | password | +----+------------------+-----------------+----------------+----------+ ... Example 1.3. MySQL create script ... CREATE TABLE purplemap ( id INT UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT, sip_user VARCHAR(128) NOT NULL, ext_user VARCHAR(128) NOT NULL, ext_prot VARCHAR(16) NOT NULL, ext_pass VARCHAR(64) ); ... 1.4. Exported Parameters 1.4.1. db_url (str) The URL to connect to database. Default value is "mysql://openserro:openserro@localhost/openser". Example 1.4. Set db_url parameter ... modparam("purple", "db_url", "dbdriver://username:password@dbhost/dbname ") ... 1.4.2. db_table (str) Database table name. Default value is purplemap. Example 1.5. Set db_table parameter ... modparam("purple", "db_table", "purplemap") ... 1.4.3. httpProxy_host (str) Address of HTTP proxy. Default value is NULL. Example 1.6. Set httpProxy_host parameter ... modparam("purple", "httpProxy_host", "10.26.52.12") ... 1.4.4. httpProxy_port (int) Port of HTTP proxy. Default value is 0. Example 1.7. Set httpProxy_port parameter ... modparam("purple", "httpProxy_port", 3128) ... 1.5. Exported Functions 1.5.1. purple_send_message() Send message to a purple destination. This function can be used from REQUEST_ROUTE. Example 1.8. purple_send_message usage ... if (is_method("MESSAGE")) { xlog("MESSAGE $ru from [$fu] to [$tu]\n"); if (uri !~ "sip:.+@.+;proto=.+") { purple_send_message(); sl_send_reply("202", "Accepted"); } } ... 1.5.2. purple_handle_publish() Handle PUBLISH to a purple destination. This function can be used from REQUEST_ROUTE. Example 1.9. purple_handle_publish usage ... if(is_method("PUBLISH")) { xlog("PUBLISH $ru from [$fu] to [$tu]\n"); if (uri !~ "sip:.+@.+;proto=.+") purple_handle_publish(); } ... 1.5.3. purple_handle_subscribe() Handle SUBSCRIBE to a purple destination. This function can be used from REQUEST_ROUTE. Example 1.10. purple_handle_subscribe usage ... if(is_method("SUBSCRIBE")) { xlog("SUBSCRIBE $ru from [$fu] to [$tu]\n"); if ($hdr(Event) == "presence") purple_handle_subscribe("$ruri", "$hdr(Expires)"); } ...