Skip to content

Commit

Permalink
initial SIP test
Browse files Browse the repository at this point in the history
  • Loading branch information
glaslos committed Jan 6, 2017
1 parent 8e204e4 commit 7fc86a5
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions sip.go
@@ -0,0 +1,29 @@
package glutton

import (
"bytes"
"log"
"net"

"github.com/1lann/go-sip/server"
"github.com/1lann/go-sip/sipnet"
)

func handleSIP(netConn net.Conn) {
sipConn := &sipnet.Conn{}
buf := []byte{}
rd := bytes.NewReader(buf)
req, err := sipnet.ReadRequest(rd)
if err != nil {
log.Println(err)
}
log.Printf("SIP method: %s", req.Method)
switch req.Method {
case sipnet.MethodRegister:
log.Println("handling SIP register")
server.HandleRegister(req, sipConn)
case sipnet.MethodInvite:
log.Println("handling SIP invite")
server.HandleInvite(req, sipConn)
}
}

0 comments on commit 7fc86a5

Please sign in to comment.