Skip to content

Commit

Permalink
Try to debug it
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerlong committed Feb 22, 2021
1 parent 4b68dd6 commit bb9d78d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions softphone.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ func (softphone *Softphone) Answer(inviteMessage SipMessage) {
var re = regexp.MustCompile(`\r\na=rtpmap:111 OPUS/48000/2\r\n`)
// to workaround a pion/webrtc bug: https://github.com/pion/webrtc/issues/879
sdp := re.ReplaceAllString(inviteMessage.Body, "\r\na=rtpmap:111 OPUS/48000/2\r\na=mid:0\r\n")
var re2 = regexp.MustCompile("\r\nm=audio ")
sdp = re2.ReplaceAllString(sdp, "\r\na=ice-lite\r\nm=audio ")
offer := webrtc.SessionDescription{
Type: webrtc.SDPTypeOffer,
SDP: sdp,
Expand Down Expand Up @@ -134,10 +136,12 @@ func (softphone *Softphone) Answer(inviteMessage SipMessage) {
if err != nil {
panic(err)
}
gatherComplete := webrtc.GatheringCompletePromise(peerConnection)
err = peerConnection.SetLocalDescription(answer)
if err != nil {
panic(err)
}
<-gatherComplete

peerConnection.OnTrack(func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) {
log.Println("OnTrack")
Expand Down

0 comments on commit bb9d78d

Please sign in to comment.