[asterisk-commits] mmichelson: branch group/CCSS r236664 - /team/group/CCSS/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 28 10:36:20 CST 2009


Author: mmichelson
Date: Mon Dec 28 10:36:18 2009
New Revision: 236664

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=236664
Log:
Add function to add pidf body to CC PUBLISH requests.


Modified:
    team/group/CCSS/channels/chan_sip.c

Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=236664&r1=236663&r2=236664
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Mon Dec 28 10:36:18 2009
@@ -3685,6 +3685,27 @@
 	return 0;
 }
 
+static int construct_pidf_body(enum sip_cc_publish_state state, char *pidf_body, size_t size)
+{
+	struct ast_str *body = ast_str_alloca(size);
+	char tuple_id[32];
+
+	generate_random_string(tuple_id, sizeof(tuple_id));
+
+	/* We'll make this a bare-bones pidf body. In state_notify_build_xml, the PIDF
+	 * body gets a lot more extra junk that isn't necessary, so we'll leave it out here.
+	 */
+	ast_str_append(&body, 0, "<?xml version= \"1.0\"?>\n");
+	/* XXX Need to come up with an entity name to put in here. */
+	ast_str_append(&body, 0, "<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" entity=\"?????\">\n");
+	ast_str_append(&body, 0, "<tuple id=\"%s\"\n", tuple_id);
+	ast_str_append(&body, 0, "<status><basic>%s</basic></status>\n", state == CC_OPEN ? "open" : "closed");
+	ast_str_append(&body, 0, "</tuple>\n");
+	ast_str_append(&body, 0, "</presence>\n");
+	ast_copy_string(pidf_body, ast_str_buffer(body), size);
+	return 0;
+}
+
 static int sip_cc_monitor_suspend(struct ast_cc_monitor *monitor, const int core_id)
 {
 	struct sip_monitor_instance *monitor_instance = find_sip_monitor_instance(core_id);




More information about the asterisk-commits mailing list