[svn-commits] branch bweschke/polycom_acd_functions - r8043 /team/bweschke/polycom_acd_func...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Jan 12 20:52:29 CST 2006


Author: bweschke
Date: Thu Jan 12 20:52:27 2006
New Revision: 8043

URL: http://svn.digium.com/view/asterisk?rev=8043&view=rev
Log:
 Basic avail/unavail complete. TODO: Still need to add some sanity checking when breaking down the NOTIFY


Modified:
    team/bweschke/polycom_acd_functions/channels/chan_sip.c

Modified: team/bweschke/polycom_acd_functions/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/channels/chan_sip.c?rev=8043&r1=8042&r2=8043&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/channels/chan_sip.c (original)
+++ team/bweschke/polycom_acd_functions/channels/chan_sip.c Thu Jan 12 20:52:27 2006
@@ -58,6 +58,7 @@
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/agents.h"
+#include "asterisk/queues.h"
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
 #include "asterisk/config.h"
@@ -11294,6 +11295,8 @@
 	int debug = sip_debug_test_pvt(p);
 	char *e;
 	int error = 0;
+	int x = 0;
+	char *agentinterface = NULL, *tmp = NULL;
 
 	/* Clear out potential response */
 	memset(&resp, 0, sizeof(resp));
@@ -11446,6 +11449,36 @@
 	case SIP_NOTIFY:
 		/* XXX we get NOTIFY's from some servers. WHY?? Maybe we should
 			look into this someday XXX */
+		if (debug) {
+			x = 0;
+			while (x < req->lines) {
+				ast_log(LOG_DEBUG, "%d: %s\n", x, req->line[x]);
+				x++;
+			}
+				
+		}
+		if (req->lines == 6) {
+			 agentinterface = strstr(req->line[1], "sip:");
+			 if (agentinterface) {
+				agentinterface += 4;
+				tmp = strchr(agentinterface, '@');
+				if (tmp) {
+					*tmp = '\0';
+					if (strstr(req->line[3], "<basic>open")) {
+						ast_log(LOG_NOTICE, "SIP Device is requesting agent %s be unpaused.\n", agentinterface);
+						tmp = ast_strdupa(agentinterface);
+						sprintf(tmp, "Agent/%s", agentinterface);
+						ast_queuemember_callback_unpause(tmp);
+					}
+					if (strstr(req->line[3], "<basic>closed")) {
+						ast_log(LOG_NOTICE, "SIP Device is requesting agent %s be paused.\n", agentinterface);
+						tmp = ast_strdupa(agentinterface);
+						sprintf(tmp, "Agent/%s", agentinterface);
+						ast_queuemember_callback_pause(tmp);
+					}
+				} 	
+			 }
+		} 
 		transmit_response(p, "200 OK", req);
 		if (!p->lastinvite) 
 			ast_set_flag(p, SIP_NEEDDESTROY);	



More information about the svn-commits mailing list