การใช้งาน FreeSwitch เบื้องต้น
จาก Asterisk DIY - VoIP Opensource WiKi, สารานุกรมฟรี
การเปิดการทำงานของ FreeSwitch
การเปิดการทำงานของ FreeSwitch ทำได้สองทางคือการใช้ Unix command line กับ การใช้ Start-Up script ซึ่ง การใช้ Command Line จะใช้ในกรณีที่ต้องการ test ระบบก่อนที่ configuration ต่างๆจะสำเร็จ และ StartUp script จะใช้ในกรณีปรกติที่จะให้ freeswitch ทำงานเป็น Daemon
การ start แบบ Command Line:
cd /usr/local/freeswitch/bin ./freeswitch
การ start แบบ Script:
จำเป็นต้องทำการ copy startup script จาก source ไปยังตำแหน่งที่ OS จะทำการอ่าน config
create "/etc/init.d/freeswitch" file และใส่ค่า config ตามด้านล่างลงไป chmod 755 /etc/init.d/freeswitch chkconfig --add freeswitch
#!/bin/bash
#
# freeswitch This starts and stops the freeswitch
#
# chkconfig: 345 60 50
# chkconfig: - 60 50
# description: freeswitch.sh - startup script for freeswitch on FreeBSD
# processname: /usr/local/freeswitch/bin/freeswitch
# pidfile: /usr/local/freeswitch/log/freeswitch.pid
PATH=/sbin:/bin:/usr/bin:/usr/sbin
# Source function library.
. /etc/init.d/functions
# Get config.
test -f /etc/sysconfig/network && . /etc/sysconfig/network
# Check that we are root ... so non-root users stop here
[ `id -u` = 0 ] || exit 1
# Check that networking is up.
[ "${NETWORKING}" = "yes" ] || exit 0
RETVAL=0
prog="Freeswitch"
start() {
if [ -x /usr/local/freeswitch/bin/freeswitch ] ; then
echo -n $"Starting $prog: "
/usr/local/freeswitch/bin/freeswitch -nc &
RETVAL=$?
sleep 1
fi
return $RETVAL
}
stop() {
if [ -x /usr/local/freeswitch/bin/freeswitch ] ; then
echo -n $"Stopping $prog: "
/usr/local/freeswitch/bin/freeswitch -stop &
RETVAL=$?
sleep 1
fi
return $RETVAL
}
restart(){
stop
sleep 5
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "usage: $0 { start | stop | restart }" >&2
RETVAL=1
esac
exit $RETVAL
หากต้องการ test service ว่าสามารถ run ได้หรือไม่
service freeswitch start
คำสั่งต่างๆใน FreeSwitch CLI
คำสั่งพิเศษต่างๆ
<tab> ใช้สำหรับการ list command ต่างๆใน, โดย สามารถทำการ filter ได้โดยการพิมพ์ค่าที่ทราบแล้วค่ากด <tab> "shutdown" ใช้สำหรับการ ปิด Freeswitch "..." ใช้สำหรับการ ปิด Freeswitch