Search code examples
javascriptandroidasterisksipml

Asterisk goes mute in android but works on PC


I have an asterisk for web(calls in the website only) working, on PC, but when I run the same client on my android 5 no sound, at least not in my android, it does send voice to PC, but just cant reproduce the incomming voice.

Everthing seems to be just fine with my asterisk, it shows in call:

servidor-asterisk*CLI> core show channels
Channel              Location             State   Application(Data)
SIP/002670-0000003d  (None)               Up      AppDial((Outgoing Line))
SIP/000001-0000003c  002670@from-internal Up      Dial(SIP/002670,60)
2 active channels
1 active call
31 calls processed

But in eclipse console i receive code 405 from android:

"__tsip_transport_ws_onmessage", source: http://IP/videoNodeJs/scripts/sip_api.js (1)
"recv=OPTIONS sip:[email protected];rtcweb-breaker=no;transport=ws SIP/2.0
"Not implemented", source: http://IP/videoNodeJs/scripts/sip_api.js (1)
"SEND: SIP/2.0 405 Method Not Allowed

Any suggestions?

UPDATE:

SIPML5 Client:

<audio id="audio-remote"/>

var opcoes_chamada = {
    audio_remote: document.getElementById('audio-remote'),
    screencast_window_id: 0x00000000, // entire desktop
    bandwidth: { audio:undefined, video:undefined },
    video_size: { minWidth:undefined, minHeight:undefined, maxWidth:undefined, maxHeight:undefined },
    events_listener: { events: '*', listener: sipEventsListener },
    sip_caps: [
                    { name: '+g.oma.sip-im' },
                    { name: 'language', value: '\"en,fr\"' }
                ]
};

To make a call:

callSession = sipStack.newSession('call-audio', opcoes_chamada);
callSession.call(sip_id_d);

To answere a call:

e.newSession.setConfiguration(opcoes_chamada);
e.newSession.accept();

405 Method Not Allowed

The method specified in the Request-Line is understood, but not 
allowed for the address identified by the Request-URI.
The response MUST include an Allow header field containing a 
list of valid methods for the indicated address.

Some interpretation of this, any chance that everthing is fine but the audio TAG is the problem in the mobile client? If not, what is the 'address identified by the Request-URI'?


Solution

  • So, it's working.

    Here is the deal, the SIP was just fine, the client to. The hole problem was a chrome limitation that makes necessary a click from the user to play any sound in the browser, it's something like this:

    I have my audio tag:

    <audio id="audio-remote"/>
    

    and later I feed the source with sipml5:

    var opcoes_chamada = {
    audio_remote: document.getElementById('audio-remote'),
    screencast_window_id: 0x00000000, // entire desktop
    bandwidth: { audio:undefined, video:undefined },
    video_size: { minWidth:undefined, minHeight:undefined, maxWidth:undefined, maxHeight:undefined },
    events_listener: { events: '*', listener: sipEventsListener },
    sip_caps: [
                    { name: '+g.oma.sip-im' },
                    { name: 'language', value: '\"en,fr\"' }
                ]
    };
    

    And here is the catch, the audio tag it's been feed with the SIPML5 source, but it's in pause( or hold, dont know what...) as long the user don't give a onclick action, so right after the 2 lines to make and answere a call I add a button with:

    onClick="document.getElementById('audio-remote').play();"
    

    and everthing finally works!