Asterisk PJSIP WebRTC

Hi, I just installed asterisk 18.4. I’m trying to do a call between a sip phone and webRTC client but it seems that nothing happens. There are together registered on the server. I heard that I have to install a “gateway” to transform sip to webrtc during call, that’s true ? I’m using res_pjsip, I don’t really understand my log file …

Here the call log :


pjsip.conf : [transport-wss] type=transport protocol=wss bind=0.0.0.0

[transport-ws]
type=transport
protocol=wss
bind=0.0.0.0

[199]
type=endpoint
aors=199
auth=199
use_avpf=yes
media_encryption=dtls
dtls_ca_file=/etc/asterisk/keys/ca.crt
dtls_cert_file=/etc/asterisk/keys/asterisk.pem
dtls_verify=fingerprint
dtls_setup=actpass
ice_support=yes
webrtc=yes
media_use_received_transport=yes
rtcp_mux=yes
context=helloworld2
disallow=all
allow=ulaw
allow=opus
allow = all

[199]
type=auth
auth_type=userpass
username=********
password=********

[199]
type=aor
max_contacts=1
remove_existing=yes

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

[portierdiese]
type = endpoint
context = diese
allow = all
fullname= 192.168.1.2&Bosphore TM
auth = portierdiese
aors = portierdiese

[portierdiese]
type = auth
auth_type = userpass
password = *************
username = *************

[portierdiese]
type = aor
max_contacts = 1
remove_existing = yes

extension.conf :

[diese]
exten => _.,1,Dial(PJSIP/${EXTEN},20)

[helloworld]
exten => _X.,1,NoOp(${EXTEN})
same => n,Playback(hello-world)
same => n,Hangup()

[helloworld2]
exten => _X.,1,NoOp(${EXTEN})
same => n,Playback(hello-world)
same => n,Dial(PJSIP/${EXTEN},20)
same => n,Read(Digits,)
same => n,Playback(you-entered)
same => n,SayNumber(${Digits})

Is the res_srtp module loaded? Additionally, remove the “allow = all” from the endpoint.

Thank you for your fast reply ! No I can’t see it with “module show”, How can I install it ? With module load or have I to download it ?

The res_srtp module is automatically built if the libsrtp library and development headers are on the system when Asterisk is built.

Thank you, I tried in my other server with res_srtp. The device receive the call but It seems that the call crashed when I answer. It’s Asterisk 13 with chan_sip this time, but I read that we can also use this channel for webrtc. Did you know why this happens ? I don’t know if it is a Asterisk problem or not.

sip.conf :

[general]
udpbindaddr=0.0.0.0:5060
realm=178.33.26.237
transport=udp,ws,wss

[0677777777]
context=diese-context-2
type=friend;
host=dynamic
secret=9999
callerid=0677777777<0677777777>
disallow=all
allow=ulaw
icesupport=yes
transport=udp,wss,ws
avpf=yes
encryption=yes;Active l’encryption media
dtlsenable=yes
dtlsverify=fingerprint
dtlscertfile=/etc/asterisk/keys/asterisk.pem
dtlscafile=/etc/asterisk/keys/ca.crt;
dtls_auto_generate_cert=yes
use_avpf=yes
media_encryption=dtls
dtls_verify=no
dtls_setup=actpass
ice_support=yes
media_use_received_transport=yes
rtcp_mux=yes
directmedia=no
nat = yes, force_rport

[0611223344]
context=diese-context-2
type=friend
host=dynamic
secret=**********
callerid=0611223344<0611223344>
disallow=all
allow=ulaw
icesupport=yes
transport=udp,wss,ws
avpf=yes
encryption=yes
dtlsenable=yes
dtlsverify=fingerprint
dtlscertfile=/etc/asterisk/keys/asterisk.pem
dtlscafile=/etc/asterisk/keys/ca.crt
dtls_auto_generate_cert=yes
use_avpf=yes
media_encryption=dtls
dtls_verify=no
dtls_setup=actpass
ice_support=yes
media_use_received_transport=yes
rtcp_mux=yes
directmedia=no
nat = yes, force_rport

I don’t provide support on unsupported versions or for chan_sip. Someone else may be able to answer if they choose. You haven’t actually stated what “call crashed” means though.

The call ends immediately after picking up. Ok then I will install srtp module on my new server and see what happens. Do you know I easy way to do it on linux , (apt get install or other) ?

It entirely depends on the Linux distribution in use. If it’s Debian or Ubuntu, then it is available as a package - which package depends on which distribution. On mine, for example, it’s “libsrtp2-dev”.

Thank you, I am on Debian (Raspbian) … I will search the package then

I found “libsrtp0” but when I open the menu select (“make menuselect”) to take res_srtp, it still be not selectable. I’m on Raspbian, is it normal or is this not the good package ?

The development package is required. If installed then the configure script has to be re-run to detect it.

Thank you, do i have to compile asterisk again ?

You will need to re-run make in order to build the res_srtp module, and then make install to install it. Assuming that is how such a thing works in your environment.

Hi ! Thank you very much for you help ! With res_srtp module up, it works ! I didn’t know that we can call a webrtc client from a simple sip client (pur rtp/udp) without gateway. An other simple question, do you know the way to install opus codec ?

Sangoma does not provide a codec_opus for the Raspberry Pi platform. I can’t comment on any other implementation.

I’m watching a forum post that saying that we can download the opus.so, i hope I understand, I’m not really a linux user, anyway, thank you !

It is possible and does work perfectly fine, I have tried it recently on AST18. You have to include some files when you build. The make menuselect will try to download the X86 versions, and most .so files will probably not work.

I’m busy with a video that covers all this, but if you want to muddle along here are some of the basics:

If you are trying to be external from you server you will need a to do a wss to sip transformation. (Assuming you want to try to be secure)

I’m using queuemetrics webrtc phone… because I purchased that product as well.

I use Ingate Separators but you can go Kamilio or other sbc. Note to me the Ingates aren’t free but they have support and they work. To each there own in product choices.

Sorry, to be clear, I was saying that opus codec on Raspberry Pi (running latest Raspberry Pi OS) works perfectly fine, and the steps you need to follow are in the Github page.