Migrating to pjsip and getting 488 error code

Hello,

I am building an asterisk based personal VoIP service for syncloud.org (open source app store for raspberrypi-like devices).

I am trying to migrate from sip to pjsip but am unable to setup test configuration and constantly getting 488 error when making a call from one user to another. In this scenario I am trying make a test call from one test user (test1/6001) to another (test2)

Could anyone help?

Here is the config:

[transport-udp]
type = transport
external_signaling_address = ${domain}
external_signaling_port = ${port}
protocol = udp
bind = 0.0.0.0:${port}

; NAT settings
;local_net = 10.0.0.0/8
local_net=192.168.0.0/255.255.0.0 ; RFC 1918 addresses
local_net=10.0.0.0/255.0.0.0 ; Also RFC1918
local_net=172.16.0.0/12 ; Another RFC1918 with CIDR notation
local_net=169.254.0.0/255.255.0.0 ; Zero conf local network

;================================ ENDPOINT TEMPLATES ==

endpoint_internal
type=endpoint
transport=transport-udp
context=from-internal
allow=all
direct_media=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
use_avpf=yes
ice_support=yes

auth_userpass
type = auth
auth_type = userpass

aor_dynamic
type=aor
max_contacts=1
;Definitions for our phones, using the templates above

test
auth=test
aors=test
test
password=test ; put a strong, unique password here instead
username=test
test

test1
auth=test1
aors=test1
test1
password=test1 ; put a strong, unique password here instead
username=test1
test1

test2
auth=test2
aors=test2
test2
password=test2 ; put a strong, unique password here instead
username=test2
test2

webrtc
auth=webrtc
aors=webrtc
media_encryption = dtls
dtls_verify = no
dtls_cert_file = /opt/data/platform/syncloud.crt
dtls_private_key = /opt/data/platform/syncloud.key
dtls_setup = actpass

webrtc
password=webrtc ; put a strong, unique password here instead
username=webrtc
webrtc

Here us the log:

SIP/2.0 200 OK
Via: SIP/2.0/UDP 127.0.0.1:40902;rport=40902;received=127.0.0.1;branch=z9hG4bKPj60c23304-5594-44b9-9186-e089f2bbb219
Call-ID: 454efec5-ebc5-4404-80b3-79fcfebf9e4d
From: sip:test2@localhost;tag=5c6b84e3-61ad-4333-a1f7-dcfb64bd4767
To: sip:test2@localhost;tag=z9hG4bKPj60c23304-5594-44b9-9186-e089f2bbb219
CSeq: 9053 REGISTER
Date: Tue, 19 Apr 2016 11:13:05 GMT
Contact: sip:test2@192.168.99.49:5070;ob;expires=299
Expires: 300
Server: Asterisk PBX 13.8.0
Content-Length: 0

[Apr 19 11:13:05] VERBOSE[679] res_pjsip_logger.c: <— Received SIP request (1076 bytes) from UDP:127.0.0.1:40902 —>
INVITE sip:6002@localhost:5070 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:40902;rport;branch=z9hG4bKPjd9710c5f-8f83-451c-b41a-f419f8116f8a
Max-Forwards: 70
From: sip:test1@localhost;tag=ae77eb11-37a7-4028-bac9-024b7512dfc3
To: sip:6002@localhost
Contact: sip:test1@127.0.0.1:40902;ob
Call-ID: 13994db0-7a4e-4e7c-845f-80823abcb95c
CSeq: 31865 INVITE
Route: sip:localhost:5070;lr
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
User-Agent: pjsip python
Content-Type: application/sdp
Content-Length: 428

v=0
o=- 3670053185 3670053185 IN IP4 192.168.99.49
s=pjmedia
b=AS:84
t=0 0
a=X-nat:0
m=audio 4000 RTP/AVP 98 97 99 3 0 8 9 96
c=IN IP4 192.168.99.49
b=TIAS:64000
a=rtcp:4001 IN IP4 192.168.99.49
a=sendrecv
a=rtpmap:98 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:99 speex/32000
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16

[Apr 19 11:13:05] DEBUG[679] netsock2.c: Splitting ‘127.0.0.1:40902’ into…
[Apr 19 11:13:05] DEBUG[679] netsock2.c: …host ‘127.0.0.1’ and port ‘40902’.
[Apr 19 11:13:05] DEBUG[679] netsock2.c: Splitting ‘0.0.0.0:5070’ into…
[Apr 19 11:13:05] DEBUG[679] netsock2.c: …host ‘0.0.0.0’ and port ‘5070’.
[Apr 19 11:13:05] DEBUG[680] res_pjsip_endpoint_identifier_ip.c: No identify sections to match against
[Apr 19 11:13:05] DEBUG[680] res_pjsip_endpoint_identifier_user.c: Retrieved endpoint test1
[Apr 19 11:13:05] DEBUG[680] netsock2.c: Splitting ‘192.168.99.49’ into…
[Apr 19 11:13:05] DEBUG[680] netsock2.c: …host ‘192.168.99.49’ and port ‘’.
[Apr 19 11:13:05] DEBUG[680] netsock2.c: Splitting ‘127.0.0.1’ into…
[Apr 19 11:13:05] DEBUG[680] netsock2.c: …host ‘127.0.0.1’ and port ‘’.
[Apr 19 11:13:05] DEBUG[680] netsock2.c: Splitting ‘127.0.0.1’ into…
[Apr 19 11:13:05] DEBUG[680] netsock2.c: …host ‘127.0.0.1’ and port ‘’.
[Apr 19 11:13:05] DEBUG[680] netsock2.c: Splitting ‘0.0.0.0:5070’ into…
[Apr 19 11:13:05] DEBUG[680] netsock2.c: …host ‘0.0.0.0’ and port ‘5070’.
[Apr 19 11:13:05] DEBUG[680] netsock2.c: Splitting ‘127.0.0.1:40902’ into…
[Apr 19 11:13:05] DEBUG[680] netsock2.c: …host ‘127.0.0.1’ and port ‘40902’.
[Apr 19 11:13:05] VERBOSE[680] res_pjsip_logger.c: <— Transmitting SIP response (555 bytes) to UDP:127.0.0.1:40902 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 127.0.0.1:40902;rport=40902;received=127.0.0.1;branch=z9hG4bKPjd9710c5f-8f83-451c-b41a-f419f8116f8a
Call-ID: 13994db0-7a4e-4e7c-845f-80823abcb95c
From: sip:test1@localhost;tag=ae77eb11-37a7-4028-bac9-024b7512dfc3
To: sip:6002@localhost;tag=z9hG4bKPjd9710c5f-8f83-451c-b41a-f419f8116f8a
CSeq: 31865 INVITE
WWW-Authenticate: Digest realm=“asterisk”,nonce=“1461064385/2ac77bb418d2239c0bd4e520664c6a3a”,opaque=“07a5797b228bfb6f”,algorithm=md5,qop="auth"
Server: Asterisk PBX 13.8.0
Content-Length: 0

[Apr 19 11:13:05] VERBOSE[679] res_pjsip_logger.c: <— Received SIP request (410 bytes) from UDP:127.0.0.1:40902 —>
ACK sip:6002@localhost:5070 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:40902;rport;branch=z9hG4bKPjd9710c5f-8f83-451c-b41a-f419f8116f8a
Max-Forwards: 70
From: sip:test1@localhost;tag=ae77eb11-37a7-4028-bac9-024b7512dfc3
To: sip:6002@localhost;tag=z9hG4bKPjd9710c5f-8f83-451c-b41a-f419f8116f8a
Call-ID: 13994db0-7a4e-4e7c-845f-80823abcb95c
CSeq: 31865 ACK
Route: sip:localhost:5070;lr
Content-Length: 0

[Apr 19 11:13:05] DEBUG[679] netsock2.c: Splitting ‘127.0.0.1:40902’ into…
[Apr 19 11:13:05] DEBUG[679] netsock2.c: …host ‘127.0.0.1’ and port ‘40902’.
[Apr 19 11:13:05] DEBUG[679] netsock2.c: Splitting ‘0.0.0.0:5070’ into…
[Apr 19 11:13:05] DEBUG[679] netsock2.c: …host ‘0.0.0.0’ and port ‘5070’.
[Apr 19 11:13:05] VERBOSE[679] res_pjsip_logger.c: <— Received SIP request (1375 bytes) from UDP:127.0.0.1:40902 —>
INVITE sip:6002@localhost:5070 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:40902;rport;branch=z9hG4bKPj6609b94f-43e3-43ca-bc77-38dd39458c64
Max-Forwards: 70
From: sip:test1@localhost;tag=ae77eb11-37a7-4028-bac9-024b7512dfc3
To: sip:6002@localhost
Contact: sip:test1@127.0.0.1:40902;ob
Call-ID: 13994db0-7a4e-4e7c-845f-80823abcb95c
CSeq: 31866 INVITE
Route: sip:localhost:5070;lr
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
User-Agent: pjsip python
Authorization: Digest username=“test1”, realm=“asterisk”, nonce=“1461064385/2ac77bb418d2239c0bd4e520664c6a3a”, uri=“sip:6002@localhost:5070”, response=“059864488e9d1df913f9a0a03de0e4ba”, algorithm=md5, cnonce=“6b140718-7497-4daa-86a5-823eefef3852”, opaque=“07a5797b228bfb6f”, qop=auth, nc=00000001
Content-Type: application/sdp
Content-Length: 428

v=0
o=- 3670053185 3670053185 IN IP4 192.168.99.49
s=pjmedia
b=AS:84
t=0 0
a=X-nat:0
m=audio 4000 RTP/AVP 98 97 99 3 0 8 9 96
c=IN IP4 192.168.99.49
b=TIAS:64000
a=rtcp:4001 IN IP4 192.168.99.49
a=sendrecv
a=rtpmap:98 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:99 speex/32000
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16

[Apr 19 11:13:05] DEBUG[679] netsock2.c: Splitting ‘127.0.0.1:40902’ into…
[Apr 19 11:13:05] DEBUG[679] netsock2.c: …host ‘127.0.0.1’ and port ‘40902’.
[Apr 19 11:13:05] DEBUG[679] netsock2.c: Splitting ‘0.0.0.0:5070’ into…
[Apr 19 11:13:05] DEBUG[679] netsock2.c: …host ‘0.0.0.0’ and port ‘5070’.
[Apr 19 11:13:05] DEBUG[681] res_pjsip_endpoint_identifier_ip.c: No identify sections to match against
[Apr 19 11:13:05] DEBUG[681] res_pjsip_endpoint_identifier_user.c: Retrieved endpoint test1
[Apr 19 11:13:05] DEBUG[681] res_pjsip_endpoint_identifier_ip.c: No identify sections to match against
[Apr 19 11:13:05] DEBUG[681] res_pjsip_endpoint_identifier_user.c: Retrieved endpoint test1
[Apr 19 11:13:05] DEBUG[681] res_pjsip_authenticator_digest.c: Calculated nonce 1461064385/2ac77bb418d2239c0bd4e520664c6a3a. Actual nonce is 1461064385/2ac77bb418d2239c0bd4e520664c6a3a
[Apr 19 11:13:05] DEBUG[681] netsock2.c: Splitting ‘192.168.99.49’ into…
[Apr 19 11:13:05] DEBUG[681] netsock2.c: …host ‘192.168.99.49’ and port ‘’.
[Apr 19 11:13:05] DEBUG[681] netsock2.c: Splitting ‘127.0.0.1’ into…
[Apr 19 11:13:05] DEBUG[681] netsock2.c: …host ‘127.0.0.1’ and port ‘’.
[Apr 19 11:13:05] DEBUG[681] res_pjsip_session.c: Negotiating incoming SDP media stream ‘audio’ using audio SDP handler
[Apr 19 11:13:05] DEBUG[681] res_pjsip_session.c: Method is INVITE, Response is 488 Not Acceptable Here
[Apr 19 11:13:05] DEBUG[681] netsock2.c: Splitting ‘127.0.0.1’ into…
[Apr 19 11:13:05] DEBUG[681] netsock2.c: …host ‘127.0.0.1’ and port ‘’.
[Apr 19 11:13:05] DEBUG[681] netsock2.c: Splitting ‘0.0.0.0:5070’ into…
[Apr 19 11:13:05] DEBUG[681] netsock2.c: …host ‘0.0.0.0’ and port ‘5070’.
[Apr 19 11:13:05] DEBUG[681] netsock2.c: Splitting ‘127.0.0.1:40902’ into…
[Apr 19 11:13:05] DEBUG[681] netsock2.c: …host ‘127.0.0.1’ and port ‘40902’.
[Apr 19 11:13:05] VERBOSE[681] res_pjsip_logger.c: <— Transmitting SIP response (406 bytes) to UDP:127.0.0.1:40902 —>
SIP/2.0 488 Not Acceptable Here
Via: SIP/2.0/UDP 127.0.0.1:40902;rport=40902;received=127.0.0.1;branch=z9hG4bKPj6609b94f-43e3-43ca-bc77-38dd39458c64
Call-ID: 13994db0-7a4e-4e7c-845f-80823abcb95c
From: sip:test1@localhost;tag=ae77eb11-37a7-4028-bac9-024b7512dfc3
To: sip:6002@localhost;tag=e069ee26-5fd2-4f94-abb8-0050f36e06ec
CSeq: 31866 INVITE
Server: Asterisk PBX 13.8.0
Content-Length: 0

Are you using same codecs?
Are you allowing WebRTC settings to non WebRTC devices?

The issue to me appear in the SDP negotiation. Try to create templates for simple SIP devices and For WebSocket Devices. And check the codecs between the endpoints.

I am not really using/restricting to any specific codec at this point. That is why I have ‘allow: all’.

Webrtc is the main reason why I am migrating from sip to pjsip lib. I have just commented out webrtc sections as the whole setup is not working yet.

Result is the same, 488.

In sip lib I used to see server/client codec intersections in the log and it was easy to say where is the problem. Now I see only this:

a=rtpmap:98 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:99 speex/32000
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000

Probably client list, what about server.

Thanks for helping.

If you disable speex from your offering does the behavior change?

Same thing:

v=0
o=- 3670164214 3670164214 IN IP4 192.168.99.49
s=pjmedia
b=AS:84
t=0 0
a=X-nat:0
m=audio 4000 RTP/AVP 3 0 8 9 96
c=IN IP4 192.168.99.49
b=TIAS:64000
a=rtcp:4001 IN IP4 192.168.99.49
a=sendrecv
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16

[Apr 20 18:03:34] DEBUG[679] netsock2.c: Splitting ‘127.0.0.1:44659’ into…
[Apr 20 18:03:34] DEBUG[679] netsock2.c: …host ‘127.0.0.1’ and port ‘44659’.
[Apr 20 18:03:34] DEBUG[679] netsock2.c: Splitting ‘0.0.0.0:5070’ into…
[Apr 20 18:03:34] DEBUG[679] netsock2.c: …host ‘0.0.0.0’ and port ‘5070’.
[Apr 20 18:03:34] DEBUG[680] res_pjsip_endpoint_identifier_ip.c: No identify sections to match against
[Apr 20 18:03:34] DEBUG[680] res_pjsip_endpoint_identifier_user.c: Retrieved endpoint test1
[Apr 20 18:03:34] DEBUG[680] res_pjsip_authenticator_digest.c: Calculated nonce 1461175414/66377e67a26253676bb49af6abf67f5d. Actual nonce is 1461175414/66377e67a26253676bb49af6abf67f5d
[Apr 20 18:03:34] DEBUG[680] netsock2.c: Splitting ‘192.168.99.49’ into…
[Apr 20 18:03:34] DEBUG[680] netsock2.c: …host ‘192.168.99.49’ and port ‘’.
[Apr 20 18:03:34] DEBUG[680] netsock2.c: Splitting ‘127.0.0.1’ into…
[Apr 20 18:03:34] DEBUG[680] netsock2.c: …host ‘127.0.0.1’ and port ‘’.
[Apr 20 18:03:34] DEBUG[680] res_pjsip_session.c: Negotiating incoming SDP media stream ‘audio’ using audio SDP handler
[Apr 20 18:03:34] DEBUG[680] res_pjsip_session.c: Method is INVITE, Response is 488 Not Acceptable Here
[Apr 20 18:03:34] DEBUG[680] netsock2.c: Splitting ‘127.0.0.1’ into…
[Apr 20 18:03:34] DEBUG[680] netsock2.c: …host ‘127.0.0.1’ and port ‘’.
[Apr 20 18:03:34] DEBUG[680] netsock2.c: Splitting ‘0.0.0.0:5070’ into…
[Apr 20 18:03:34] DEBUG[680] netsock2.c: …host ‘0.0.0.0’ and port ‘5070’.
[Apr 20 18:03:34] DEBUG[680] netsock2.c: Splitting ‘127.0.0.1:44659’ into…
[Apr 20 18:03:34] DEBUG[680] netsock2.c: …host ‘127.0.0.1’ and port ‘44659’.
[Apr 20 18:03:34] VERBOSE[680] res_pjsip_logger.c: <— Transmitting SIP response (406 bytes) to UDP:127.0.0.1:44659 —>
SIP/2.0 488 Not Acceptable Here
Via: SIP/2.0/UDP 127.0.0.1:44659;rport=44659;received=127.0.0.1;branch=z9hG4bKPja3b60e65-cd21-43dd-aa58-569b633d209d
Call-ID: 5add83ec-cc9b-4bc9-ae7a-f4a25866a9c5
From: sip:test1@localhost;tag=bae65c1f-5533-4af7-9464-42295b87cff7
To: sip:6002@localhost;tag=40c4fd7b-dd01-4f50-8c0b-d16f9cd52a8c
CSeq: 23810 INVITE
Server: Asterisk PBX 13.8.0
Content-Length: 0

What is the current configuration you’re using? Same as before?

Yes, with disabled webrtc and speex (server and client):

[transport-udp]
type = transport
external_signaling_address = ${domain}
external_signaling_port = ${port}
protocol = udp
bind = 0.0.0.0:${port}

; NAT settings
;local_net = 10.0.0.0/8
local_net=192.168.0.0/255.255.0.0 ; RFC 1918 addresses
local_net=10.0.0.0/255.0.0.0 ; Also RFC1918
local_net=172.16.0.0/12 ; Another RFC1918 with CIDR notation
local_net=169.254.0.0/255.255.0.0 ; Zero conf local network

;================================ ENDPOINT TEMPLATES ==

endpoint_internal
type=endpoint
transport=transport-udp
context=from-internal
disallow=speex
allow=all
direct_media=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
use_avpf=yes
ice_support=yes

auth_userpass
type = auth
auth_type = userpass

aor_dynamic
type=aor
max_contacts=1
;Definitions for our phones, using the templates above

test
auth=test
aors=test
test
password=test ; put a strong, unique password here instead
username=test
test

test1
auth=test1
aors=test1
test1
password=test1 ; put a strong, unique password here instead
username=test1
test1

test2
auth=test2
aors=test2
test2
password=test2 ; put a strong, unique password here instead
username=test2
test2

;webrtc
;auth=webrtc
;aors=webrtc
;media_encryption = dtls
;dtls_verify = no
;dtls_cert_file = /opt/data/platform/syncloud.crt
;dtls_private_key = /opt/data/platform/syncloud.key
;dtls_setup = actpass

;webrtc
;password=webrtc ; put a strong, unique !password here instead
;username=webrtc
;webrtc

Set use_avpf to no in the configuration.

1 Like

That was it, now I am getting different error (503), but that is because I still need to convert my extensions from SIP to PJSIP format.

Thank you.