[Home]

Summary:ASTERISK-26803: res_pjsip: AOR Bindings Erased on REGISTER-Fetch (Endpoint Unreachable)
Reporter:Peter Sokolov (peterdoo)Labels:
Date Opened:2017-02-17 11:33:52.000-0600Date Closed:
Priority:MajorRegression?
Status:Open/NewComponents:Resources/res_pjsip
Versions:14.3.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:
Description:Many endpoints follow the RFC and periodically send REGISTER request without the Contact: field to Asterisk to get the list of current AOR bindings.

RFC 3261 (10.3 Processing REGISTER Requests) instructs that if no contact field is present in the received REGISTER request, nothing should be done, just return the existing bindings in the OK reply to REGISTER request.

This worked correctly using chan_sip. However with chan_pjsip, when Asterisk receives a REGISTER request without the contact field, it simply erases AOR bindings for the endpoint instead of returning the existing bindings in the OK reply to REGISTER request. The endpoint state changes immediatelly (before the expiration time of bindings is reached) to unreachable until the endpoint refreshes its registration.

So all endpoints are unreachable from time to time and calls to them fail in that time intervals.

Here is a part of the log showing the behavior:
{noformat}
<--- Received SIP request (909 bytes) from UDP:2a00:x:x:x:x:x:x:x:5060 --->
REGISTER sip:mydom.com SIP/2.0
Via: SIP/2.0/UDP [2a00:x:x:x:x:x:x:x]:5060;branch=z9hG4bK19E6FAB45767CDAF
From: <sip:337@mydom.com>;tag=4225369515
To: <sip:337@mydom.com>
Call-ID: CDAF0BFBE092AEAC@[2a00:x:x:x:x:x:x:x]
CSeq: 84863 REGISTER
Authorization: Digest username="337", realm="mydom.com", nonce="1487294118/8a53bb8d1297c9010425d82300245d61", uri="sip:mydom.com", response="8a86c774918afdf01339ce4974162e84", algorithm=md5, cnonce="B1E79EA8920CB100", opaque="06645a9c1741f0c9", qop=auth, nc=00000001
Max-Forwards: 70
User-Agent: AVM FRITZ!Box 7330 107.06.50 (Apr  1 2016)
Supported: 100rel,replaces
Allow-Events: telephone-event,refer,reg
Allow: INVITE,ACK,OPTIONS,CANCEL,BYE,UPDATE,PRACK,INFO,SUBSCRIBE,NOTIFY,REFER,MESSAGE,PUBLISH
Accept: application/sdp, multipart/mixed
Accept-Encoding: identity
Content-Length: 0

[Feb 17 02:15:18] DEBUG[14877]: res_pjsip_endpoint_identifier_user.c:133 username_identify: Attempting identify by From username '337' domain 'mydom.com'
[Feb 17 02:15:18] DEBUG[14877]: res_pjsip_endpoint_identifier_user.c:145 username_identify: Identified by From username '337' domain 'mydom.com'

[Feb 17 02:15:18] DEBUG[14877]: res_pjsip_registrar.c:548 match_aor: Matched id '337' to aor '337'
[Feb 17 02:15:18] DEBUG[14877]: res_pjsip_registrar.c:637 find_registrar_aor: Matched aor '337' by To username

<--- Transmitting SIP response (430 bytes) to UDP:2a00:x:x:x:x:x:x:x:5060 --->
SIP/2.0 200 OK
v: SIP/2.0/UDP [2a00:x:x:x:x:x:x:x]:5060;rport=5060;received=2a00:x:x:x:x:x:x:x;branch=z9hG4bK19E6FAB45767CDAF
i: CDAF0BFBE092AEAC@[2a00:x:x:x:x:x:x:x]
f: <sip:337@mydom.com>;tag=4225369515
t: <sip:337@mydom.com>;tag=z9hG4bK19E6FAB45767CDAF
CSeq: 84863 REGISTER
Date: Fri, 17 Feb 2017 01:15:18 GMT
Server: Asterisk
l:  0

 == Endpoint 337 is now Unreachable
[Feb 17 02:15:18] DEBUG[16945]: devicestate.c:369 _ast_device_state: No provider found, checking channel drivers for PJSIP - 337
[Feb 17 02:15:18] DEBUG[16945]: devicestate.c:474 do_state_change: Changing state for PJSIP/337 - state 5 (Unavailable)
[Feb 17 02:15:18] DEBUG[16987]: app_queue.c:2503 device_state_cb: Device 'PJSIP/337' changed to state '5' (Unavailable) but we don't care because they're not a member of any queue.

 == Contact 337/sip:337@[2a00:x:x:x:x:x:x:x];uniq=C09040DC74C0F2A9D6039136CB478 has been deleted
{noformat}

The aor for the endpoint is configured in the following way:
{noformat}
[337]
type=aor
max_contacts=1
maximum_expiration=180
remove_existing=yes or no
{noformat}

It makes no difference whether remove_existing is set to yes or no.
Comments:By: Asterisk Team (asteriskteam) 2017-02-17 11:33:53.964-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].