當前位置: 首頁>>代碼示例>>Golang>>正文


Golang StoredCdr.CdrHost方法代碼示例

本文整理匯總了Golang中github.com/cgrates/cgrates/utils.StoredCdr.CdrHost方法的典型用法代碼示例。如果您正苦於以下問題:Golang StoredCdr.CdrHost方法的具體用法?Golang StoredCdr.CdrHost怎麽用?Golang StoredCdr.CdrHost使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/cgrates/cgrates/utils.StoredCdr的用法示例。


在下文中一共展示了StoredCdr.CdrHost方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: AsStoredCdr

func (fsev FSEvent) AsStoredCdr() *utils.StoredCdr {
	storCdr := new(utils.StoredCdr)
	storCdr.CgrId = fsev.GetCgrId()
	storCdr.TOR = utils.VOICE
	storCdr.AccId = fsev.GetUUID()
	storCdr.CdrHost = fsev.GetOriginatorIP(utils.META_DEFAULT)
	storCdr.CdrSource = "FS_" + fsev.GetName()
	storCdr.ReqType = fsev.GetReqType(utils.META_DEFAULT)
	storCdr.Direction = fsev.GetDirection(utils.META_DEFAULT)
	storCdr.Tenant = fsev.GetTenant(utils.META_DEFAULT)
	storCdr.Category = fsev.GetCategory(utils.META_DEFAULT)
	storCdr.Account = fsev.GetAccount(utils.META_DEFAULT)
	storCdr.Subject = fsev.GetSubject(utils.META_DEFAULT)
	storCdr.Destination = fsev.GetDestination(utils.META_DEFAULT)
	storCdr.SetupTime, _ = fsev.GetSetupTime(utils.META_DEFAULT)
	storCdr.AnswerTime, _ = fsev.GetAnswerTime(utils.META_DEFAULT)
	storCdr.Usage, _ = fsev.GetDuration(utils.META_DEFAULT)
	storCdr.ExtraFields = fsev.GetExtraFields()
	storCdr.Cost = -1
	return storCdr
}
開發者ID:intralanman,項目名稱:cgrates,代碼行數:21,代碼來源:fsevent.go

示例2: AsStoredCdr

func (fsCdr FSCdr) AsStoredCdr() *utils.StoredCdr {
	storCdr := new(utils.StoredCdr)
	storCdr.CgrId = fsCdr.getCgrId()
	storCdr.TOR = utils.VOICE
	storCdr.AccId = fsCdr.vars[FS_UUID]
	storCdr.CdrHost = fsCdr.vars[FS_IP]
	storCdr.CdrSource = FS_CDR_SOURCE
	storCdr.ReqType = utils.FirstNonEmpty(fsCdr.vars[FS_REQTYPE], cfg.DefaultReqType)
	storCdr.Direction = "*out"
	storCdr.Tenant = utils.FirstNonEmpty(fsCdr.vars[FS_CSTMID], cfg.DefaultTenant)
	storCdr.Category = utils.FirstNonEmpty(fsCdr.vars[FS_CATEGORY], cfg.DefaultCategory)
	storCdr.Account = utils.FirstNonEmpty(fsCdr.vars[FS_ACCOUNT], fsCdr.vars[FS_USERNAME])
	storCdr.Subject = utils.FirstNonEmpty(fsCdr.vars[FS_SUBJECT], fsCdr.vars[FS_USERNAME])
	storCdr.Destination = utils.FirstNonEmpty(fsCdr.vars[FS_DESTINATION], fsCdr.vars[FS_CALL_DEST_NR], fsCdr.vars[FS_SIP_REQUSER])
	storCdr.SetupTime, _ = utils.ParseTimeDetectLayout(fsCdr.vars[FS_SETUP_TIME]) // Not interested to process errors, should do them if necessary in a previous step
	storCdr.AnswerTime, _ = utils.ParseTimeDetectLayout(fsCdr.vars[FS_ANSWER_TIME])
	storCdr.Usage, _ = utils.ParseDurationWithSecs(fsCdr.vars[FS_DURATION])
	storCdr.ExtraFields = fsCdr.getExtraFields()
	storCdr.Cost = -1
	return storCdr
}
開發者ID:intralanman,項目名稱:cgrates,代碼行數:21,代碼來源:fscdr.go


注:本文中的github.com/cgrates/cgrates/utils.StoredCdr.CdrHost方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。