Browse Source

Use loose signalling and fix trace logging.

pull/2/head
Justine Alexandra Roberts Tunney 11 years ago
parent
commit
716dad5d8e
4 changed files with 6 additions and 8 deletions
  1. +2
    -2
      sip/dialog.go
  2. +1
    -1
      sip/receiver.go
  3. +2
    -4
      sip/trace.go
  4. +1
    -1
      sip/transport.go

+ 2
- 2
sip/dialog.go View File

@ -21,7 +21,7 @@ const (
)
var (
looseSignalling = flag.Bool("looseSignalling", false, "Permit SIP messages from servers other than the next hop.")
looseSignalling = flag.Bool("looseSignalling", true, "Permit SIP messages from servers other than the next hop.")
resendInterval = flag.Int("resendInterval", 200, "Milliseconds between SIP resends.")
maxResends = flag.Int("maxResends", 2, "Max SIP message retransmits.")
)
@ -388,7 +388,7 @@ func (dls *dialogState) send(msg *Msg) bool {
dls.b.Reset()
msg.Append(&dls.b)
if *tracing {
trace("send", dls.b.String(), dls.sock.RemoteAddr(), ts)
trace("send", dls.b.String(), dls.sock.RemoteAddr())
}
_, err := dls.sock.Write(dls.b.Bytes())
if err != nil {


+ 1
- 1
sip/receiver.go View File

@ -21,7 +21,7 @@ func ReceiveMessages(sock *net.UDPConn, c chan<- *Msg, e chan<- error) {
ts := time.Now()
packet := string(buf[0:amt])
if *tracing {
trace("recv", packet, addr, ts)
trace("recv", packet, addr)
}
msg, err := ParseMsg(packet)
if err != nil {


+ 2
- 4
sip/trace.go View File

@ -5,7 +5,6 @@ import (
"log"
"net"
"strings"
"time"
)
var (
@ -13,7 +12,7 @@ var (
timestampTagging = flag.Bool("timestampTagging", false, "Add microsecond timestamps to Via tags")
)
func trace(dir, pkt string, addr net.Addr, t time.Time) {
func trace(dir, pkt string, addr net.Addr) {
size := len(pkt)
bar := strings.Repeat("-", 72)
suffix := "\n"
@ -21,12 +20,11 @@ func trace(dir, pkt string, addr net.Addr, t time.Time) {
suffix = ""
}
log.Printf(
"%s %d bytes to %s/%s at %s\n"+
"%s %d bytes from %s/%s\n"+
"%s\n"+
"%s%s"+
"%s\n",
dir, size, addr.Network(), addr.String(),
t.Format(time.RFC3339Nano),
bar,
pkt, suffix,
bar)


+ 1
- 1
sip/transport.go View File

@ -73,7 +73,7 @@ func (tp *Transport) Send(msg *Msg) error {
var b bytes.Buffer
msg.Append(&b)
if *tracing {
trace("send", b.String(), addr, ts)
trace("send", b.String(), addr)
}
_, err = tp.Sock.WriteTo(b.Bytes(), addr)
if err != nil {


Loading…
Cancel
Save