Browse Source

Customize SIP parsing

Replace the package name to cresta
Remove SDP parsing
pull/29/head
Caibin Chen 2 years ago
parent
commit
c379ac1a3c
27 changed files with 5435 additions and 3808 deletions
  1. +4
    -4
      dialog/dialog.go
  2. +2
    -2
      dialog/messages.go
  3. +1
    -1
      dialog/receiver.go
  4. +2
    -2
      dialog/route.go
  5. +2
    -2
      dialog/transport.go
  6. +1
    -1
      dsp/awgn_test.go
  7. +1
    -1
      dsp/dsp_test.go
  8. +4
    -4
      example/echo/echo_test.go
  9. +5
    -5
      example/echo2/echo2_test.go
  10. +6
    -6
      example/echo3/echo3_test.go
  11. +2
    -2
      example/options/options_test.go
  12. +1
    -1
      example/rawsip/rawsip_test.go
  13. +6
    -6
      fone/main.go
  14. +2
    -2
      go.mod
  15. +2
    -0
      go.sum
  16. +2
    -2
      rtp/session.go
  17. +1
    -1
      sdp/origin.go
  18. +1
    -1
      sdp/sdp.go
  19. +1
    -1
      sdp/sdp_test.go
  20. +1
    -1
      sip/addr.go
  21. +1
    -1
      sip/addr_test.go
  22. +5382
    -3749
      sip/msg_parse.go
  23. +1
    -9
      sip/msg_parse.rl
  24. +1
    -1
      sip/msg_test.go
  25. +1
    -1
      sip/uri.go
  26. +1
    -1
      sip/uri_test.go
  27. +1
    -1
      sip/via.go

+ 4
- 4
dialog/dialog.go View File

@ -24,10 +24,10 @@ import (
"net"
"time"
"github.com/jart/gosip/rtp"
"github.com/jart/gosip/sdp"
"github.com/jart/gosip/sip"
"github.com/jart/gosip/util"
"github.com/cresta/gosip/rtp"
"github.com/cresta/gosip/sdp"
"github.com/cresta/gosip/sip"
"github.com/cresta/gosip/util"
)
const (


+ 2
- 2
dialog/messages.go View File

@ -17,8 +17,8 @@ package dialog
import (
"log"
"github.com/jart/gosip/sip"
"github.com/jart/gosip/util"
"github.com/cresta/gosip/sip"
"github.com/cresta/gosip/util"
)
const (


+ 1
- 1
dialog/receiver.go View File

@ -20,7 +20,7 @@ import (
"strconv"
"time"
"github.com/jart/gosip/sip"
"github.com/cresta/gosip/sip"
)
func ReceiveMessages(sock *net.UDPConn, c chan<- *sip.Msg, e chan<- error) {


+ 2
- 2
dialog/route.go View File

@ -20,8 +20,8 @@ import (
"net"
"strconv"
"github.com/jart/gosip/sip"
"github.com/jart/gosip/util"
"github.com/cresta/gosip/sip"
"github.com/cresta/gosip/util"
)
type AddressRoute struct {


+ 2
- 2
dialog/transport.go View File

@ -22,8 +22,8 @@ import (
"net"
"time"
"github.com/jart/gosip/sip"
"github.com/jart/gosip/util"
"github.com/cresta/gosip/sip"
"github.com/cresta/gosip/util"
)
// Transport sends and receives SIP messages over UDP with stateless routing.


+ 1
- 1
dsp/awgn_test.go View File

@ -17,7 +17,7 @@ package dsp_test
import (
"testing"
"github.com/jart/gosip/dsp"
"github.com/cresta/gosip/dsp"
)
func TestAWGN(t *testing.T) {


+ 1
- 1
dsp/dsp_test.go View File

@ -17,7 +17,7 @@ package dsp_test
import (
"testing"
"github.com/jart/gosip/dsp"
"github.com/cresta/gosip/dsp"
)
func TestL16MixSat160(t *testing.T) {


+ 4
- 4
example/echo/echo_test.go View File

@ -153,10 +153,10 @@ import (
"testing"
"time"
"github.com/jart/gosip/rtp"
"github.com/jart/gosip/sdp"
"github.com/jart/gosip/sip"
"github.com/jart/gosip/util"
"github.com/cresta/gosip/rtp"
"github.com/cresta/gosip/sdp"
"github.com/cresta/gosip/sip"
"github.com/cresta/gosip/util"
)
func TestCallToEchoApp(t *testing.T) {


+ 5
- 5
example/echo2/echo2_test.go View File

@ -22,11 +22,11 @@ import (
"testing"
"time"
"github.com/jart/gosip/dialog"
"github.com/jart/gosip/dsp"
"github.com/jart/gosip/rtp"
"github.com/jart/gosip/sdp"
"github.com/jart/gosip/sip"
"github.com/cresta/gosip/dialog"
"github.com/cresta/gosip/dsp"
"github.com/cresta/gosip/rtp"
"github.com/cresta/gosip/sdp"
"github.com/cresta/gosip/sip"
)
func TestCallToEchoApp(t *testing.T) {


+ 6
- 6
example/echo3/echo3_test.go View File

@ -21,12 +21,12 @@ import (
"testing"
"time"
"github.com/jart/gosip/dialog"
"github.com/jart/gosip/dsp"
"github.com/jart/gosip/rtp"
"github.com/jart/gosip/sdp"
"github.com/jart/gosip/sip"
"github.com/jart/gosip/util"
"github.com/cresta/gosip/dialog"
"github.com/cresta/gosip/dsp"
"github.com/cresta/gosip/rtp"
"github.com/cresta/gosip/sdp"
"github.com/cresta/gosip/sip"
"github.com/cresta/gosip/util"
)
func TestCallToEchoApp(t *testing.T) {


+ 2
- 2
example/options/options_test.go View File

@ -22,8 +22,8 @@ import (
"testing"
"time"
"github.com/jart/gosip/sip"
"github.com/jart/gosip/util"
"github.com/cresta/gosip/sip"
"github.com/cresta/gosip/util"
)
func TestOptions(t *testing.T) {


+ 1
- 1
example/rawsip/rawsip_test.go View File

@ -24,7 +24,7 @@ import (
"testing"
"time"
"github.com/jart/gosip/util"
"github.com/cresta/gosip/util"
)
// An 'OPTIONS' message is used to:


+ 6
- 6
fone/main.go View File

@ -34,12 +34,12 @@ import (
"time"
"unsafe"
"github.com/jart/gosip/dialog"
"github.com/jart/gosip/dsp"
"github.com/jart/gosip/rtp"
"github.com/jart/gosip/sdp"
"github.com/jart/gosip/sip"
"github.com/jart/gosip/util"
"github.com/cresta/gosip/dialog"
"github.com/cresta/gosip/dsp"
"github.com/cresta/gosip/rtp"
"github.com/cresta/gosip/sdp"
"github.com/cresta/gosip/sip"
"github.com/cresta/gosip/util"
)
const (


+ 2
- 2
go.mod View File

@ -1,3 +1,3 @@
module github.com/jart/gosip
module github.com/cresta/gosip
go 1.14
go 1.20

+ 2
- 0
go.sum View File

@ -0,0 +1,2 @@
github.com/jart/gosip v0.0.0-20220818224804-29801cedf805 h1:mAaAQei2Kf679W1Zc65tkAEC8z4C6OZYWzJxVEB8mc8=
github.com/jart/gosip v0.0.0-20220818224804-29801cedf805/go.mod h1:pLqHw0l24s7B/i+bBauWzg3oF8z+78wfh/8MnRce81Q=

+ 2
- 2
rtp/session.go View File

@ -24,8 +24,8 @@ import (
"strconv"
"strings"
"github.com/jart/gosip/dsp"
"github.com/jart/gosip/sdp"
"github.com/cresta/gosip/dsp"
"github.com/cresta/gosip/sdp"
)
const (


+ 1
- 1
sdp/origin.go View File

@ -17,7 +17,7 @@ package sdp
import (
"bytes"
"github.com/jart/gosip/util"
"github.com/cresta/gosip/util"
)
// Origin represents the session origin (o=) line of an SDP. Who knows what


+ 1
- 1
sdp/sdp.go View File

@ -74,7 +74,7 @@ import (
"strconv"
"strings"
"github.com/jart/gosip/util"
"github.com/cresta/gosip/util"
)
const (


+ 1
- 1
sdp/sdp_test.go View File

@ -18,7 +18,7 @@ import (
"fmt"
"testing"
"github.com/jart/gosip/sdp"
"github.com/cresta/gosip/sdp"
)
type sdpTest struct {


+ 1
- 1
sip/addr.go View File

@ -35,7 +35,7 @@ package sip
import (
"bytes"
"github.com/jart/gosip/util"
"github.com/cresta/gosip/util"
)
// Represents a SIP Address Linked List


+ 1
- 1
sip/addr_test.go View File

@ -19,7 +19,7 @@ import (
"reflect"
"testing"
"github.com/jart/gosip/sip"
"github.com/cresta/gosip/sip"
)
type addrTest struct {


+ 5382
- 3749
sip/msg_parse.go
File diff suppressed because it is too large
View File


+ 1
- 9
sip/msg_parse.rl View File

@ -64,15 +64,7 @@ func ParseMsg(data []byte) (msg *Msg, err error) {
if clen != len(data) - p {
return nil, errors.New(fmt.Sprintf("Content-Length incorrect: %d != %d", clen, len(data) - p))
}
if ctype == sdp.ContentType {
ms, err := sdp.Parse(string(data[p:len(data)]))
if err != nil {
return nil, err
}
msg.Payload = ms
} else {
msg.Payload = &MiscPayload{T: ctype, D: data[p:len(data)]}
}
msg.Payload = &MiscPayload{T: ctype, D: data[p:len(data)]}
}
return msg, nil
}


+ 1
- 1
sip/msg_test.go View File

@ -18,7 +18,7 @@ import (
"reflect"
"testing"
"github.com/jart/gosip/sip"
"github.com/cresta/gosip/sip"
)
const (


+ 1
- 1
sip/uri.go View File

@ -37,7 +37,7 @@ package sip
import (
"bytes"
"github.com/jart/gosip/util"
"github.com/cresta/gosip/util"
)
const (


+ 1
- 1
sip/uri_test.go View File

@ -19,7 +19,7 @@ import (
"reflect"
"testing"
"github.com/jart/gosip/sip"
"github.com/cresta/gosip/sip"
)
type uriTest struct {


+ 1
- 1
sip/via.go View File

@ -20,7 +20,7 @@ import (
"bytes"
"strconv"
"github.com/jart/gosip/util"
"github.com/cresta/gosip/util"
)
// Example: SIP/2.0/UDP 1.2.3.4:5060;branch=z9hG4bK556f77e6.


Loading…
Cancel
Save