Asterisk webrtc no audio

I config asterisk for webrtc and sipjs.com. so that work for SimpleUser configuration. with SimpleUser every thing is Ok. but when I use UserAgent , connection has established without audio .this is asterisk console when User3 call User2 :

WebSocket connection from '2.185.145.48:45486' for protocol 'sip' accepted using version '13'
    -- Added contact 'sip:1vprke50@2.185.145.48:45486;transport=ws' to AOR 'User2' with expiration of 600 seconds
    -- Executing [30@main-context:1] Dial("PJSIP/User2-00000000", "PJSIP/User2,20") in new stack
    -- Called PJSIP/User2
    -- PJSIP/User2-00000001 is ringing
       > 0x26e4050 -- Strict RTP learning after remote address set to: 0.0.0.0:9
    -- Call on PJSIP/User2-00000001 placed on hold
    -- Started music on hold, class 'default', on channel 'PJSIP/User2-00000000'
    -- PJSIP/User2-00000001 answered PJSIP/User2-00000000
    -- Stopped music on hold on PJSIP/User2-00000000
       > 0x270c430 -- Strict RTP learning after remote address set to: 0.0.0.0:9
    -- Channel PJSIP/User2-00000001 joined 'simple_bridge' basic-bridge <51cc3bdc-6e5d-4f99-a1a2-5cbc6092a567>
    -- Channel PJSIP/User2-00000000 joined 'simple_bridge' basic-bridge <51cc3bdc-6e5d-4f99-a1a2-5cbc6092a567>
    -- Started music on hold, class 'default', on channel 'PJSIP/User2-00000001'
    -- Channel PJSIP/User2-00000000 left 'simple_bridge' basic-bridge <51cc3bdc-6e5d-4f99-a1a2-5cbc6092a567>
  == Spawn extension (main-context, 30, 1) exited non-zero on 'PJSIP/User2-00000000'
    -- Channel PJSIP/User2-00000001 left 'simple_bridge' basic-bridge <51cc3bdc-6e5d-4f99-a1a2-5cbc6092a567>
    -- Stopped music on hold on PJSIP/User2-00000001

and this is pjsip.conf

[webrtc-phones](!)
context=main-context
transport=transport-wss
rtp_symmetric=yes
force_rport=yes
disallow=all
allow=opus,alaw
webrtc=yes

[User2](webrtc-phones)
type=endpoint
callerid=”User Two”
auth=User2
aors=User2
[User2]
type=aor
max_contacts=3
[User2]
type=auth
auth_type=userpass
username=User2
password=1234
[User3](webrtc-phones)
type=endpoint
callerid=”User Three”
auth=User3
aors=User3
[User3]
type=aor
max_contacts=3
[User3]
type=auth
auth_type=userpass
username=User3
password=1234

in sipjs SessionState has Established but no audio transfer .

0.0.0.0 and 9 are bogus values used by WebRTC. The actual address and port should be determined using ICE. (0.0.0.0 was, historically, a signal to put the stream on hold, and 9 represents the discard service, so anything actually sent to 9 will get thrown away.

You need to check that the ICE negotiation is correct, by looking at the SDP.

How can I set address and port using ICE?

I haven’t used WebRTC. I just know that ICE is essential to WebRTC, and that a knowledge of how ICE works is more or less essential for anyone trying to implement a WebRTC based system.

Your starting point should be to look at the SDP and work out what is wrong with the ICE, firstly reading up on SDP and ICE, if necessary.

I turn on debug and this error display in console:

0x7f9738334fc0 -- Strict RTP learning after remote address set to: 2.185.145.48:46616
[Jan 21 18:45:59] ERROR[24151]: pjproject: <?>: 	   icess0x7f97383d11c8 ......Error sending STUN request: Invalid argument

this is the only error.also all packet display in console

as you can see audio transfer but i can not hear audio from speaker.
I use sipjs for client.when use SampleUser from sipjs everything is Ok. but problem is when I use Useragent in sipjs.

If audio is flowing in Asterisk and it works with some other part, then it sounds like your issue is not with Asterisk but what you’re using and help would be better received elsewhere.

After I test other library I get this from console:

Executing [23@main-context:1] Dial("PJSIP/User2-00000060", "PJSIP/User1,20") in new stack
    -- Called PJSIP/User1
    -- PJSIP/User1-00000061 is ringing
       > 0x7f9734356480 -- Strict RTP learning after remote address set to: 0.0.0.0:9
[Jan 22 00:18:14] **ERROR[29429]: pjproject: <?>: 	   icess0x7f97343ee708 ......Error sending STUN request: Invalid argument**
    -- Call on PJSIP/User1-00000061 placed on hold
    -- Started music on hold, class 'default', on channel 'PJSIP/User2-00000060'
    -- PJSIP/User1-00000061 answered PJSIP/User2-00000060
    -- Stopped music on hold on PJSIP/User2-00000060
       > 0x7f9734356480 -- Strict RTP learning after ICE completion
       > 0x7f9734200e00 -- Strict RTP learning after remote address set to: 192.168.1.4:35323
    -- Channel PJSIP/User1-00000061 joined 'simple_bridge' basic-bridge <4eda5dd6-d418-4862-b161-644c88f7aebe>
    -- Channel PJSIP/User2-00000060 joined 'simple_bridge' basic-bridge <4eda5dd6-d418-4862-b161-644c88f7aebe>
       > 0x7f9734356480 -- Strict RTP learning after remote address set to: 2.185.145.48:57989
       > 0x7f9734200e00 -- Strict RTP learning after ICE completion
       > 0x7f9734200e00 -- Strict RTP learning after remote address set to: 2.185.145.48:35323
       > 0x7f9734200e00 -- Strict RTP switching to RTP target address 2.185.145.48:35323 as source
       > 0x7f9734356480 -- Strict RTP switching to RTP target address 2.185.145.48:57989 as source
       > 0x7f9734356480 -- Strict RTP learning complete - Locking on source address 2.185.145.48:57989
       > 0x7f9734200e00 -- Strict RTP learning complete - Locking on source address 2.185.145.48:35323

I have a error about STUN. I do not know any thing about STUN.Are you thinq my problem is about STUN?

No, the message regarding STUN is likely not your issue.

I test several js library.I found out when use incognito tab in browser every thing is ok and this is my console:

Executing [23@main-context:1] Dial("PJSIP/User2-00000066", "PJSIP/User1,20") in new stack
    -- Called PJSIP/User1
    -- PJSIP/User1-00000067 is ringing
       > 0x7f9730206730 -- Strict RTP learning after remote address set to: 2.185.145.48:41660
    -- PJSIP/User1-00000067 answered PJSIP/User2-00000066
       > 0x7f973003b160 -- Strict RTP learning after remote address set to: 2.185.145.48:49654
    -- Channel PJSIP/User1-00000067 joined 'simple_bridge' basic-bridge <5c235bd2-39a8-4bdd-ad60-73d14ced465e>
    -- Channel PJSIP/User2-00000066 joined 'simple_bridge' basic-bridge <5c235bd2-39a8-4bdd-ad60-73d14ced465e>
       > 0x7f9730206730 -- Strict RTP learning after ICE completion
       > 0x7f9730206730 -- Strict RTP learning after remote address set to: 2.185.145.48:41660
       > 0x7f973003b160 -- Strict RTP learning after ICE completion
       > 0x7f973003b160 -- Strict RTP learning after remote address set to: 2.185.145.48:49654
       > 0x7f9730206730 -- Strict RTP switching to RTP target address 2.185.145.48:41660 as source
       > 0x7f973003b160 -- Strict RTP switching to RTP target address 2.185.145.48:49654 as source
       > 0x7f9730206730 -- Strict RTP learning complete - Locking on source address 2.185.145.48:41660
       > 0x7f973003b160 -- Strict RTP learning complete - Locking on source address 2.185.145.48:49654

the problem is when run in a browser for second time .and when i clear all browser data that is work.
difference between incognito mode and normal mode in browser is remote address for destination user.
this is incognito mode:

-- PJSIP/User1-00000067 is ringing
       > 0x7f9730206730 -- Strict RTP learning after remote address set to: 2.185.145.48:41660

and this is normal mode:

-- PJSIP/User1-00000061 is ringing
       > 0x7f9734356480 -- Strict RTP learning after remote address set to: 0.0.0.0:9
    -- Call on PJSIP/User1-00000061 placed on hold
    -- Started music on hold, class 'default', on channel 'PJSIP/User2-00000060'

I can not understand why it sets the remote address to 0.0.0.0:9 .

That’s what WebRTC does. It doesn’t know the true correct address so it sends an invalid address and port. ICE provides multiple possible addresses.

However your RTP logging shows that the correct addresses have been found, although it is possible that something at one browser end isn’t actually allowing incoming traffic on that address, even though outgoing is working and Asterisk is forwarding to outgoing address from the other side, in both directions. As Joshua says, I think your logging demonstrates that your problem is outside Asterisk.

I found the problem.
I am using Android 4.4 phone and computer without microphone. So I expected the sound to be transmitted through the Android microphone. But webRTC supports andriod 5 and above with webview. So I used another device and the problem was solved.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.