[asterisk-commits] branch oej/subscribemwi r10624 - in /team/oej/subscribemwi: channels/ include...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Feb 21 01:25:56 MST 2006


Author: oej
Date: Tue Feb 21 02:25:54 2006
New Revision: 10624

URL: http://svn.digium.com/view/asterisk?rev=10624&view=rev
Log:
- Temporary fix for sha1 on FreeBSD 4.11
- Fixes for enabling subscriptions of MWI (while testing)

Modified:
    team/oej/subscribemwi/channels/chan_sip.c
    team/oej/subscribemwi/include/asterisk/sha1.h

Modified: team/oej/subscribemwi/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi/channels/chan_sip.c?rev=10624&r1=10623&r2=10624&view=diff
==============================================================================
--- team/oej/subscribemwi/channels/chan_sip.c (original)
+++ team/oej/subscribemwi/channels/chan_sip.c Tue Feb 21 02:25:54 2006
@@ -10799,15 +10799,18 @@
 			/* Do not destroy session, since we will break the call if we do */
 			ast_log(LOG_DEBUG, "Got a subscription within the context of another call, can't handle that - %s (Method %s)\n", p->callid, sip_methods[p->initreq.method].text);
 			return 0;
-		} else {
-			if (debug)
+		} else if (debug) {
+			if (p->subscribed != NONE)
 				ast_log(LOG_DEBUG, "Got a re-subscribe on existing subscription %s\n", p->callid);
+			else
+				ast_log(LOG_DEBUG, "Got a new subscription %s (possibly with auth)\n", p->callid);
 		}
 	}
 	if (!ignore && !p->initreq.headers) {
 		/* Use this as the basis */
 		if (debug)
-			ast_verbose("Using latest SUBSCRIBE request as basis request\n");
+			ast_verbose("Creating new subscription\n");
+
 		/* This call is no longer outgoing if it ever was */
 		ast_clear_flag(p, SIP_OUTGOING);
 		copy_request(&p->initreq, req);
@@ -10829,20 +10832,23 @@
 			}
 			return 0;
 		}
+
 		/* Initialize the context if it hasn't been already */
 		if (!ast_strlen_zero(p->subscribecontext))
 			ast_string_field_set(p, context, p->subscribecontext);
 		else if (ast_strlen_zero(p->context))
 			ast_string_field_set(p, context, default_context);
+
 		/* Get destination right away */
 		gotdest = get_destination(p, NULL);
 		build_contact(p);
 		if (gotdest) {
 			if (gotdest < 0)
-				transmit_response(p, "404 Not Found", req);
+				transmit_response(p, "404 Not Found (gotdest)", req);
 			else
 				transmit_response(p, "484 Address Incomplete", req);	/* Overlap dialing on SUBSCRIBE?? */
 			ast_set_flag(p, SIP_NEEDDESTROY);	
+			return 0;
 		} else {
 
 			/* Initialize tag for new subscriptions */	
@@ -10884,16 +10890,17 @@
 				  config section.
 				
 				*/
-				if (authpeer && !ast_strlen_zero(authpeer->mailbox)) {
-					transmit_response(p, "200 OK", req);
- 					p->subscribed = MWI_NOTIFICATION;
-					authpeer->mwipvt = p;	/* Link from peer to pvt */
-					p->relatedpeer = authpeer;	/* Link from pvt to peer */
-				} else {
-					transmit_response(p, "404 Not found", req);
+				if (!authpeer || ast_strlen_zero(authpeer->mailbox)) {
+					transmit_response(p, "404 Not found (no mailbox)", req);
 					ast_set_flag(p, SIP_NEEDDESTROY);	
+					ast_log(LOG_NOTICE, "Received SIP subscribe for peer without mailbox: %s\n", authpeer->name);
 					return 0;
 				}
+
+				transmit_response(p, "200 OK", req);
+ 				p->subscribed = MWI_NOTIFICATION;
+				authpeer->mwipvt = p;	/* Link from peer to pvt */
+				p->relatedpeer = authpeer;	/* Link from pvt to peer */
 			} else { /* At this point, Asterisk does not understand the specified event */
 				transmit_response(p, "489 Bad Event", req);
 				if (option_debug > 1)
@@ -10901,7 +10908,7 @@
 				ast_set_flag(p, SIP_NEEDDESTROY);	
 				return 0;
 			}
-			if (p->subscribed != NONE)
+			if (p->subscribed != MWI_NOTIFICATION)
 				p->stateid = ast_extension_state_add(p->context, p->exten, cb_extensionstate, p);
 		}
 	}

Modified: team/oej/subscribemwi/include/asterisk/sha1.h
URL: http://svn.digium.com/view/asterisk/team/oej/subscribemwi/include/asterisk/sha1.h?rev=10624&r1=10623&r2=10624&view=diff
==============================================================================
--- team/oej/subscribemwi/include/asterisk/sha1.h (original)
+++ team/oej/subscribemwi/include/asterisk/sha1.h Tue Feb 21 02:25:54 2006
@@ -22,6 +22,7 @@
 
 #if defined(__OpenBSD__) || defined( __FreeBSD__)
 #include <inttypes.h>
+#define int_least16_t 	int
 #else
 #include <stdint.h>
 #endif



More information about the asterisk-commits mailing list