emiago / sipgo Goto Github PK
View Code? Open in Web Editor NEWSIP library for writing fast SIP services in GO
License: BSD 2-Clause "Simplified" License
SIP library for writing fast SIP services in GO
License: BSD 2-Clause "Simplified" License
If recv a register request, but server did not found handler by method, this tx will be blocked, and server routinue blocked.
The next response will not be reponsed.
`func (srv *Server) handleRequest(req *sip.Request, tx sip.ServerTransaction) {
for _, mid := range srv.requestMiddlewares {
mid(req)
}
handler := srv.getHandler(req.Method)
if handler == nil {
srv.log.Warn().Msg("SIP request handler not found")
res := sip.NewResponseFromRequest(req, 405, "Method Not Allowed", nil)
if err := srv.WriteResponse(res); err != nil {
srv.log.Error().Msgf("respond '405 Method Not Allowed' failed: %s", err)
}
//. no timer trigger. or we shoud destroy this tx.
for {
select {
case <-tx.Done():
srv.log.Warn().Msgf("recv tx.Done() tx:%s", tx)
return
case err, ok := <-tx.Errors():
srv.log.Warn().Msgf("recv tx.Errors() tx:%s, err:%s", tx, err)
if !ok {
return
}
srv.log.Warn().Msgf("error from SIP server transaction %s: %s", tx, err)
}
}
}
handler(req, tx)
if tx != nil {
// Must be called to prevent any transaction leaks
tx.Terminate()
}
}`
I have some trouble to understand this comment:
“Multiple readers makes problem, which can delay writing response”
Why multi UDPReadWorkers Goroutine can delay writing response?
Server may get sipVersion ends with LF if request start line ends with LF ranther than CRLF.
Although it's documented here. https://www.rfc-editor.org/rfc/rfc3261.html#section-7
If consider return err while startline ends with LF or CR ?
SIP/2.0 200 OK Via: SIP/2.0/UDP 192.168.10.8:60719;rport=60719;branch=z9hG4bK1377739937 From: <sip:34020000002000000719@3402000000>;tag=1534571172 To: <sip:34020000002000000719@3402000000>;tag=b70dda5e-f487-4b46-8e21-42b7c5dfcfa0 Call-ID: 1566767517 CSeq: 1 REGISTER Content-Length: 0
Building client needs more features.
Example or some wrapper for handling dialogs
Hello,
Are there any examples available of basic server with authentication or a client ?
Besides the 2 examples that are there.
Thanks!
Performance dropped from v0.6.0 due to forcing on generate new via branch.
sip.GenerateBranch function needs to be fixed and optimized to remove allocs
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.