main.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "log4cpp/Category.hh"
  2. #include "log4cpp/FileAppender.hh"
  3. #include "log4cpp/OstreamAppender.hh"
  4. #include "PjsuaCommunicator.hpp"
  5. #include "MumbleCommunicator.hpp"
  6. #include "Configuration.hpp"
  7. int main(int argc, char *argv[]) {
  8. log4cpp::Appender *appender1 = new log4cpp::OstreamAppender("console", &std::cout);
  9. appender1->setLayout(new log4cpp::BasicLayout());
  10. log4cpp::Category &logger = log4cpp::Category::getRoot();
  11. logger.setPriority(log4cpp::Priority::DEBUG);
  12. logger.addAppender(appender1);
  13. if (argc == 1) {
  14. logger.crit("No configuration file provided. Use %s {config file}", argv[0]);
  15. return 1;
  16. }
  17. config::Configuration conf(argv[1]);
  18. sip::PjsuaCommunicator pjsuaCommunicator(
  19. conf.getString("sip.host"),
  20. conf.getString("sip.user"),
  21. conf.getString("sip.password"),
  22. conf.getInt("sip.port"));
  23. mumble::MumbleCommunicator mumbleCommunicator(
  24. pjsuaCommunicator,
  25. conf.getString("mumble.user"),
  26. conf.getString("mumble.password"),
  27. conf.getString("mumble.host"),
  28. conf.getInt("mumble.port"));
  29. logger.info("Application started.");
  30. mumbleCommunicator.loop();
  31. return 0;
  32. }