[svn-commits] eliel: branch group/data_api_gsoc2009 r213829 - in /team/group/data_api_gsoc2...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Aug 24 09:27:47 CDT 2009


Author: eliel
Date: Mon Aug 24 09:27:42 2009
New Revision: 213829

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=213829
Log:
Merged revisions 213697,213716,213738,213748,213790 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r213697 | kpfleming | 2009-08-21 17:39:51 -0400 (Fri, 21 Aug 2009) | 12 lines
  
  Ensure that realtime mailboxes properly report status on subscription.
  
  This patch modifies app_voicemail's response to mailbox status subscriptions
  (via the internal event system) to ensure that a subscription triggers an
  explicit poll of the mailbox, so the subscriber can get an immediate cached
  event with that status. Previously, the cache was only populated with the
  status of non-realtime mailboxes.
  
  (closes issue #15717)
  Reported by: natmlt
........
  r213716 | dvossel | 2009-08-21 18:22:11 -0400 (Fri, 21 Aug 2009) | 10 lines
  
  Register request line contains wrong address when user domain and register host differ
  
  (closes issue #15539)
  Reported by: Nick_Lewis
  Patches:
        chan_sip.c-registraraddr.patch uploaded by Nick (license 657)
        register_domain_fix_1.6.2 uploaded by dvossel (license 671)
  Tested by: Nick_Lewis, dvossel
........
  r213738 | tilghman | 2009-08-21 18:36:39 -0400 (Fri, 21 Aug 2009) | 2 lines
  
  Clarifying comments in sip_register, and removing a dead section
........
  r213748 | rmudgett | 2009-08-21 19:18:16 -0400 (Fri, 21 Aug 2009) | 2 lines
  
  Update configure script for libpri COLP feature dependency requirements.
........
  r213790 | moy | 2009-08-24 00:46:28 -0400 (Mon, 24 Aug 2009) | 1 line
  
  improve handling of openr2_chan_disconnect_call API failure, unlikely, but happened on openr2 library bug
........

Modified:
    team/group/data_api_gsoc2009/   (props changed)
    team/group/data_api_gsoc2009/apps/app_voicemail.c
    team/group/data_api_gsoc2009/channels/chan_dahdi.c
    team/group/data_api_gsoc2009/channels/chan_sip.c
    team/group/data_api_gsoc2009/channels/sig_pri.c
    team/group/data_api_gsoc2009/configure
    team/group/data_api_gsoc2009/configure.ac

Propchange: team/group/data_api_gsoc2009/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Aug 24 09:27:42 2009
@@ -1,1 +1,1 @@
-/trunk:1-213649
+/trunk:1-213827

Modified: team/group/data_api_gsoc2009/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/apps/app_voicemail.c?view=diff&rev=213829&r1=213828&r2=213829
==============================================================================
--- team/group/data_api_gsoc2009/apps/app_voicemail.c (original)
+++ team/group/data_api_gsoc2009/apps/app_voicemail.c Mon Aug 24 09:27:42 2009
@@ -10313,24 +10313,28 @@
 	AST_DATA_ENTRY("asterisk/application/app_voicemail/voicemail", &vm_data_provider)
 };
 
+static void poll_subscribed_mailbox(struct mwi_sub *mwi_sub)
+{
+	int new = 0, old = 0, urgent = 0;
+
+	inboxcount2(mwi_sub->mailbox, &urgent, &new, &old);
+
+	if (urgent != mwi_sub->old_urgent || new != mwi_sub->old_new || old != mwi_sub->old_old) {
+		mwi_sub->old_urgent = urgent;
+		mwi_sub->old_new = new;
+		mwi_sub->old_old = old;
+		queue_mwi_event(mwi_sub->mailbox, urgent, new, old);
+	}
+}
+
 static void poll_subscribed_mailboxes(void)
 {
 	struct mwi_sub *mwi_sub;
 
 	AST_RWLIST_RDLOCK(&mwi_subs);
 	AST_RWLIST_TRAVERSE(&mwi_subs, mwi_sub, entry) {
-		int new = 0, old = 0, urgent = 0;
-
-		if (ast_strlen_zero(mwi_sub->mailbox))
-			continue;
-
-		inboxcount2(mwi_sub->mailbox, &urgent, &new, &old);
-
-		if (urgent != mwi_sub->old_urgent || new != mwi_sub->old_new || old != mwi_sub->old_old) {
-			mwi_sub->old_urgent = urgent;
-			mwi_sub->old_new = new;
-			mwi_sub->old_old = old;
-			queue_mwi_event(mwi_sub->mailbox, urgent, new, old);
+		if (!ast_strlen_zero(mwi_sub->mailbox)) {
+			poll_subscribed_mailbox(mwi_sub);
 		}
 	}
 	AST_RWLIST_UNLOCK(&mwi_subs);
@@ -10416,7 +10420,8 @@
 	AST_RWLIST_UNLOCK(&mwi_subs);
 	ast_free((void *) p->mailbox);
 	ast_free((void *) p->context);
-	ast_free(p);	
+	ast_free(p);
+	poll_subscribed_mailbox(mwi_sub);
 	return 0;
 }
 

Modified: team/group/data_api_gsoc2009/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/channels/chan_dahdi.c?view=diff&rev=213829&r1=213828&r2=213829
==============================================================================
--- team/group/data_api_gsoc2009/channels/chan_dahdi.c (original)
+++ team/group/data_api_gsoc2009/channels/chan_dahdi.c Mon Aug 24 09:27:42 2009
@@ -3052,6 +3052,19 @@
 	ast_mutex_unlock(&mfcr2->monitored_count_lock);
 }
 
+static void dahdi_r2_disconnect_call(struct dahdi_pvt *p, openr2_call_disconnect_cause_t cause)
+{
+	if (openr2_chan_disconnect_call(p->r2chan, cause)) {
+		ast_log(LOG_NOTICE, "Bad! failed to disconnect call on channel %d with reason %s, hope for the best!\n",
+		   p->channel, openr2_proto_get_disconnect_string(cause));
+		/* force the chan to idle and release the call flag now since we will not see a clean on_call_end */
+		openr2_chan_set_idle(p->r2chan);
+		ast_mutex_lock(&p->lock);
+		p->mfcr2call = 0;
+		ast_mutex_unlock(&p->lock);
+	}
+}
+
 static void dahdi_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, const char *dnis, openr2_calling_party_category_t category)
 {
 	struct dahdi_pvt *p;
@@ -3063,7 +3076,7 @@
 	/* if collect calls are not allowed and this is a collect call, reject it! */
 	if (!p->mfcr2_allow_collect_calls && category == OR2_CALLING_PARTY_CATEGORY_COLLECT_CALL) {
 		ast_log(LOG_NOTICE, "Rejecting MFC/R2 collect call\n");
-		openr2_chan_disconnect_call(r2chan, OR2_CAUSE_COLLECT_CALL_REJECTED);
+		dahdi_r2_disconnect_call(p, OR2_CAUSE_COLLECT_CALL_REJECTED);
 		return;
 	}
 	ast_mutex_lock(&p->lock);
@@ -3084,7 +3097,7 @@
 	if (!ast_exists_extension(NULL, p->context, p->exten, 1, p->cid_num)) {
 		ast_log(LOG_NOTICE, "MFC/R2 call on channel %d requested non-existent extension '%s' in context '%s'. Rejecting call.\n",
 				p->channel, p->exten, p->context);
-		openr2_chan_disconnect_call(r2chan, OR2_CAUSE_UNALLOCATED_NUMBER);
+		dahdi_r2_disconnect_call(p, OR2_CAUSE_UNALLOCATED_NUMBER);
 		return;
 	}
 	if (!p->mfcr2_accept_on_offer) {
@@ -3098,7 +3111,7 @@
 			return;
 		}
 		ast_log(LOG_WARNING, "Unable to create PBX channel in DAHDI channel %d\n", p->channel);
-		openr2_chan_disconnect_call(r2chan, OR2_CAUSE_OUT_OF_ORDER);
+		dahdi_r2_disconnect_call(p, OR2_CAUSE_OUT_OF_ORDER);
 	} else if (p->mfcr2_charge_calls) {
 		ast_log(LOG_DEBUG, "Accepting MFC/R2 call with charge on chan %d\n", p->channel);
 		openr2_chan_accept_call(r2chan, OR2_CALL_WITH_CHARGE);
@@ -3150,7 +3163,7 @@
 		}
 		ast_log(LOG_WARNING, "Unable to create PBX channel in DAHDI channel %d\n", p->channel);
 		/* failed to create the channel, bail out and report it as an out of order line */
-		openr2_chan_disconnect_call(r2chan, OR2_CAUSE_OUT_OF_ORDER);
+		dahdi_r2_disconnect_call(p, OR2_CAUSE_OUT_OF_ORDER);
 		return;
 	}
 	/* this is an outgoing call, no need to launch the PBX thread, most likely we're in one already */
@@ -3203,10 +3216,10 @@
 	if (!p->owner) {
 		ast_mutex_unlock(&p->lock);
 		/* no owner, therefore we can't use dahdi_hangup to disconnect, do it right now */
-		openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING);
+		dahdi_r2_disconnect_call(p, OR2_CAUSE_NORMAL_CLEARING);
 		return;
 	}
-	/* when we have an owner we don't call openr2_chan_disconnect_call here, that will
+	/* when we have an owner we don't call dahdi_r2_disconnect_call here, that will
 	   be done in dahdi_hangup */
 	if (p->owner->_state == AST_STATE_UP) {
 		p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
@@ -5260,13 +5273,13 @@
 			ast_log(LOG_DEBUG, "disconnecting MFC/R2 call on chan %d\n", p->channel);
 			/* If it's an incoming call, check the mfcr2_forced_release setting */
 			if (openr2_chan_get_direction(p->r2chan) == OR2_DIR_BACKWARD && p->mfcr2_forced_release) {
-				openr2_chan_disconnect_call(p->r2chan, OR2_CAUSE_FORCED_RELEASE);
+				dahdi_r2_disconnect_call(p, OR2_CAUSE_FORCED_RELEASE);
 			} else {
 				const char *r2causestr = pbx_builtin_getvar_helper(ast, "MFCR2_CAUSE");
 				int r2cause_user = r2causestr ? atoi(r2causestr) : 0;
 				openr2_call_disconnect_cause_t r2cause = r2cause_user ? dahdi_ast_cause_to_r2_cause(r2cause_user)
 					                                              : dahdi_ast_cause_to_r2_cause(ast->hangupcause);
-				openr2_chan_disconnect_call(p->r2chan, r2cause);
+				dahdi_r2_disconnect_call(p, r2cause);
 			}
 			dahdi_r2_update_monitor_count(p->mfcr2, 1);
 		} else if (p->mfcr2call) {
@@ -13305,6 +13318,7 @@
 		openr2_chan_set_idle(p->r2chan);
 		ast_mutex_lock(&p->lock);
 		p->locallyblocked = 0;
+		p->mfcr2call = 0;
 		ast_mutex_unlock(&p->lock);
 		if (channo != -1) {
 			break;

Modified: team/group/data_api_gsoc2009/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/channels/chan_sip.c?view=diff&rev=213829&r1=213828&r2=213829
==============================================================================
--- team/group/data_api_gsoc2009/channels/chan_sip.c (original)
+++ team/group/data_api_gsoc2009/channels/chan_sip.c Mon Aug 24 09:27:42 2009
@@ -7412,7 +7412,7 @@
 	 * host2.extension => [extension]
 	 * host1.expiry => [expiry]
 	 */
-	AST_NONSTANDARD_RAW_ARGS(host2, hostpart, '/');
+	AST_NONSTANDARD_RAW_ARGS(host2, host1.hostpart, '/');
 
 	/*!
 	 * user1.userpart => [peer?][transport://]user[@domain]
@@ -7423,18 +7423,7 @@
 	 * host2.extension => extension
 	 * host1.expiry => expiry
 	 */
-	AST_NONSTANDARD_RAW_ARGS(host3, hostpart, ':');
-
-	/*!
-	 * user2.userpart => [peer?][transport://]user[@domain]
-	 * user1.secret => secret
-	 * user1.authuser => authuser
-	 * host3.host => host
-	 * host3.port => port
-	 * host2.extension => extension (callback)
-	 * host1.expiry => expiry
-	 */
-	AST_NONSTANDARD_RAW_ARGS(user2, user1.userpart, ':');
+	AST_NONSTANDARD_RAW_ARGS(host3, host2.hostpart, ':');
 
 	/*!
 	 * user2.userpart => [peer?][transport://]user
@@ -7446,14 +7435,37 @@
 	 * host2.extension => extension (callback)
 	 * host1.expiry => expiry
 	 */
-	AST_NONSTANDARD_RAW_ARGS(user2, user2.userpart, '@');
-
+	AST_NONSTANDARD_RAW_ARGS(user2, user1.userpart, '@');
+
+	/*!
+	 * peername => peer
+	 * user2.userpart => [transport://]user
+	 * user2.domain => domain (regdomain)
+	 * user1.secret => secret
+	 * user1.authuser => authuser
+	 * host3.host => host
+	 * host3.port => port
+	 * host2.extension => extension (callback)
+	 * host1.expiry => expiry
+	 */
 	if ((tmp = strchr(user2.userpart, '?'))) {
 		*tmp = '\0';
 		peername = user2.userpart;
 		user2.userpart = tmp + 1;
 	}
 
+	/*!
+	 * peername => peer
+	 * transport_str => transport
+	 * username => user
+	 * user2.domain => domain (regdomain)
+	 * user1.secret => secret
+	 * user1.authuser => authuser
+	 * host3.host => host
+	 * host3.port => port
+	 * host2.extension => extension (callback)
+	 * host1.expiry => expiry
+	 */
 	if ((tmp = strstr(user2.userpart, "://"))) {
 		*tmp = '\0';
 		transport_str = user2.userpart;
@@ -11751,12 +11763,11 @@
 		snprintf(to, sizeof(to), "<sip:%s@%s>", r->username, r->regdomain);
 	}
 
-	/* Domain is what we are registering to, regardless of actual
-	   host name from SRV */
+	/* Host is what we are registered to, reguardless of domain in username field */
 	if (ntohs(p->sa.sin_port) != STANDARD_SIP_PORT)
-		snprintf(addr, sizeof(addr), "sip:%s:%d", r->regdomain, ntohs(p->sa.sin_port));
+		snprintf(addr, sizeof(addr), "sip:%s:%d", r->hostname, ntohs(p->sa.sin_port));
 	else
-		snprintf(addr, sizeof(addr), "sip:%s", r->regdomain);
+		snprintf(addr, sizeof(addr), "sip:%s", r->hostname);
 
 	ast_string_field_set(p, uri, addr);
 

Modified: team/group/data_api_gsoc2009/channels/sig_pri.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/channels/sig_pri.c?view=diff&rev=213829&r1=213828&r2=213829
==============================================================================
--- team/group/data_api_gsoc2009/channels/sig_pri.c (original)
+++ team/group/data_api_gsoc2009/channels/sig_pri.c Mon Aug 24 09:27:42 2009
@@ -47,6 +47,9 @@
 #include "asterisk/features.h"
 
 #include "sig_pri.h"
+#ifndef PRI_EVENT_FACILITY
+#error please update libpri
+#endif
 
 /* define this to send PRI user-user information elements */
 #undef SUPPORT_USERUSER
@@ -1981,9 +1984,6 @@
 					sig_pri_unlock_private(pri->pvts[chanpos]);
 				}
 				break;
-#ifndef PRI_EVENT_FACILITY
-#error please update libpri
-#endif
 			case PRI_EVENT_FACILITY:
 				chanpos = pri_find_principle(pri, e->facility.channel);
 				if (chanpos < 0) {
@@ -2115,9 +2115,6 @@
 					}
 				}
 				break;
-#ifndef PRI_EVENT_HANGUP_REQ
-#error please update libpri
-#endif
 			case PRI_EVENT_HANGUP_REQ:
 				chanpos = pri_find_principle(pri, e->hangup.channel);
 				if (chanpos < 0) {

Modified: team/group/data_api_gsoc2009/configure.ac
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/configure.ac?view=diff&rev=213829&r1=213828&r2=213829
==============================================================================
--- team/group/data_api_gsoc2009/configure.ac (original)
+++ team/group/data_api_gsoc2009/configure.ac Mon Aug 24 09:27:42 2009
@@ -1457,15 +1457,16 @@
 
 AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
 
-AST_EXT_LIB_CHECK([PRI], [pri], [pri_new_bri], [libpri.h])
-
+AST_EXT_LIB_CHECK([PRI], [pri], [pri_connected_line_update], [libpri.h])
+
+# ------------------------------------v
+# TODO: The code can be changed to always include these features now.
+# These features will always be present if pri_connected_line_update is available.
 AST_EXT_LIB_CHECK([PRI_PROG_W_CAUSE], [pri], [pri_progress_with_cause], [libpri.h])
-
 AST_EXT_LIB_CHECK([PRI_INBANDDISCONNECT], [pri], [pri_set_inbanddisconnect], [libpri.h])
-
 AST_EXT_LIB_CHECK([PRI_SERVICE_MESSAGES], [pri], [pri_maintenance_service], [libpri.h])
-
 AST_EXT_LIB_CHECK([PRI_REVERSE_CHARGE], [pri], [pri_sr_set_reversecharge], [libpri.h])
+# ------------------------------------^
 
 AST_EXT_LIB_CHECK([RESAMPLE], [resample], [resample_open], [libresample.h], [-lm])
 




More information about the svn-commits mailing list