Menggunakan openserctl
Revision as of 10:39, 12 March 2008 by Onnowpurbo (talk | contribs)
Aktifkan openser database
# openser_mysql create MySQL password for root: creating database openser ... Core OpenSER tables succesfully created. Install presence related tables ?(y/n):y creating presence tables into openser ... Presence tables succesfully created. Install extra tables - imc,cpl,siptrace,domainpolicy ?(y/n):y creating extra tables into openser ... Extra tables succesfully created. Install SERWEB related tables ?(y/n):y Domain (realm) for the default user 'admin': 192.168.0.2.
creating serweb tables into openser ... SERWEB tables succesfully created.
Akan keluar warning
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! ! WARNING ! ! ! ! There was a default admin user created: ! ! username: admin@192.168.0.2. ! password: openserrw ! ! ! Please change this password or remove this user ! ! from the subscriber and admin_privileges table. ! ! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Biasanya bisa di ignore saja.
Menyiapkan openserctl
Edit /etc/openser/openserctlrc
# vi /etc/openser/openserctlrc
Pastikan
## your SIP domain SIP_DOMAIN=openser.org
## database type: MYSQL or PGSQL, by defaulte none is loaded DBENGINE=MYSQL
## database host DBHOST=localhost
## database name DBNAME=openser
## database read/write user DBRWUSER=openser
## database read only user DBROUSER=openserro
## password for database read only user DBROPW=openserro
## database super user DBROOTUSER="root"
## type of aliases used: DB - database aliases; UL - usrloc aliases ## - default: none ALIASES_TYPE="DB"
## control engine: FIFO or UNIXSOCK ## - default FIFO CTLENGINE="FIFO"
## path to FIFO file ## Perhatikan baik-baik path-nya OSER_FIFO="/tmp/openser_fifo"
Alternatif lain, OSER_FIFO di disable saja.
## path to FIFO file # OSER_FIFO="/tmp/openser_fifo"
## check ACL names; default on (1); off (0) # VERIFY_ACL=1
## ACL names - if VERIFY_ACL is set, only the ACL names from below list ## are accepted # ACL_GROUPS="local ld int voicemail free-pstn"
## presence of serweb tables - default "no" # HAS_SERWEB="yes"
## verbose - debug purposes - default '0' # VERBOSE=1
## do (1) or don't (0) store plaintext passwords ## in the subscriber table - default '1' # STORE_PLAINTEXT_PW=0
Lakukan
# touch /tmp/openser_fifo
Menjalankan openserctl
# openserctl /usr/sbin/openserctl 1.2 - $Revision: 2135 $ Existing commands:
-- command 'start|stop|restart' restart ............................ restart OpenSER start .............................. start OpenSER stop ............................... stop OpenSER
-- command 'acl' - manage access control lists (acl) acl show [<username>] .............. show user membership acl grant <username> <group> ....... grant user membership (*) acl revoke <username> [<group>] .... grant user membership(s) (*)
-- command 'alias_db' - manage database aliases alias_db show <alias> .............. show alias details alias_db list <sip-id> ............. list aliases for uri alias_db add <alias> <sip-id> ...... add an alias (*) alias_db rm <alias> ................ remove an alias (*) alias_db help ...................... help message - <alias> must be an AoR (username@domain)" - <sip-id> must be an AoR (username@domain)"
-- command 'avp' - manage AVPs avp list [-T table] [-u <sip-id|uuid>] [-a attribute] [-v value] [-t type] ... list AVPs avp add [-T table] <sip-id|uuid> <attribute> <type> <value> ............ add AVP (*) avp rm [-T table] [-u <sip-id|uuid>] [-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)) - <sip-id> must be an AoR (username@domain) - <uuid> must be a string but not AoR
-- command 'db' - database operations db exec <query> ..................... execute SQL query db roexec <roquery> ................. execute read-only SQL query db run <id> ......................... execute SQL query from $id variable db rorun <id> ....................... execute read-only SQL query from $id variable db show <tabel> ..................... display table content
-- command 'lcr' - manage least cost routes (lcr) * lcr * * IP addresses must be entered in dotted quad format e.g. 1.2.3.4 * * <uri_scheme> and <transport> must be entered in integer or text,* * e.g. transport '2' is identical to transport 'tcp'. * * scheme: 1=sip, 2=sips; transport: 1=udp, 2=tcp, 3=tls * * Examples: lcr addgw_grp usa 1 * * lcr addgw level3 1.2.3.4 5080 sip tcp 1 * * lcr addroute +1 1 1 * lcr show .................................................................... ............. show routes, gateways and groups lcr reload .................................................................. ............. reload lcr gateways lcr addgw_grp <grp_name> .................................................... .............. add gateway group, autocreate grp_id lcr addgw_grp <grp_name> <grp_id> ........................................... ............... add gateway group with grp_id lcr rmgw_grp <grp_id> ...................................................... ............... delete the gw_grp lcr addgw <gw_name> <ip> <port> <scheme> <transport> <grp_id> ............... ............... add a gateway lcr addgw <gw_name> <ip> <port> <scheme> <transport> <grp_id> <prefix> ...... ............... add a gateway with prefix lcr addgw <gw_name> <ip> <port> <scheme> <transport> <grp_id> <prefix> <strip> ............... add a gateway with prefix and strip lcr rmgw <gw_name> ......................................................... ............... delete a gateway lcr addroute <prefix> <from> <grp_id> <prio> ................................ .............. add a route ( use to match anything in <from> ) lcr rmroute <prefix> <from> <grp_id> <prio> ................................ .............. delete a route
-- command 'rpid' - manage Remote-Party-ID (RPID) rpid add <username> <rpid> ......... add rpid for a user (*) rpid rm <username> ................. set rpid to NULL for a user (*) rpid show <username> ............... show rpid of a user
-- command 'speeddial' - manage speed dials (short numbers) speeddial show <speeddial-id> ....... show speeddial details speeddial list <sip-id> ............. list speeddial for uri speeddial add <sip-id> <sd-id> <new-uri> [<desc>] ... ........................... add a speedial (*) speeddial rm <sip-id> <sd-id> ....... remove a speeddial (*) speeddial help ...................... help message - <speeddial-id>, <sd-id> must be an AoR (username@domain) - <sip-id> must be an AoR (username@domain) - <new-uri> must be a SIP AoR (sip:username@domain) - <desc> a description for speeddial
-- command 'add|mail|passwd|rm' - manage subscribers add <username> <password> <email> .. add a new subscriber (*) passwd <username> <passwd> ......... change user's password (*) rm <username> ...................... delete a user (*) mail <username> .................... send an email to a user
-- command 'cisco_restart' - restart CISCO phone (NOTIFY) cisco_restart <uri> ................ restart phone configured for <uri>
-- command 'online' - dump online users from memory online ............................. display online users
-- command 'monitor' - show internal status monitor ............................ show server's internal status
-- command 'ping' - ping a SIP URI (OPTIONS) ping <uri> ......................... ping <uri> with SIP OPTIONS
-- command 'ul|alias' - manage user location or aliases ul show [<username>]................ show in-RAM online users ul show --brief..................... show in-RAM online users in short format ul rm <username> [<contact URI>].... delete user's UsrLoc entries ul add <username> <uri> ............ introduce a permanent UrLoc entry ul add <username> <uri> <expires> .. introduce a temporary UrLoc entry
-- command 'fifo' fifo ............................... send raw FIFO command
Beberapa Tips Menggunakan openserctl
Menambah user
# openserctl add 2000 123456 nomail@nomail.com MySql password for user 'openser@localhost': (default openserrw) -e new user '2000' added
Melihat user yang sedang online, misalnya nomor 2001
# openserctl ul show 2001
-e database engine 'MYSQL' loaded -e Control engine 'FIFO' loaded -e entering fifo_cmd ul_show_contact location 2001@192.168.0.2 200 OK Contact:: <sip:2001@192.168.0.92>;q=;expires=3413;flags=0x0;cflags=0x0;socket=<udp:192.168.0.2:5060>;methods=0x163F;user_agent=<Grandstream BT120 1.0.8.17> -e FIFO command was: :ul_show_contact:openser_receiver_27106 location 2001@192.168.0.2
Kita dapat melihat dengan jelas IP address user di kalimat sip:2001@192.168.0.92