How to suppress permisson request to microphone in browsers?

marcw

Member
Max, that was a big step forward! :) I can hear now what I am talking into the called mobile in the client player! Also I can (like before) hear the injected wav file in the mobile. But I cannot hear it in the client player. I tried it among others with
Code:
http://www.locophono.com:9091/rest-api/push/sound_on
{
"mediaSessionId": "8a0b6b80-9432-11e8-82bd-5b2ab03a45c0",
"soundFile":"facebook5.wav",
"loop": true
}
but get a 500 error. Any idea? May be it is possible to inject the wav file into the sip stream to the callee and to the client player in one command?
Anyway, I feel that I am close to finalizing my project! :)

Best
Marc
 

Max

Administrator
Staff member
Hello
Currently WCS doesn't have methods allowing to inject wav file to a playback stream.
You can inject wav file:
1) To a SIP call (remote leg), using /inject_sound
2) To an outbound RTMP stream using /push/startup, /push/sound_on

If you want to play a wav file, you can play it directly in your app once you received 200 OK from REST.
You can do that using default HTML5 capabilities.
 

marcw

Member
Hi Max!
Unfortunatelly that is not a makable way for me. There are too many audio files available (1000 first names combined with dozens of city names and so on). So I will switch back to the original plan.

Best regards
Marc
 

marcw

Member
Or do you think it is possible to initialize two streams simultanously to the user? One stream for receiving the sip audio from the callee and a second where I can send the wav audio stream back to the user? So I would play/inject the wav file from the server two times in the same moment: One via inject to the callee and a second time to the user. Or was that also your idea when writing
2) To an outbound RTMP stream using /push/startup, /push/sound_on
?

Best
Marc
 

marcw

Member
Hi Max!
Can you give me a final hint so that I can make a decision which of the two ways of implementation I will follow?

Best
Marc
 

Max

Administrator
Staff member
Hello
/push/startup, /push/sound_on
This means you can go this way:
1. Make a SIP call using /call/startup (SIP as Stream)
For example 'stream1'
2. Re-publish this stream to rtmp://localhost:1935/live using /push/startup
For example it will be re-published as 'rtmp_stream1'
3. Play RTMP stream as WebRTC in Player
4. Inject wav file into RTMP stream using /push/sound_on
5. Inject the same wav file into SIP call using /inject_sound
Looks bit complex though.
 

marcw

Member
Thank you, Max, but to be honest I would appreciate if you could give me a working REST-API code example. I tried, I think, 100 hundred of combinations in the way you pointed to but nothing of it worked. I still have problems to inject a wav file into a stream to the app user. Just let's ignore the sip call stream to the callee and only bring a RTMP stream to the app user to work. Which app for demonstration purposes can I use and which REST-API commands do I have to enter via ARC?
I tried things like
http://www.locophono.com:9091/rest-api/push/startup

{
"streamName": "abc",
"rtmpUrl":"rtmp://localhost:1935/live"
}


http://www.locophono.com:9091/rest-api/push/sound_on

{
"mediaSessionId": "abc",
"soundFile":"facebook5.wav",
"loop": false
}
Are the used variable names correct so far? And if so, how do I receive the value for the "streamName"? And how do I get the "mediaSessionId"?
Sorry for being such a pain but I feel like runing in a circle since weeks.

Best
Marc
 

Max

Administrator
Staff member
Hello

Please check out this example: Demo - SIP as RTMP 2
https://demo.flashphoner.com/client2/examples/demo/sip/sip-as-rtmp-2/sip-as-rtmp-2.html
https://demo.flashphoner.com/client2/examples/demo/sip/sip-as-rtmp-2/sip-as-rtmp-2.js
Here you can find all steps related your case.

Music control is backed by function /sound_on

Related docs:
https://docs.flashphoner.com/display/WCS5EN/SIP as RTMP 2

upload_2018-8-16_11-37-41.png


how do I receive the value for the "streamName"?
You set this as "toStream":"streamName" field when you make a call
And how do I get the "mediaSessionId"?
When you do /push/startup you can do /push/find_all to list all push-sessions with its mediaSessionId.
 

marcw

Member
Hello!
First of all that example only works with a Flash supporting browser. Or am I wrong? Finally it must work on a browser without Flash. So a test with another browser supporting Flash would not make sense.
RTMP Player
Your browser doesn't support the Flash technology necessary for work of an example
Then you wrote to find out the mediaSessionId I use /push/find_all when I do /push/startup. I think you mean one after the other? But doing /push/startup returns an error.

http://www.locophono.com:9091/rest-api/call/startup

{
"callId":"7",
"callee":"00491777000001",
"hasAudio":"true",
"hasVideo":"false",
"sipLogin":"marcwaesche",
"sipAuthenticationName":"marcwaesche",
"sipPassword":"xxxxxx",
"sipDomain":"77.72.174.xxx",
"sipOutboundProxy":"77.72.174.xxx",
"sipPort":"6000",
"appKey":"xxx",
"sipRegisterRequired":"true",
"toStream":"stream77"
}
This starts successfully the phone call.

http://www.locophono.com:9091/rest-api/push/startup

{
"streamName": "stream77",
"rtmpUrl":"rtmp://localhost:1935/live"
}
is answered with the error

409 Conflict

{
"timestamp": 1535486501561,
"status": 409,
"error": "Conflict",
"exception": "com.flashphoner.server.manager.controller.exception.ConflictException",
"message": "Transponder can't be initialized",
"path": "/rest-api/push/startup"
}
The reason may be (or not) that there is no Flash supporting browser listening. But anyway, it must work without Flash. Was the example you gave me the wrong one?

Best regards
Marc
 

Max

Administrator
Staff member
Hello
First of all that example only works with a Flash supporting browser
In SIP as RTMP, WebRTC as RTMP examples Flash player is used to play RTMP stream. You can play RTMP stream in Player example too, it is not require Flash support in browser.
The reason may be (or not) that there is no Flash supporting browser listening
The problem is in option
Code:
generate_av_for_ua=all
in flashphoner.properties file. This option is necessary to /call/inject_sound REST query to work with audio only calls. But, when this option is active, it seems like stream republishing as RTMP with /push/startup query stops working so RTMP stream cannot be published on server. You can disable this option temporarily as workaround, and we will see what we can do with this.
 

marcw

Member
Hi Max!
If disabling the generate_av_for_ua=all setting and restarting WCS there is no more any error message. But I cannot hear the published stream.

http://www.locophono.com:9091/rest-api/call/startup

{
"callId":"7",
"callee":"00491777000001",
"hasAudio":"true",
"hasVideo":"false",
"sipLogin":"marcwaesche",
"sipAuthenticationName":"marcwaesche",
"sipPassword":"xxxxxxx",
"sipDomain":"77.72.174.xxx",
"sipOutboundProxy":"77.72.174.xxx",
"sipPort":"6000",
"appKey":"xxxxxx",
"sipRegisterRequired":"true",
"toStream":"stream77"
}


http://www.locophono.com:9091/rest-api/push/startup

{
"streamName": "stream77",
"rtmpUrl":"rtmp://localhost:1935/live"
}


http://www.locophono.com:9091/rest-api/push/find_all
{}
-> for receiving mediaSessionId




https://www.locophono.com:8888/dashboard.xhtml
-> Player , using "stream77"


http://www.locophono.com:9091/rest-api/push/sound_on

{
"mediaSessionId": "ed4ph166e3u4p4ridebe6juqjc",
"soundFile":"facebook5.wav",
"loop": false
}

-> nothing to hear
Best regards
Marc
 

Max

Administrator
Staff member
Hi Marc,
the generate_av_for_ua=all setting must be enabled to handle the streams from audio only SIP calls. But this breaks stream republishing as RTMP and SIP as RTMP functions. Sorry, this is bug, and we working on it (internal case WCS-1443). We let you now when we fix it.
 

Max

Administrator
Staff member
We fixed the issue with generate_av_for_ua=all option. You have to update to version 5.1.3511 from this page and place the following content to file WCS_HOME/conf/media_transponder.sdp
Code:
v=0
o=- 1988962254 1988962254 IN IP4 0.0.0.0
c=IN IP4 0.0.0.0
t=0 0
a=sdplang:en
m=video 0 RTP/AVP 95 96
a=rtpmap:95 H264/90000
a=fmtp:95 profile-level-id=" + profile + ";packetization-mode=0
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=" + profile + ";packetization-mode=1
a=recvonly
m=audio 0 RTP/AVP 8
a=rtpmap:8 PCMA/8000
a=recvonly
for your case to work.
 

marcw

Member
Hi Max!
I updated the WCS but now every POST request via REST api returns a 308 error:
{"exception":"java.io.EOFException","path":"/rest-api/call/startup","error":"Internal Server Error","message":"No content to map to Object due to end of input","timestamp":1536095313412,"status":500}
Any ideas? And another question to the hint to add the above listed parameters to the file WCS_HOME/conf/media_transponder.sdp : That file wasn't existing per default, is that correct? I created that file and added the parameters. Hope that was correct.

Best
Marc
 

Max

Administrator
Staff member
I updated the WCS but now every POST request via REST api returns a 308 error
In last versions REST API queries handling was moved from WCS manager module to WCS core, and default REST API ports was changed from 9091 (HTTP) and 8888 (HTTPS) to 8081 (HTTP) and 8444 (HTTPS) respectively (see docs for details). So 308 Permanent redirect is returned when you send request to port 9091, and most browser REST clients understand this. You have to change the port from 9091 to 8081 for all of REST requests in your scripts.
That file wasn't existing per default, is that correct? I created that file and added the parameters. Hope that was correct.
Yes, this is correct. The default SDP settings are specified in WCS source code, so SDP files should be created if we have to customize settings. See also here for details.
 

marcw

Member
Ahaaa! :) Okay, all looked nice now excepted that no sound could be heard. From the logs:
03:12:53,469 INFO EchoApp - http-nio-9091-exec-7 handleRequest method: playStream params:{nodeId=6dzCTphAUgqfXb9yFioDZ3Td3Zc0H7AY@195.201.166.182, appKey=defaultApp, sessionId=/62.143.33.90:62487/195.201.166.182:8443, mediaSessionId=d0aaaa00-b0a8-11e8-ad67-e78584240934, name=stream78, published=false, hasVideo=true, hasAudio=true, status=PENDING, record=false, width=0, height=0, bitrate=0, minBitrate=0, maxBitrate=0, quality=0, mediaProvider=WebRTC, history=false, origin=https://www.locophono.com:8888}
03:12:55,050 INFO EchoApp - http-nio-9091-exec-9 handleRequest method: StreamStatusEvent params:{nodeId=6dzCTphAUgqfXb9yFioDZ3Td3Zc0H7AY@195.201.166.182, appKey=defaultApp, sessionId=/62.143.33.90:62487/195.201.166.182:8443, mediaSessionId=d0aaaa00-b0a8-11e8-ad67-e78584240934, name=stream78, published=false, hasVideo=true, hasAudio=true, status=PLAYING, audioCodec=PCMA, videoCodec=H264, record=false, width=0, height=0, bitrate=0, minBitrate=0, maxBitrate=0, quality=0, createDate=1536109973490, mediaProvider=WebRTC, history=false, origin=https://www.locophono.com:8888}
published=false and bitrate/quality = 0 tell me: There was really nothing given out. But why not? I had connected the "player" app to the matching stream ("stream78").
Additionally to the default values in flashphoner.properities I only added
rtp_force_synchronization=true
rtp_activity_detecting=false,0
generate_av_for_ua=all
Best
Marc
 
Top