Sergey
Sergey

Reputation: 21201

Asterisk 13.10 + pjsip + WebRTC - Rx buffer overflow (PJSIP_ERXOVERFLOW)

After testing pjsip for a couple of days I finally understood a bit how it works. I hoped it will help me making WebRTC calls from site.

Situation:

Here is pjsip "webrtc" config (for now):

[webrtc]
type=endpoint
transport=transport-udp
context=webrtc
disallow=all
allow=alaw
allow=ulaw
dtls_cert_file=/etc/letsencrypt/live/example.org/fullchain.pem
dtls_private_key=/etc/letsencrypt/live/example.org/privkey.pem
auth=webrtc
aors=webrtc
use_avpf=yes
direct_media=no

[webrtc]
type=aor
contact=sip:[email protected]:5060
max_contacts=1000
outbound_proxy=sip:example.org

[webrtc]
type=auth
auth_type=userpass
username=webrtc
password=psswd
realm=example.org

The problem happens when I make a call:

[Sep  1 17:50:37] ERROR[7760] pjproject:        sip_endpoint.c Error processing packet from 127.0.0.1:57928: Rx buffer overflow (PJSIP_ERXOVERFLOW)  [code 171062]:
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/WSS df7jal23ls0d.invalid;branch=z9hG4bKX7Ng7L0OKRBkpUqGlHPV4GfxO0I7d93i;rport
From: <sip:[email protected]>;tag=ypLlm1BDxPkn8aTTkVJL
To: <sip:[email protected]>
Contact: <sips:[email protected];rtcweb-breaker=no;click2call=no;transport=wss>;+g.oma.sip-im;language="en,fr"
Call-ID: 30f526f4-3c4f-e96f-391d-39290b9dc983
CSeq: 60845 INVITE
Content-Type: application/sdp
Content-Length: 3621
Max-Forwards: 70
User-Agent: IM-client/OMA1.0 sipML5-v1.2016.03.04
Organization: Doubango Telecom

v=0
o=- 8456797239022316000 2 IN IP4 127.0.0.1
s=Doubango Telecom - chrome
t=0 0
a=group:BUNDLE audio
a=msid-semantic: WMS gVGmhQ6UmwynNn99UhRNBJJjcV5AqYkpNF3M
m=audio 47942 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 126
c=IN IP4 ...
...
a=ice-ufrag:B0dVeWHjfVOT/n0s
a=ice-pwd:BP5DshTjqBa4CqBiZSb8ZpNp
a=fingerprint:sha-256 5B:41:25:27:9E:AD:F2:E9:F2:0A:D6:26:CF:FA:5A:C7:F3:7B:B6:35:32:9A:CF:04:35:2B:07:DB:A1:8F:2E:FD
a=setup:actpass
a=mid:audio
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=sendrecv
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtp

Why is it happening? The task is simple: just make a webrtc call to the simplest Asterisk extension (Playback(demo-congrats))

PS: I proxy /ws with Nginx, thats why it's 127.0.0.1 in Error processing packet from 127.0.0.1:57928.


Solve:

vim third-party/pjproject/patches/config_site.h
/* #define PJSIP_MAX_PKT_LEN            6000 */
#define PJ_ICE_MAX_CAND 32
#define PJ_ICE_MAX_CHECKS (PJ_ICE_MAX_CAND * 16)
#define PJSIP_MAX_PKT_LEN 12288

./configure --with-pjproject-bundled
make
make install

Upvotes: 3

Views: 2877

Answers (1)

Chad
Chad

Reputation: 2289

pjsip has a maximum packet size that can be exceeded by WebRTC SDPs. You can fix by following these steps:

  1. find (or create) config_site.h in your pjsip source distribution under include/pj/
  2. add (or set) the following define to increase the max message size: #define PJSIP_MAX_PKT_LEN 12288. A full example of the file may look something like this:

    #ifndef __PJ_CONFIG_SITE_H__
    #define __PJ_CONFIG_SITE_H__
    
    #define PJ_ICE_MAX_CAND 32
    #define PJ_ICE_MAX_CHECKS (PJ_ICE_MAX_CAND * 16)
    #define PJSIP_MAX_PKT_LEN 12288
    
    #endif /* __PJ_CONFIG_SITE_H__ */
    

    note: I also put in some other sane settings for WebRTC, to help make sure you don't hit a limit on your ice candidates, too.

  3. recompile pjsip
  4. recompile asterisk

Upvotes: 5

Related Questions