数据库文件内容如下:
#!/bin/sh 
#
#
# The partysip SIP proxy Server.
# http://www.partysip.org
#
###
### This script will help you to create database for partysip.
###DB="sipdb"
ADMIN="root"
PSPUSER="pspadmin"
PSPPWD=""
HOST="10.106.1.64"#
psp_build ()
{mysql -h localhost -p -u $root << EOFcreate database $DB;
use $DB;# Add new Users
GRANT ALL PRIVILEGES ON $DB.* TO $PSPUSER IDENTIFIED  BY '$PSPPWD';
GRANT ALL PRIVILEGES ON $DB.* TO ${PSPUSER}@$HOST IDENTIFIED BY '$PSPPWD';# create a databse
CREATE TABLE psp_users ( userid DOUBLE NOT NULL AUTO_INCREMENT,
    username VARCHAR( 30 ) NOT NULL ,
    domain VARCHAR( 30 ) NOT NULL ,
    ha1 VARCHAR( 35 ) NOT NULL ,
    sipurl VARCHAR( 100 ) NOT NULL ,
    email VARCHAR( 100 ) NOT NULL ,
    status VARCHAR( 30 ) NOT NULL ,
    creation_time TIMESTAMP(14) NOT NULL ,
    update_time TIMESTAMP(14) NOT NULL ,
    PRIMARY KEY ( username ) ,
    INDEX ( userid )
) TYPE=MyISAM;# insert a test user (with a password set to "partsysip".
# the realm is atosc.org.
INSERT INTO psp_users ( userid ,
    username ,
    domain ,
    ha1 ,
    sipurl ,
    email ,
    status ,
    creation_time ,
    update_time ) 
    VALUES ('',
    'test',
    'atosc.org',
    'bfae48a22116fc0dd34edaac0406b41c',
    'Test <sip:[email protected]>',
    'sip:[email protected]',
    'Unavailable',
    NOW( ) ,
    CURTIME( ) 
 );CREATE TABLE psp_locations (
    username VARCHAR(30) NOT NULL default '',
    contact  VARCHAR(255) NOT NULL default '',
    expires  DATETIME default NULL,
    qparam   FLOAT(10,2) default NULL,
    modified TIMESTAMP(14) NOT NULL,
    KEY user (username,contact)
) TYPE=MyISAM;# use ser accounting database format
CREATE TABLE psp_acc (
  sip_from varchar(128) NOT NULL default '',
  sip_to varchar(128) NOT NULL default '',
  sip_status varchar(128) NOT NULL default '',
  sip_method varchar(16) NOT NULL default '',
  i_uri varchar(128) NOT NULL default '',
  o_uri varchar(128) NOT NULL default '',
  sip_callid varchar(128) NOT NULL default '',
  user varchar(64) NOT NULL default '',
  time datetime NOT NULL default '0000-00-00 00:00:00',
  timestamp timestamp(14) NOT NULL
) TYPE=MyISAM;# use ser event database format
CREATE TABLE event (
  id int(10) unsigned NOT NULL auto_increment,
  user varchar(50) NOT NULL ,
  uri varchar(255) NOT NULL ,
  description varchar(255) NOT NULL ,
  PRIMARY KEY  (id),
  UNIQUE KEY id (id)
) TYPE=MyISAM;EOF}psp_delete()
{
mysql -h localhost -p -u $ADMIN << EOFDROP DATABASE $DB;EOF
}psp_dump()
{
mysqldump -h localhost -p  -c -t -u $ADMIN
}usage ()
{
prog=`basename $0`
echo "
usage:   $prog [build|delete|dump]
         $prog [add_user] username domain ha1 sipurl email   This utility build, delete and dum SQL database used by partysip.
   You can change the default settings by editing some global values
   that match your database.
"}#
psp_add_user () # $1 username $2 domain $3 ha1 $4 email $5 sipurl
{
mysql -h localhost -p -u $ADMIN << EOFuse $DB;# insert a test user (with a password set to "partsysip")
INSERT INTO psp_users ( userid ,
    username ,
    domain ,
    ha1 ,
    sipurl ,
    email ,
    status ,
    creation_time ,
    update_time ) 
    VALUES ('',
    "$1",
    "$2",
    "$3",
    "$5",
    "$4",
    'Not available',
    NOW( ) ,
    CURTIME( ) 
 );EOF
}if [ $# -ne 6 ]; then
    if [ $# -ne 1 ]; then
usage
exit 1
    fi
ficase $1 in
add_user)
if [ $# -ne 6 ]; then
    usage
    exit 1
fi
psp_add_user $2 $3 $4 $5 $6
exit $?
;;
build)
psp_build
exit $?
;;
dump)
psp_dump
exit $?
;;
delete)
psp_delete
exit $?
;;
*)
usage
exit 1;
;;
esac