[asterisk-commits] russell: branch russell/chan_refcount r82324 - in /team/russell/chan_refcount...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 13 10:30:51 CDT 2007
Author: russell
Date: Thu Sep 13 10:30:50 2007
New Revision: 82324
URL: http://svn.digium.com/view/asterisk?view=rev&rev=82324
Log:
sync with trunk
Modified:
team/russell/chan_refcount/ (props changed)
team/russell/chan_refcount/apps/app_queue.c
team/russell/chan_refcount/channels/chan_gtalk.c
team/russell/chan_refcount/channels/chan_jingle.c
team/russell/chan_refcount/configs/res_config_sqlite.conf
team/russell/chan_refcount/doc/res_config_sqlite.txt
team/russell/chan_refcount/include/asterisk/doxyref.h
team/russell/chan_refcount/include/asterisk/jingle.h
team/russell/chan_refcount/res/res_config_sqlite.c
Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Sep 13 10:30:50 2007
@@ -1,1 +1,1 @@
-/trunk:1-82297
+/trunk:1-82323
Modified: team/russell/chan_refcount/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_queue.c?view=diff&rev=82324&r1=82323&r2=82324
==============================================================================
--- team/russell/chan_refcount/apps/app_queue.c (original)
+++ team/russell/chan_refcount/apps/app_queue.c Thu Sep 13 10:30:50 2007
@@ -514,21 +514,17 @@
ast_mutex_lock(&q->lock);
mem_iter = ao2_iterator_init(q->members, 0);
- while ((member = ao2_iterator_next(&mem_iter))) {
- if (max_penalty && (member->penalty > max_penalty)) {
- ao2_ref(member, -1);
+ for (; (member = ao2_iterator_next(&mem_iter)); ao2_ref(member, -1)) {
+ if (max_penalty && (member->penalty > max_penalty))
continue;
- }
switch (member->status) {
case AST_DEVICE_INVALID:
/* nothing to do */
- ao2_ref(member, -1);
break;
case AST_DEVICE_UNAVAILABLE:
if (result != QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS)
result = QUEUE_NO_REACHABLE_MEMBERS;
- ao2_ref(member, -1);
break;
default:
if (member->paused) {
Modified: team/russell/chan_refcount/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/channels/chan_gtalk.c?view=diff&rev=82324&r1=82323&r2=82324
==============================================================================
--- team/russell/chan_refcount/channels/chan_gtalk.c (original)
+++ team/russell/chan_refcount/channels/chan_gtalk.c Thu Sep 13 10:30:50 2007
@@ -649,12 +649,12 @@
static int gtalk_handle_dtmf(struct gtalk *client, ikspak *pak)
{
struct gtalk_pvt *tmp;
- iks *dtmfnode = NULL;
+ iks *dtmfnode = NULL, *dtmfchild = NULL;
char *dtmf;
char *from;
/* Make sure our new call doesn't exist yet */
for (tmp = client->p; tmp; tmp = tmp->next) {
- if (iks_find_with_attrib(pak->x, "session", "id", tmp->sid))
+ if (iks_find_with_attrib(pak->x, "session", "id", tmp->sid) || iks_find_with_attrib(pak->x, "gtalk", "sid", tmp->sid))
break;
}
from = iks_find_attrib(pak->x, "to");
@@ -688,6 +688,22 @@
ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
}
}
+ } else if ((dtmfnode = iks_find_with_attrib(pak->x, "gtalk", "action", "session-info"))) {
+ if((dtmfchild = iks_find(dtmfnode, "dtmf"))) {
+ if((dtmf = iks_find_attrib(dtmfchild, "code"))) {
+ if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-up")) {
+ struct ast_frame f = {AST_FRAME_DTMF_END, };
+ f.subclass = dtmf[0];
+ ast_queue_frame(tmp->owner, &f);
+ ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
+ } else if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-down")) {
+ struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
+ f.subclass = dtmf[0];
+ ast_queue_frame(tmp->owner, &f);
+ ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
+ }
+ }
+ }
}
gtalk_response(client, from, pak, NULL, NULL);
return 1;
@@ -697,7 +713,6 @@
gtalk_response(client, from, pak, NULL, NULL);
return 1;
}
-
static int gtalk_hangup_farend(struct gtalk *client, ikspak *pak)
{
@@ -1438,7 +1453,7 @@
iks_insert_attrib(iq, "id", client->connection->mid);
ast_aji_increment_mid(client->connection->mid);
iks_insert_attrib(gtalk, "xmlns", "http://jabber.org/protocol/gtalk");
- iks_insert_attrib(gtalk, "action", "content-info");
+ iks_insert_attrib(gtalk, "action", "session-info");
iks_insert_attrib(gtalk, "initiator", p->initiator ? p->us: p->them);
iks_insert_attrib(gtalk, "sid", p->sid);
iks_insert_attrib(dtmf, "xmlns", "http://jabber.org/protocol/gtalk/info/dtmf");
@@ -1447,9 +1462,9 @@
iks_insert_node(gtalk, dtmf);
ast_mutex_lock(&p->lock);
- if (ast->dtmff.frametype == AST_FRAME_DTMF_BEGIN) {
+ if (ast->dtmff.frametype == AST_FRAME_DTMF_BEGIN || duration == 0) {
iks_insert_attrib(dtmf, "action", "button-down");
- } else if (ast->dtmff.frametype == AST_FRAME_DTMF_END) {
+ } else if (ast->dtmff.frametype == AST_FRAME_DTMF_END || duration != 0) {
iks_insert_attrib(dtmf, "action", "button-up");
}
iks_send(client->connection->p, iq);
@@ -1640,7 +1655,7 @@
gtalk_is_answered(client, pak);
} else if (iks_find_with_attrib(pak->x, "session", "type", "transport-accept")) {
gtalk_is_accepted(client, pak);
- } else if (iks_find_with_attrib(pak->x, "session", "type", "content-info")) {
+ } else if (iks_find_with_attrib(pak->x, "session", "type", "content-info") || iks_find_with_attrib(pak->x, "gtalk", "action", "session-info")) {
gtalk_handle_dtmf(client, pak);
} else if (iks_find_with_attrib(pak->x, "session", "type", "terminate")) {
gtalk_hangup_farend(client, pak);
@@ -1736,10 +1751,11 @@
else if (!strcasecmp(var->name, "connection")) {
if ((client = ast_aji_get_client(var->value))) {
member->connection = client;
- iks_filter_add_rule(client->f, gtalk_parser, member, IKS_RULE_TYPE,
- IKS_PAK_IQ, IKS_RULE_FROM_PARTIAL, member->user,
- IKS_RULE_NS, "http://www.google.com/session",
- IKS_RULE_DONE);
+ iks_filter_add_rule(client->f, gtalk_parser, member,
+ IKS_RULE_TYPE, IKS_PAK_IQ,
+ IKS_RULE_FROM_PARTIAL, member->user,
+ IKS_RULE_NS, "http://www.google.com/session",
+ IKS_RULE_DONE);
} else {
ast_log(LOG_ERROR, "connection referenced not found!\n");
@@ -1852,8 +1868,8 @@
ASTOBJ_WRLOCK(iterator);
ASTOBJ_WRLOCK(member);
member->connection = iterator;
- 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);
+ 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);
+ iks_filter_add_rule(iterator->f, gtalk_parser, member, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_NS, "http://jabber.org/protocol/gtalk", IKS_RULE_DONE);
ASTOBJ_UNLOCK(member);
ASTOBJ_CONTAINER_LINK(>alk_list, member);
ASTOBJ_UNLOCK(iterator);
Modified: team/russell/chan_refcount/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/channels/chan_jingle.c?view=diff&rev=82324&r1=82323&r2=82324
==============================================================================
--- team/russell/chan_refcount/channels/chan_jingle.c (original)
+++ team/russell/chan_refcount/channels/chan_jingle.c Thu Sep 13 10:30:50 2007
@@ -367,7 +367,7 @@
iks_insert_attrib(iq, "id", client->connection->mid);
ast_aji_increment_mid(client->connection->mid);
- iks_insert_attrib(jingle, "xmlns", "http://www.google.com/session");
+ iks_insert_attrib(jingle, "xmlns", GOOGLE_NS);
iks_insert_attrib(jingle, "type", JINGLE_ACCEPT);
iks_insert_attrib(jingle, "initiator",
p->initiator ? client->connection->jid->full : p->from);
@@ -525,7 +525,7 @@
if(iks_find_with_attrib(pak->x, "dtmf-method", "method", "rtp")) {
jingle_response(client,pak,
"feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'",
- "unsupported-dtmf-method xmlns='http://jabber.org/protocol/jingle/info/dtmf#errors'");
+ "unsupported-dtmf-method xmlns='http://www.xmpp.org/extensions/xep-0181.html#ns-errors'");
return -1;
}
if ((dtmfnode = iks_find(pak->x, "dtmf"))) {
@@ -861,7 +861,7 @@
iks_insert_attrib(session, "id", p->sid);
iks_insert_attrib(session, "initiator",
p->initiator ? client->connection->jid->full : p->from);
- iks_insert_attrib(session, "xmlns", "http://www.google.com/session");
+ iks_insert_attrib(session, "xmlns", GOOGLE_NS);
iks_insert_node(request, session);
iks_send(client->connection->p, request);
iks_delete(session);
@@ -1220,11 +1220,11 @@
iks_insert_attrib(iq, "from", client->connection->jid->full);
iks_insert_attrib(iq, "id", client->connection->mid);
ast_aji_increment_mid(client->connection->mid);
- iks_insert_attrib(jingle, "xmlns", "http://jabber.org/protocol/jingle");
- iks_insert_attrib(jingle, "action", "content-info");
+ iks_insert_attrib(jingle, "xmlns", JINGLE_NS);
+ iks_insert_attrib(jingle, "action", "session-info");
iks_insert_attrib(jingle, "initiator", p->initiator ? client->connection->jid->full : p->from);
iks_insert_attrib(jingle, "sid", p->sid);
- iks_insert_attrib(dtmf, "xmlns", "http://jabber.org/protocol/jingle/info/dtmf");
+ iks_insert_attrib(dtmf, "xmlns", JINGLE_DTMF_NS);
iks_insert_attrib(dtmf, "code", buffer);
iks_insert_node(iq, jingle);
iks_insert_node(jingle, dtmf);
@@ -1279,7 +1279,7 @@
iks_insert_attrib(session, "type", "initiate");
iks_insert_attrib(session, "id", p->sid);
iks_insert_attrib(session, "initiator", client->jid->full);
- iks_insert_attrib(session, "xmlns", "http://www.google.com/session");
+ iks_insert_attrib(session, "xmlns", GOOGLE_NS);
iks_insert_attrib(desc, "xmlns", "http://www.google.com/session/phone");
payload_pcmu = iks_new("payload-type");
iks_insert_attrib(payload_pcmu, "id", "0");
@@ -1442,7 +1442,7 @@
ast_debug(3, "Candidate Added!\n");
} else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", GOOGLE_ACCEPT)) {
jingle_is_answered(client, pak);
- } else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", "content-info")) {
+ } else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", "session-info")) {
jingle_handle_dtmf(client, pak);
} else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", "terminate")) {
jingle_hangup_farend(client, pak);
@@ -1537,10 +1537,11 @@
else if (!strcasecmp(var->name, "connection")) {
if ((client = ast_aji_get_client(var->value))) {
member->connection = client;
- iks_filter_add_rule(client->f, jingle_parser, member, IKS_RULE_TYPE,
- IKS_PAK_IQ, IKS_RULE_FROM_PARTIAL, member->user,
- IKS_RULE_NS, "http://jabber.org/protocol/jingle",
- IKS_RULE_DONE);
+ iks_filter_add_rule(client->f, jingle_parser, member,
+ IKS_RULE_TYPE, IKS_PAK_IQ,
+ IKS_RULE_FROM_PARTIAL, member->user,
+ IKS_RULE_NS, JINGLE_NS,
+ IKS_RULE_DONE);
} else {
ast_log(LOG_ERROR, "connection referenced not found!\n");
return 0;
@@ -1645,8 +1646,7 @@
ASTOBJ_WRLOCK(iterator);
ASTOBJ_WRLOCK(member);
member->connection = iterator;
- iks_filter_add_rule(iterator->f, jingle_parser, member, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_NS,
- "http://jabber.org/protocol/jingle", IKS_RULE_DONE);
+ iks_filter_add_rule(iterator->f, jingle_parser, member, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_NS, JINGLE_NS, IKS_RULE_DONE);
ASTOBJ_UNLOCK(member);
ASTOBJ_CONTAINER_LINK(&jingles, member);
ASTOBJ_UNLOCK(iterator);
Modified: team/russell/chan_refcount/configs/res_config_sqlite.conf
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/configs/res_config_sqlite.conf?view=diff&rev=82324&r1=82323&r2=82324
==============================================================================
--- team/russell/chan_refcount/configs/res_config_sqlite.conf (original)
+++ team/russell/chan_refcount/configs/res_config_sqlite.conf Thu Sep 13 10:30:50 2007
@@ -9,7 +9,3 @@
; support is simply disabled.
config_table => ast_config
cdr_table => ast_cdr
-
-; This parameter controls the registration of the SQLITE() Dialplan application.
-app_enable => yes
-
Modified: team/russell/chan_refcount/doc/res_config_sqlite.txt
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/doc/res_config_sqlite.txt?view=diff&rev=82324&r1=82323&r2=82324
==============================================================================
--- team/russell/chan_refcount/doc/res_config_sqlite.txt (original)
+++ team/russell/chan_refcount/doc/res_config_sqlite.txt Thu Sep 13 10:30:50 2007
@@ -1,8 +1,8 @@
/*
- * res_sqlite - SQLite 2 support for Asterisk
- *
+ * res_config_sqlite - SQLite 2 support for Asterisk
+ *
* This module can be used as a static/RealTime configuration module, and a CDR
- * handler. See the Doxygen documentation for a detailed description of the
+ * handler. See the Doxygen documentation for a detailed description of the
* module, and the configs/ directory for the sample configuration file.
*/
@@ -13,105 +13,109 @@
/*
* RealTime static table.
*/
-CREATE TABLE ast_config
-(
- id INTEGER PRIMARY KEY,
- commented INT(11) NOT NULL DEFAULT '0',
- filename VARCHAR(128) NOT NULL,
- category VARCHAR(128) NOT NULL,
- var_name VARCHAR(128) NOT NULL,
- var_val VARCHAR(128) NOT NULL
+CREATE TABLE ast_config (
+ id INTEGER,
+ commented TINYINT(1) NOT NULL DEFAULT 0,
+ filename VARCHAR(128) NOT NULL DEFAULT '',
+ category VARCHAR(128) NOT NULL DEFAULT 'default',
+ var_name VARCHAR(128) NOT NULL DEFAULT '',
+ var_val TEXT NOT NULL DEFAULT '',
+ PRIMARY KEY (id)
);
-CREATE INDEX ast_config_filename_commented ON ast_config(filename, commented);
+CREATE INDEX ast_config__idx__filename_commented ON ast_config(filename, commented);
+CREATE INDEX ast_config__idx__category ON ast_config(category);
/*
* CDR table (this table is automatically created if non existent).
- *
- * CREATE TABLE ast_cdr
- * (
- * id INTEGER PRIMARY KEY,
- * clid VARCHAR(80) NOT NULL DEFAULT '',
- * src VARCHAR(80) NOT NULL DEFAULT '',
- * dst VARCHAR(80) NOT NULL DEFAULT '',
- * dcontext VARCHAR(80) NOT NULL DEFAULT '',
- * channel VARCHAR(80) NOT NULL DEFAULT '',
- * dstchannel VARCHAR(80) NOT NULL DEFAULT '',
- * lastapp VARCHAR(80) NOT NULL DEFAULT '',
- * lastdata VARCHAR(80) NOT NULL DEFAULT '',
- * start CHAR(19) NOT NULL DEFAULT '0000-00-00 00:00:00',
- * answer CHAR(19) NOT NULL DEFAULT '0000-00-00 00:00:00',
- * end CHAR(19) NOT NULL DEFAULT '0000-00-00 00:00:00',
- * duration INT(11) NOT NULL DEFAULT '0',
- * billsec INT(11) NOT NULL DEFAULT '0',
- * disposition INT(11) NOT NULL DEFAULT '0',
- * amaflags INT(11) NOT NULL DEFAULT '0',
- * accountcode VARCHAR(20) NOT NULL DEFAULT '',
- * uniqueid VARCHAR(32) NOT NULL DEFAULT '',
- * userfield VARCHAR(255) NOT NULL DEFAULT ''
- * );
*/
+CREATE TABLE ast_cdr (
+ id INTEGER,
+ clid VARCHAR(80) NOT NULL DEFAULT '',
+ src VARCHAR(80) NOT NULL DEFAULT '',
+ dst VARCHAR(80) NOT NULL DEFAULT '',
+ dcontext VARCHAR(80) NOT NULL DEFAULT '',
+ channel VARCHAR(80) NOT NULL DEFAULT '',
+ dstchannel VARCHAR(80) NOT NULL DEFAULT '',
+ lastapp VARCHAR(80) NOT NULL DEFAULT '',
+ lastdata VARCHAR(80) NOT NULL DEFAULT '',
+ start DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ answer DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ end DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ duration INT(11) NOT NULL DEFAULT 0,
+ billsec INT(11) NOT NULL DEFAULT 0,
+ disposition VARCHAR(45) NOT NULL DEFAULT '',
+ amaflags INT(11) NOT NULL DEFAULT 0,
+ accountcode VARCHAR(20) NOT NULL DEFAULT '',
+ uniqueid VARCHAR(32) NOT NULL DEFAULT '',
+ userfield VARCHAR(255) NOT NULL DEFAULT '',
+ PRIMARY KEY (id)
+);
/*
* SIP RealTime table.
*/
-CREATE TABLE ast_sip
-(
- id INTEGER PRIMARY KEY,
- commented INT(11) NOT NULL DEFAULT '0',
- name VARCHAR(80) NOT NULL,
- accountcode VARCHAR(20),
- amaflags VARCHAR(13),
- callgroup VARCHAR(10),
- callerid VARCHAR(80),
- canreinvite CHAR(3),
- context VARCHAR(80),
- defaultip VARCHAR(15),
- dtmfmode VARCHAR(7),
- fromuser VARCHAR(80),
- fromdomain VARCHAR(80),
- fullcontact VARCHAR(80),
- host VARCHAR(31) NOT NULL,
- insecure VARCHAR(4),
- language CHAR(2),
- mailbox VARCHAR(50),
- md5secret VARCHAR(80),
- nat VARCHAR(5) NOT NULL DEFAULT 'no',
- deny VARCHAR(95),
- permit VARCHAR(95),
- mask VARCHAR(95),
- pickupgroup VARCHAR(10),
- port VARCHAR(5) NOT NULL,
- qualify CHAR(3),
- restrictcid CHAR(1),
- rtptimeout CHAR(3),
- rtpholdtimeout CHAR(3),
- secret VARCHAR(80),
- type VARCHAR(6) NOT NULL DEFAULT 'friend',
- username VARCHAR(80) NOT NULL,
- disallow VARCHAR(100),
- allow VARCHAR(100),
- musiconhold VARCHAR(100),
- regseconds INT(11) NOT NULL DEFAULT '0',
- ipaddr VARCHAR(15) NOT NULL,
- regexten VARCHAR(80) NOT NULL,
- cancallforward CHAR(3),
- setvar VARCHAR(100) NOT NULL
+CREATE TABLE ast_sip (
+ id INTEGER,
+ commented TINYINT(1) NOT NULL DEFAULT 0,
+ name VARCHAR(80) NOT NULL DEFAULT '',
+ host VARCHAR(31) NOT NULL DEFAULT '',
+ nat VARCHAR(5) NOT NULL DEFAULT 'no',
+ type VARCHAR(6) NOT NULL DEFAULT 'friend',
+ accountcode VARCHAR(20) DEFAULT NULL,
+ amaflags VARCHAR(13) DEFAULT NULL,
+ callgroup VARCHAR(10) DEFAULT NULL,
+ callerid VARCHAR(80) DEFAULT NULL,
+ cancallforward CHAR(3) DEFAULT 'yes',
+ canreinvite CHAR(3) DEFAULT 'yes',
+ context VARCHAR(80) DEFAULT NULL,
+ defaultip VARCHAR(15) DEFAULT NULL,
+ dtmfmode VARCHAR(7) DEFAULT NULL,
+ fromuser VARCHAR(80) DEFAULT NULL,
+ fromdomain VARCHAR(80) DEFAULT NULL,
+ insecure VARCHAR(4) DEFAULT NULL,
+ language CHAR(2) DEFAULT NULL,
+ mailbox VARCHAR(50) DEFAULT NULL,
+ md5secret VARCHAR(80) DEFAULT NULL,
+ deny VARCHAR(95) DEFAULT NULL,
+ permit VARCHAR(95) DEFAULT NULL,
+ mask VARCHAR(95) DEFAULT NULL,
+ musiconhold VARCHAR(100) DEFAULT NULL,
+ pickupgroup VARCHAR(10) DEFAULT NULL,
+ qualify CHAR(3) DEFAULT NULL,
+ regexten VARCHAR(80) DEFAULT NULL,
+ restrictcid CHAR(3) DEFAULT NULL,
+ rtptimeout CHAR(3) DEFAULT NULL,
+ rtpholdtimeout CHAR(3) DEFAULT NULL,
+ secret VARCHAR(80) DEFAULT NULL,
+ setvar VARCHAR(100) DEFAULT NULL,
+ disallow VARCHAR(100) DEFAULT 'all',
+ allow VARCHAR(100) DEFAULT 'g729,ilbc,gsm,ulaw,alaw',
+ fullcontact VARCHAR(80) NOT NULL DEFAULT '',
+ ipaddr VARCHAR(15) NOT NULL DEFAULT '',
+ port INT(11) NOT NULL DEFAULT 0,
+ regserver VARCHAR(100) DEFAULT NULL,
+ regseconds INT(11) NOT NULL DEFAULT 0,
+ username VARCHAR(80) NOT NULL DEFAULT '',
+ PRIMARY KEY (id)
+ UNIQUE (name)
);
-CREATE UNIQUE INDEX ast_sip_name ON ast_sip(name);
+CREATE INDEX ast_sip__idx__commented ON ast_sip(commented);
/*
* Dialplan RealTime table.
*/
-CREATE TABLE ast_exten
-(
- id INTEGER PRIMARY KEY,
- commented INT(11) NOT NULL DEFAULT '0',
- context VARCHAR(20) NOT NULL,
- exten VARCHAR(20) NOT NULL,
- priority TINYINT(4) NOT NULL,
- app VARCHAR(20) NOT NULL,
- appdata VARCHAR(128) NOT NULL
+CREATE TABLE ast_exten (
+ id INTEGER,
+ commented TINYINT(1) NOT NULL DEFAULT 0,
+ context VARCHAR(80) NOT NULL DEFAULT '',
+ exten VARCHAR(40) NOT NULL DEFAULT '',
+ priority INT(11) NOT NULL DEFAULT 0,
+ app VARCHAR(128) NOT NULL DEFAULT '',
+ appdata VARCHAR(128) NOT NULL DEFAULT '',
+ PRIMARY KEY (id)
);
+CREATE INDEX ast_exten__idx__commented ON ast_exten(commented);
+CREATE INDEX ast_exten__idx__context_exten_priority ON ast_exten(context, exten, priority);
Modified: team/russell/chan_refcount/include/asterisk/doxyref.h
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/include/asterisk/doxyref.h?view=diff&rev=82324&r1=82323&r2=82324
==============================================================================
--- team/russell/chan_refcount/include/asterisk/doxyref.h (original)
+++ team/russell/chan_refcount/include/asterisk/doxyref.h Thu Sep 13 10:30:50 2007
@@ -252,6 +252,7 @@
* \arg \link Config_enum ENUM configuration \endlink
* \arg \link Config_moh Music on Hold configuration \endlink
* \arg \link Config_vm Voicemail configuration \endlink
+ * \arg \link res_config_sqlite SQLite Resource driver configuration \endlink
*/
/*! \page Config_ast Asterisk.conf
@@ -551,3 +552,13 @@
* \arg \link Config_ami Configuration file \endlink
* \verbinclude ajam.txt
*/
+
+/*! \page res_config_sqlite SQLite Resource driver configuration
+ * \arg Implemented in \ref res_config_sqlite.c
+ * \arg Configuration file:
+ * \verbinclude res_config_sqlite.conf
+ * \arg SQL tables:
+ * \verbinclude res_config_sqlite.txt
+ * \arg See also:
+ * http://www.sqlite.org
+ */
Modified: team/russell/chan_refcount/include/asterisk/jingle.h
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/include/asterisk/jingle.h?view=diff&rev=82324&r1=82323&r2=82324
==============================================================================
--- team/russell/chan_refcount/include/asterisk/jingle.h (original)
+++ team/russell/chan_refcount/include/asterisk/jingle.h Thu Sep 13 10:30:50 2007
@@ -37,7 +37,9 @@
#define JINGLE_NODE "jingle"
#define GOOGLE_NODE "session"
-#define JINGLE_NS "http://jabber.org/protocol/jingle"
+#define JINGLE_NS "http://www.xmpp.org/extensions/xep-0166.html#ns"
+#define JINGLE_DTMF_NS "http://www.xmpp.org/extensions/xep-0181.html#ns"
+#define JINGLE_DTMF_NS_ERRORS "http://www.xmpp.org/extensions/xep-0181.html#ns-errors"
#define GOOGLE_NS "http://www.google.com/session"
#define JINGLE_SID "sid"
Modified: team/russell/chan_refcount/res/res_config_sqlite.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/res/res_config_sqlite.c?view=diff&rev=82324&r1=82323&r2=82324
==============================================================================
--- team/russell/chan_refcount/res/res_config_sqlite.c (original)
+++ team/russell/chan_refcount/res/res_config_sqlite.c Thu Sep 13 10:30:50 2007
@@ -5,7 +5,7 @@
*
* Written by Richard Braun <rbraun at proformatique.com>
*
- * Based on res_sqlite3 by Anthony Minessale II,
+ * Based on res_sqlite3 by Anthony Minessale II,
* and res_config_mysql by Matthew Boehm
*
* See http://www.asterisk.org for more information about
@@ -21,75 +21,60 @@
/*!
* \page res_config_sqlite
- *
+ *
* \section intro_sec Presentation
- *
- * res_config_sqlite is a module for the Asterisk Open Source PBX to
- * support SQLite 2 databases. It can be used to fetch configuration
- * from a database (static configuration files and/or using the Asterisk
+ *
+ * res_config_sqlite is a module for the Asterisk Open Source PBX to
+ * support SQLite 2 databases. It can be used to fetch configuration
+ * from a database (static configuration files and/or using the Asterisk
* RealTime Architecture - ARA).
* It can also be used to log CDR entries. Finally, it can be used for simple
* queries in the Dialplan. Note that Asterisk already comes with a module
- * named cdr_sqlite. There are two reasons for including it in res_sqlite:
+ * named cdr_sqlite. There are two reasons for including it in res_config_sqlite:
* the first is that rewriting it was a training to learn how to write a
* simple module for Asterisk, the other is to have the same database open for
* all kinds of operations, which improves reliability and performance.
- *
+ *
* There is already a module for SQLite 3 (named res_sqlite3) in the Asterisk
- * addons. res_sqlite was developed because we, at Proformatique, are using
+ * addons. res_config_sqlite was developed because we, at Proformatique, are using
* PHP 4 in our embedded systems, and PHP 4 has no stable support for SQLite 3
* at this time. We also needed RealTime support.
- *
+ *
* \section conf_sec Configuration
- *
+ *
* The main configuration file is res_config_sqlite.conf. It must be readable or
- * res_sqlite will fail to start. It is suggested to use the sample file
+ * res_config_sqlite will fail to start. It is suggested to use the sample file
* in this package as a starting point. The file has only one section
* named <code>general</code>. Here are the supported parameters :
- *
+ *
* <dl>
* <dt><code>dbfile</code></dt>
* <dd>The absolute path to the SQLite database (the file can be non existent,
- * res_sqlite will create it if is has the appropriate rights)</dd>
+ * res_config_sqlite will create it if it has the appropriate rights)</dd>
* <dt><code>config_table</code></dt>
* <dd>The table used for static configuration</dd>
* <dt><code>cdr_table</code></dt>
* <dd>The table used to store CDR entries (if ommitted, CDR support is
* disabled)</dd>
* </dl>
- *
- * To use res_sqlite for static and/or RealTime configuration, refer to the
+ *
+ * To use res_config_sqlite for static and/or RealTime configuration, refer to the
* Asterisk documentation. The file tables.sql can be used to create the
* needed tables.
- *
- * The SQLITE() application is very similar to the MYSQL() application. You
- * can find more details at
- * <a href="http://voip-info.org/wiki/view/Asterisk+cmd+MYSQL">http://voip-info.org/wiki/view/Asterisk+cmd+MYSQL</a>.
- * The main difference is that you cannot choose your database - it's the
- * file set in the <code>dbfile</code> parameter. As a result, there is no
- * Connect or Disconnect command, and there is no connid variable.
- *
+ *
* \section status_sec Driver status
- *
+ *
* The CLI command <code>show sqlite status</code> returns status information
- * about the running driver. One information is more important than others:
- * the number of registered virtual machines. A SQLite virtual machine is
- * created each time a SQLITE() query command is used. If the number of
- * registered virtual machines isn't 0 (or near 0, since one or more SQLITE()
- * commands can be running when requesting the module status) and increases
- * over time, this probably means that you're badly using the application
- * and you're creating resource leaks. You should check your Dialplan and
- * reload res_sqlite (by unloading and then loading again - reloading isn't
- * supported)
- *
+ * about the running driver.
+ *
* \section credits_sec Credits
- *
+ *
* res_config_sqlite was developed by Richard Braun at the Proformatique company.
*/
/*!
- * \file
- * \brief res_sqlite module.
+ * \file
+ * \brief res_config_sqlite module.
*/
/*** MODULEINFO
@@ -114,94 +99,85 @@
#include "asterisk/options.h"
#include "asterisk/linkedlists.h"
-#define RES_SQLITE_NAME "res_sqlite"
-#define RES_SQLITE_DRIVER "sqlite"
-#define RES_SQLITE_APP_DRIVER "SQLITE"
-#define RES_SQLITE_DESCRIPTION "Resource Module for SQLite 2"
-#define RES_SQLITE_CONF_FILE "res_config_sqlite.conf"
-#define RES_SQLITE_APP_SYNOPSIS "Dialplan access to SQLite 2"
-#define RES_SQLITE_APP_DESCRIPTION \
-"SQLITE(): " RES_SQLITE_APP_SYNOPSIS "\n"
-#define RES_SQLITE_STATUS_SUMMARY \
-"Show status information about the SQLite 2 driver"
-#define RES_SQLITE_STATUS_USAGE \
-"Usage: show sqlite status\n" \
-" " RES_SQLITE_STATUS_SUMMARY "\n"
+#define MACRO_BEGIN do {
+#define MACRO_END } while (0)
+
+#define RES_CONFIG_SQLITE_NAME "res_config_sqlite"
+#define RES_CONFIG_SQLITE_DRIVER "sqlite"
+#define RES_CONFIG_SQLITE_DESCRIPTION "Resource Module for SQLite 2"
+#define RES_CONFIG_SQLITE_CONF_FILE "res_config_sqlite.conf"
+#define RES_CONFIG_SQLITE_STATUS_SUMMARY "Show status information about the SQLite 2 driver"
+#define RES_CONFIG_SQLITE_STATUS_USAGE \
+ "Usage: show sqlite status\n" \
+ " " RES_CONFIG_SQLITE_STATUS_SUMMARY "\n"
enum {
- RES_SQLITE_CONFIG_ID,
- RES_SQLITE_CONFIG_COMMENTED,
- RES_SQLITE_CONFIG_FILENAME,
- RES_SQLITE_CONFIG_CATEGORY,
- RES_SQLITE_CONFIG_VAR_NAME,
- RES_SQLITE_CONFIG_VAR_VAL,
- RES_SQLITE_CONFIG_COLUMNS,
+ RES_CONFIG_SQLITE_CONFIG_ID,
+ RES_CONFIG_SQLITE_CONFIG_COMMENTED,
+ RES_CONFIG_SQLITE_CONFIG_FILENAME,
+ RES_CONFIG_SQLITE_CONFIG_CATEGORY,
+ RES_CONFIG_SQLITE_CONFIG_VAR_NAME,
+ RES_CONFIG_SQLITE_CONFIG_VAR_VAL,
+ RES_CONFIG_SQLITE_CONFIG_COLUMNS,
};
-/*!
- * Limit the number of maximum simultaneous registered SQLite VMs to avoid
- * a denial of service attack.
- */
-#define RES_SQLITE_VM_MAX 1024
-
-#define SET_VAR(config, to, from) \
-do \
- { \
- int __error; \
- __error = set_var(&to, #to, from->value); \
- if (__error) \
- { \
- ast_config_destroy(config); \
- unload_config(); \
- return 1; \
- } \
- } \
-while (0)
+#define SET_VAR(config, to, from) \
+MACRO_BEGIN \
+ int __error; \
+ \
+ __error = set_var(&to, #to, from->value); \
+ \
+ if (__error) { \
+ ast_config_destroy(config); \
+ unload_config(); \
+ return 1; \
+ } \
+MACRO_END
/*!
* Maximum number of loops before giving up executing a query. Calls to
* sqlite_xxx() functions which can return SQLITE_BUSY or SQLITE_LOCKED
- * are enclosed by RES_SQLITE_BEGIN and RES_SQLITE_END, e.g.
+ * are enclosed by RES_CONFIG_SQLITE_BEGIN and RES_CONFIG_SQLITE_END, e.g.
* <pre>
* char *errormsg;
* int error;
- *
- * RES_SQLITE_BEGIN
+ *
+ * RES_CONFIG_SQLITE_BEGIN
* error = sqlite_exec(db, query, NULL, NULL, &errormsg);
- * RES_SQLITE_END(error)
- *
+ * RES_CONFIG_SQLITE_END(error)
+ *
* if (error)
* ...;
* </pre>
*/
-#define RES_SQLITE_MAX_LOOPS 10
+#define RES_CONFIG_SQLITE_MAX_LOOPS 10
/*!
* Macro used before executing a query.
- *
- * \see RES_SQLITE_MAX_LOOPS.
- */
-#define RES_SQLITE_BEGIN \
-{ \
- int __i; \
- for (__i = 0; __i < RES_SQLITE_MAX_LOOPS; __i++) \
- {
+ *
+ * \see RES_CONFIG_SQLITE_MAX_LOOPS.
+ */
+#define RES_CONFIG_SQLITE_BEGIN \
+MACRO_BEGIN \
+ int __i; \
+ \
+ for (__i = 0; __i < RES_CONFIG_SQLITE_MAX_LOOPS; __i++) {
/*!
* Macro used after executing a query.
- *
- * \see RES_SQLITE_MAX_LOOPS.
- */
-#define RES_SQLITE_END(error) \
- if (error != SQLITE_BUSY && error != SQLITE_LOCKED) \
- break; \
- usleep(1000); \
- } \
-}
+ *
+ * \see RES_CONFIG_SQLITE_MAX_LOOPS.
+ */
+#define RES_CONFIG_SQLITE_END(error) \
+ if (error != SQLITE_BUSY && error != SQLITE_LOCKED) \
+ break; \
+ usleep(1000); \
+ } \
+MACRO_END;
/*!
* Structure sent to the SQLite callback function for static configuration.
- *
+ *
* \see add_cfg_entry()
*/
struct cfg_entry_args {
@@ -212,7 +188,7 @@
/*!
* Structure sent to the SQLite callback function for RealTime configuration.
- *
+ *
* \see add_rt_cfg_entry()
*/
struct rt_cfg_entry_args {
@@ -223,7 +199,7 @@
/*!
* Structure sent to the SQLite callback function for RealTime configuration
* (realtime_multi_handler()).
- *
+ *
* \see add_rt_multi_cfg_entry()
*/
struct rt_multi_cfg_entry_args {
@@ -244,10 +220,10 @@
/*!
* \brief Load the configuration file.
* \see unload_config()
- *
+ *
* This function sets dbfile, config_table, and cdr_table. It calls
* check_vars() before returning, and unload_config() if an error occurred.
- *
+ *
* \retval 0 on success
* \retval 1 if an error occurred
*/
@@ -262,10 +238,10 @@
/*!
* \brief Asterisk callback function for CDR support.
* \param cdr the CDR entry Asterisk sends us.
- *
+ *
* Asterisk will call this function each time a CDR entry must be logged if
* CDR support is enabled.
- *
+ *
* \retval 0 on success
* \retval 1 if an error occurred
*/
@@ -273,11 +249,11 @@
/*!
* \brief SQLite callback function for static configuration.
- *
+ *
* This function is passed to the SQLite engine as a callback function to
* parse a row and store it in a struct ast_config object. It relies on
- * resulting rows being sorted by category.
- *
+ * resulting rows being sorted by category.
+ *
* \param arg a pointer to a struct cfg_entry_args object
* \param argc number of columns
* \param argv values in the row
@@ -292,10 +268,10 @@
/*!
* \brief Asterisk callback function for static configuration.
- *
+ *
* Asterisk will call this function when it loads its static configuration,
* which usually happens at startup and reload.
- *
+ *
* \param database the database to use (ignored)
* \param table the table to use
* \param file the file to load from the database
@@ -307,24 +283,24 @@
* \see add_cfg_entry()
*/
static struct ast_config * config_handler(const char *database, const char *table, const char *file,
-struct ast_config *cfg, struct ast_flags flags, const char *suggested_incl);
+ struct ast_config *cfg, struct ast_flags flags, const char *suggested_incl);
/*!
* \brief Helper function to parse a va_list object into 2 dynamic arrays of
* strings, parameters and values.
- *
+ *
* ap must have the following format : param1 val1 param2 val2 param3 val3 ...
* arguments will be extracted to create 2 arrays:
- *
+ *
* <ul>
* <li>params : param1 param2 param3 ...</li>
* <li>vals : val1 val2 val3 ...</li>
* </ul>
- *
+ *
* The address of these arrays are stored in params_ptr and vals_ptr. It
* is the responsibility of the caller to release the memory of these arrays.
* It is considered an error that va_list has a null or odd number of strings.
- *
+ *
* \param ap the va_list object to parse
* \param params_ptr where the address of the params array is stored
* \param vals_ptr where the address of the vals array is stored
@@ -336,10 +312,10 @@
/*!
* \brief SQLite callback function for RealTime configuration.
- *
+ *
* This function is passed to the SQLite engine as a callback function to
* parse a row and store it in a linked list of struct ast_variable objects.
- *
+ *
* \param arg a pointer to a struct rt_cfg_entry_args object
* \param argc number of columns
* \param argv values in the row
@@ -354,16 +330,16 @@
/*!
* Asterisk callback function for RealTime configuration.
- *
+ *
* Asterisk will call this function each time it requires a variable
* through the RealTime architecture. ap is a list of parameters and
* values used to find a specific row, e.g one parameter "name" and
* one value "123" so that the SQL query becomes <code>SELECT * FROM
* table WHERE name = '123';</code>.
- *
+ *
* \param database the database to use (ignored)
- * \param table the table to use
- * \param ap list of parameters and values to match
+ * \param table the table to use
+ * \param ap list of parameters and values to match
*
* \retval a linked list of struct ast_variable objects
* \retval NULL if an error occurred
@@ -374,11 +350,11 @@
/*!
* \brief SQLite callback function for RealTime configuration.
- *
+ *
* This function performs the same actions as add_rt_cfg_entry() except
* that the rt_multi_cfg_entry_args structure is designed to store
- * categories in addition of variables.
- *
+ * categories in addition to variables.
+ *
* \param arg a pointer to a struct rt_multi_cfg_entry_args object
* \param argc number of columns
* \param argv values in the row
@@ -393,11 +369,11 @@
/*!
* \brief Asterisk callback function for RealTime configuration.
- *
+ *
* This function performs the same actions as realtime_handler() except
* that it can store variables per category, and can return several
* categories.
- *
+ *
* \param database the database to use (ignored)
* \param table the table to use
* \param ap list of parameters and values to match
@@ -407,19 +383,18 @@
* \see add_rt_multi_cfg_entry()
*/
static struct ast_config * realtime_multi_handler(const char *database,
- const char *table,
- va_list ap);
+ const char *table, va_list ap);
/*!
* \brief Asterisk callback function for RealTime configuration (variable
* update).
- *
+ *
* Asterisk will call this function each time a variable has been modified
* internally and must be updated in the backend engine. keyfield and entity
* are used to find the row to update, e.g. <code>UPDATE table SET ... WHERE
* keyfield = 'entity';</code>. ap is a list of parameters and values with the
* same format as the other realtime functions.
- *
+ *
* \param database the database to use (ignored)
* \param table the table to use
* \param keyfield the column of the matching cell
@@ -429,18 +404,17 @@
* \retval -1 if an error occurred.
*/
static int realtime_update_handler(const char *database, const char *table,
- const char *keyfield, const char *entity,
- va_list ap);
+ const char *keyfield, const char *entity, va_list ap);
/*!
* \brief Asterisk callback function for RealTime configuration (variable
* create/store).
- *
+ *
* Asterisk will call this function each time a variable has been created
- * internally and must be stored in the backend engine.
- * are used to find the row to update, e.g. ap is a list of parameters and
+ * internally and must be stored in the backend engine.
+ * are used to find the row to update, e.g. ap is a list of parameters and
* values with the same format as the other realtime functions.
- *
+ *
* \param database the database to use (ignored)
* \param table the table to use
* \param ap list of parameters and new values to insert into the database
@@ -451,15 +425,15 @@
va_list ap);
/*!
- * \brief Asterisk callback function for RealTime configuration (destroys
+ * \brief Asterisk callback function for RealTime configuration (destroys
* variable).
- *
+ *
* Asterisk will call this function each time a variable has been destroyed
* internally and must be removed from the backend engine. keyfield and entity
* are used to find the row to delete, e.g. <code>DELETE FROM table WHERE
* keyfield = 'entity';</code>. ap is a list of parameters and values with the
* same format as the other realtime functions.
- *
+ *
* \param database the database to use (ignored)
* \param table the table to use
* \param keyfield the column of the matching cell
@@ -469,12 +443,11 @@
* \retval -1 if an error occurred.
*/
static int realtime_destroy_handler(const char *database, const char *table,
- const char *keyfield, const char *entity,
- va_list ap);
+ const char *keyfield, const char *entity, va_list ap);
/*!
* \brief Asterisk callback function for the CLI status command.
- *
+ *
* \param fd file descriptor provided by Asterisk to use with ast_cli()
* \param argc number of arguments
* \param argv arguments list
@@ -503,16 +476,13 @@
/*! The name of the table used to store CDR entries. */
static char *cdr_table;
-/*! The number of registered virtual machines. */
-static int vm_count;
-
/*!
* The structure specifying all callback functions used by Asterisk for static
* and RealTime configuration.
*/
static struct ast_config_engine sqlite_engine =
{
- .name = RES_SQLITE_DRIVER,
+ .name = RES_CONFIG_SQLITE_DRIVER,
.load_func = config_handler,
.realtime_func = realtime_handler,
.realtime_multi_func = realtime_multi_handler,
@@ -523,7 +493,6 @@
/*!
* The mutex used to prevent simultaneous access to the SQLite database.
- * SQLite isn't always compiled with thread safety.
*/
AST_MUTEX_DEFINE_STATIC(mutex);
@@ -535,8 +504,8 @@
{
.cmda = {"show", "sqlite", "status", NULL},
.handler = cli_status,
- .summary = RES_SQLITE_STATUS_SUMMARY,
- .usage = RES_SQLITE_STATUS_USAGE
+ .summary = RES_CONFIG_SQLITE_STATUS_SUMMARY,
+ .usage = RES_CONFIG_SQLITE_STATUS_USAGE
};
/*
@@ -545,32 +514,33 @@
/*! SQL query format to create the CDR table if non existent. */
static char *sql_create_cdr_table =
-"CREATE TABLE '%q' ("
-" id INTEGER PRIMARY KEY,"
-" clid VARCHAR(80) NOT NULL DEFAULT '',"
-" src VARCHAR(80) NOT NULL DEFAULT '',"
-" dst VARCHAR(80) NOT NULL DEFAULT '',"
-" dcontext VARCHAR(80) NOT NULL DEFAULT '',"
[... 510 lines stripped ...]
More information about the asterisk-commits
mailing list