case "$1" in
  meta-data)    meta_data
                exit $OCF_SUCCESS;;
  usage|help)   usage
                exit $OCF_SUCCESS;;
esac


# Anything except meta-data and help must pass validation
asterisk_validate || exit $?

# Now that validate has passed and we can be sure to be able to read
# the config file, set convenience variables
ASTRUNDIR=`grep astrundir $OCF_RESKEY_config | awk '/^astrundir/ {print $3}'`
ASTLOGDIR=`grep astlogdir $OCF_RESKEY_config | awk '/^astlogdir/ {print $3}'`

# What kind of method was invoked?
case "$1" in
  start)        asterisk_start;;
  stop)         asterisk_stop;;
  status)       asterisk_status;;
  monitor)      asterisk_monitor;;
  validate-all) ;;
  *)            usage
                exit $OCF_ERR_UNIMPLEMENTED;;
esac
