[asterisk-commits] mogorman: branch mogorman/asterisk-jabber r41041
- /team/mogorman/asterisk-ja...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Aug 24 23:27:45 MST 2006
Author: mogorman
Date: Fri Aug 25 01:27:45 2006
New Revision: 41041
URL: http://svn.digium.com/view/asterisk?rev=41041&view=rev
Log:
ooh and two commands, guess i have to add content though.
Modified:
team/mogorman/asterisk-jabber/channels/chan_gtalk.c
Modified: team/mogorman/asterisk-jabber/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/team/mogorman/asterisk-jabber/channels/chan_gtalk.c?rev=41041&r1=41040&r2=41041&view=diff
==============================================================================
--- team/mogorman/asterisk-jabber/channels/chan_gtalk.c (original)
+++ team/mogorman/asterisk-jabber/channels/chan_gtalk.c Fri Aug 25 01:27:45 2006
@@ -185,6 +185,8 @@
static int gtalk_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
static int gtalk_sendhtml(struct ast_channel *ast, int subclass, const char *data, int datalen);
static struct gtalk_pvt *gtalk_alloc(struct gtalk *client, const char *us, const char *them, const char *sid);
+static int gtalk_do_reload(int fd, int argc, char **argv);
+static int gtalk_show_channels(int fd, int argc, char **argv);
/*----- RTP interface functions */
static int gtalk_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp,
struct ast_rtp *vrtp, int codecs, int nat_active);
@@ -226,9 +228,25 @@
get_codec: gtalk_get_codec,
};
+static char debug_usage[] =
+"Usage: gtalk show channels\n"
+" Shows current state of the Gtalk channels.\n";
+
+static char reload_usage[] =
+"Usage: gtalk reload\n"
+" Reload gtalk channel driver.\n";
+
+
+static struct ast_cli_entry gtalk_cli[] = {
+ {{ "gtalk", "reload", NULL}, gtalk_do_reload, "Enable Jabber debugging", reload_usage },
+ {{ "gtalk", "show", "channels", NULL}, gtalk_show_channels, "Show GoogleTalk Channels", debug_usage },
+ };
+
+
+
static char externip[16];
-static struct gtalk_container gtalks;
+static struct gtalk_container gtalk_list;
static void gtalk_member_destroy(struct gtalk *obj)
{
@@ -245,12 +263,12 @@
ast_verbose("OOOOH domain = %s\n", domain);
free(s);
}
- gtalk = ASTOBJ_CONTAINER_FIND(>alks, name);
+ gtalk = ASTOBJ_CONTAINER_FIND(>alk_list, name);
if (!gtalk && strchr(name, '@'))
- gtalk = ASTOBJ_CONTAINER_FIND_FULL(>alks, name, user,,, strcasecmp);
+ gtalk = ASTOBJ_CONTAINER_FIND_FULL(>alk_list, name, user,,, strcasecmp);
if (!gtalk) { /* guest call */
- ASTOBJ_CONTAINER_TRAVERSE(>alks, 1, {
+ ASTOBJ_CONTAINER_TRAVERSE(>alk_list, 1, {
ASTOBJ_WRLOCK(iterator);
if (!strcasecmp(iterator->name, "guest")) {
if (!strcasecmp(iterator->connection->jid->partial, connection)) {
@@ -490,7 +508,6 @@
struct gtalk_pvt *p = ast->tech_pvt;
int res = 0;
- ast_verbose("XXXXXX \n XXXXXX\nWTF them %s us %s\n", p->them, p->us);
if (option_debug)
ast_log(LOG_DEBUG, "Answer!\n");
ast_mutex_lock(&p->lock);
@@ -1465,38 +1482,24 @@
return chan;
}
-#if 0
/*! \brief CLI command "gtalk show channels" */
-static int gtalk_show(int fd, int argc, char **argv)
-{
- struct gtalk_pvt *p = NULL;
- struct gtalk *peer = NULL;
- struct gtalk_candidate *tmp;
- struct gtalk *client = NULL;
- client = ast_aji_get_client("asterisk");
+static int gtalk_show_channels(int fd, int argc, char **argv)
+{
if (argc != 3)
return RESULT_SHOWUSAGE;
ast_mutex_lock(>alklock);
- if (client)
- p = gtalks->p;
- while (p) {
- ast_mutex_lock(&p->lock);
- ast_cli(fd, "SID = %s\n", p->sid);
- tmp = p->candidates;
- while (tmp) {
- ast_verbose("port %d\n", tmp->port);
- tmp = tmp->next;
- }
- ast_mutex_unlock(&p->lock);
- p = p->next;
- }
- if (!gtalks->p)
+// if (!gtalk_list->p)
ast_cli(fd, "No gtalk channels in use\n");
ast_mutex_unlock(>alklock);
return RESULT_SUCCESS;
}
-#endif
-
+
+/*! \brief CLI command "gtalk show channels" */
+static int gtalk_do_reload(int fd, int argc, char **argv)
+{
+ ast_verbose("IT DOES WORK!\n");
+ return RESULT_SUCCESS;
+}
static int gtalk_parser(void *data, ikspak *pak)
{
struct gtalk *client = ASTOBJ_REF((struct gtalk *) data);
@@ -1717,7 +1720,7 @@
iks_filter_add_rule(iterator->f, gtalk_parser, member, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_NS,
"http://www.google.com/session", IKS_RULE_DONE);
ASTOBJ_UNLOCK(member);
- ASTOBJ_CONTAINER_LINK(>alks, member);
+ ASTOBJ_CONTAINER_LINK(>alk_list, member);
ASTOBJ_UNLOCK(iterator);
});
} else {
@@ -1727,7 +1730,7 @@
} else {
ASTOBJ_UNLOCK(member);
if (gtalk_create_member(cat, var, allowguest, prefs, context, member))
- ASTOBJ_CONTAINER_LINK(>alks, member);
+ ASTOBJ_CONTAINER_LINK(>alk_list, member);
ASTOBJ_UNREF(member, gtalk_member_destroy);
}
}
@@ -1740,7 +1743,7 @@
/*! \brief Load module into PBX, register channel */
static int load_module(void)
{
- ASTOBJ_CONTAINER_INIT(>alks);
+ ASTOBJ_CONTAINER_INIT(>alk_list);
if (!gtalk_load_config()) {
ast_log(LOG_ERROR, "Unable to read config file %s. Not loading module.\n", GOOGLE_CONFIG);
return 0;
@@ -1760,6 +1763,7 @@
}
ast_rtp_proto_register(>alk_rtp);
+ ast_cli_register_multiple(gtalk_cli, sizeof(gtalk_cli) / sizeof(gtalk_cli[0]));
/* Make sure we can register our channel type */
if (ast_channel_register(>alk_tech)) {
@@ -1779,14 +1783,14 @@
static int unload_module(void)
{
struct gtalk_pvt *privates = NULL;
-
+ ast_cli_unregister_multiple(gtalk_cli, sizeof(gtalk_cli) / sizeof(gtalk_cli[0]));
/* First, take us out of the channel loop */
ast_channel_unregister(>alk_tech);
ast_rtp_proto_unregister(>alk_rtp);
if (!ast_mutex_lock(>alklock)) {
/* Hangup all interfaces if they have an owner */
- ASTOBJ_CONTAINER_TRAVERSE(>alks, 1, {
+ ASTOBJ_CONTAINER_TRAVERSE(>alk_list, 1, {
ASTOBJ_WRLOCK(iterator);
privates = iterator->p;
while(privates) {
@@ -1802,8 +1806,8 @@
ast_log(LOG_WARNING, "Unable to lock the monitor\n");
return -1;
}
- ASTOBJ_CONTAINER_DESTROYALL(>alks, gtalk_member_destroy);
- ASTOBJ_CONTAINER_DESTROY(>alks);
+ ASTOBJ_CONTAINER_DESTROYALL(>alk_list, gtalk_member_destroy);
+ ASTOBJ_CONTAINER_DESTROY(>alk_list);
return 0;
}
More information about the asterisk-commits
mailing list