Use 1 pjsip endpoint for webrtc and softphone connection

Hello. I have 2 pjsip enpoint configuration teampltes for webrtc users and softphone connection

[webrtc-endpoint-template](!)
type=endpoint
context=from-internal
disallow=all
allow=opus
webrtc=yes
rtp_symmetric=yes
rewrite_contact=yes
force_rport=yes
dtmf_mode=auto
direct_media=no

[nat-endpoint-template](!)
type=endpoint
context=from-internal
disallow=all
allow=ulaw
allow=alaw
transport=transport-udp
rtp_symmetric=yes
rewrite_contact=yes
force_rport=yes
dtmf_mode=auto
direct_media=no

and all worked perfect, but some users want to use Webrtc or softphone sometimes.

And I tried to make general template

[common-endpoint-template](!)
type=endpoint
context=from-internal
disallow=all
allow=opus
allow=ulaw
allow=alaw
webrtc=yes
rtp_symmetric=yes
rewrite_contact=yes
force_rport=yes
dtmf_mode=auto
direct_media=no

and one shoulder RTP and SIP work correct, but when one softphone call to another using common-endpoint-template

INVITE to second softphone(both softphones configured to support only ulaw, alaw codecs)
I have 488 Not Acceptable Here
CDP

v=0
xo=- 359246305 359246305 IN IP4 45.140.122.54
xs=Asterisk
xc=IN IP4 EXTERNAL IP
xt=0 0
xa=msid-semantic:WMS *
xa=group:BUNDLE audio-0
xm=audio 12628 UDP/TLS/RTP/SAVPF 0 8 101
xa=connection:new
xa=setup:actpass
xa=fingerprint:SHA-256 75:1B:AD:3D:8E:21:B5:B3:F9:69:36:16:ED:B3:5B:66:E1:8D:DC:57:
x:28:06:D5:AF:E6:D8:32:D3:C9:88:43
xa=ice-ufrag:70127d6a0f6b9a88492fc7257e4551d3
xa=ice-pwd:7160cb1e3b105c1a635471883997cd28
xa=candidate:H2d8c7a36 1 UDP 2130706431 45.140.122.54 12628 typ host
xa=candidate:Hb15fcfbe 1 UDP 2130706431 fe80::145c:52ff:fe7c:edb8 12628 typ host
xa=rtpmap:0 PCMU/8000
xa=rtpmap:8 PCMA/8000
xa=rtpmap:101 telephone-event/8000

both endpoints had
allow : (opus|ulaw|alaw)

Does somebody had way how to merge endpoints configuration for Webrtc and softphones?
and fixed codec negotiation between 2 channels

You can’t. SDP for WebRTC and SDP for a normal phone are incompatible.

1 Like