[asterisk-commits] dvossel: branch dvossel/sip_resource_list_trunk r186808 - /team/dvossel/sip_r...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 7 17:39:45 CDT 2009


Author: dvossel
Date: Tue Apr  7 17:39:41 2009
New Revision: 186808

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=186808
Log:
Updating current work,  Down to creating Notify for subscriptions, definitely not as straight forward as it appears.  todo, implement resourcelist and pvt locking correctly.

Modified:
    team/dvossel/sip_resource_list_trunk/channels/chan_sip.c

Modified: team/dvossel/sip_resource_list_trunk/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/dvossel/sip_resource_list_trunk/channels/chan_sip.c?view=diff&rev=186808&r1=186807&r2=186808
==============================================================================
--- team/dvossel/sip_resource_list_trunk/channels/chan_sip.c (original)
+++ team/dvossel/sip_resource_list_trunk/channels/chan_sip.c Tue Apr  7 17:39:41 2009
@@ -665,7 +665,7 @@
 	{ PIDF_XML,        "presence", "application/pidf+xml",        "pidf+xml" },       /* RFC 3863 */
 	{ XPIDF_XML,       "presence", "application/xpidf+xml",       "xpidf+xml" },       /* Pre-RFC 3863 with MS additions */
 	{ MWI_NOTIFICATION,	"message-summary", "application/simple-message-summary", "mwi" }, /* RFC 3842: Mailbox notification */
-	{ DIALOG_RLMI_XML, "dialog",   "multipart/related;boundary=UniqueAsteriskRLMIBoundary;type=application/rlmi+xml", "application/rlmi+xml" } /* RFC 4662 */
+	{ DIALOG_RLMI_XML, "dialog",   "multipart/related;boundary=UniqueAsteriskRLMIBoundary;type=application/rlmi+xml", "application/rlmi+xml" } /* RFC 4662 todohere fix boundary */
 };
 
 
@@ -1883,7 +1883,6 @@
 struct sip_rlist_resource {
 	int stateid;
 	int laststate;
-	int dialogver;
 
 	AST_DECLARE_STRING_FIELDS(
 		AST_STRING_FIELD(exten);       /*!< this is an extension to watch within rlist */
@@ -1898,7 +1897,6 @@
 	AST_DECLARE_STRING_FIELDS (
 		AST_STRING_FIELD(context);
 	);
-	int version;
 	int the_mark;
 	int num_watchers;
 	int startmonitor;
@@ -10514,6 +10512,7 @@
 	subscriptiontype = find_subscription_type(p->subscribed);
 	
 	/* Check which device/devices we are watching  and if they are registered */
+	//todohere this should not be done for rlmi, fix it
 	if (ast_get_hint(hint, sizeof(hint), NULL, 0, NULL, p->context, p->exten)) {
 		char *hint2 = hint, *individual_hint = NULL;
 		int hint_count = 0, unavailable_count = 0;
@@ -10577,6 +10576,20 @@
 	}
 	switch (p->subscribed) {
 	case XPIDF_XML:
+	case DIALOG_RLMI_XML:
+	//todohere finish progress made in creating rlmi NOTIFY
+	/*	struct sip_rlist_resource *resource;
+		//todohere add name attributes for list and elements within list
+		ast_str_append(&tmp, 0, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
+		ast_str_append(&tmp, 0, "<list xmlns=\"urn:ietf:params:xml:ns:rlmi\"\n");
+		ast_str_append(&tmp, 0, "uri=\"%s\">\n", mfrom);
+		ast_str_append(&tmp, 0, "version=\"%d\" fullState=\"true\">", p->dialogver);
+		AST_LIST_TRAVERSE(&p->rlist->resources, resource, entry) {
+			ast_str_append(&tmp, 0, "<resource uri=\"sip:%s@%s\">", resource->exten, p->fromdomain);
+			ast_str_append(&tmp, 0, "<instance id="
+		}
+		//ast_log(LOG_NOTICE, "IN NOTIFY, mfrom:%s, mto:%s p->domain:%s \n", mfrom, mto, p->fromdomain);
+	*/
 	case CPIM_PIDF_XML:
 		ast_str_append(&tmp, 0,
 			"<?xml version=\"1.0\"?>\n"
@@ -12189,6 +12202,7 @@
 {
 	struct sip_rlist *rlist = data;
 	struct sip_rlist_resource *resource;
+	struct sip_pvt *pvt;
 	int found = 0;
 
 
@@ -12212,7 +12226,8 @@
 	switch(state) {
 	case AST_EXTENSION_DEACTIVATED:	/* Retry after a while */
 	case AST_EXTENSION_REMOVED:	/* Extension is gone */
-		resource->stateid = -1;
+		//todohere how to handle this ?
+		//resource->stateid = -1;
 		break;
 	default:	/* Tell user */
 		resource->laststate = state;
@@ -12220,6 +12235,10 @@
 	}
 
 //todohere transmit notify to all rlist watchers, something like this transmit_rlist_state_notify(p, state, 1, FALSE);
+	AST_LIST_TRAVERSE(&rlist->watchers, pvt, rlist_entry) {
+		ast_log(LOG_NOTICE, "SENDING NOTIFY FOR pvt\n"); //todohere remove
+		transmit_state_notify(pvt, state, 1, FALSE);
+	}
 	return 0;
 }
 
@@ -21161,6 +21180,7 @@
 				ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
 				transmit_response(p, "200 OK", req);
 				ast_string_field_build(p, subscribeuri, "%s@%s", p->exten, p->context);
+				p->dialogver = 0;
 				//todohere force first notify and delete any matching old subscriptions (they will time out, but why wait
 			} else {
 				transmit_response(p, "404 Not found", req);




More information about the asterisk-commits mailing list