[asterisk-commits] res pjsip pidf eyebeam body supplement: Correct status prese... (asterisk[14])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Aug 1 14:13:42 CDT 2017
George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/6097 )
Change subject: res_pjsip_pidf_eyebeam_body_supplement: Correct status presentation
......................................................................
res_pjsip_pidf_eyebeam_body_supplement: Correct status presentation
This change fixes PIDF content generation when the underlying device
state is considered in use. Previously it was incorrectly marked
as closed meaning they were offline/unavailable. The code now
correctly marks them as open.
Additionally:
* Generate an XML element for our activity instead of a using a text
node.
* Consider every extension state other than "unavailable" to be 'open'
status.
* Update the XML namespaces and structure to reflect those
documented in RFC 4480
* Use 'on-the-phone' (defined in RFC 4880) instead of 'busy' as the
"in use" activity. This change results in eyeBeam using the
appropriate icon for the watched user.
This was tested on eyeBeam 1.5.20.2 build 59030 on Windows.
ASTERISK-26659 #close
Reported by: Abraham Liebsch
patches:
ASTERISK-26659.diff submitted by snuffy (license 5024)
Change-Id: I6e5ad450f91106029fb30517b8c0ea0c2058c810
---
M res/res_pjsip/presence_xml.c
M res/res_pjsip_pidf_body_generator.c
M res/res_pjsip_pidf_eyebeam_body_supplement.c
3 files changed, 24 insertions(+), 26 deletions(-)
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
diff --git a/res/res_pjsip/presence_xml.c b/res/res_pjsip/presence_xml.c
index 1aca307..3cea79e9 100644
--- a/res/res_pjsip/presence_xml.c
+++ b/res/res_pjsip/presence_xml.c
@@ -89,7 +89,7 @@
case AST_EXTENSION_RINGING:
*statestring = "early";
*local_state = NOTIFY_INUSE;
- *pidfstate = "busy";
+ *pidfstate = "on-the-phone";
*pidfnote = "Ringing";
break;
case (AST_EXTENSION_INUSE | AST_EXTENSION_RINGING):
@@ -99,31 +99,31 @@
*statestring = "confirmed";
}
*local_state = NOTIFY_INUSE;
- *pidfstate = "busy";
+ *pidfstate = "on-the-phone";
*pidfnote = "Ringing";
break;
case AST_EXTENSION_INUSE:
*statestring = "confirmed";
*local_state = NOTIFY_INUSE;
- *pidfstate = "busy";
+ *pidfstate = "on-the-phone";
*pidfnote = "On the phone";
break;
case AST_EXTENSION_BUSY:
*statestring = "confirmed";
- *local_state = NOTIFY_CLOSED;
- *pidfstate = "busy";
+ *local_state = NOTIFY_INUSE;
+ *pidfstate = "on-the-phone";
*pidfnote = "On the phone";
break;
case AST_EXTENSION_UNAVAILABLE:
*statestring = "terminated";
*local_state = NOTIFY_CLOSED;
- *pidfstate = "away";
+ *pidfstate = "--";
*pidfnote = "Unavailable";
break;
case AST_EXTENSION_ONHOLD:
*statestring = "confirmed";
- *local_state = NOTIFY_CLOSED;
- *pidfstate = "busy";
+ *local_state = NOTIFY_INUSE;
+ *pidfstate = "on-the-phone";
*pidfnote = "On hold";
break;
case AST_EXTENSION_NOT_INUSE:
diff --git a/res/res_pjsip_pidf_body_generator.c b/res/res_pjsip_pidf_body_generator.c
index cc10082..29c9e6b 100644
--- a/res/res_pjsip_pidf_body_generator.c
+++ b/res/res_pjsip_pidf_body_generator.c
@@ -75,7 +75,7 @@
pjpidf_tuple_set_contact(state_data->pool, tuple, pj_cstr(&contact, sanitized));
pjpidf_tuple_set_contact_prio(state_data->pool, tuple, pj_cstr(&priority, "1"));
pjpidf_status_set_basic_open(pjpidf_tuple_get_status(tuple),
- local_state == NOTIFY_OPEN);
+ local_state == NOTIFY_OPEN || local_state == NOTIFY_INUSE);
return 0;
}
diff --git a/res/res_pjsip_pidf_eyebeam_body_supplement.c b/res/res_pjsip_pidf_eyebeam_body_supplement.c
index a0f50fd..4047084 100644
--- a/res/res_pjsip_pidf_eyebeam_body_supplement.c
+++ b/res/res_pjsip_pidf_eyebeam_body_supplement.c
@@ -46,30 +46,28 @@
*/
static void add_eyebeam(pj_pool_t *pool, pj_xml_node *node, const char *pidfstate)
{
- static const char *XMLNS_PP = "xmlns:pp";
- static const char *XMLNS_PERSON = "urn:ietf:params:xml:ns:pidf:person";
+ static const char *XMLNS_DM_PREFIX = "xmlns:dm";
+ static const char *XMLNS_DM = "urn:ietf:params:xml:ns:pidf:data-model";
- static const char *XMLNS_ES = "xmlns:es";
- static const char *XMLNS_RPID_STATUS = "urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status";
+ static const char *XMLNS_RPID_PREFIX = "xmlns:rpid";
+ static const char *XMLNS_RPID = "urn:ietf:params:xml:ns:pidf:rpid";
- static const char *XMLNS_EP = "xmlns:ep";
- static const char *XMLNS_RPID_PERSON = "urn:ietf:params:xml:ns:pidf:rpid:rpid-person";
-
- pj_xml_node *person = ast_sip_presence_xml_create_node(pool, node, "pp:person");
- pj_xml_node *status = ast_sip_presence_xml_create_node(pool, person, "status");
+ pj_xml_node *person = ast_sip_presence_xml_create_node(pool, node, "dm:person");
if (pidfstate[0] != '-') {
- pj_xml_node *activities = ast_sip_presence_xml_create_node(pool, status, "ep:activities");
- size_t str_size = sizeof("ep:") + strlen(pidfstate);
+ pj_xml_node *activities = ast_sip_presence_xml_create_node(pool, person, "rpid:activities");
+ size_t str_size = sizeof("rpid:") + strlen(pidfstate);
+ char *act_str = ast_alloca(str_size);
- activities->content.ptr = pj_pool_alloc(pool, str_size);
- activities->content.slen = pj_ansi_snprintf(activities->content.ptr, str_size,
- "ep:%s", pidfstate);
+ /* Safe */
+ strcpy(act_str, "rpid:");
+ strcat(act_str, pidfstate);
+
+ ast_sip_presence_xml_create_node(pool, activities, act_str);
}
- ast_sip_presence_xml_create_attr(pool, node, XMLNS_PP, XMLNS_PERSON);
- ast_sip_presence_xml_create_attr(pool, node, XMLNS_ES, XMLNS_RPID_STATUS);
- ast_sip_presence_xml_create_attr(pool, node, XMLNS_EP, XMLNS_RPID_PERSON);
+ ast_sip_presence_xml_create_attr(pool, node, XMLNS_DM_PREFIX, XMLNS_DM);
+ ast_sip_presence_xml_create_attr(pool, node, XMLNS_RPID_PREFIX, XMLNS_RPID);
}
static int pidf_supplement_body(void *body, void *data)
--
To view, visit https://gerrit.asterisk.org/6097
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: merged
Gerrit-Change-Id: I6e5ad450f91106029fb30517b8c0ea0c2058c810
Gerrit-Change-Number: 6097
Gerrit-PatchSet: 3
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170801/42b63dd9/attachment-0001.html>
More information about the asterisk-commits
mailing list