# # $Id$ # # control tool for maintaining Kamailio # #=================================================================== ##### ----------------------------------------------- ##### ### common variables and functions for SQL engines if [ -z "$DBNAME" ] ; then DBNAME=kamailio fi if [ -z "$DBHOST" ] ; then DBHOST=localhost fi if [ -z "$DBRWUSER" ] ; then DBRWUSER=kamailio fi # the read-only user for whom password may be stored here if [ -z "$DBROUSER" ] ; then DBROUSER=kamailioro fi if [ -z "$DBROPW" ] ; then DBROPW=kamailioro fi # full privileges SQL user if [ -z "$DBROOTUSER" ]; then DBROOTUSER="root" fi DBFNOW="now()" #params: none # output: DBRWPW prompt_pw() { if [ -z "$DBRWPW" ] ; then savetty=`stty -g` if [ -z "$1" ] ; then printf "Password: " > /dev/stderr else printf "$1: " > /dev/stderr fi stty -echo read DBRWPW stty $savetty echo fi } # dbtext don't support db_ops usage_db_ops() { echo mecho " -- command 'db' - database operations" echo cat < ..................... execute SQL query db roexec ................. execute read-only SQL query db run ......................... execute SQL query from \$id variable db rorun ....................... execute read-only SQL query from \$id variable db show ..................... display table content db showg
.................... display formatted table content db smatch
...... display record from table that has ........................... column key equal to value as string db nmatch
...... display record from table that has ........................... column key equal to value as non-string EOF } USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_db_ops" # speeddial not implemented for dbtext usage_speeddial() { echo mecho " -- command 'speeddial' - manage speed dials (short numbers)" echo cat < ....... show speeddial details speeddial list ............. list speeddial for uri speeddial add [] ... ........................... add a speedial (*) speeddial rm ....... remove a speeddial (*) speeddial help ...................... help message - , must be an AoR (username@domain) - must be an AoR (username@domain) - must be a SIP AoR (sip:username@domain) - a description for speeddial EOF } USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_speeddial" # avp operations not implemented for dbtext usage_avp() { echo mecho " -- command 'avp' - manage AVPs" echo cat <] [-a attribute] [-v value] [-t type] ... list AVPs avp add [-T table] ............ add AVP (*) avp rm [-T table] [-u ] [-a attribute] [-v value] [-t type] ... remove AVP (*) avp help .................................. help message - -T - table name - -u - SIP id or unique id - -a - AVP name - -v - AVP value - -t - AVP name and type (0 (str:str), 1 (str:int), 2 (int:str), 3 (int:int)) - must be an AoR (username@domain) - must be a string but not AoR EOF } USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_avp" # alias_db not implemented for dbtext usage_alias_db() { echo mecho " -- command 'alias_db' - manage database aliases" echo cat < .............. show alias details alias_db list ............. list aliases for uri alias_db add ...... add an alias (*) alias_db rm ................ remove an alias (*) alias_db help ...................... help message - must be an AoR (username@domain)" - must be an AoR (username@domain)" EOF } USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_alias_db" usage_domain() { echo mecho " -- command 'domain' - manage local domains" echo cat < ................. add the domain to the database domain rm .................. delete the domain from the database EOF } USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_domain" uid_usage_domain() { echo mecho " -- command 'uid_domain' - manage local domains" echo cat < [did] [flags].... add the domain to the database uid_domain rm .................. delete the domain from the database EOF } USAGE_FUNCTIONS="$USAGE_FUNCTIONS uid_usage_domain"