References

Read these ressources:

my notes, in the following sections, are only to document some bits that were not obvious at first.

PJSIP Wizard

The PJSIP Configuration Wizard avoids having to write those really redundant PJSIP sections.

PJSIP commands

Display SIP registrations (ex: connected to voip.ms accounts):

1
pjsip show registrations

Display SIP devices locally connected:

1
pjsip show endpoints

Opus codec installation

  • Install the opus codec for webrtc (apt-get install asterisk-opus)

Fixed: “Unable to find a codec translation path: (opus) -> (ulaw)”.

asterisk http.conf

1
2
3
servername=Asterisk
enabled=yes
bindaddr=192.168.42.1

I used nginx to handle https, because … habits and felt simpler (my asterisk VM didn’t have certbot/dehydrated).

asterisk pjsip.conf

I got rid of the old “sip” module, but that’s not required, both can run.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[general]
default_realm=bidon.ca

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

[transport-wss]
type=transport
protocol=wss
bind=192.168.42.1

[testrtc]
type=aor
max_contacts=5
remove_existing=yes

[testrtc]
type=auth
auth_type=userpass
username=testrtc
password=fixme
realm=bidon.ca

[testrtc]
type=endpoint
aors=testrtc
auth=testrtc
webrtc=yes
dtls_auto_generate_cert=yes
context=home
disallow=all
allow=opus,ulaw

todo: document trunk configurations.

extensions.conf

To switch from SIP to PJSIP, I had to change my dialplan so that it used, for example:

1
2
3
exten => _NXXNXXXXXX,1,Set(CALLERID(all)="Jane Doe <5145551212>")
exten => _NXXNXXXXXX,n,Dial(PJSIP/${EXTEN}@voipms5145551212)
exten => _NXXNXXXXXX,n,Congestion

sipML5 installation

Add to a nginx vhost with https:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
  location /ws {
    # prevents 502 bad gateway error
    proxy_buffers 8 32k;
    proxy_buffer_size 64k;

    # NB: my asterisk runs on 192.168.42.1, which is a different VM than
    # where my nginx runs. Had to open 8088 for that host on my asterisk VM
    proxy_pass http://192.168.41.1:8088/ws;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    #proxy_set_header X-NginX-Proxy true;

    # enables WS support
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

    proxy_read_timeout 999999999;
  }

based on: https://gist.github.com/steve-ng/ed6de1fa702ef70bd6ce

When using sipml5:

  • Dial Name: John Doe
  • Private Identity: testrtc
  • Public Identity: sip:testrtc@mydomain.org
  • Password: fixme
  • Realm: mydomain.org (because I have set one in pjsip.conf)
  • Expert mode:
    • Disable video: ✔
    • WebSocket Server URL: wss://myvoip.myserver.org:443/ws
    • Disable 3GPP Early IMS: ✔
    • Disable debug messages: ✔
    • Cache the media stream: ✔