示例#1
0
文件: conf.go 项目: nwaycn/Nway_ac2
func (this *NwayConfig) Load() bool {
	conf, result := SetConfig("conf.ini")
	if result == false {
		logger.Debug("load the config file failed")
		return false
	}

	this.Dbconf.ConnString, result = conf.GetValue("database", "connstring")
	if result == false {
		logger.Error("load database connect string failed")
		return false
	}
	this.Fsconf.FsHost, result = conf.GetValue("freeswitch", "host")
	if result == false {
		logger.Error("load freeswitch host string failed")
		return false
	}
	this.Fsconf.FsAuth, result = conf.GetValue("freeswitch", "auth")
	if result == false {
		logger.Error("load freeswitch auth string failed")
		return false
	}
	this.Fsconf.FsPort = conf.GetInt("freeswitch", "port", 8021)

	this.Fsconf.FsTimeout = conf.GetInt("freeswitch", "timeout", 500)

	this.Fsoutboundconf.ObPort, result = conf.GetValue("freeswitch", "outboundport")
	this.Fsoutboundconf.ObPPort, result = conf.GetValue("freeswitch", "pub-outboundport")

	return true

}
示例#2
0
func StartService() bool {
	runtime.GOMAXPROCS(runtime.NumCPU())
	logger.SetConsole(true)
	logger.SetRollingDaily(".", "nwaypbx.log")
	logger.SetLevel(logger.INFO)
	if StartOutboundService() {
		logger.Debug("Outbound service has started")
	} else {
		logger.Debug("Outbound service start failed")
		return false
	}

	if StartInboundService() {
		logger.Debug("Inbound service has started")
	} else {
		logger.Debug("Inbound service start failed")
		return false
	}
	return true
}