Raghuvendra Kumar
Raghuvendra Kumar

Reputation: 87

no audio with chrome using sip.js based webrtc app and asterisk 11.11.0. Working fine with firefox and Opera

I am working on webrtc using sip.js and asterisk. My webrtc application is working fine with firefox 31 and opera 22.0.1471.70. But when i use my webrtc application with chrome (Version 37.0.2062.58 beta-m (64-bit)). Everything seems fine but there is no audio. I have also tried 32 version of the latest stable chrome browser. Issue remains the same.

Setup Details:-

1. Asterisk 32 bit - 11.11.0
2. Sip-0.6.1.js 
3. Chrome (Version 37.0.2062.58 beta-m (64-bit)), Firefox 31.0 and opera 22.0.1471.70.
4. Cent O.S 6.5 (32 bit)

Asterisk Configuration:

http.conf :-

[general]

enabled=yes
bindaddr=0.0.0.0
bindport=8088

sip.conf :-

[1061] ; This will be the legacy SIP client
type=friend
username=1061
host=dynamic
secret=password
context=default


[1090] ; This will be WebRTC client
type=friend
username=1090 ; The Auth user for SIP.js
host=dynamic ; Allows any host to register
secret=testsip ; The SIP Password for SIP.js
encryption=yes ; Tell Asterisk to use encryption for this peer
avpf=yes ; Tell Asterisk to use AVPF for this peer
icesupport=yes ; Tell Asterisk to use ICE for this peer
context=default ; Tell Asterisk which context to use when this peer is dialing
directmedia=no ; Asterisk will relay media for this peer
transport=udp,ws ; Asterisk will allow this peer to register on UDP or WebSockets
force_avp=yes ; Force Asterisk to use avp. Introduced in Asterisk 11.11
dtlsenable=yes ; Tell Asterisk to enable DTLS for this peer
dtlsverify=no ; Tell Asterisk to not verify your DTLS certs
dtlscertfile=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS cert file is
dtlsprivatekey=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS private key is
dtlssetup=actpass ; Tell Asterisk to use actpass SDP parameter when setting up DTLS
nat=no
disallow=all
allow=ulaw

extension.conf 
[default]
exten => 1060,1,Dial(SIP/1060) ; Dialing 1060 will call the SIP client registered to 1060
exten => 1061,1,Dial(SIP/1061) ; Dialing 1061 will call the SIP client registered to 1061

webrtc application code:-

call.js code:-

( function()
  {
     var session;

     var endButton = document.getElementById('endCall');

     endButton.addEventListener("click", function ()
                                         {
                                            session.bye();
                                            alert ("Call Terminated");
                                         }
                                       , false
                               );


     //Registration and websocket connectivity details for the useragent

     var config = {
                        // Asterisk IP address
                        uri: '[email protected]',

                        // Asterisk IP address,
                        // and replace the port with your Asterisk port from the http.conf file
                        wsServers: 'ws://192.168.56.129:8088/ws',

                        // Replace this with the username from your sip.conf file
                        authorizationUser: '1090',

                        // Replace this with the password from your sip.conf file
                        password: 'testsip',

                        // Enable sip traces on js console
                        traceSip: true,


                        stunServers: 'null',
                 };


     //Creates the anonymous user agent so that you can make calls
     var userAgent = new SIP.UA (config);

    //Here you determine whether the call has video and audio
     var options = {

                     media: {
                              constraints: {
                                             audio: true,
                                             video: false,
                                           },
                              render: {
                                        remote: {
                                                   audio: document.getElementById('remoteAudio')
                                                },

                                        local:  {
                                                   audio: document.getElementById('localAudio')
                                                }
                                      }
                           }
    };



    function onAccepted ()
    {
        alert("Call Connected");
    }

    function onDisconnected ()
    {
        alert("Call Terminated");
    }


    //makes the call
    session = userAgent.invite('1000', options);
    session.on('accepted', onAccepted);
    //session.on('disconnected', onDisconnected);

  }

)();


SipCall.htm

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="style.css">
  </head>
  <body>
    <audio  id="remoteAudio"></audio>
    <audio  id="localAudio" muted="muted"></audio>
    <button id="endCall">End Call</button>
    <script src="sip-0.6.1.js"></script>
    <script src="call.js"></script>
  </body>
</html>

Please help me to debug the no audio issue with chrome browser.

Any help will be highly appreciated.

Regards,

Raghuvendra Kumar

Upvotes: 0

Views: 4605

Answers (1)

Rahul_Dabhi
Rahul_Dabhi

Reputation: 730

You enabled vp8 codec in asterisk server, If no then try to enable vp8 codec from sip.conf. If yes then copy your console log here from browser..

Thanks.!!!!

Upvotes: 1

Related Questions