Documentation ¶
Index ¶
- func BuildClientMessageRequest(method sip.Method, transport, sipSerial, sipRealm, username, srcIP string, ...) *sip.Message
- func BuildMessageRequest(method sip.Method, transport, sipSerial, sipRealm, username, srcIP string, ...) *sip.Message
- func ParseSDPAttr(data, key string) string
- func RunClient()
- func RunServer()
- type Client
- type ClientRuntime
- type ClientStatic
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildClientMessageRequest ¶ added in v1.0.4
func BuildClientMessageRequest(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 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 ParseSDPAttr ¶ added in v1.0.7
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信息。其他的处理都由库来实现。