- func AckMatch(msg, ack *sip.Msg) bool
- func NewAck(msg, invite *sip.Msg) *sip.Msg
- func NewBye(invite, remote *sip.Msg, lseq *int) *sip.Msg
- func NewCancel(invite *sip.Msg) *sip.Msg
- func NewRequest(tp *Transport, method string, to, from *sip.Addr) *sip.Msg
- func NewResponse(msg *sip.Msg, status int) *sip.Msg
- func PopulateMessage(via *sip.Via, contact *sip.Addr, msg *sip.Msg)
- func ReceiveMessages(sock *net.UDPConn, c chan<- *sip.Msg, e chan<- error)
- func ResponseMatch(req, rsp *sip.Msg) bool
- func RouteMessage(via *sip.Via, contact *sip.Addr, msg *sip.Msg) (host string, port uint16, err error)
- type AddressRoute
- type Dialog
- type Transport
const ( GosipUA = "slytherin/1.o" GosipAllow = "INVITE, ACK, CANCEL, BYE, OPTIONS" )
var ( // How often to check for shutdowns. DeathClock = 200 * time.Millisecond // SIP egress msg length must not exceed me. If you are brave and use jumbo // frames you can increase this value. MTU = 1450 // Maximum number SRV/Redirects/Etc. to entertain. More accurately, this is // the maximum number of time's we're allowed to enter the "calling" state. MaxAttempts = 10 // This is how long to wait (in nanoseconds) for a 100 trying response before // retransmitting the invite. Multiply this by RetransmitAttempts and that's // how long it'll be before we try another server. That might seem like a // very long time but happy networks facilitate fast failover by sending hard // errors (ICMP, 480, 500-599) TryingTimeout = 500 * time.Millisecond // How many times to attempt to retransmit before moving on. RetransmitAttempts = 2 // Number of nanoseconds (across all attempts) before we give up trying to // connect a call. This doesn't mean the call has to have been answered but // rather has moved beyond the "calling" state and doesn't go back. GiveupTimeout = 3 * time.Second // TODO(jart): How long to wait before refreshing a call with a re-INVITE // message. RefreshTimeout = 15 * time.Minute // How many times are proxies allowed to forward a message. MaxForwards int = 70 // Approx. how long the transaction engine remembers old Call-IDs to prevent // a retransmit from accidentally opening a new dialog. CallIDBanDuration = 35 * time.Second // Approx. how often to sweep old transactions from ban list. CallIDBanSweepDuration = 5 * time.Second // Should the transport layer add timestamps to Via headers (µsi/µse = UTC // microseconds since unix epoch ingress/egress). ViaTimestampTagging = true // Use this feature to print out raw sip messages the moment they are // sent/received by the transport layer. TransportTrace = (os.Getenv("TPORT_LOG") == "true") )
Returns true if `ack` can be considered an appropriate response to `msg`. We don't enforce a matching Via because some VoIP software will generate a new branch for ACKs.
func ResponseMatch ¶
Returns true if `resp` can be considered an appropriate response to `msg`. Do not use for ACKs.
type AddressRoute ¶
Dialog represents an outbound SIP phone call.
Transport sends and receives SIP messages over UDP with stateless routing.
func NewTransport ¶
Creates a new stateless network mechanism for transmitting and receiving SIP signalling messages.
contact is a SIP address, e.g. "<sip:184.108.40.206>", that tells how to bind sockets. If contact.Uri.Port is 0, it'll be mutated with a randomly selected port. This value is also used for contact headers which tell other user-agents where to send responses and hence should only contain an IP or canonical address.