[asterisk-commits] marquis: branch group/pinana-publish-1.4 r296989 - in /team/group/pinana-publ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 30 20:57:10 CST 2010


Author: marquis
Date: Tue Nov 30 20:57:04 2010
New Revision: 296989

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=296989
Log:
Make the case of already having an epa_entry actually work properly, though currently duplicates code.  Also, correct backported ast_devstate_str function to account for difference in ast_device_state enum between 1.4 and trunk.

Modified:
    team/group/pinana-publish-1.4/channels/chan_sip.c
    team/group/pinana-publish-1.4/main/devicestate.c

Modified: team/group/pinana-publish-1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pinana-publish-1.4/channels/chan_sip.c?view=diff&rev=296989&r1=296988&r2=296989
==============================================================================
--- team/group/pinana-publish-1.4/channels/chan_sip.c (original)
+++ team/group/pinana-publish-1.4/channels/chan_sip.c Tue Nov 30 20:57:04 2010
@@ -9944,10 +9944,17 @@
 	while ((device = ao2_iterator_next(&i))) {
 		ast_log(LOG_DEBUG, "   PUBLISH: Comparing %s and device %s\n", device->name, sc->dev);
 		if (!strcasecmp(device->pubname, pres_server->name) && !strcasecmp(device->name, sc->dev)) {
+			//Most or all of this code duplication will go away when we start using libxml2
 			char uri[SIPBUFSIZE];
+			char body[SIPBUFSIZE * 2];
+			char dlg_id[20];
+			size_t maxbytes = sizeof(body);
 			found = TRUE;
 			ast_log(LOG_DEBUG, "*** Found our friend %s in the existing list \n", device->name);
-			//This is the wrong thing to do here because the dialog id hasn't changed...
+			generate_random_string(dlg_id, sizeof(dlg_id));
+			ast_log(LOG_WARNING, "Device state is %d, %s\n", sc->state, ast_devstate_str(sc->state));
+			presence_build_dialoginfo_xml(body, &maxbytes, 1, ast_devstate_str(sc->state), dlg_id, 1, uri, 0);
+			ast_copy_string(device->epa->body, body, sizeof(device->epa->body));
 			snprintf(uri, sizeof(uri), "sip:%s@%s", sc->dev, pres_server->domain);
 			transmit_publish(device->epa, publish_type, uri);
 			/* Do stuff here */

Modified: team/group/pinana-publish-1.4/main/devicestate.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pinana-publish-1.4/main/devicestate.c?view=diff&rev=296989&r1=296988&r2=296989
==============================================================================
--- team/group/pinana-publish-1.4/main/devicestate.c (original)
+++ team/group/pinana-publish-1.4/main/devicestate.c Tue Nov 30 20:57:04 2010
@@ -102,7 +102,7 @@
 /* Parseable */
 const char *ast_devstate_str(enum ast_device_state state)
 {
-        return devstatestring[state][1];
+        return devstatestring[state - 1][1];
 }
 /*! \brief Find out if device is active in a call or not 
 	\note find channels with the device's name in it




More information about the asterisk-commits mailing list