FreeSWITCH中文网,电话机器人开发网 ,微信订阅号:

FreeSWITCH及VOIP,Openser,电话机器人等产品中文技术资讯、交流、沟通、培训、咨询、服务一体化网络。QQ群:293697898

NwayPbx Runtime实时存储


tags:NwayPbx FreeSWITCH中间件 内存数据结构 创建时间:2016-08-05 12:16:28

package nwaypbxruntime

import (
    . "nway/nway_pbx/nway_pbx_struct"
    "nway/utils/log"
    "regexp"
    "sync"
)

type NwayPbxRuntime struct {
    GatewayGroups   map[int64]Gateway_group
    Dialplans       map[int64]*regexp.Regexp
    Ivrs            map[string]Ivr
    Opts            map[int]string
    Fifos           map[string]Fifo
    RingPath        string
    RecordPath      string
    LinuxPlatform   bool
    VoicemailFile   string
    JobNumberPrefix string
    JobNumberSuffix string
    BaseConfigMutex *sync.RWMutex
    FifoMutex       *sync.RWMutex
    GatewayMutex    *sync.RWMutex
    DialplanMutex   *sync.RWMutex
    IvrMutex        *sync.RWMutex
    RedisMutex      *sync.Mutex
    //OptMutex *sync.RWMutex

}

var _init_runtime sync.Once
var _instance_ *NwayPbxRuntime

func NewRuntime() *NwayPbxRuntime {
    _init_runtime.Do(func() {
        logger.Debug("New a runtime class")
        _instance_ = new(NwayPbxRuntime)

    })
    return _instance_
}

func (this *NwayPbxRuntime) Initlize() error {
    //初始化
    this.BaseConfigMutex = new(sync.RWMutex)
    this.DialplanMutex = new(sync.RWMutex)
    this.FifoMutex = new(sync.RWMutex)
    this.IvrMutex = new(sync.RWMutex)
    this.GatewayMutex = new(sync.RWMutex)
    this.RedisMutex = new(sync.Mutex)
    //load 初始化数据

    return nil
}


上海老李,QQ:1354608370,FreeSWITCH QQ群: