GithubHelp home page GithubHelp logo

1lann / go-sip Goto Github PK

View Code? Open in Web Editor NEW
108.0 7.0 24.0 27 KB

A Go (golang) library to interface with SIP (Session Initiation Protocol) as defined in RFC 3261.

License: MIT License

Go 100.00%
go sip

go-sip's Introduction

go-sip

Go Report Card GoDoc

This library is unmaintained, I highly recommend you against using this as I wrote this as a very quick hacky high school project. Use https://github.com/jart/gosip (which honestly looks magnitudes better than mine) or something instead

A Go (golang) library to interface with SIP (Session Initiation Protocol) as defined in RFC 3261. This library is a work in progress, and strives to follow Go standards. This library may or may not ever be finished.

License

go-sip is licensed under the MIT License which can be found here.

go-sip's People

Contributors

1lann avatar glaslos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-sip's Issues

运行example_server.go报错

github.com/1lann/go-sip/server

..\lineme-server\other\src\github.com\1lann\go-sip\server\invite.go:65:24: cannot use to (type *sipnet.Conn) as type net.Conn in argument to initialRequest.WriteTo:
*sipnet.Conn does not implement net.Conn (missing LocalAddr method)
..\lineme-server\other\src\github.com\1lann\go-sip\server\invite.go:82:16: cannot use to (type *sipnet.Conn) as type net.Conn in argument to req.WriteTo:
*sipnet.Conn does not implement net.Conn (missing LocalAddr method)
..\lineme-server\other\src\github.com\1lann\go-sip\server\invite.go:124:16: cannot use from (type *sipnet.Conn) as type net.Conn in argument to req.WriteTo:
*sipnet.Conn does not implement net.Conn (missing LocalAddr method)
..\lineme-server\other\src\github.com\1lann\go-sip\server\invite.go:177:21: cannot use toConn (type *sipnet.Conn) as type net.Conn in argument to r.WriteTo:
*sipnet.Conn does not implement net.Conn (missing LocalAddr method)

运行example_server.go报错

github.com/1lann/go-sip/server

..\lineme-server\other\src\github.com\1lann\go-sip\server\invite.go:65:24: cannot use to (type *sipnet.Conn) as type net.Conn in argument to initialRequest.WriteTo:
*sipnet.Conn does not implement net.Conn (missing LocalAddr method)
..\lineme-server\other\src\github.com\1lann\go-sip\server\invite.go:82:16: cannot use to (type *sipnet.Conn) as type net.Conn in argument to req.WriteTo:
*sipnet.Conn does not implement net.Conn (missing LocalAddr method)
..\lineme-server\other\src\github.com\1lann\go-sip\server\invite.go:124:16: cannot use from (type *sipnet.Conn) as type net.Conn in argument to req.WriteTo:
*sipnet.Conn does not implement net.Conn (missing LocalAddr method)
..\lineme-server\other\src\github.com\1lann\go-sip\server\invite.go:177:21: cannot use toConn (type *sipnet.Conn) as type net.Conn in argument to r.WriteTo:
*sipnet.Conn does not implement net.Conn (missing LocalAddr method)

Possible deadlock

At udpJanitor() function.
The thread hold l.udpPoolMutex.Lock(). then check udpPoll for whether there is a UDP connection got timed out.
If there is, the thread call conn.Close() to close the connection.

l.udpPoolMutex.Lock()
for address, conn := range l.udpPool {
if time.Now().Sub(conn.LastMessage) > time.Second*30 {
// Disconnect
conn.Close()

However, at conn.Close()

go-sip/sipnet/connection.go

Lines 198 to 216 in 68e86c6

func (c *Conn) Close() error {
if c.Closed {
return nil
}
c.Closed = true
if c.Transport == "udp" {
if c.Listener != nil {
c.Listener.udpPoolMutex.Lock()
delete(c.Listener.udpPool, c.Address.String())
c.Listener.udpPoolMutex.Unlock()
}
close(c.UdpReceiver)
return nil
}
return c.Conn.Close()
}

if c.Listener != nil . This function will try to hold l.udpPoolMutex too.

This cause a deadlock and the program will stop listening for new connections.
Tested on go version go1.12.7 linux/amd64.

I'd like to create a pull request however I'm not familiar with Golang. So any help would be much appreciate. Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.