diff --git a/fone/main.go b/fone/main.go index 95fb6fd..a95ce11 100644 --- a/fone/main.go +++ b/fone/main.go @@ -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 diff --git a/rtp/session.go b/rtp/session.go index aa4e11f..2bc271b 100644 --- a/rtp/session.go +++ b/rtp/session.go @@ -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 } diff --git a/sip/dialog.go b/sip/dialog.go index 18e166d..4e404cf 100755 --- a/sip/dialog.go +++ b/sip/dialog.go @@ -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.") ) diff --git a/sip/messages.go b/sip/messages.go index f821d16..a2d54e8 100644 --- a/sip/messages.go +++ b/sip/messages.go @@ -6,7 +6,7 @@ import ( ) const ( - GosipUA = "gosip/0.1" + GosipUA = "slytherin/1.o" GosipAllow = "INVITE, ACK, CANCEL, BYE, OPTIONS" ) diff --git a/sip/receiver.go b/sip/receiver.go index 0656550..69405ad 100644 --- a/sip/receiver.go +++ b/sip/receiver.go @@ -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} + } } } diff --git a/sip/trace.go b/sip/trace.go index 7219244..8aa349a 100644 --- a/sip/trace.go +++ b/sip/trace.go @@ -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") )