<p>Alexei Gradinari has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18233">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_pubsub: RLS 'uri' list attribute mismatch with SUBSCRIBE request<br><br>When asterisk generates the RLMI part of NOTIFY request,<br>the asterisk uses the local contact uri instead of the URI to which<br>the SUBSCRIBE request is sent.<br>Because of this mismatch some IP phones (for example Cisco 5XX) ignore<br>this list.<br><br>According<br>https://datatracker.ietf.org/doc/html/rfc4662#section-5.2<br>  The first mandatory <list> attribute is "uri", which contains the uri<br>  that corresponds to the list. Typically, this is the URI to which<br>  the SUBSCRIBE request was sent.<br>https://datatracker.ietf.org/doc/html/rfc4662#section-5.3<br>  The "uri" attribute identifies the resource to which the <resource><br>  element corresponds. Typically, this will be a SIP URI that, if<br>  subscribed to, would return the state of the resource.<br><br>This patch makes asterisk to generate URI using SUBSCRIBE request URI.<br><br>ASTERISK-29961 #close<br><br>Change-Id: I1fcfc08fd589677f40608c59a4e143c45ee05f6c<br>---<br>M res/res_pjsip_pubsub.c<br>1 file changed, 10 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/33/18233/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c</span><br><span>index 21174ae..1d13695 100644</span><br><span>--- a/res/res_pjsip_pubsub.c</span><br><span>+++ b/res/res_pjsip_pubsub.c</span><br><span>@@ -1257,7 +1257,14 @@</span><br><span>              const char *resource, const char *display_name, struct sip_subscription_tree *tree)</span><br><span> {</span><br><span>     struct ast_sip_subscription *sub;</span><br><span style="color: hsl(0, 100%, 40%);">-       pjsip_sip_uri *contact_uri;</span><br><span style="color: hsl(120, 100%, 40%);">+   pjsip_msg *msg;</span><br><span style="color: hsl(120, 100%, 40%);">+       pjsip_sip_uri *request_uri;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ msg = ast_sip_mod_data_get(tree->dlg->mod_data, pubsub_module.id, MOD_DATA_MSG);</span><br><span style="color: hsl(120, 100%, 40%);">+        if (!msg) {</span><br><span style="color: hsl(120, 100%, 40%);">+           ast_log(LOG_ERROR, "No dialog message saved for SIP subscription. Cannot allocate subscription for resource %s\n", resource);</span><br><span style="color: hsl(120, 100%, 40%);">+               return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span> </span><br><span>        sub = ast_calloc(1, sizeof(*sub) + strlen(resource) + 1);</span><br><span>    if (!sub) {</span><br><span>@@ -1280,8 +1287,8 @@</span><br><span>  }</span><br><span> </span><br><span>        sub->uri = pjsip_sip_uri_create(tree->dlg->pool, PJ_FALSE);</span><br><span style="color: hsl(0, 100%, 40%);">-    contact_uri = pjsip_uri_get_uri(tree->dlg->local.contact->uri);</span><br><span style="color: hsl(0, 100%, 40%);">-        pjsip_sip_uri_assign(tree->dlg->pool, sub->uri, contact_uri);</span><br><span style="color: hsl(120, 100%, 40%);">+        request_uri = pjsip_uri_get_uri(msg->line.req.uri);</span><br><span style="color: hsl(120, 100%, 40%);">+        pjsip_sip_uri_assign(tree->dlg->pool, sub->uri, request_uri);</span><br><span>       pj_strdup2(tree->dlg->pool, &sub->uri->user, resource);</span><br><span> </span><br><span>  /* If there is any persistence information available for this subscription that was persisted</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18233">change 18233</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/18233"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: I1fcfc08fd589677f40608c59a4e143c45ee05f6c </div>
<div style="display:none"> Gerrit-Change-Number: 18233 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>