示例#1
0
func (f *Fs_Gateway) Rescan() bool {
	conf, result := config.SetConfig("conf.ini")
	if result == false {
		logger.Debug("load the config file failed")
		return false
	}

	var Fshost, Fsauth, Fsport string
	//var Fsport,Fstime int

	Fshost, result = conf.GetValue("freeswitch", "fshost")
	if result == false {
		return false
	}
	Fsport, result = conf.GetValue("freeswitch", "fsport")
	if result == false {
		return false
	}
	Fsauth, result = conf.GetValue("freeswitch", "fsauth")
	if result == false {
		return false
	}
	//Fstime, err := iniconf.Int("timeout",500)
	c, err := eventsocket.Dial(Fshost+":"+Fsport, Fsauth)
	if err != nil {
		fmt.Println(err)
		//log.Fatal(err)
		return false
	}
	defer c.Close()
	//sofia profile external rescan
	// sofia profile external rescan reloadxml
	//ev, err := c.Send(fmt.Sprintf("bgapi %s", dial_string))
	ev, err := c.Send("bgapi sofia profile external rescan reloadxml")
	if err != nil {
		fmt.Println(err)
		//log.Fatal(err)
		return false
	}
	//	if len(ev.Body) > 0  {
	//		fmt.Println(ev.Body)
	//		return true
	//	}
	fmt.Println(ev.Get("Reply-Text"))
	ev.PrettyPrint()
	return true
}
示例#2
0
func (f *Fs_Gateway) GetXmlPath() (string, bool) {
	conf, result := config.SetConfig("conf.ini")
	if result == false {
		logger.Debug("load the config file failed")
		return "", false
	}
	var pathstring string
	pathstring, result = conf.GetValue("freeswitch", "externalpath")
	if result == false {
		logger.Error("load database connect string failed")
		return "", false
	}
	return pathstring, true
}