4

I have made a mode-verto android client, using WebRtc;

  • Pre-built library: org.webrtc:google-webrtc:1.0.+
  • libjingle: io.pristine:libjingle:11139@aar

and FreeSwitch but only got success to make uni-directional communication(SIP phone to an android client, voice communication in both devices successfully). But when I try to make a call from an android client to a SIP phone it doesn't work.


Steps: From Web To mode-verto android Client(Working scenario): Login Call:

{"method":"login","id":1,"params":{"passwd":"XXX","userVariables":{},"loginParams":{},"login":"1002@XXX.XXX.com","sessid":"0afc3741-97cf-4b59-94a4-57bdcc2f5f17"},"jsonrpc":"2.0"}

Login Call Response:

{"jsonrpc":"2.0","id":1,"result":{"message":"logged in","sessid":"0afc3741-97cf-4b59-94a4-57bdcc2f5f17"}}

 {"jsonrpc":"2.0","id":254,"method":"verto.clientReady","params":{"reattached_sessions":[]}}

Call Invitation From Web:

{"jsonrpc":"2.0","id":255,"method":"verto.invite","params":{"callID":"94c79b9e-9aa1-41d6-85be-3f94d71bf4f4","sdp":"v=0\r\no=FreeSWITCH 1633327591 1633327592 IN IP4 192.168.0.1\r\ns=FreeSWITCH\r\nc=IN IP4 192.168.0.1\r\nt=0 0\r\na=msid-semantic: WMS esmOfEYFBQ88Oj5egBp9rex75ApyzBlE\r\nm=audio 16468 RTP/SAVPF 102 9 0 8\r\na=rtpmap:102 opus/48000/2\r\na=fmtp:102 useinbandfec=1; maxaveragebitrate=30000; maxplaybackrate=48000; ptime=20; minptime=10; maxptime=40; stereo=1\r\na=rtpmap:9 G722/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=fingerprint:sha-256 30:D5:C6:44:1E:D6:22:FD:54:D1:0E:E8:7C:B4:E7:AD:93:99:E9:CD:48:D0:6D:B6:28:EE:19:45:83:8A:62:B8\r\na=setup:actpass\r\na=rtcp-mux\r\na=rtcp:16468 IN IP4 192.168.0.1\r\na=ssrc:2708468483 cname:UyjZ27vuNtssDnxJ\r\na=ssrc:2708468483 msid:esmOfEYFBQ88Oj5egBp9rex75ApyzBlE a0\r\na=ssrc:2708468483 mslabel:esmOfEYFBQ88Oj5egBp9rex75ApyzBlE\r\na=ssrc:2708468483 label:esmOfEYFBQ88Oj5egBp9rex75ApyzBlEa0\r\na=ice-ufrag:OMJ6Q73MxiaXJmsu\r\na=ice-pwd:KBkDyFYcZgvtuS29vC5czYOX\r\na=candidate:9757738161 1 udp 2130706431 192.168.0.1 16468 typ host generation 0\r\na=candidate:9757738161 2 udp 2130706431 192.168.0.1 16468 typ host generation 0\r\na=silenceSupp:off - - - -\r\na=ptime:20\r\na=sendrecv\r\nm=video 16470 RTP/SAVPF 96 98 100 102 127 125 108 124 123\r\nb=AS:3072\r\na=rtpmap:96 VP8/90000\r\na=rtpmap:98 VP9/90000\r\na=fmtp:98 profile-id=0\r\na=rtpmap:100 VP9/90000\r\na=fmtp:100 profile-id=2\r\na=rtpmap:102 H264/90000\r\na=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f\r\na=rtpmap:127 H264/90000\r\na=fmtp:127 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f\r\na=rtpmap:125 H264/90000\r\na=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=rtpmap:108 H264/90000\r\na=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f\r\na=rtpmap:124 H264/90000\r\na=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f\r\na=rtpmap:123 H264/90000\r\na=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f\r\na=sendrecv\r\na=fingerprint:sha-256 30:D5:C6:44:1E:D6:22:FD:54:D1:0E:E8:7C:B4:E7:AD:93:99:E9:CD:48:D0:6D:B6:28:EE:19:45:83:8A:62:B8\r\na=setup:actpass\r\na=rtcp-mux\r\na=rtcp:16470 IN IP4 192.168.0.1\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 ccm tmmbr\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtcp-fb:98 ccm fir\r\na=rtcp-fb:98 ccm tmmbr\r\na=rtcp-fb:98 nack\r\na=rtcp-fb:98 nack pli\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 ccm tmmbr\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=rtcp-fb:102 ccm fir\r\na=rtcp-fb:102 ccm tmmbr\r\na=rtcp-fb:102 nack\r\na=rtcp-fb:102 nack pli\r\na=rtcp-fb:127 ccm fir\r\na=rtcp-fb:127 ccm tmmbr\r\na=rtcp-fb:127 nack\r\na=rtcp-fb:127 nack pli\r\na=rtcp-fb:125 ccm fir\r\na=rtcp-fb:125 ccm tmmbr\r\na=rtcp-fb:125 nack\r\na=rtcp-fb:125 nack pli\r\na=rtcp-fb:108 ccm fir\r\na=rtcp-fb:108 ccm tmmbr\r\na=rtcp-fb:108 nack\r\na=rtcp-fb:108 nack pli\r\na=rtcp-fb:124 ccm fir\r\na=rtcp-fb:124 ccm tmmbr\r\na=rtcp-fb:124 nack\r\na=rtcp-fb:124 nack pli\r\na=rtcp-fb:123 ccm fir\r\na=rtcp-fb:123 ccm tmmbr\r\na=rtcp-fb:123 nack\r\na=rtcp-fb:123 nack pli\r\na=ssrc:1891818205 cname:UyjZ27vuNtssDnxJ\r\na=ssrc:1891818205 msid:esmOfEYFBQ88Oj5egBp9rex75ApyzBlE v0\r\na=ssrc:1891818205 mslabel:esmOfEYFBQ88Oj5egBp9rex75ApyzBlE\r\na=ssrc:1891818205 label:esmOfEYFBQ88Oj5egBp9rex75ApyzBlEv0\r\na=ice-ufrag:pWTWGFjyLZJAyUKz\r\na=ice-pwd:0XZUOcLk08IHnyICkspRXyfz\r\na=candidate:0896075528 1 udp 2130706431 192.168.0.1 16470 typ host generation 0\r\na=candidate:0896075528 2 udp 2130706430 192.168.0.1 16470 typ host generation 0\r\na=end-of-candidates\r\n","caller_id_name":"Extension 1001","caller_id_number":"1001","callee_id_name":"Outbound Call","callee_id_number":"1002","display_direction":"outbound"}}

Call Response with SDP:

{"method":"verto.answer","id":2,"params":{"dialogParams":{"callID":"94c79b9e-9aa1-41d6-85be-3f94d71bf4f4","remote_caller_id_number":"1002","destination_number":"1002","remote_caller_id_name":"1002"},"session_id":"0afc3741-97cf-4b59-94a4-57bdcc2f5f17","sdp":"v=0\r\no=- 4285064094073427202 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=msid-semantic: WMS MediaStream\r\nm=audio 63288 RTP\/SAVPF 102 9 0 8\r\nc=IN IP4 192.168.2.1\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=candidate:341193750 1 udp 2122260223 192.168.8.101 49077 typ host generation 0 network-id 3 network-cost 10\r\na=candidate:1510613869 1 udp 2122129151 127.0.0.1 49460 typ host generation 0 network-id 1\r\na=candidate:842163049 1 udp 1686052607 192.168.2.1 63288 typ srflx raddr 192.168.8.101 rport 49077 generation 0 network-id 3 network-cost 10\r\na=ice-ufrag:BfLO\r\na=ice-pwd:RBsUQ\/uNeEiqmPgyvWJBN4vs\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 3D:3A:73:40:49:34:6F:E6:F0:17:9F:E6:7F:FE:C1:0D:C0:3D:86:A1:28:39:73:3A:EB:64:67:E4:57:55:EA:C0\r\na=setup:active\r\na=mid:audio\r\na=sendrecv\r\na=rtcp-mux\r\na=rtpmap:102 opus\/48000\/2\r\na=fmtp:102 minptime=10;useinbandfec=1\r\na=rtpmap:9 G722\/8000\r\na=rtpmap:0 PCMU\/8000\r\na=rtpmap:8 PCMA\/8000\r\na=ssrc:2607788540 cname:lwXiQ5hT1hGGiwou\r\na=ssrc:2607788540 msid:MediaStream ARDAMSa0\r\na=ssrc:2607788540 mslabel:MediaStream\r\na=ssrc:2607788540 label:ARDAMSa0\r\nm=video 0 RTP\/SAVPF 96 98 125\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:OxRK\r\na=ice-pwd:LCVdU01PHZJFx4\/dv4j3nqdN\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 3D:3A:73:40:49:34:6F:E6:F0:17:9F:E6:7F:FE:C1:0D:C0:3D:86:A1:28:39:73:3A:EB:64:67:E4:57:55:EA:C0\r\na=setup:active\r\na=mid:video\r\na=inactive\r\na=rtcp-mux\r\na=rtpmap:96 VP8\/90000\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtpmap:98 VP9\/90000\r\na=rtcp-fb:98 ccm fir\r\na=rtcp-fb:98 nack\r\na=rtcp-fb:98 nack pli\r\na=rtpmap:125 H264\/90000\r\na=rtcp-fb:125 ccm fir\r\na=rtcp-fb:125 nack\r\na=rtcp-fb:125 nack pli\r\na=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\n"},"jsonrpc":"2.0"}

Followings are the messages received after successful call invitation response:

{"jsonrpc":"2.0","id":2,"result":{"sessid":"0afc3741-97cf-4b59-94a4-57bdcc2f5f17"}}
{"jsonrpc":"2.0","id":259,"method":"verto.display","params":{"callID":"94c79b9e-9aa1-41d6-85be-3f94d71bf4f4","display_name":"Extension 1001","display_number":"1001","caller_id_name":"Extension 1001","caller_id_number":"1001","callee_id_name":"Outbound Call","callee_id_number":"1002","display_direction":"outbound"}}
{"jsonrpc":"2.0","id":260,"method":"verto.bye","params":{"callID":"94c79b9e-9aa1-41d6-85be-3f94d71bf4f4","causeCode":16,"cause":"NORMAL_CLEARING"}}

In the above scenario, the followings states are CONNECTED:

onStandardizedIceConnectionChange

onIceGatheringChange

onConnectionChange

onIceConnectionChange

mode-verto to Web Platform/SIP (Scenario in which help is required):

Login Call:

{"method":"login","id":1,"params":{"passwd":"XXX","userVariables":{},"loginParams":{},"login":"1002@XXX.XXXX.com","sessid":"9743f047-ba15-47ad-828b-26c57529fcf3"},"jsonrpc":"2.0"}

Login Call Response:

{"jsonrpc":"2.0","id":1,"result":{"message":"logged in","sessid":"9743f047-ba15-47ad-828b-26c57529fcf3"}}
{"jsonrpc":"2.0","id":261,"method":"verto.clientReady","params":{"reattached_sessions":[]}}

Call Invitation:

{"method":"verto.invite","id":2,"params":{"dialogParams":{"callID":"50533ec8-985c-4857-99bf-bcb1b021e558","caller_id_name":"1002","remote_caller_id_number":"1001","destination_number":"1001","remote_caller_id_name":"Outbound Call","useVideo":false,"useStereo":false,"useMic":"any","login":"1002@XXXX.XXXX.com","useCamera":"any","screenShare":false,"tag":"any","caller_id_number":"1002","useSpeak":"any","videoParams":{"minHeight":"720","minFrameRate":30,"minWidth":"1280"}},"sdp":"v=0\r\no=- 1985358600062838354 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio\r\na=msid-semantic: WMS MediaStream\r\nm=audio 60367 UDP\/TLS\/RTP\/SAVPF 111 103 104 9 102 0 8 106 105 13 110 112 113 126\r\nc=IN IP4 37.111.135.112\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=candidate:341193750 1 udp 2122260223 192.168.2.1 49612 typ host generation 0 network-id 3 network-cost 10\r\na=candidate:1510613869 1 udp 2122129151 127.0.0.1 42121 typ host generation 0 network-id 1\r\na=candidate:842163049 1 udp 1686052607 37.111.135.112 60367 typ srflx raddr 192.168.2.1 rport 49612 generation 0 network-id 3 network-cost 10\r\na=ice-ufrag:DRth\r\na=ice-pwd:6ZrLWyqfDk4vqVPGktrUsCOw\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 DF:C1:F2:1E:F9:C6:9F:54:55:CD:A0:78:D5:85:23:B0:C7:E5:6A:C9:48:6C:4D:5E:17:5C:00:D4:F5:D0:D6:BF\r\na=setup:actpass\r\na=mid:audio\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/abs-send-time\r\na=extmap:3 http:\/\/www.ietf.org\/id\/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=sendrecv\r\na=rtcp-mux\r\na=rtpmap:111 opus\/48000\/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\na=rtpmap:103 ISAC\/16000\r\na=rtpmap:104 ISAC\/32000\r\na=rtpmap:9 G722\/8000\r\na=rtpmap:102 ILBC\/8000\r\na=rtpmap:0 PCMU\/8000\r\na=rtpmap:8 PCMA\/8000\r\na=rtpmap:106 CN\/32000\r\na=rtpmap:105 CN\/16000\r\na=rtpmap:13 CN\/8000\r\na=rtpmap:110 telephone-event\/48000\r\na=rtpmap:112 telephone-event\/32000\r\na=rtpmap:113 telephone-event\/16000\r\na=rtpmap:126 telephone-event\/8000\r\na=ssrc:859436163 cname:6xspDJIe1I+kt4ue\r\na=ssrc:859436163 msid:MediaStream ARDAMSa0\r\na=ssrc:859436163 mslabel:MediaStream\r\na=ssrc:859436163 label:ARDAMSa0\r\n","sessid":"9743f047-ba15-47ad-828b-26c57529fcf3"},"jsonrpc":"2.0"}

Call Invitation Response:

 {"jsonrpc":"2.0","id":2,"result":{"message":"CALL CREATED","callID":"50533ec8-985c-4857-99bf-bcb1b021e558","sessid":"9743f047-ba15-47ad-828b-26c57529fcf3"}}

{"jsonrpc":"2.0","id":263,"method":"verto.media","params":{"callID":"50533ec8-985c-4857-99bf-bcb1b021e558","sdp":"v=0\r\no=FreeSWITCH 1633328922 1633328923 IN IP4 172.1.0.165\r\ns=FreeSWITCH\r\nc=IN IP4 172.1.0.165\r\nt=0 0\r\na=msid-semantic: WMS YfVYnQ98r94pqu4N6K4IJDNht8vLsWrg\r\nm=audio 17076 UDP/TLS/RTP/SAVPF 111 110\r\na=rtpmap:111 opus/48000/2\r\na=fmtp:111 useinbandfec=1; minptime=10\r\na=rtpmap:110 telephone-event/48000\r\na=silenceSupp:off - - - -\r\na=ptime:20\r\na=sendrecv\r\na=fingerprint:sha-256 30:D5:C6:44:1E:D6:22:FD:54:D1:0E:E8:7C:B4:E7:AD:93:99:E9:CD:48:D0:6D:B6:28:EE:19:45:83:8A:62:B8\r\na=setup:active\r\na=rtcp-mux\r\na=rtcp:17076 IN IP4 172.1.0.165\r\na=ice-ufrag:VRYvkCDEAYgSKxZD\r\na=ice-pwd:zTJiNNjGMzQ6KDmvlbRwEk05\r\na=candidate:8820384080 1 udp 2130706431 172.1.0.165 17076 typ host generation 0\r\na=end-of-candidates\r\na=ssrc:2909163670 cname:2c4fT3eb39qjtkXq\r\na=ssrc:2909163670 msid:YfVYnQ98r94pqu4N6K4IJDNht8vLsWrg a0\r\na=ssrc:2909163670 mslabel:YfVYnQ98r94pqu4N6K4IJDNht8vLsWrg\r\na=ssrc:2909163670 label:YfVYnQ98r94pqu4N6K4IJDNht8vLsWrga0\r\n"}}

Call Invitation Ans. confirmation Response:

{"jsonrpc":"2.0","id":264,"method":"verto.answer","params":{"callID":"50533ec8-985c-4857-99bf-bcb1b021e558"}}

After this process: onIceConnectionChange and onStandardizedIceConnectionChange get stuck in CHECKING state and onConnectionChange in CONNECTING state. and after few seconds, onIceConnectionChange , onStandardizedIceConnectionChange and onConnectionChange states change to FAILED.

On the android client, it takes 30, 40 seconds to gather complete Ice-Candidates, which is a lot. On exchange of successful SDP's , even after ice candidates completion, onIceConnectionChange and onStandardizedIceConnectionChange states change to Failed.

Also followed these solutions:

But still, I do not get what I am doing wrong.

Is there anything I'll be missing which I should check? Any help from the community would be really helpful for me.

  • Did you get any help from the above link? The behavior of `FreeSWITCH` with `mod-verto` is somewhat `uni-directional in nature. If the `mod-verto` android application is behaving the same then it might be an issue with `FreeSWITCH + SIP Trunking` server. Here are some useful references might help:(https://stackoverflow.com/a/41117397/10413749), (https://stackoverflow.com/questions/38734727/unable-to-make-webrtc-work-in-freeswitch) ,https://stackoverflow.com/questions/37717674/user-not-registered-in-moid-verto , https://stackoverflow.com/questions/37717674/user-not-registered-in-moid-verto – Muhammad Usman Bashir Oct 04 '21 at 15:44
  • 1
    I have also compared my remote SDP with - https://stackoverflow.com/questions/64622610/no-audio-when-webrtc-mobile-clients-connected-in-different-network and that is 100% match. should I send my invitation to callee after **Ice-candidates** completion, also should I wait to send call invitation response after ice-candidates completion? – Muhammad Aoun Oct 05 '21 at 12:33
  • 2
    @MuhammadAoun just send the invite to sip trunck after 2-5 seconds once ice candidates are generated.im just waiting for 2 seconds for my ice candidates to generate.after that i get the sdp with current ice candidates and sent it sip trunck.my call gets connected.similarly i did for verto.answer.hope it helps – Jeeva Oct 06 '21 at 06:49
  • @Jeeva , Thankyou for replying, I have created a p2p app, using native webrtc library, and over there ice candidates get completed within a second. and I am using the same library in the mode-verto android client application, but then it takes 40 secs. to get complete. These are the logs for p2p application: - https://1drv.ms/u/s!Ai8SDD7HWsys13AH1r8IQSoSYx1Z and these are the logs for mode-verto client application: - https://1drv.ms/u/s!Ai8SDD7HWsys129-J5Pk4hqj-pHR – Muhammad Aoun Oct 06 '21 at 11:50
  • 1
    @MuhammadAoun really sorry could not check your logs.but im not waiting for full ice candidates formed.so give it a try with 5 seconds and then forward – Jeeva Oct 06 '21 at 14:47
  • @Jeeva, I have tested multiple times, but while I am working on a simple p2p application, `Ice-candidates` gather completely within a sec. as you have mentioned. But when I integrated `mode-verto` functionality and try to run the process, `Ice-candidates` take around 40s. and because of this after setting remote SDP, `onConnectionChange` stuck at connecting state. It would be very helpful for me if you provide me with any assistance. – Muhammad Aoun Oct 13 '21 at 11:33
  • 1
    @MuhammadAoun hi bro im not a expert bro.what i did was i didnt wait until for full ice connection ,i sent the invite with sdp to sip trunk after 5 seconds and it worked.and for me onConnectionChange was stuck at connecting state only when my ice candidates were not connected properly.if possible try to use better ice and stun servers. – Jeeva Oct 14 '21 at 18:28
  • @Jeeva, is it possible, that you can send me your demo application? So that I can check where I am making mistakes. That would be a great help for me. because I am stuck at this point for a while. – Muhammad Aoun Oct 21 '21 at 12:31
  • 1
    @MuhammadAoun no bro i dont have demo app .i was working on production app.this was a feature. – Jeeva Oct 27 '21 at 05:52
  • @Jeeva, can we communicate over some other platform. And if it's possible can you consult me, but I'll pay you for your consultation. – Muhammad Aoun Nov 02 '21 at 07:08

0 Answers0