Setting up Asterisk + webrtc

I am trying to set up Asterisk to work with webrtc… On the client side I am using sipML5.
This is new to me so I am having some difficulties. Below are my config file

extensions.conf

[default]
exten=>bob,1,Dial(PJSIP/${EXTEN})
exten=>lucy,1,Dial(PJSIP/${EXTEN})

http.conf

[general]
enabled=yes
bindaddr=0.0.0.0
bindport=8088
tlsenable=yes
tlsbindaddr=0.0.0.0:8089
tlscertfile=/etc/asterisk/keys/asterisk.pem

rtp.conf

[general]
rtpstart=10000
rtpend=20000
stunaddr=stun.l.google.com:19302

pjsip.conf

[transport_wss]
type=transport
bind=0.0.0.0
protocol=wss

[bob]
type=aor
max_contacts=1

[bob]
type=auth
auth_type=userpass
username=bob
password=123456 ; This is an insecure password

[bob]
type=endpoint
context=default
direct_media=no
allow=!all,ulaw,vp8,h264
aors=bob
auth=bob
max_audio_streams=10
max_video_streams=10
webrtc=yes
dtls_cert_file=/etc/asterisk/keys/asterisk.pem
dtls_ca_file=/etc/asterisk/keys/ca.crt

[lucy]
type=aor
max_contacts=1

[lucy]
type=auth
auth_type=userpass
username=lucy
password=123456 ; This is an insecure password

[lucy]
type=endpoint
context=default
direct_media=no
allow=!all,ulaw,vp8,h264
aors=lucy
auth=lucy
max_audio_streams=10
max_video_streams=10
webrtc=yes
dtls_cert_file=/etc/asterisk/keys/asterisk.pem
dtls_ca_file=/etc/asterisk/keys/ca.crt

I am using sipml5 in browser to initiate a call. Image depicting the situation.

While the registration process is done without any hassle, whenever I try to call lucy, it shows call in progress… and then nothing. I am pasting the output from browser console.

SEND: INVITE sip:lucy@192.168.5.240 SIP/2.0
Via: SIP/2.0/WS df7jal23ls0d.invalid;branch=z9hG4bKJqNKVm8FAolyGCgAwqzodBv7mqnn1fMI;rport
From: "bob"<sip:bob@192.168.5.240>;tag=zoXiEWFrIS8aWE8NsM73
To: <sip:lucy@192.168.5.240>
Contact: "bob"<sip:bob@df7jal23ls0d.invalid;rtcweb-breaker=no;click2call=no;transport=ws>;+g.oma.sip-im;language="en,fr"
Call-ID: d3132f61-16b8-b1e1-a3a7-57d6e4a7c026
CSeq: 31217 INVITE
Content-Type: application/sdp
Content-Length: 1345
Max-Forwards: 70
User-Agent: IM-client/OMA1.0 sipML5-v1.2016.03.04
Organization: Doubango Telecom

v=0
o=mozilla...THIS_IS_SDPARTA-91.0.2 7078761787079714000 0 IN IP4 127.0.0.1
s=Doubango Telecom - firefox
t=0 0
a=sendrecv
a=fingerprint:sha-256  D4:19:8F:2E:4B:09:9D:11:B1:BE:39:9E:C1:DA:4A:A0:F2:78:AB:3A:6F:85:70:7F:83:66:69:F7:F3:45:C8:69
a=group:BUNDLE 0
a=ice-options:trickle
a=msid-semantic:WMS *
m=audio 48510 UDP/TLS/RTP/SAVPF 109 9 0 8 101
c=IN IP4 192.168.5.240
a=candidate:0 1 UDP 2122252543 192.168.5.240 48510 typ host
a=candidate:5 1 TCP 2105524479 192.168.5.240 9 typ host tcptype active
a=candidate:0 2 UDP 2122252542 192.168.5.240 33548 typ host
a=candidate:5 2 TCP 2105524478 192.168.5.240 9 typ host tcptype active
a=sendrecv
a=end-of-candidates
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2/recvonly urn:ietf:params:rtp-hdrext:csrc-audio-level
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=fmtp:109 maxplaybackrate=48000;stereo=1;useinbandfec=1
a=fmtp:101 0-15
a=ice-pwd:f783c8c7730e1a0fb0452874847c94bd
a=ice-ufrag:cc6d4770
a=mid:0
a=msid:{f9680322-af64-4e1c-9d4d-914ecb7e000f} {e5f3c53b-63f2-48d4-8543-2e123d3a0014}
a=rtcp:33548 IN IP4 192.168.5.240
a=rtcp-mux
a=rtpmap:109 opus/48000/2
a=rtpmap:9 G722/8000/1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=setup:actpass
a=ssrc:2565114692 cname:{8199f724-189a-4907-9e58-479c402727c4}


__tsip_transport_ws_onmessage tsk_utils.js:116:65
recv=SIP/2.0 401 Unauthorized
Via: SIP/2.0/WS df7jal23ls0d.invalid;rport=52704;received=192.168.5.240;branch=z9hG4bKJqNKVm8FAolyGCgAwqzodBv7mqnn1fMI
From: "bob"<sip:bob@192.168.5.240>;tag=zoXiEWFrIS8aWE8NsM73
To: <sip:lucy@192.168.5.240>;tag=z9hG4bKJqNKVm8FAolyGCgAwqzodBv7mqnn1fMI
Call-ID: d3132f61-16b8-b1e1-a3a7-57d6e4a7c026
CSeq: 31217 INVITE
Content-Length: 0
WWW-Authenticate: Digest realm="asterisk",qop="auth",nonce="1630570870/e1479902f9a76951e382002e033c97d6",opaque="2d987ff95facbd3f",stale=FALSE,algorithm=md5
Server: Asterisk PBX 18.5.1

SEND: ACK sip:lucy@192.168.5.240 SIP/2.0
Via: SIP/2.0/WS df7jal23ls0d.invalid;branch=z9hG4bKJqNKVm8FAolyGCgAwqzodBv7mqnn1fMI;rport
From: "bob"<sip:bob@192.168.5.240>;tag=zoXiEWFrIS8aWE8NsM73
To: <sip:lucy@192.168.5.240>;tag=z9hG4bKJqNKVm8FAolyGCgAwqzodBv7mqnn1fMI
Call-ID: d3132f61-16b8-b1e1-a3a7-57d6e4a7c026
CSeq: 31217 ACK
Content-Length: 0
Max-Forwards: 70

State machine: x0000_Any_2_Any_X_i401_407_INVITE tsk_utils.js:116:65

SEND: INVITE sip:lucy@192.168.5.240 SIP/2.0
Via: SIP/2.0/WS df7jal23ls0d.invalid;branch=z9hG4bKvOvxmLoVuDrOKCGHwcTUJnsa6W1pDd0o;rport
From: "bob"<sip:bob@192.168.5.240>;tag=zoXiEWFrIS8aWE8NsM73
To: <sip:lucy@192.168.5.240>
Contact: "bob"<sip:bob@df7jal23ls0d.invalid;rtcweb-breaker=no;click2call=no;transport=ws>;+g.oma.sip-im;language="en,fr"

Call-ID: d3132f61-16b8-b1e1-a3a7-57d6e4a7c026
CSeq: 31218 INVITE
Content-Type: application/sdp
Content-Length: 1345
Max-Forwards: 70
Authorization: Digest     username="bob",realm="asterisk",nonce="1630570870/e1479902f9a76951e382002e033c97d6",uri="sip:lucy@192.168.5.240",response="392ab7a05965b49f6516d5622a92f209",algorithm=md5,cnonce="6ecee939225265170a96b8ebef0f88ec",opaque="2d987ff95facbd3f",qop=auth,nc=00000001 
User-Agent: IM-client/OMA1.0 sipML5-v1.2016.03.04
Organization: Doubango Telecom

v=0
o=mozilla...THIS_IS_SDPARTA-91.0.2 7078761787079714000 0 IN IP4 127.0.0.1
s=Doubango Telecom - firefox
t=0 0
a=sendrecv
a=fingerprint:sha-256 D4:19:8F:2E:4B:09:9D:11:B1:BE:39:9E:C1:DA:4A:A0:F2:78:AB:3A:6F:85:70:7F:83:66:69:F7:F3:45:C8:69
a=group:BUNDLE 0
a=ice-options:trickle
a=msid-semantic:WMS *
m=audio 48510 UDP/TLS/RTP/SAVPF 109 9 0 8 101
c=IN IP4 192.168.5.240
a=candidate:0 1 UDP 2122252543 192.168.5.240 48510 typ host
a=candidate:5 1 TCP 2105524479 192.168.5.240 9 typ host tcptype active
a=candidate:0 2 UDP 2122252542 192.168.5.240 33548 typ host
a=candidate:5 2 TCP 2105524478 192.168.5.240 9 typ host tcptype active
a=sendrecv
a=end-of-candidates
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2/recvonly urn:ietf:params:rtp-hdrext:csrc-audio-level
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=fmtp:109 maxplaybackrate=48000;stereo=1;useinbandfec=1
a=fmtp:101 0-15
a=ice-pwd:f783c8c7730e1a0fb0452874847c94bd
a=ice-ufrag:cc6d4770
a=mid:0
a=msid:{f9680322-af64-4e1c-9d4d-914ecb7e000f} {e5f3c53b-63f2-48d4-8543-2e123d3a0014}
a=rtcp:33548 IN IP4 192.168.5.240
a=rtcp-mux
a=rtpmap:109 opus/48000/2
a=rtpmap:9 G722/8000/1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=setup:actpass
a=ssrc:2565114692 cname:{8199f724-189a-4907-9e58-479c402727c4}

__tsip_transport_ws_onmessage tsk_utils.js:116:65

recv=SIP/2.0 100 Trying
Via: SIP/2.0/WS df7jal23ls0d.invalid;rport=52704;received=192.168.5.240;branch=z9hG4bKvOvxmLoVuDrOKCGHwcTUJnsa6W1pDd0o
From: "bob"<sip:bob@192.168.5.240>;tag=zoXiEWFrIS8aWE8NsM73
To: <sip:lucy@192.168.5.240>
Call-ID: d3132f61-16b8-b1e1-a3a7-57d6e4a7c026
CSeq: 31218 INVITE
Content-Length: 0
Server: Asterisk PBX 18.5.1

State machine: x0000_Any_2_Any_X_i1xx tsk_utils.js:116:65
==session event = i_ao_request tsk_utils.js:116:65

After this, no 180 TRYING appears in the console. I am not sure why, but after the above message, there are again registration message in the console. I have seen multiple examples on the internet, but I could not manage to configure most of them.

Thanks

Ensure you have followed all instructions at:

Configuring Asterisk for WebRTC Clients
WebRTC tutorial using SIPML5

It appears a few configuration options are missing, or slightly different. Also, since you didn’t post it not sure about the SIPML5 expert options, but ensure those are set correctly as well.

Once all that is verified and if stuff still doesn’t work then also post the SIP trace from the Asterisk side of things. You can enable SIP logging in Asterisk for pjsip by using the following CLI command:

*CLI> pjsip set logger on

More info on collecting debug information from Asterisk can be found here if you’re interested.