tu

package
v3.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2022 License: AGPL-3.0 Imports: 5 Imported by: 0

README

Transaction User(TU)事务用户:在transaction 层之上的协议层。TU包括了UAC core、UAS core,和proxy core。 tu处理业务逻辑,并对事务层进行操作。

类型

SIP服务器典型有以下几类:

a. 注册服务器 -即只管Register消息,这里相当于location也在这里了

b. 重定向服务器 -给ua回一条302后,转给其它的服务器,这样保证全系统统一接入

c. 代理服务器 -只做proxy,即对SIP消息转发

d. 媒体服务器-只做rtp包相关处理,即media server

e. B2BUA - 这个里包实际一般是可以含以上几种服务器类型

暂时仅处理gb28181 相关

TU

tu负责根据应用层需求,发起操作。 比如注册到sip服务器、发起会话、取消会话等。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMessageRequest

func BuildMessageRequest(method sip.Method, transport, sipSerial, sipRealm, username, srcIP string, srcPort uint16, expires, cseq int, body string) *sip.Message

根据参数构建各种消息 参数来自于session/transaction等会话管理器

method:请求方法 transport:UDP/TCP sipSerial: sip server ID sipRealm: sip domain username: 用户名/设备序列号 srcIP: 源IP srcPort:源端口 expires: 过期时间 cseq:消息序列号,当前对话递增

构建消息:以客户端(可能是IPC,也可能是SIP Server)的角度

func RunClient

func RunClient()

TODO:对于一个TU,开启之后 运行一个sip client

func RunServer

func RunServer()

运行一个sip server

Types

type Client

type Client struct {
	*transaction.Core //transaction manager
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config *transaction.Config, static *ClientStatic) *Client

type ClientRuntime

type ClientRuntime struct {
	RemoteAddress string //设备的公网的IP和端口,格式x.x.x.x:x
	Online        bool   //在线状态
	Branch        string //branch
	Cseq          int    //消息序列号,发送消息递增, uint32
	FromTag       string //from tag
	ToTag         string //to tag
	Received      string //remote ip
	Rport         string //remote port
}

client运行时信息

type ClientStatic

type ClientStatic struct {
	LocalIP   string //设备本地IP
	LocalPort uint16 //客户端SIP端口
	Username  string //SIP用户名,一般是取通道ID,默认 34020000001320000001
	AuthID    string //SIP用户认证ID,一般是通道ID, 默认 34020000001320000001
	Password  string //密码
}

sip server和client的配置,可以得到sip URI:sip 格式:user:password@host:port;uri-parameters?headers 在这些URI里边包含了足够的信息来发起和维持到这个资源的一个通讯会话。 client静态配置

type Server

type Server struct {
	*transaction.Core //SIP transaction manager
	// contains filtered or unexported fields
}

TODO:参考http服务,使用者仅需要根据需要实现某些handler,替换某些header fileds or body信息。其他的处理都由库来实现。

func NewServer

func NewServer(config *transaction.Config) *Server

提供config参数

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL