[Asterisk-cvs] asterisk-addons/res_sqlite3 Makefile, NONE, 1.1 README, NONE, 1.1 dialplan.sql, NONE, 1.1 res_sqlite.c, NONE, 1.1 res_sqlite.conf, NONE, 1.1 res_sqlite.new.c, NONE, 1.1 upgrade.sh, NONE, 1.1

anthm at lists.digium.com anthm at lists.digium.com
Mon Nov 15 09:41:21 CST 2004


Update of /usr/cvsroot/asterisk-addons/res_sqlite3
In directory mongoose.digium.com:/tmp/cvs-serv9113/res_sqlite3

Added Files:
	Makefile README dialplan.sql res_sqlite.c res_sqlite.conf 
	res_sqlite.new.c upgrade.sh 
Log Message:
check in res_sqlite3

--- NEW FILE: Makefile ---
ASTDIR=/usr/src/asterisk
ASTXS=/usr/src/asterisk/contrib/scripts/astxs
ASTMODS=/usr/lib/asterisk/modules
ASTSQLITE=/var/lib/asterisk/sqlite
SQLITE2=/usr/local/bin/sqlite
SQLITE3=/usr/local/bin/sqlite3

CC=gcc

CFLAGS=-I sqlite -I sqlite/src

all: .sqlite res_sqlite.so


res_sqlite.so: 
	$(ASTXS) "-append=CFLAGS:$(CFLAGS)" "-append=EXTOBJ:./sqlite/.libs/libsqlite3.a" res_sqlite.c

.sqlite:
	cd sqlite && test -f ./config.status || ./configure --enable-threadsafe
	cd sqlite && make
	touch .sqlite


clean:
	/bin/rm -f *.o *.so *~

distclean: clean
	cd sqlite && make clean && /bin/rm -f ./config.status && /bin/rm -f ./config.log
	/bin/rm -f .sqlite

install:
	$(ASTXS) -autoload -install res_sqlite.so
	/bin/mkdir -p $(ASTSQLITE)
	if [ ! -f  /etc/asterisk/res_sqlite.conf ] ; then /bin/cp res_sqlite.conf /etc/asterisk; fi

sqlite_install: .sqlite
	cd sqlite && make install
	test -f /etc/ld.so.conf && ldconfig

upgrade: $(SQLITE2) $(SQLITE3)
	@echo upgrading database files 
	@upgrade.sh $(ASTSQLITE) $(SQLITE2) $(SQLITE3)




--- NEW FILE: README ---
res_sqlite for SQLite3

Improvements include new db engine and the auto-creation of some tables
along with a few cleanups.

to upgrade from the old res_sqlite (assuming each step works or forget it.)

make
make upgrade
make install

*NOTE* once you make upgrade all your data will be converted to sqlite3 format 
forever.


res_sqlite can be 

A real-time sqlite dialplan switch
A sqlite driven config handler
A sqlite cdr_handler
A Dialplan based SQL interaction system
A way to make you send paypal donations to anthmct at yahoo.com


In case the above hint was not enough.

To avoid lengthy download times, the complete list of asterisk modification/features
which I have made are not included with this package.  To show your support for
these contributions please paypal to anthmct at yahoo.com

Questions and comments can be addressed to anthmct at yahoo.com in the note attached
to your paypal donation.

If you are looking for custom asterisk work feel free to contact me at the above 
email address I have already shamelessly listed several times.


--- NEW FILE: dialplan.sql ---
BEGIN TRANSACTION;
create table dialplan(context varchar(255), exten varchar(255), pri int, app varchar(255), data varchar(255));
INSERT INTO dialplan VALUES('phone1',099,1,'PlayBack','demo-congrats');
COMMIT;

--- NEW FILE: res_sqlite.c ---
/*
 * Asterisk -- A telephony toolkit for Linux.
 *
 * SQLite Resource
 * 
 * Copyright (C) 2004, Anthony Minessale II
 *
 * Anthony Minessale II <anthmct at cylynx.com>
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License
 */

#include <asterisk/file.h>
#include <asterisk/logger.h>
#include <asterisk/options.h>
#include <asterisk/channel.h>
#include <asterisk/pbx.h>
#include <asterisk/cli.h>
[...1226 lines suppressed...]
	
	return res;
}

char *description(void)
{
	return desc;
}

int usecount(void)
{
	int res=0;
	STANDARD_USECOUNT(res);
	return res;
}

char *key()
{
	return ASTERISK_GPL_KEY;
}

--- NEW FILE: res_sqlite.conf ---
[general]
reload => no

[config]
table => ast_config
dbfile => config


[cdr]
table => ast_cdr
dbfile => ast_cdr


[switch]
table => dialplan
dbfile => asterisk

[cli]
dbfile => asterisk





--- NEW FILE: res_sqlite.new.c ---
/*
 * Asterisk -- A telephony toolkit for Linux.
 *
 * SQLite Resource
 * 
 * Copyright (C) 2004, Anthony Minessale II
 *
 * Anthony Minessale II <anthmct at cylynx.com>
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License
 */

#include <asterisk/file.h>
#include <asterisk/logger.h>
#include <asterisk/options.h>
#include <asterisk/channel.h>
#include <asterisk/pbx.h>
#include <asterisk/cli.h>
[...1287 lines suppressed...]
	
	return res;
}

char *description(void)
{
	return desc;
}

int usecount(void)
{
	int res=0;
	STANDARD_USECOUNT(res);
	return res;
}

char *key()
{
	return ASTERISK_GPL_KEY;
}

--- NEW FILE: upgrade.sh ---
#!/bin/sh

if [ -z $1 ] || [ -z $2 ] || [ -z $3 ] ; then
    echo "Usage $0 <db_dir> <sqlite2_binary> <sqlite3_binary>"
    echo "You would be better off with make upgrade"
    exit
fi

echo do not run this script more than once or you will fry your data.
echo only the word yes will proceed.
echo -n proceed [yes/no]:
read in

if [ ! -z $in ] && [ $in = "yes" ] ; then
    cd $1
    for i in *.db 
      do 
      echo upgrade $i
      $2 $i .dump | $3 $i.new
      /bin/mv $i.new $i
    done
fi




More information about the svn-commits mailing list