Safari doesn't send audio packets

229 views
Skip to first unread message

richard...@thisisdrum.com

unread,
Nov 10, 2017, 11:43:42 AM11/10/17
to SIP.js
Hello,

I'm having problems getting the audio to flow with SIP.js 0.8.3 on Safari to a FreeSWITCH MSU.

I've tried with the minimal Alice/Bob application from the https://sipjs.com/ homepage. (I did modify the Simple.js code so that registration is not required.)

On investigation I have found that Safari defines the addTrack() method on the peerConnection, but if we use this path in SessionDescriptionHandler::getDescription() then nothing is added to the peerConnection local stream (as evidenced by printing peerConnection.getLocalStreams() at regular intervals). Firefox will create a local stream after the tracks are added.

If I modify SIP.js to use the peerConnection.addStream() method then both of the audio and video tracks are added to the stream. But, I still cannot see an outgoing audio stream. I am using the PCMU codec for audio.

In both of these cases the video works fine!! In the absence of a "chrome://webrtc-internals" page in Safari I have checked the delivery of the audio RTP packets in FreeSWITCH and Wireshark.

I can't see any glaring problems with the SIP.js code but it seems that many application (eg. https://appr.tc) are working fine on Safari! I attached the minimal webpage that I have been using.

Has anyone got SIP.js 0.8.3 working on Safari?

Thanks,
Richard

Demo page:
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>WebRTC Demo</title>
<script src="sip.js"></script>

</head>
<body>

<video id="video-of-bob"></video>
<video id="video-of-alice" muted="muted"></video>
<button id="alice-video-button" class="right" type="button">video</button>
<script>

var domain = 'example.com'; //CHANGED
var aliceURI = 'alice.' + window.token + '@' + domain;
var aliceName = 'Alice';

var bobURI = "sip:li...@example.com"; //CHANGED
var bobName = 'Bob';

// Function: createSimple
// creates a SIP.js Simple instance with the given arguments plugged into the
// configuration. This is a standard Simple instance for WebRTC calls.
//
// Arguments:
// callerURI: the URI of the caller, aka, the URI that belongs to this user.
// displayName: what name we should display the user as
// remoteVideo: the DOM element id of the video for the remote
// buttonId: the DOM element id of the button for that user
function createSimple(callerURI, displayName, target, remoteVideo, buttonId) {
var remoteVideoElement = document.getElementById(remoteVideo);
var button = document.getElementById(buttonId);

var configuration = {
media: {
remote: {
video: remoteVideoElement,
// Need audio to be not null to do audio & video instead of just video
audio: remoteVideoElement
}
},
ua: {
wsServers: "wss://example.com/websocket", //ADDED
register: false, //ADDED
traceSip: true,
uri: callerURI,
displayName: displayName,
userAgentString: SIP.C.USER_AGENT + " sipjs.com"
}
};
var simple = new SIP.WebRTC.Simple(configuration);

button.addEventListener('click', function() {
// No current call up
if (simple.state === SIP.WebRTC.Simple.C.STATUS_NULL ||
simple.state === SIP.WebRTC.Simple.C.STATUS_COMPLETED) {
simple.call(target);
} else {
simple.hangup();
}
});

return simple;
}

var aliceSimple = createSimple(aliceURI, aliceName, bobURI, 'video-of-bob', 'alice-video-button');

</script>
</body>
</html>
```

Eric Green

unread,
Nov 10, 2017, 2:55:30 PM11/10/17
to SIP.js
Hi Richard,

I just retested Safari with Simple and it works for me. I am running Safari Version 11.0.1 (12604.3.5.1.1). This is a snippet of my test code. Let me know if that helps at all.

-Eric Green

Richard Screene

unread,
Nov 10, 2017, 3:39:58 PM11/10/17
to sip...@googlegroups.com

Thanks Eric, i'll check it out on Monday!

--
You received this message because you are subscribed to a topic in the Google Groups "SIP.js" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sip_js/Cax3oYUI8xs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sip_js+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sip_js/41040b33-409a-4765-8a04-7b56aa73a1a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Richard Screene

unread,
Nov 13, 2017, 10:59:51 AM11/13/17
to sip...@googlegroups.com
Even with your code I couldn't get it to work!
In desperation I tried it with the latest Safari Technology Preview and it worked!!!!
So, it looks like a Safari fault. Although, I can't explain why it worked for you!

Thanks for your help,
Richard

Eric Green

unread,
Nov 13, 2017, 11:07:49 AM11/13/17
to SIP.js
It must be something with your Safari setup. I also tested our demo on sipjs.com homepage and that worked. I had someone from the marketing team on another Mac also test the homepage demo and it worked for them as well. 

Eric Green

unread,
Nov 15, 2017, 1:26:58 PM11/15/17
to SIP.js
Just had something happen in production Safari where it was receiving audio, but not sending. I had to close all other browsers and Spotify, then it started working again with no code changes. Must be something funky with the way that it is acquiring the media i/o on the underlying system. Figured I would report here for other users experiencing this. I cannot reproduce consistently, and I see no obvious fix in the JS layer. This is probably outside of our control.

-Eric Green
Reply all
Reply to author
Forward
0 new messages