asterisk-xmpp merge in

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@29553 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matt O'Gorman 2006-05-22 21:12:30 +00:00
parent 64b94dad80
commit 7aa1a77e75
15 changed files with 4188 additions and 0 deletions

View File

@ -24,4 +24,5 @@ WIN32=@OSISWIN32@
ZLIB=@PBX_LIBZLIB@
ZAPTEL=@PBX_LIBZAPTEL@
LIBGSM=@PBX_LIBgsm@
IKSEMEL=@PBX_LIBIKSEMEL@
IXJUSER=@PBX_IXJUSER@

View File

@ -131,6 +131,12 @@ chan_vpb.o: chan_vpb.c
chan_vpb.so: chan_vpb.o
$(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl
chan_jingle.o: chan_jingle.c
$(CC) -c -o $@ $(CFLAGS) $(IKSEMEL_INCLUDE) $<
chan_jingle.so: chan_jingle.o
$(CC) $(SOLINK) -o $@ $< $(IKSEMEL_LIB)
ifeq ($(OSARCH),Linux)
chan_h323.so: chan_h323.o h323/libchanh323.a h323/Makefile.ast
$(CC) $(SOLINK) $(H323LDFLAGS) -o $@ $< h323/libchanh323.a $(H323LDLIBS) -lstdc++

1695
channels/chan_jingle.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -505,6 +505,8 @@ include => demo
;exten => 6245,dial+101,Voicemail(6245,b) ; Voicemail (busy)
;exten => 6361,1,Dial(IAX2/JaneDoe,,rm) ; ring without time limit
;exten => 6389,1,Dial(MGCP/aaln/1@192.168.0.14)
;exten => 6390,1,Dial(JINGLE/caller/callee) ; Dial via jingle using labels
;exten => 6391,1,Dial(JINGLE/asterisk@digium.com/mogorman@astjab.org) ;Dial via jingle using asterisk as the transport and calling mogorman.
;exten => 6394,1,Dial(Local/6275/n) ; this will dial ${MARK}
;exten => 6275,1,Macro(stdexten,6275,${MARK}) ; assuming ${MARK} is something like Zap/2

View File

@ -0,0 +1,15 @@
[general]
;debug=yes ;;Turn on debugging by default.
;autoprune=yes ;;Auto remove users from buddy list.
;autoregister=yes ;;Auto register users from buddy list.
;[asterisk] ;;label
;type=client ;;Client or Component connection
;serverhost=astjab.org ;;Route to server for example,
;; talk.google.com
;username=asterisk@astjab.org/asterisk ;;username with optional roster.
;secret=blah ;;Password
;port=5222 ;;Port to use defaults to 5222
;usetls=yes ;;use tls or not
;usesasl=yes ;;use sasl or not
;buddy=mogorman@astjab.org ;;manual addition of buddy to list.

View File

@ -0,0 +1,19 @@
;[general]
;context=default ;;Context to dump call into
;allowguest=yes ;;Allow calls from people not in
;;list of peers
;
;[guest] ;;special account for options on guest account
;disallow=all
;allow=ulaw
;context=guest
;
;[ogorman]
;username=ogorman@gmail.com ;;username of the peer your
;;calling or accepting calls from
;disallow=all
;allow=ulaw
;context=default
;connection=asterisk ;;client or component in jabber.conf
;;for the call to leave on.
;

View File

@ -190,6 +190,7 @@ AC_SUBST(AST_DEVMODE)
AST_EXT_LIB([asound], [snd_spcm_init], [alsa/asoundlib.h], [ALSA], [Advanced Linux Sound Architecture], [-lm -ldl])
AST_EXT_LIB([curses], [initscr], [curses.h], [CURSES], [curses], [])
AST_EXT_LIB([iksemel], [iks_start_sasl], [iksemel.h], [IKSEMEL], [Iksemel Jabber Library])
AST_EXT_LIB([nbs], [nbs_connect], [nbs.h], [NBS], [Network Broadcast Sound])
AST_EXT_LIB([ncurses], [initscr], [curses.h], [NCURSES], [ncurses], [])
AST_EXT_LIB([newt], [newtBell], [newt.h], [NEWT], [newt])

13
doc/jabber.txt Normal file
View File

@ -0,0 +1,13 @@
(res_jabber is very experimental!)
Jabber(xmpp) is an xml based protocol primarily for presence and messaging.
It is an open standard and there are several open server implementations,
ejabberd, jabberd(2), wildfire, and many others, as well as several open source
clients, Psi, gajim, gaim etc. Jabber differs from otherIM applications as it
is immensly extendable. This allows us to easily integrate asterisk with
jabber. The Asterisk Jabber Interface is provided by res_jabber. res_jabber
allows for asterisk to connect to any jabber server via the standard client
protocol or also as a simple client. Several simple functions are exposed to
the dial plan, jabberstatus, jabbersend, and soon jabberrecv. res_jabber is also used
to provide the connection interface for chan_jingle.
The maintainer of res_jabber is Matthew O'Gorman <mogorman@digum.com> or
mog_work on irc or prefered mogorman@astjab.org over jabber.

8
doc/jingle.txt Normal file
View File

@ -0,0 +1,8 @@
(Jingle support in asterisk is experimental)
Jingle is an xmpp based protocol for signalling the transfer of media.
Currently asterisk supports the propitery GoogleTalk protocol that is
very similar to jingle, and hopes to support true jingle specs
(JEP-166,167,176,177,180,181 etc) as more clients support the true standard.
Jingle's configuration is very similar to sip.conf only as we are not the
jabber server in this case you must provide a connection for the peer to
travel out on.

133
include/asterisk/jabber.h Normal file
View File

@ -0,0 +1,133 @@
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 1999 - 2005, Digium, Inc.
*
* Matt O'Gorman <mogorman@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
#ifndef _ASTERISK_JABBER_H
#define _ASTERISK_JABBER_H
#include <iksemel.h>
#include "asterisk/astobj.h"
enum aji_state {
AJI_DISCONNECTED=0,
AJI_CONNECTING,
AJI_ALMOST,
AJI_CONNECTED
};
enum {
AJI_AUTOPRUNE = (1 << 0),
AJI_AUTOREGISTER = (1 << 1)
};
enum aji_btype {
AJI_USER=0,
AJI_TRANS=1,
AJI_UTRANS=2
};
enum aji_type {
AJI_COMPONENT,
AJI_CLIENT,
};
struct aji_version {
char version[50];
int jingle;
struct aji_capabilities *parent;
struct aji_version *next;
};
struct aji_capabilities {
char node[200];
struct aji_version *versions;
struct aji_capabilities *next;
};
struct aji_resource {
int status;
char resource[80];
char description[1000];
struct aji_version *cap;
int priority;
struct aji_resource *next;
};
struct aji_buddy {
ASTOBJ_COMPONENTS(struct aji_buddy);
char user[160];
char host[160];
char pass[160]; /*For Transports*/
char server[160]; /*For Transports */
char channel[160];
struct aji_resource *resources;
enum aji_btype btype;
unsigned int flags;
};
struct aji_buddy_container {
ASTOBJ_CONTAINER_COMPONENTS(struct aji_buddy);
};
struct aji_transport_container {
ASTOBJ_CONTAINER_COMPONENTS(struct aji_transport);
};
struct aji_client {
ASTOBJ_COMPONENTS(struct aji_client);
char password[160];
char user[160];
char serverhost[160];
char context[100];
char sid[10]; /* Session ID */
char mid[6]; /* Message ID */
iksid *jid;
iksparser *p;
iksfilter *f;
ikstack *stack;
enum aji_state state;
int port;
int debug;
int usetls;
int forcessl;
int usesasl;
int keepalive;
int allowguest;
int timeout;
int authorized;
unsigned int flags;
enum aji_type component;
struct aji_buddy_container buddies;
void *jingle;
pthread_t thread;
};
struct aji_client_container{
ASTOBJ_CONTAINER_COMPONENTS(struct aji_client);
};
int ast_aji_send(struct aji_client *client, char *address, char *message);
int ast_aji_disconnect(struct aji_client *client);
int ast_aji_check_roster(void);
void ast_aji_increment_mid(char *mid);
int ast_aji_create_chat(struct aji_client *client,char *room, char *server, char *topic);
int ast_aji_invite_chat(struct aji_client *client, char *user, char *room, char *message);
int ast_aji_join_chat(struct aji_client *client,char *room);
struct aji_client *ast_aji_get_client(char *name);
struct aji_client_container *ast_aji_get_clients(void);
#endif

45
include/asterisk/jingle.h Normal file
View File

@ -0,0 +1,45 @@
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 1999 - 2005, Digium, Inc.
*
* Matt O'Gorman <mogorman@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
#ifndef _ASTERISK_JINGLE_H
#define _ASTERISK_JINGLE_H
#include <iksemel.h>
#include "asterisk/astobj.h"
/* Jingle Constants */
#define JINGLE_NODE "jingle"
#define GOOGLE_NODE "session"
#define JINGLE_NS "http://jabber.org/protocol/jingle"
#define GOOGLE_NS "http://www.google.com/session"
#define JINGLE_SID "sid"
#define GOOGLE_SID "id"
#define JINGLE_INITIATE "initiate"
#define JINGLE_ACCEPT "accept"
#define GOOGLE_ACCEPT "accept"
#define JINGLE_NEGOTIATE "negotiate"
#define GOOGLE_NEGOTIATE "candidates"
#endif

View File

@ -112,6 +112,9 @@
/* Define if your system has the GTK libraries. */
#undef HAVE_GTK
/* Define to indicate the Iksemel Jabber Library library */
#undef HAVE_IKSEMEL
/* Define to 1 if you have the `inet_ntoa' function. */
#undef HAVE_INET_NTOA

View File

@ -88,6 +88,9 @@ NEWT_INCLUDE=@NEWT_INCLUDE@
PWLIB_LIB=@PWLIB_LIB@
PWLIB_INCLUDE=@PWLIB_INCLUDE@
IKSEMEL_LIB=@IKSEMEL_LIB@
IKSEMEL_INCLUDE=@IKSEMEL_INCLUDE@
SSL_LIB=@OPENSSL_LIB@
SSL_INCLUDE=@OPENSSL_INCLUDE@

View File

@ -73,6 +73,12 @@ res_odbc.so: res_odbc.o
res_odbc.o: res_odbc.c
$(CC) -c -o $@ $(CFLAGS) $(ODBC_INCLUDE) $<
res_jabber.o: res_jabber.c
$(CC) -c -o $@ $(CFLAGS) $(IKSEMEL_INCLUDE) $<
res_jabber.so: res_jabber.o
$(CC) $(SOLINK) -o $@ $< $(IKSEMEL_LIB)
res_osp.so: res_osp.o
$(CC) $(SOLINK) -o $@ $< $(OSPTK_LIB)

2238
res/res_jabber.c Normal file

File diff suppressed because it is too large Load Diff