Hello!

Maybe it will be useful for somebody, I applied next configuration and iOS starts working.

....
modparam("rtpengine", "write_sdp_pv", "$avp(sdp)")
....
rtpengine_manage("trust-address replace-origin replace-session-connection rtcp-mux-offer rtcp-mux-accept media-handover ICE=force RTP/SAVPF");
set_body("$avp(sdp)", "application/sdp");
....
$avp(sdp) = $(avp(sdp){re.subst,/t=0 0/t=0 0\r\na=group:BUNDLE audio/g});
$avp(sdp) = $(avp(sdp){re.subst,/a=setup:actpass/a=setup:actpass\r\na=mid:audio/g});
set_body("$avp(sdp)", "application/sdp");

BR,
Denys




On 31 October 2017 at 16:57, Denys Pozniak <denys.pozniak@crazycall.com> wrote:
Hello!

Probably this case is not connected Kamailio directly, but it can be somebody will point me in the correct direction :)
 
We have VoIP solution: FreeSWITCH -> Kamailio + Rtpengine -> WebRTC Chrome.
Everything works Ok except iOS application based on React Native WebRTC (https://github.com/oney/react-native-webrtc) + JsSIP.
It answers error 488 on incoming INVITE (wSDP):

INVITE SDP to iOS:
......
v=0
o=FreeSWITCH 1508701860 1508701861 IN IP4 52.52.52.52
s=FreeSWITCH
c=IN IP4 52.52.52.52
t=0 0
m=audio 30028 RTP/SAVPF 0 8 102
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:102 opus/48000/2
a=fmtp:102 useinbandfec=1; maxaveragebitrate=14400; maxplaybackrate=8000; ptime=20; minptime=10; maxptime=40
a=ptime:20
a=sendrecv
a=rtcp:30028
a=rtcp-mux
a=setup:actpass
a=fingerprint:sha-1 97:1A:E9:FE:D6:65:98:E6:88:EE:D5:9F:20:A3:19:F8:86:E7:E0:E3
a=ice-ufrag:9QBO8qg2
a=ice-pwd:PPGPo35xGBAs6RnTdMYVM9I8fx
a=candidate:KXENzrffZpQvwxdV 1 UDP 2130706431 52.52.52.52 30028 typ host

iOS console log:

11:55:23.670 browser.js:133 JsSIP:WebSocketInterface send() +10ms
11:55:23.670 browser.js:133 JsSIP:RTCSession session progress +5ms
11:55:23.671 browser.js:133 JsSIP:RTCSession emit "progress" +1ms
11:55:23.671 webrtc.js:108 WebRTC.on progress:  local
11:55:23.679 browser.js:133 JsSIP:RTCSession emit "peerconnection" +8ms
11:55:23.680 webrtc.js:89 WebRTC.on peerconnection
11:55:23.680 browser.js:133 JsSIP:RTCSession emit "sdp" +1ms
11:55:23.689 browser.js:133 JsSIP:Transport send() +20ms
11:55:23.689 browser.js:133 JsSIP:Transport sending message:
SIP/2.0 488 Not Acceptable Here
11:55:23.701 debug.js:115 JsSIP:ERROR:RTCSession emit "peerconnection:setremotedescriptionfailed" [error:Error: Failed to set remote offer sdp: Failed to create channels.


I found similar issue on thier git https://github.com/oney/react-native-webrtc/issues/293 and main solution is to struct SDP in way like:

a=group:BUNDLE audio
m=audio PORT RTP/SAVPF N M K
a=mid:audio

How to modify SDP on Kamailio side (after Rtpengine modification) like below?


v=0
o=FreeSWITCH 1508701860 1508701861 IN IP4 52.52.52.52
s=FreeSWITCH
c=IN IP4 52.52.52.52
t=0 0
a=group:BUNDLE audio
m=audio 30028 RTP/SAVPF 0 8 102
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:102 opus/48000/2
a=fmtp:102 useinbandfec=1; maxaveragebitrate=14400; maxplaybackrate=8000; ptime=20; minptime=10; maxptime=40
a=ptime:20
a=sendrecv
a=rtcp:30028
a=rtcp-mux
a=setup:actpass
a=mid:audio
a=fingerprint:sha-1 97:1A:E9:FE:D6:65:98:E6:88:EE:D5:9F:20:A3:19:F8:86:E7:E0:E3
a=ice-ufrag:9QBO8qg2
a=ice-pwd:PPGPo35xGBAs6RnTdMYVM9I8fx
a=candidate:KXENzrffZpQvwxdV 1 UDP 2130706431 52.52.52.52 30028 typ host


BR,
Denys