本文整理汇总了Golang中github.com/zaf/agi.Session.Answer方法的典型用法代码示例。如果您正苦于以下问题:Golang Session.Answer方法的具体用法?Golang Session.Answer怎么用?Golang Session.Answer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/zaf/agi.Session
的用法示例。
在下文中一共展示了Session.Answer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: FaxRecv
func FaxRecv(sess *agi.Session) {
sess.Answer()
uid := strings.Split(sess.Env["uniqueid"], ".")
_, err := sess.SetVariable("FAXFILENAME", fmt.Sprintf("%s_%s_%s", sess.Env["callerid"], sess.Env["dnid"], uid[0]))
_, err = sess.SetVariable("FAXOPT(headerinfo)", fmt.Sprintf("Received_by_%s_%s", sess.Env["callerid"], uid[0]))
_, err = sess.SetVariable("FAXOPT(localstationid)", sess.Env["callerid"])
_, err = sess.SetVariable("FAXOPT(maxrate)", "14400")
_, err = sess.SetVariable("FAXOPT(minrate)", "4800")
filename, err := sess.GetVariable("FAXFILENAME")
_, err = sess.Exec("ReceiveFax", fmt.Sprintf(FAXDIR+FAXRECVSTR, filename.Dat))
if err != nil {
LoggerErr(err)
} else {
fs, err := sess.GetVariable("FAXSTATUS")
fp, err := sess.GetVariable("FAXPAGES")
fb, err := sess.GetVariable("FAXBITRATE")
fr, err := sess.GetVariable("FAXRESOLUTION")
if err != nil {
LoggerErr(err)
}
if fs.Dat == "" || fs.Dat == "FAILED" {
fs.Dat = "FAILED"
}
msg := fmt.Sprintf("Статус: %s\nС номера: %s\nНа номер: %s\nКоличество страниц: %s\nСкорость передачи(bitrate): %s\nРазрешение файла: %s",
fs.Dat,
sess.Env["callerid"],
sess.Env["dnid"],
fp.Dat,
fb.Dat,
fr.Dat)
NotifyMail("ФаксВходящий", sess.Env["callerid"], msg, MAIL)
NotifyMail("ФаксВходящий", sess.Env["callerid"], msg, "fax-"+sess.Env["dnid"])
}
sess.Hangup()
}
示例2: ConfBridgeAccess
func ConfBridgeAccess(sess *agi.Session) {
sess.Answer()
_, err := sess.SetVariable("__CONFNO", sess.Env["extension"])
if err != nil {
LoggerErr(err)
}
_, err = sess.SetVariable("__DYNAMIC_FEATURES", CONFBRIDGE_FEATURES)
if err != nil {
LoggerErr(err)
}
if sess.Env["extension"] == sess.Env["callerid"] {
inner_num, err := strconv.Atoi(LEN_INNER_NUM)
if len(sess.Env["callerid"]) == inner_num {
_, err = sess.Exec("ConfBridge", fmt.Sprintf("%s,,,%s", sess.Env["extension"], AMENU))
} else {
_, err = sess.Exec("ConfBridge", fmt.Sprintf("%s,,,%s", sess.Env["extension"], UMENU))
}
if err != nil {
LoggerErr(err)
}
} else {
_, err = sess.Exec("ConfBridge", fmt.Sprintf("%s,,,%s", sess.Env["extension"], UMENU))
}
if err != nil {
LoggerErr(err)
}
LoggerString("Confbridge Admin " + sess.Env["extension"])
}