[Asterisk-code-review] presence xml.c: PJSIP presence - incorrectly marked as CLOSED (asterisk[13])

Daniel Journo asteriskteam at digium.com
Sat Jun 3 21:26:15 CDT 2017


Daniel Journo has uploaded a new change for review. ( https://gerrit.asterisk.org/5749 )

Change subject: presence_xml.c: PJSIP presence - incorrectly marked as CLOSED
......................................................................

presence_xml.c: PJSIP presence - incorrectly marked as CLOSED

Presence notifications were incorrectly marked as CLOSED meaning
offline/unavailable when on a call according to the RFC.

ASTERISK-26659 #close
Reported by: Abraham Liebsch

Change-Id: Id1f4d1224d6c9b3fd8b01e6c708885e72f6a3a49
---
M res/res_pjsip/presence_xml.c
M res/res_pjsip_pidf_eyebeam_body_supplement.c
2 files changed, 8 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/49/5749/1

diff --git a/res/res_pjsip/presence_xml.c b/res/res_pjsip/presence_xml.c
index c991a0d..16809e0 100644
--- a/res/res_pjsip/presence_xml.c
+++ b/res/res_pjsip/presence_xml.c
@@ -87,25 +87,25 @@
 	switch (state) {
 	case AST_EXTENSION_RINGING:
 		*statestring = "early";
-		*local_state = NOTIFY_INUSE;
+		*local_state = NOTIFY_OPEN;
 		*pidfstate = "busy";
 		*pidfnote = "Ringing";
 		break;
 	case (AST_EXTENSION_INUSE | AST_EXTENSION_RINGING):
 		*statestring = "confirmed";
-		*local_state = NOTIFY_INUSE;
+		*local_state = NOTIFY_OPEN;
 		*pidfstate = "busy";
 		*pidfnote = "Ringing";
 		break;
 	case AST_EXTENSION_INUSE:
 		*statestring = "confirmed";
-		*local_state = NOTIFY_INUSE;
+		*local_state = NOTIFY_OPEN;
 		*pidfstate = "busy";
 		*pidfnote = "On the phone";
 		break;
 	case AST_EXTENSION_BUSY:
 		*statestring = "confirmed";
-		*local_state = NOTIFY_CLOSED;
+		*local_state = NOTIFY_OPEN;
 		*pidfstate = "busy";
 		*pidfnote = "On the phone";
 		break;
@@ -117,7 +117,7 @@
 		break;
 	case AST_EXTENSION_ONHOLD:
 		*statestring = "confirmed";
-		*local_state = NOTIFY_CLOSED;
+		*local_state = NOTIFY_OPEN;
 		*pidfstate = "busy";
 		*pidfnote = "On hold";
 		break;
diff --git a/res/res_pjsip_pidf_eyebeam_body_supplement.c b/res/res_pjsip_pidf_eyebeam_body_supplement.c
index cd590c3..66211c1 100644
--- a/res/res_pjsip_pidf_eyebeam_body_supplement.c
+++ b/res/res_pjsip_pidf_eyebeam_body_supplement.c
@@ -60,11 +60,10 @@
 
 	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);
+		struct ast_str *act_str = ast_str_alloca(strlen("ep:") + strlen(pidfstate) + 1);
 
-		activities->content.ptr = pj_pool_alloc(pool, str_size);
-		activities->content.slen = pj_ansi_snprintf(activities->content.ptr, str_size,
-				"ep:%s", pidfstate);
+		ast_str_append(&act_str, 0, "ep:%s", pidfstate);
+		ast_sip_presence_xml_create_node(pool, activities, ast_str_buffer(act_str));
 	}
 
 	ast_sip_presence_xml_create_attr(pool, node, XMLNS_PP, XMLNS_PERSON);

-- 
To view, visit https://gerrit.asterisk.org/5749
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1f4d1224d6c9b3fd8b01e6c708885e72f6a3a49
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Daniel Journo <dan at keshercommunications.com>



More information about the asterisk-code-review mailing list