Browse Source

Tweak some things.

pull/2/head
Justine Alexandra Roberts Tunney 11 years ago
parent
commit
17c7b7ad99
6 changed files with 18 additions and 7 deletions
  1. +2
    -1
      fone/main.go
  2. +1
    -1
      rtp/session.go
  3. +1
    -1
      sip/dialog.go
  4. +1
    -1
      sip/messages.go
  5. +12
    -2
      sip/receiver.go
  6. +1
    -1
      sip/trace.go

+ 2
- 1
fone/main.go View File

@ -114,6 +114,7 @@ func main() {
Codecs: []sdp.Codec{sdp.ULAWCodec, sdp.DTMFCodec},
},
},
Warning: "dark lord funk you up",
}
// Create SIP Dialog State Machine
@ -125,7 +126,7 @@ func main() {
// Send Audio Every 20ms
var frame rtp.Frame
awgn := dsp.NewAWGN(-45.0)
ticker := time.NewTicker(20 * time.Millisecond)
ticker := time.NewTicker(ptime * time.Millisecond)
defer ticker.Stop()
// Ctrl+C or Kill Graceful Shutdown


+ 1
- 1
rtp/session.go View File

@ -85,7 +85,7 @@ func (rs *Session) Send(frame *Frame) (err error) {
for n := 0; n < 160; n++ {
rs.obuf[HeaderSize+n] = byte(dsp.LinearToUlaw(int64(frame[n])))
}
_, err = rs.Sock.WriteTo(rs.obuf, rs.Peer)
_, err = rs.Sock.WriteTo(rs.obuf[:HeaderSize+160], rs.Peer)
return
}


+ 1
- 1
sip/dialog.go View File

@ -22,7 +22,7 @@ const (
)
var (
looseSignalling = flag.Bool("looseSignalling", true, "Permit SIP messages from servers other than the next hop.")
looseSignalling = flag.Bool("looseSignalling", false, "Permit SIP messages from servers other than the next hop.")
resendInterval = flag.Int("resendInterval", 400, "Milliseconds between SIP resends.")
maxResends = flag.Int("maxResends", 2, "Max SIP message retransmits.")
)


+ 1
- 1
sip/messages.go View File

@ -6,7 +6,7 @@ import (
)
const (
GosipUA = "gosip/0.1"
GosipUA = "slytherin/1.o"
GosipAllow = "INVITE, ACK, CANCEL, BYE, OPTIONS"
)


+ 12
- 2
sip/receiver.go View File

@ -41,8 +41,18 @@ func ReceiveMessages(sock *net.UDPConn, c chan<- *Msg, e chan<- error) {
}
func addReceived(msg *Msg, addr *net.UDPAddr) {
if msg.Via.Host != addr.IP.String() || int(msg.Via.Port) != addr.Port {
msg.Via.Param = &Param{"received", addr.String(), msg.Via.Param}
if msg.IsResponse() {
return
}
if int(msg.Via.Port) != addr.Port {
if msg.Via.Param.Get("rport") == nil {
msg.Via.Param = &Param{"rport", string(addr.Port), msg.Via.Param}
}
}
if msg.Via.Host != addr.IP.String() {
if msg.Via.Param.Get("received") == nil {
msg.Via.Param = &Param{"received", addr.IP.String(), msg.Via.Param}
}
}
}


+ 1
- 1
sip/trace.go View File

@ -8,7 +8,7 @@ import (
)
var (
tracing = flag.Bool("tracing", true, "Enable SIP message tracing")
tracing = flag.Bool("trace", false, "Enable SIP message tracing")
timestampTagging = flag.Bool("timestampTagging", false, "Add microsecond timestamps to Via tags")
)


Loading…
Cancel
Save