-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] services : sip: implementing sip protocol #406
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #406 +/- ##
=========================================
Coverage ? 41.67%
=========================================
Files ? 78
Lines ? 8796
Branches ? 0
=========================================
Hits ? 3666
Misses ? 4705
Partials ? 425
Continue to review full report at Codecov.
|
services/sip/sip.go
Outdated
|
||
s.Method = args[0] | ||
s.Uri = args[1] | ||
s.SIPVersion = strings.TrimSpace(args[2]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add those values also in the event? eg sip.version, sip.method and sip.uri
services/sip/sip.go
Outdated
return ErrBadMessage | ||
} | ||
|
||
fn := sipRequest[s.Method] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if !ok {
// not supported
return ErrBadMessage
}```
services/sip/sip.go
Outdated
|
||
ch pushers.Channel | ||
|
||
Method, Uri, SIPVersion, Username, Domain string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cannot put values here, those are shared across all connections.
services/sip/request.go
Outdated
} | ||
|
||
func (s *sipService) checkRequest(line string) bool { | ||
ok := s.parseURI() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just use url.Parse here?
|
||
args := strings.Split(line, " ") | ||
if len(args) != 3 { | ||
return ErrBadMessage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should send a sip response back here.
import "fmt" | ||
|
||
func (s *sipService) OptionMethod() string { | ||
return fmt.Sprintf(` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it easier to return a http.Response? then you can also use resp.WriteTo(c)
take a look at this library, maybe useful: https://github.com/marv2097/siprocket or something comparable |
No description provided.