<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6097">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Verified
  George Joseph: Looks good to me, but someone else must approve; Approved for Submit
  Kevin Harwell: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_pidf_eyebeam_body_supplement: Correct status presentation<br><br>This change fixes PIDF content generation when the underlying device<br>state is considered in use. Previously it was incorrectly marked<br>as closed meaning they were offline/unavailable. The code now<br>correctly marks them as open.<br><br>Additionally:<br><br>  * Generate an XML element for our activity instead of a using a text<br>    node.<br><br>  * Consider every extension state other than "unavailable" to be 'open'<br>    status.<br><br>  * Update the XML namespaces and structure to reflect those<br>    documented in RFC 4480<br><br>  * Use 'on-the-phone' (defined in RFC 4880) instead of 'busy' as the<br>    "in use" activity. This change results in eyeBeam using the<br>    appropriate icon for the watched user.<br><br>This was tested on eyeBeam 1.5.20.2 build 59030 on Windows.<br><br>ASTERISK-26659 #close<br>Reported by: Abraham Liebsch<br>patches:<br>  ASTERISK-26659.diff submitted by snuffy (license 5024)<br><br>Change-Id: I6e5ad450f91106029fb30517b8c0ea0c2058c810<br>---<br>M res/res_pjsip/presence_xml.c<br>M res/res_pjsip_pidf_body_generator.c<br>M res/res_pjsip_pidf_eyebeam_body_supplement.c<br>3 files changed, 24 insertions(+), 26 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip/presence_xml.c b/res/res_pjsip/presence_xml.c<br>index 1aca307..3cea79e9 100644<br>--- a/res/res_pjsip/presence_xml.c<br>+++ b/res/res_pjsip/presence_xml.c<br>@@ -89,7 +89,7 @@<br>         case AST_EXTENSION_RINGING:<br>           *statestring = "early";<br>             *local_state = NOTIFY_INUSE;<br>-         *pidfstate = "busy";<br>+               *pidfstate = "on-the-phone";<br>                *pidfnote = "Ringing";<br>              break;<br>        case (AST_EXTENSION_INUSE | AST_EXTENSION_RINGING):<br>@@ -99,31 +99,31 @@<br>                      *statestring = "confirmed";<br>                 }<br>             *local_state = NOTIFY_INUSE;<br>-         *pidfstate = "busy";<br>+               *pidfstate = "on-the-phone";<br>                *pidfnote = "Ringing";<br>              break;<br>        case AST_EXTENSION_INUSE:<br>             *statestring = "confirmed";<br>                 *local_state = NOTIFY_INUSE;<br>-         *pidfstate = "busy";<br>+               *pidfstate = "on-the-phone";<br>                *pidfnote = "On the phone";<br>                 break;<br>        case AST_EXTENSION_BUSY:<br>              *statestring = "confirmed";<br>-                *local_state = NOTIFY_CLOSED;<br>-                *pidfstate = "busy";<br>+               *local_state = NOTIFY_INUSE;<br>+         *pidfstate = "on-the-phone";<br>                *pidfnote = "On the phone";<br>                 break;<br>        case AST_EXTENSION_UNAVAILABLE:<br>               *statestring = "terminated";<br>                *local_state = NOTIFY_CLOSED;<br>-                *pidfstate = "away";<br>+               *pidfstate = "--";<br>          *pidfnote = "Unavailable";<br>          break;<br>        case AST_EXTENSION_ONHOLD:<br>            *statestring = "confirmed";<br>-                *local_state = NOTIFY_CLOSED;<br>-                *pidfstate = "busy";<br>+               *local_state = NOTIFY_INUSE;<br>+         *pidfstate = "on-the-phone";<br>                *pidfnote = "On hold";<br>              break;<br>        case AST_EXTENSION_NOT_INUSE:<br>diff --git a/res/res_pjsip_pidf_body_generator.c b/res/res_pjsip_pidf_body_generator.c<br>index cc10082..29c9e6b 100644<br>--- a/res/res_pjsip_pidf_body_generator.c<br>+++ b/res/res_pjsip_pidf_body_generator.c<br>@@ -75,7 +75,7 @@<br>         pjpidf_tuple_set_contact(state_data->pool, tuple, pj_cstr(&contact, sanitized));<br>       pjpidf_tuple_set_contact_prio(state_data->pool, tuple, pj_cstr(&priority, "1"));<br>     pjpidf_status_set_basic_open(pjpidf_tuple_get_status(tuple),<br>-                 local_state == NOTIFY_OPEN);<br>+                 local_state == NOTIFY_OPEN || local_state == NOTIFY_INUSE);<br> <br>        return 0;<br> }<br>diff --git a/res/res_pjsip_pidf_eyebeam_body_supplement.c b/res/res_pjsip_pidf_eyebeam_body_supplement.c<br>index a0f50fd..4047084 100644<br>--- a/res/res_pjsip_pidf_eyebeam_body_supplement.c<br>+++ b/res/res_pjsip_pidf_eyebeam_body_supplement.c<br>@@ -46,30 +46,28 @@<br>  */<br> static void add_eyebeam(pj_pool_t *pool, pj_xml_node *node, const char *pidfstate)<br> {<br>-   static const char *XMLNS_PP = "xmlns:pp";<br>-  static const char *XMLNS_PERSON = "urn:ietf:params:xml:ns:pidf:person";<br>+    static const char *XMLNS_DM_PREFIX = "xmlns:dm";<br>+   static const char *XMLNS_DM = "urn:ietf:params:xml:ns:pidf:data-model";<br> <br>- static const char *XMLNS_ES = "xmlns:es";<br>-  static const char *XMLNS_RPID_STATUS = "urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status";<br>+      static const char *XMLNS_RPID_PREFIX = "xmlns:rpid";<br>+       static const char *XMLNS_RPID = "urn:ietf:params:xml:ns:pidf:rpid";<br> <br>-     static const char *XMLNS_EP = "xmlns:ep";<br>-  static const char *XMLNS_RPID_PERSON = "urn:ietf:params:xml:ns:pidf:rpid:rpid-person";<br>-<br>-  pj_xml_node *person = ast_sip_presence_xml_create_node(pool, node, "pp:person");<br>-   pj_xml_node *status = ast_sip_presence_xml_create_node(pool, person, "status");<br>+    pj_xml_node *person = ast_sip_presence_xml_create_node(pool, node, "dm:person");<br> <br>         if (pidfstate[0] != '-') {<br>-           pj_xml_node *activities = ast_sip_presence_xml_create_node(pool, status, "ep:activities");<br>-         size_t str_size = sizeof("ep:") + strlen(pidfstate);<br>+               pj_xml_node *activities = ast_sip_presence_xml_create_node(pool, person, "rpid:activities");<br>+               size_t str_size = sizeof("rpid:") + strlen(pidfstate);<br>+             char *act_str = ast_alloca(str_size);<br> <br>-             activities->content.ptr = pj_pool_alloc(pool, str_size);<br>-          activities->content.slen = pj_ansi_snprintf(activities->content.ptr, str_size,<br>-                         "ep:%s", pidfstate);<br>+               /* Safe */<br>+           strcpy(act_str, "rpid:");<br>+          strcat(act_str, pidfstate);<br>+<br>+               ast_sip_presence_xml_create_node(pool, activities, act_str);<br>  }<br> <br>- ast_sip_presence_xml_create_attr(pool, node, XMLNS_PP, XMLNS_PERSON);<br>-        ast_sip_presence_xml_create_attr(pool, node, XMLNS_ES, XMLNS_RPID_STATUS);<br>-   ast_sip_presence_xml_create_attr(pool, node, XMLNS_EP, XMLNS_RPID_PERSON);<br>+   ast_sip_presence_xml_create_attr(pool, node, XMLNS_DM_PREFIX, XMLNS_DM);<br>+     ast_sip_presence_xml_create_attr(pool, node, XMLNS_RPID_PREFIX, XMLNS_RPID);<br> }<br> <br> static int pidf_supplement_body(void *body, void *data)<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6097">change 6097</a>. To unsubscribe, 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/6097"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 14 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I6e5ad450f91106029fb30517b8c0ea0c2058c810 </div>
<div style="display:none"> Gerrit-Change-Number: 6097 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>