2006-05-22 21:12:30 +00:00
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2007-02-24 17:51:23 +00:00
|
|
|
/*! \file
|
|
|
|
|
* \brief AJI - The Asterisk Jabber Interface
|
2007-07-16 02:51:56 +00:00
|
|
|
* \arg \ref AJI_intro
|
2007-02-24 17:51:23 +00:00
|
|
|
* \ref res_jabber.c
|
|
|
|
|
* \author Matt O'Gorman <mogorman@digium.com>
|
2007-02-24 19:27:50 +00:00
|
|
|
* \extref IKSEMEL http://iksemel.jabberstudio.org
|
2007-02-24 17:51:23 +00:00
|
|
|
*
|
|
|
|
|
* \page AJI_intro AJI - The Asterisk Jabber Interface
|
|
|
|
|
*
|
|
|
|
|
* The Asterisk Jabber Interface, AJI, publishes an API for
|
|
|
|
|
* modules to use jabber communication. res_jabber.c implements
|
|
|
|
|
* a Jabber client and a component that can connect as a service
|
|
|
|
|
* to Jabber servers.
|
|
|
|
|
*
|
2007-02-24 18:03:17 +00:00
|
|
|
* \section External dependencies
|
|
|
|
|
* AJI use the IKSEMEL library found at http://iksemel.jabberstudio.org/
|
|
|
|
|
* To use TLS connections, IKSEMEL depends on the GNUTLS library
|
|
|
|
|
* available at http://iksemel.jabberstudio.org/
|
|
|
|
|
*
|
|
|
|
|
* \section Files
|
2007-02-24 17:51:23 +00:00
|
|
|
* - res_jabber.c
|
|
|
|
|
* - jabber.h
|
|
|
|
|
* - chan_gtalk.c
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2006-05-22 21:12:30 +00:00
|
|
|
#ifndef _ASTERISK_JABBER_H
|
|
|
|
|
#define _ASTERISK_JABBER_H
|
|
|
|
|
|
|
|
|
|
#include <iksemel.h>
|
|
|
|
|
#include "asterisk/astobj.h"
|
2006-06-09 16:08:33 +00:00
|
|
|
#include "asterisk/linkedlists.h"
|
2006-05-22 21:12:30 +00:00
|
|
|
|
|
|
|
|
enum aji_state {
|
2007-06-07 09:21:29 +00:00
|
|
|
AJI_DISCONNECTING,
|
|
|
|
|
AJI_DISCONNECTED,
|
2006-05-22 21:12:30 +00:00
|
|
|
AJI_CONNECTING,
|
|
|
|
|
AJI_CONNECTED
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
AJI_AUTOPRUNE = (1 << 0),
|
|
|
|
|
AJI_AUTOREGISTER = (1 << 1)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum aji_btype {
|
|
|
|
|
AJI_USER=0,
|
|
|
|
|
AJI_TRANS=1,
|
|
|
|
|
AJI_UTRANS=2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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];
|
2006-06-06 19:51:26 +00:00
|
|
|
char *description;
|
2006-05-22 21:12:30 +00:00
|
|
|
struct aji_version *cap;
|
|
|
|
|
int priority;
|
|
|
|
|
struct aji_resource *next;
|
|
|
|
|
};
|
|
|
|
|
|
2006-06-07 22:43:20 +00:00
|
|
|
struct aji_message {
|
|
|
|
|
char *from;
|
|
|
|
|
char *message;
|
|
|
|
|
char id[25];
|
|
|
|
|
time_t arrived;
|
2006-06-09 16:08:33 +00:00
|
|
|
AST_LIST_ENTRY(aji_message) list;
|
2006-06-07 22:43:20 +00:00
|
|
|
};
|
|
|
|
|
|
2006-05-22 21:12:30 +00:00
|
|
|
struct aji_buddy {
|
|
|
|
|
ASTOBJ_COMPONENTS(struct aji_buddy);
|
|
|
|
|
char channel[160];
|
|
|
|
|
struct aji_resource *resources;
|
|
|
|
|
enum aji_btype btype;
|
After some study, thought, comparing, etc. I've backed out the previous universal mod to make ast_flags a 64 bit thing. Instead, I added a 64-bit version of ast_flags (ast_flags64), and 64-bit versions of the test-flag, set-flag, etc. macros, and an app_parse_options64 routine, and I use these in app_dial alone, to eliminate the 30-option limit it had grown to meet. There is room now for 32 more options and flags. I was heavily tempted to implement some of the other ideas that were presented, but this solution does not intro any new versions of dial, doesn't have a different API, has a minimal/zero impact on code outside of dial, and doesn't seriously (I hope) affect the code structure of dial. It's the best I can think of right now. My goal was NOT to rewrite dial. I leave that to a future, coordinated effort.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75983 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-19 23:24:27 +00:00
|
|
|
unsigned int flags;
|
2006-05-22 21:12:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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];
|
2006-06-01 07:49:47 +00:00
|
|
|
char statusmessage[256];
|
2006-05-22 21:12:30 +00:00
|
|
|
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;
|
2006-06-07 22:43:20 +00:00
|
|
|
int message_timeout;
|
2006-05-22 21:12:30 +00:00
|
|
|
int authorized;
|
After some study, thought, comparing, etc. I've backed out the previous universal mod to make ast_flags a 64 bit thing. Instead, I added a 64-bit version of ast_flags (ast_flags64), and 64-bit versions of the test-flag, set-flag, etc. macros, and an app_parse_options64 routine, and I use these in app_dial alone, to eliminate the 30-option limit it had grown to meet. There is room now for 32 more options and flags. I was heavily tempted to implement some of the other ideas that were presented, but this solution does not intro any new versions of dial, doesn't have a different API, has a minimal/zero impact on code outside of dial, and doesn't seriously (I hope) affect the code structure of dial. It's the best I can think of right now. My goal was NOT to rewrite dial. I leave that to a future, coordinated effort.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75983 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-19 23:24:27 +00:00
|
|
|
unsigned int flags;
|
2006-09-21 23:55:13 +00:00
|
|
|
int component; /* 0 client, 1 component */
|
2006-05-22 21:12:30 +00:00
|
|
|
struct aji_buddy_container buddies;
|
2006-06-09 16:08:33 +00:00
|
|
|
AST_LIST_HEAD(messages,aji_message) messages;
|
2006-05-22 21:12:30 +00:00
|
|
|
void *jingle;
|
|
|
|
|
pthread_t thread;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct aji_client_container{
|
|
|
|
|
ASTOBJ_CONTAINER_COMPONENTS(struct aji_client);
|
|
|
|
|
};
|
|
|
|
|
|
2007-02-24 17:51:23 +00:00
|
|
|
/*! Send jabber message from connected client to jabber URI */
|
2007-01-05 22:43:18 +00:00
|
|
|
int ast_aji_send(struct aji_client *client, const char *address, const char *message);
|
2007-02-24 17:51:23 +00:00
|
|
|
/*! Disconnect jabber client */
|
2006-05-22 21:12:30 +00:00
|
|
|
int ast_aji_disconnect(struct aji_client *client);
|
|
|
|
|
int ast_aji_check_roster(void);
|
|
|
|
|
void ast_aji_increment_mid(char *mid);
|
2007-02-24 17:51:23 +00:00
|
|
|
/*! Open Chat session */
|
2006-05-22 21:12:30 +00:00
|
|
|
int ast_aji_create_chat(struct aji_client *client,char *room, char *server, char *topic);
|
2007-02-24 17:51:23 +00:00
|
|
|
/*! Invite to opened Chat session */
|
2006-05-22 21:12:30 +00:00
|
|
|
int ast_aji_invite_chat(struct aji_client *client, char *user, char *room, char *message);
|
2007-02-24 17:51:23 +00:00
|
|
|
/*! Join existing Chat session */
|
2006-05-22 21:12:30 +00:00
|
|
|
int ast_aji_join_chat(struct aji_client *client,char *room);
|
2007-01-05 22:43:18 +00:00
|
|
|
struct aji_client *ast_aji_get_client(const char *name);
|
2006-05-22 21:12:30 +00:00
|
|
|
struct aji_client_container *ast_aji_get_clients(void);
|
|
|
|
|
|
|
|
|
|
#endif
|