summaryrefslogtreecommitdiff
path: root/res/res_pjsip_pidf_eyebeam_body_supplement.c
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-07-26 09:48:29 -0400
committerGeorge Joseph <gjoseph@digium.com>2017-08-01 15:42:38 -0600
commit2be8d91c0f5802a1f9c87b35f8f419e0db1b22d8 (patch)
treee412f590ea4cede5ef0cf8f5f1f6ac3ee78e461b /res/res_pjsip_pidf_eyebeam_body_supplement.c
parent2a4283f3e7f0c8459be1f6e877d3ef45a8ceacc2 (diff)
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
Diffstat (limited to 'res/res_pjsip_pidf_eyebeam_body_supplement.c')
-rw-r--r--res/res_pjsip_pidf_eyebeam_body_supplement.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/res/res_pjsip_pidf_eyebeam_body_supplement.c b/res/res_pjsip_pidf_eyebeam_body_supplement.c
index a0f50fdde..40470840c 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);
+
+ /* Safe */
+ strcpy(act_str, "rpid:");
+ strcat(act_str, pidfstate);
- activities->content.ptr = pj_pool_alloc(pool, str_size);
- activities->content.slen = pj_ansi_snprintf(activities->content.ptr, str_size,
- "ep:%s", 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)