[svn-commits] russell: branch murf/bug11210 r104842 - in /team/murf/bug11210: ./ apps/ chan...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Feb 27 16:13:24 CST 2008


Author: russell
Date: Wed Feb 27 16:13:24 2008
New Revision: 104842

URL: http://svn.digium.com/view/asterisk?view=rev&rev=104842
Log:
sync with trunk

Modified:
    team/murf/bug11210/   (props changed)
    team/murf/bug11210/apps/app_chanspy.c
    team/murf/bug11210/apps/app_voicemail.c
    team/murf/bug11210/channels/chan_sip.c
    team/murf/bug11210/main/features.c
    team/murf/bug11210/main/file.c
    team/murf/bug11210/main/loader.c
    team/murf/bug11210/main/manager.c
    team/murf/bug11210/main/rtp.c
    team/murf/bug11210/res/res_smdi.c
    team/murf/bug11210/utils/astcanary.c

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Feb 27 16:13:24 2008
@@ -1,1 +1,1 @@
-/trunk:1-104517
+/trunk:1-104841

Modified: team/murf/bug11210/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/apps/app_chanspy.c?view=diff&rev=104842&r1=104841&r2=104842
==============================================================================
--- team/murf/bug11210/apps/app_chanspy.c (original)
+++ team/murf/bug11210/apps/app_chanspy.c Wed Feb 27 16:13:24 2008
@@ -500,6 +500,10 @@
 	if (!strncmp(this->name, "Zap/pseudo", 10)) {
 		ast_channel_unlock(this);
 		goto redo;
+	} else if (this == chan) {
+		last = this;
+		ast_channel_unlock(this);
+		goto redo;
 	}
 
 	return setup_chanspy_ds(this, chanspy_ds);
@@ -610,9 +614,10 @@
 				break;
 			}
 
-			if (peer == chan) {
+			if (ast_check_hangup(chan)) {
 				ast_channel_unlock(peer);
-				continue;
+				chanspy_ds_free(peer_chanspy_ds);
+				break;
 			}
 
 			if (ast_test_flag(flags, OPTION_BRIDGED) && !ast_bridged_channel(peer)) {
@@ -708,6 +713,7 @@
 			num_spyed_upon++;	
 
 			if (res == -1) {
+				chanspy_ds_free(peer_chanspy_ds);
 				goto exit;
 			} else if (res == -2) {
 				res = 0;
@@ -738,6 +744,8 @@
 				peer = NULL;
 			}
 		}
+		if (res == -1 || ast_check_hangup(chan))
+			break;
 	}
 exit:
 

Modified: team/murf/bug11210/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/apps/app_voicemail.c?view=diff&rev=104842&r1=104841&r2=104842
==============================================================================
--- team/murf/bug11210/apps/app_voicemail.c (original)
+++ team/murf/bug11210/apps/app_voicemail.c Wed Feb 27 16:13:24 2008
@@ -8174,8 +8174,6 @@
 	char *cat;
 	struct ast_variable *var;
 	const char *val;
-	const char *s;
-	const char *key;
 	char *q, *stringp;
 	int x;
 	int tmpadsi[4];
@@ -8387,7 +8385,7 @@
 		}
 
 		/* SMDI voicemail notification */
-		if ((s = ast_variable_retrieve(cfg, "general", "smdienable")) && ast_true(s)) {
+		if ((val = ast_variable_retrieve(cfg, "general", "smdienable")) && ast_true(val)) {
 			ast_debug(1, "Enabled SMDI voicemail notification\n");
 			if ((val = ast_variable_retrieve(cfg, "general", "smdiport"))) {
 				smdi_iface = ast_smdi_interface_find(val);
@@ -8410,19 +8408,19 @@
 		ast_copy_string(serveremail, val, sizeof(serveremail));
 		
 		vmmaxsecs = 0;
-		if ((s = ast_variable_retrieve(cfg, "general", "maxsecs"))) {
-			if (sscanf(s, "%d", &x) == 1) {
+		if ((val = ast_variable_retrieve(cfg, "general", "maxsecs"))) {
+			if (sscanf(val, "%d", &x) == 1) {
 				vmmaxsecs = x;
 			} else {
 				ast_log(LOG_WARNING, "Invalid max message time length\n");
 			}
-		} else if ((s = ast_variable_retrieve(cfg, "general", "maxmessage"))) {
+		} else if ((val = ast_variable_retrieve(cfg, "general", "maxmessage"))) {
 			static int maxmessage_deprecate = 0;
 			if (maxmessage_deprecate == 0) {
 				maxmessage_deprecate = 1;
 				ast_log(LOG_WARNING, "Setting 'maxmessage' has been deprecated in favor of 'maxsecs'.\n");
 			}
-			if (sscanf(s, "%d", &x) == 1) {
+			if (sscanf(val, "%d", &x) == 1) {
 				vmmaxsecs = x;
 			} else {
 				ast_log(LOG_WARNING, "Invalid max message time length\n");
@@ -8430,21 +8428,21 @@
 		}
 
 		vmminsecs = 0;
-		if ((s = ast_variable_retrieve(cfg, "general", "minsecs"))) {
-			if (sscanf(s, "%d", &x) == 1) {
+		if ((val = ast_variable_retrieve(cfg, "general", "minsecs"))) {
+			if (sscanf(val, "%d", &x) == 1) {
 				vmminsecs = x;
 				if (maxsilence <= vmminsecs)
 					ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n");
 			} else {
 				ast_log(LOG_WARNING, "Invalid min message time length\n");
 			}
-		} else if ((s = ast_variable_retrieve(cfg, "general", "minmessage"))) {
+		} else if ((val = ast_variable_retrieve(cfg, "general", "minmessage"))) {
 			static int maxmessage_deprecate = 0;
 			if (maxmessage_deprecate == 0) {
 				maxmessage_deprecate = 1;
 				ast_log(LOG_WARNING, "Setting 'minmessage' has been deprecated in favor of 'minsecs'.\n");
 			}
-			if (sscanf(s, "%d", &x) == 1) {
+			if (sscanf(val, "%d", &x) == 1) {
 				vmminsecs = x;
 				if (maxsilence <= vmminsecs)
 					ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n");
@@ -8459,16 +8457,16 @@
 		ast_copy_string(vmfmts, val, sizeof(vmfmts));
 
 		skipms = 3000;
-		if ((s = ast_variable_retrieve(cfg, "general", "maxgreet"))) {
-			if (sscanf(s, "%d", &x) == 1) {
+		if ((val = ast_variable_retrieve(cfg, "general", "maxgreet"))) {
+			if (sscanf(val, "%d", &x) == 1) {
 				maxgreet = x;
 			} else {
 				ast_log(LOG_WARNING, "Invalid max message greeting length\n");
 			}
 		}
 
-		if ((s = ast_variable_retrieve(cfg, "general", "skipms"))) {
-			if (sscanf(s, "%d", &x) == 1) {
+		if ((val = ast_variable_retrieve(cfg, "general", "skipms"))) {
+			if (sscanf(val, "%d", &x) == 1) {
 				skipms = x;
 			} else {
 				ast_log(LOG_WARNING, "Invalid skipms value\n");
@@ -8476,8 +8474,8 @@
 		}
 
 		maxlogins = 3;
-		if ((s = ast_variable_retrieve(cfg, "general", "maxlogins"))) {
-			if (sscanf(s, "%d", &x) == 1) {
+		if ((val = ast_variable_retrieve(cfg, "general", "maxlogins"))) {
+			if (sscanf(val, "%d", &x) == 1) {
 				maxlogins = x;
 			} else {
 				ast_log(LOG_WARNING, "Invalid max failed login attempts\n");
@@ -8494,9 +8492,9 @@
 			val = "no";
 		ast_set2_flag((&globalflags), ast_true(val), VM_FORCEGREET);
 
-		if ((s = ast_variable_retrieve(cfg, "general", "cidinternalcontexts"))) {
-			ast_debug(1, "VM_CID Internal context string: %s\n", s);
-			stringp = ast_strdupa(s);
+		if ((val = ast_variable_retrieve(cfg, "general", "cidinternalcontexts"))) {
+			ast_debug(1, "VM_CID Internal context string: %s\n", val);
+			stringp = ast_strdupa(val);
 			for (x = 0; x < MAX_NUM_CID_CONTEXTS; x++) {
 				if (!ast_strlen_zero(stringp)) {
 					q = strsep(&stringp, ",");
@@ -8608,16 +8606,16 @@
 		if ((val = ast_variable_retrieve(cfg, "general", "vm-mismatch")))
 			ast_copy_string(vm_mismatch, val, sizeof(vm_mismatch));
 		/* load configurable audio prompts */
-		if ((key = ast_variable_retrieve(cfg, "general", "listen-control-forward-key")) && is_valid_dtmf(key))
-			ast_copy_string(listen_control_forward_key, key, sizeof(listen_control_forward_key));
-		if ((key = ast_variable_retrieve(cfg, "general", "listen-control-reverse-key")) && is_valid_dtmf(key))
-			ast_copy_string(listen_control_reverse_key, key, sizeof(listen_control_reverse_key));
-		if ((key = ast_variable_retrieve(cfg, "general", "listen-control-pause-key")) && is_valid_dtmf(key))
-			ast_copy_string(listen_control_pause_key, key, sizeof(listen_control_pause_key));
-		if ((key = ast_variable_retrieve(cfg, "general", "listen-control-restart-key")) && is_valid_dtmf(key))
-			ast_copy_string(listen_control_restart_key, key, sizeof(listen_control_restart_key));
-		if ((key = ast_variable_retrieve(cfg, "general", "listen-control-stop-key")) && is_valid_dtmf(key))
-			ast_copy_string(listen_control_stop_key, key, sizeof(listen_control_stop_key));
+		if ((val = ast_variable_retrieve(cfg, "general", "listen-control-forward-key")) && is_valid_dtmf(val))
+			ast_copy_string(listen_control_forward_key, val, sizeof(listen_control_forward_key));
+		if ((val = ast_variable_retrieve(cfg, "general", "listen-control-reverse-key")) && is_valid_dtmf(val))
+			ast_copy_string(listen_control_reverse_key, val, sizeof(listen_control_reverse_key));
+		if ((val = ast_variable_retrieve(cfg, "general", "listen-control-pause-key")) && is_valid_dtmf(val))
+			ast_copy_string(listen_control_pause_key, val, sizeof(listen_control_pause_key));
+		if ((val = ast_variable_retrieve(cfg, "general", "listen-control-restart-key")) && is_valid_dtmf(val))
+			ast_copy_string(listen_control_restart_key, val, sizeof(listen_control_restart_key));
+		if ((val = ast_variable_retrieve(cfg, "general", "listen-control-stop-key")) && is_valid_dtmf(val))
+			ast_copy_string(listen_control_stop_key, val, sizeof(listen_control_stop_key));
 
 		if (!(val = ast_variable_retrieve(cfg, "general", "usedirectory"))) 
 			val = "no";
@@ -8707,39 +8705,39 @@
 			ast_free(pagersubject);
 			pagersubject = NULL;
 		}
-		if ((s = ast_variable_retrieve(cfg, "general", "pbxskip")))
-			ast_set2_flag((&globalflags), ast_true(s), VM_PBXSKIP);
-		if ((s = ast_variable_retrieve(cfg, "general", "fromstring")))
-			ast_copy_string(fromstring, s, sizeof(fromstring));
-		if ((s = ast_variable_retrieve(cfg, "general", "pagerfromstring")))
-			ast_copy_string(pagerfromstring, s, sizeof(pagerfromstring));
-		if ((s = ast_variable_retrieve(cfg, "general", "charset")))
-			ast_copy_string(charset, s, sizeof(charset));
-		if ((s = ast_variable_retrieve(cfg, "general", "adsifdn"))) {
-			sscanf(s, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]);
+		if ((val = ast_variable_retrieve(cfg, "general", "pbxskip")))
+			ast_set2_flag((&globalflags), ast_true(val), VM_PBXSKIP);
+		if ((val = ast_variable_retrieve(cfg, "general", "fromstring")))
+			ast_copy_string(fromstring, val, sizeof(fromstring));
+		if ((val = ast_variable_retrieve(cfg, "general", "pagerfromstring")))
+			ast_copy_string(pagerfromstring, val, sizeof(pagerfromstring));
+		if ((val = ast_variable_retrieve(cfg, "general", "charset")))
+			ast_copy_string(charset, val, sizeof(charset));
+		if ((val = ast_variable_retrieve(cfg, "general", "adsifdn"))) {
+			sscanf(val, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]);
 			for (x = 0; x < 4; x++) {
 				memcpy(&adsifdn[x], &tmpadsi[x], 1);
 			}
 		}
-		if ((s = ast_variable_retrieve(cfg, "general", "adsisec"))) {
-			sscanf(s, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]);
+		if ((val = ast_variable_retrieve(cfg, "general", "adsisec"))) {
+			sscanf(val, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]);
 			for (x = 0; x < 4; x++) {
 				memcpy(&adsisec[x], &tmpadsi[x], 1);
 			}
 		}
-		if ((s = ast_variable_retrieve(cfg, "general", "adsiver")))
-			if (atoi(s)) {
-				adsiver = atoi(s);
-			}
-		if ((s = ast_variable_retrieve(cfg, "general", "emailtitle"))) {
+		if ((val = ast_variable_retrieve(cfg, "general", "adsiver")))
+			if (atoi(val)) {
+				adsiver = atoi(val);
+			}
+		if ((val = ast_variable_retrieve(cfg, "general", "emailtitle"))) {
 			ast_log(LOG_NOTICE, "Keyword 'emailtitle' is DEPRECATED, please use 'emailsubject' instead.\n");
-			ast_copy_string(emailtitle, s, sizeof(emailtitle));
-		}
-		if ((s = ast_variable_retrieve(cfg, "general", "emailsubject")))
-			emailsubject = ast_strdup(s);
-		if ((s = ast_variable_retrieve(cfg, "general", "emailbody"))) {
+			ast_copy_string(emailtitle, val, sizeof(emailtitle));
+		}
+		if ((val = ast_variable_retrieve(cfg, "general", "emailsubject")))
+			emailsubject = ast_strdup(val);
+		if ((val = ast_variable_retrieve(cfg, "general", "emailbody"))) {
 			char *tmpread, *tmpwrite;
-			emailbody = ast_strdup(s);
+			emailbody = ast_strdup(val);
 
 			/* substitute strings \t and \n into the appropriate characters */
 			tmpread = tmpwrite = emailbody;
@@ -8763,11 +8761,11 @@
 				tmpread = tmpwrite + 1;
 			}
 		}
-		if ((s = ast_variable_retrieve(cfg, "general", "pagersubject")))
-			pagersubject = ast_strdup(s);
-		if ((s = ast_variable_retrieve(cfg, "general", "pagerbody"))) {
+		if ((val = ast_variable_retrieve(cfg, "general", "pagersubject")))
+			pagersubject = ast_strdup(val);
+		if ((val = ast_variable_retrieve(cfg, "general", "pagerbody"))) {
 			char *tmpread, *tmpwrite;
-			pagerbody = ast_strdup(s);
+			pagerbody = ast_strdup(val);
 
 			/* substitute strings \t and \n into the appropriate characters */
 			tmpread = tmpwrite = pagerbody;

Modified: team/murf/bug11210/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_sip.c?view=diff&rev=104842&r1=104841&r2=104842
==============================================================================
--- team/murf/bug11210/channels/chan_sip.c (original)
+++ team/murf/bug11210/channels/chan_sip.c Wed Feb 27 16:13:24 2008
@@ -14999,12 +14999,12 @@
 			if (IS_SIP_TECH(bridgepeer->tech)) {
 				bridgepvt = (struct sip_pvt*)(bridgepeer->tech_pvt);
 				if (bridgepvt->udptl) {
-					if (p->t38.state == T38_PEER_REINVITE) {
+					if (p->t38.state == T38_ENABLED && bridgepvt->t38.state == T38_PEER_REINVITE) {
 						sip_handle_t38_reinvite(bridgepeer, p, 0);
 						ast_rtp_set_rtptimers_onhold(p->rtp);
 						if (p->vrtp)
 							ast_rtp_set_rtptimers_onhold(p->vrtp);	/* Turn off RTP timers while we send fax */
-					} else if (p->t38.state == T38_DISABLED && bridgepeer && (bridgepvt->t38.state == T38_ENABLED)) {
+					} else if (p->t38.state == T38_DISABLED && bridgepvt->t38.state == T38_ENABLED) {
 						ast_log(LOG_WARNING, "RTP re-invite after T38 session not handled yet !\n");
 						/* Insted of this we should somehow re-invite the other side of the bridge to RTP */
 						/* XXXX Should we really destroy this session here, without any response at all??? */
@@ -15022,10 +15022,6 @@
 				ast_debug(2, "Strange... The other side of the bridge is not a SIP channel\n");
 				change_t38_state(p, T38_DISABLED);
 			}
-		}
-		if ((p->t38.state == T38_LOCAL_REINVITE) || (p->t38.state == T38_LOCAL_DIRECT)) {
-			/* If there was T38 reinvite and we are supposed to answer with 200 OK than this should set us to T38 negotiated mode */
-			change_t38_state(p, T38_ENABLED);
 		}
 
 		if (!req->ignore && p->owner) {
@@ -21609,7 +21605,6 @@
 					}
 					peer = build_peer(cat, gen, ast_variable_browse(ucfg, cat), 0);
 					if (peer) {
-						ast_device_state_changed("SIP/%s", peer->name);
 						ao2_t_link(peers, peer, "link peer into peer table");
 						if (peer->addr.sin_addr.s_addr) {
 							ao2_t_link(peers_by_ip, peer, "link peer into peers_by_ip table");
@@ -21883,6 +21878,7 @@
 					ast_debug(3, "Sending reinvite on SIP '%s' - It's UDPTL soon redirected to IP %s:%d\n", p->callid, ast_inet_ntoa(p->udptlredirip.sin_addr), ntohs(p->udptlredirip.sin_port));
 				else
 					ast_debug(3, "Sending reinvite on SIP '%s' - It's UDPTL soon redirected to us (IP %s)\n", p->callid, ast_inet_ntoa(p->ourip.sin_addr));
+				change_t38_state(p, T38_LOCAL_REINVITE);
 				transmit_reinvite_with_sdp(p, TRUE, FALSE);
 			} else if (!ast_test_flag(&p->flags[0], SIP_PENDINGBYE)) {
 				if (flag)

Modified: team/murf/bug11210/main/features.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/features.c?view=diff&rev=104842&r1=104841&r2=104842
==============================================================================
--- team/murf/bug11210/main/features.c (original)
+++ team/murf/bug11210/main/features.c Wed Feb 27 16:13:24 2008
@@ -254,7 +254,7 @@
 	}
 }
 
-static struct ast_channel *ast_feature_request_and_dial(struct ast_channel *caller, struct ast_channel *transferee, const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, int igncallerstate);
+static struct ast_channel *ast_feature_request_and_dial(struct ast_channel *caller, struct ast_channel *transferee, const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, int igncallerstate, const char *language);
 
 /*!
  * \brief bridge the call 
@@ -1058,7 +1058,7 @@
 	l = strlen(xferto);
 	snprintf(xferto + l, sizeof(xferto) - l, "@%s/n", transferer_real_context);	/* append context */
 	newchan = ast_feature_request_and_dial(transferer, transferee, "Local", ast_best_codec(transferer->nativeformats),
-		xferto, atxfernoanswertimeout, &outstate, transferer->cid.cid_num, transferer->cid.cid_name, 1);
+		xferto, atxfernoanswertimeout, &outstate, transferer->cid.cid_num, transferer->cid.cid_name, 1, transferer->language);
 
 	if (!ast_check_hangup(transferer)) {
 		/* Transferer is up - old behaviour */
@@ -1159,14 +1159,14 @@
 
 			ast_log(LOG_NOTICE, "We're trying to call %s/%s\n", transferer_tech, transferer_name);
 			newchan = ast_feature_request_and_dial(transferee, NULL, transferer_tech, ast_best_codec(transferee->nativeformats),
-				transferer_name, atxfernoanswertimeout, &outstate, transferee->cid.cid_num, transferee->cid.cid_name, 0);
+				transferer_name, atxfernoanswertimeout, &outstate, transferee->cid.cid_num, transferee->cid.cid_name, 0, transferer->language);
 			while (!newchan && !atxferdropcall && tries < atxfercallbackretries) {
 				/* Trying to transfer again */
 				ast_autoservice_start(transferee);
 				ast_indicate(transferee, AST_CONTROL_HOLD);
 
 				newchan = ast_feature_request_and_dial(transferer, transferee, "Local", ast_best_codec(transferer->nativeformats),
-					xferto, atxfernoanswertimeout, &outstate, transferer->cid.cid_num, transferer->cid.cid_name, 1);
+					xferto, atxfernoanswertimeout, &outstate, transferer->cid.cid_num, transferer->cid.cid_name, 1, transferer->language);
 				if (ast_autoservice_stop(transferee) < 0) {
 					if (newchan)
 						ast_hangup(newchan);
@@ -1178,7 +1178,7 @@
 					ast_safe_sleep(transferee, atxferloopdelay);
 					ast_debug(1, "Trying to callback...\n");
 					newchan = ast_feature_request_and_dial(transferee, NULL, transferer_tech, ast_best_codec(transferee->nativeformats),
-						transferer_name, atxfernoanswertimeout, &outstate, transferee->cid.cid_num, transferee->cid.cid_name, 0);
+						transferer_name, atxfernoanswertimeout, &outstate, transferee->cid.cid_num, transferee->cid.cid_name, 0, transferer->language);
 				}
 				tries++;
 			}
@@ -1685,7 +1685,7 @@
  * \todo XXX Check - this is very similar to the code in channel.c 
  * \return always a channel
 */
-static struct ast_channel *ast_feature_request_and_dial(struct ast_channel *caller, struct ast_channel *transferee, const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, int igncallerstate)
+static struct ast_channel *ast_feature_request_and_dial(struct ast_channel *caller, struct ast_channel *transferee, const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, int igncallerstate, const char *language)
 {
 	int state = 0;
 	int cause = 0;
@@ -1694,9 +1694,10 @@
 	struct ast_channel *monitor_chans[2];
 	struct ast_channel *active_channel;
 	int res = 0, ready = 0;
-	
+
 	if ((chan = ast_request(type, format, data, &cause))) {
 		ast_set_callerid(chan, cid_num, cid_name, cid_num);
+		ast_string_field_set(chan, language, language);
 		ast_channel_inherit_variables(caller, chan);	
 		pbx_builtin_setvar_helper(chan, "TRANSFERERNAME", caller->name);
 		if (!chan->cdr) {

Modified: team/murf/bug11210/main/file.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/file.c?view=diff&rev=104842&r1=104841&r2=104842
==============================================================================
--- team/murf/bug11210/main/file.c (original)
+++ team/murf/bug11210/main/file.c Wed Feb 27 16:13:24 2008
@@ -467,33 +467,37 @@
  * which on success is filled with the matching filename.
  */
 static int fileexists_core(const char *filename, const char *fmt, const char *preflang,
-		char *buf, int buflen)
+			   char *buf, int buflen)
 {
 	int res = -1;
 	int langlen;	/* length of language string */
 	const char *c = strrchr(filename, '/');
 	int offset = c ? c - filename + 1 : 0;	/* points right after the last '/' */
 
-	if (preflang == NULL)
+	if (preflang == NULL) {
 		preflang = "";
+	}
 	langlen = strlen(preflang);
 	
-	if (buflen < langlen + strlen(filename) + 2) {
-		ast_log(LOG_WARNING, "buffer too small\n");
-		buf[0] = '\0'; /* set to empty */
-		buf = alloca(langlen + strlen(filename) + 2);	/* room for everything */
-	}
-	if (buf == NULL)
+	if (buflen < langlen + strlen(filename) + 4) {
+		ast_log(LOG_WARNING, "buffer too small, allocating larger buffer\n");
+		buf = alloca(langlen + strlen(filename) + 4);	/* room for everything */
+	}
+
+	if (buf == NULL) {
 		return 0;
-	buf[0] = '\0';
+	}
+
 	for (;;) {
 		if (ast_language_is_prefix) { /* new layout */
 			if (langlen) {
 				strcpy(buf, preflang);
 				buf[langlen] = '/';
 				strcpy(buf + langlen + 1, filename);
-			} else
-				strcpy(buf, filename);	/* first copy the full string */
+			} else {
+				strcpy(buf, "en/"); /* English - fallback if no file found in preferred language */
+				strcpy(buf + 3, filename);
+			}
 		} else { /* old layout */
 			strcpy(buf, filename);	/* first copy the full string */
 			if (langlen) {
@@ -503,15 +507,19 @@
 			}
 		}
 		res = ast_filehelper(buf, NULL, fmt, ACTION_EXISTS);
-		if (res > 0)		/* found format */
+		if (res > 0) {		/* found format */
 			break;
-		if (langlen == 0)	/* no more formats */
+		}
+		if (langlen == 0) {	/* no more formats */
 			break;
-		if (preflang[langlen] == '_') /* we are on the local suffix */
+		}
+		if (preflang[langlen] == '_') { /* we are on the local suffix */
 			langlen = 0;	/* try again with no language */
-		else
+		} else {
 			langlen = (c = strchr(preflang, '_')) ? c - preflang : 0;
-	}
+		}
+	}
+
 	return res;
 }
 
@@ -538,7 +546,7 @@
 	}
 	if (preflang == NULL)
 		preflang = "";
-	buflen = strlen(preflang) + strlen(filename) + 2;
+	buflen = strlen(preflang) + strlen(filename) + 4;
 	buf = alloca(buflen);
 	if (buf == NULL)
 		return NULL;
@@ -569,7 +577,7 @@
 
 	if (preflang == NULL)
 		preflang = "";
-	buflen = strlen(preflang) + strlen(filename) + 2;
+	buflen = strlen(preflang) + strlen(filename) + 4;
 	buf = alloca(buflen);
 	if (buf == NULL)
 		return NULL;
@@ -796,7 +804,7 @@
 
 	if (preflang == NULL)
 		preflang = "";
-	buflen = strlen(preflang) + strlen(filename) + 2;	/* room for everything */
+	buflen = strlen(preflang) + strlen(filename) + 4;	/* room for everything */
 	buf = alloca(buflen);
 	if (buf == NULL)
 		return 0;

Modified: team/murf/bug11210/main/loader.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/loader.c?view=diff&rev=104842&r1=104841&r2=104842
==============================================================================
--- team/murf/bug11210/main/loader.c (original)
+++ team/murf/bug11210/main/loader.c Wed Feb 27 16:13:24 2008
@@ -930,10 +930,10 @@
 	   resource has changed */
 	struct loadupdate *m;
 
-	AST_LIST_LOCK(&module_list);
+	AST_LIST_LOCK(&updaters);
 	AST_LIST_TRAVERSE(&updaters, m, entry)
 		m->updater();
-	AST_LIST_UNLOCK(&module_list);
+	AST_LIST_UNLOCK(&updaters);
 }
 
 int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *like),
@@ -978,9 +978,9 @@
 		return -1;
 
 	tmp->updater = v;
-	AST_LIST_LOCK(&module_list);
+	AST_LIST_LOCK(&updaters);
 	AST_LIST_INSERT_HEAD(&updaters, tmp, entry);
-	AST_LIST_UNLOCK(&module_list);
+	AST_LIST_UNLOCK(&updaters);
 
 	return 0;
 }
@@ -989,7 +989,7 @@
 {
 	struct loadupdate *cur;
 
-	AST_LIST_LOCK(&module_list);
+	AST_LIST_LOCK(&updaters);
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&updaters, cur, entry) {
 		if (cur->updater == v)	{
 			AST_LIST_REMOVE_CURRENT(entry);
@@ -997,7 +997,7 @@
 		}
 	}
 	AST_LIST_TRAVERSE_SAFE_END;
-	AST_LIST_UNLOCK(&module_list);
+	AST_LIST_UNLOCK(&updaters);
 
 	return cur ? 0 : -1;
 }

Modified: team/murf/bug11210/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/manager.c?view=diff&rev=104842&r1=104841&r2=104842
==============================================================================
--- team/murf/bug11210/main/manager.c (original)
+++ team/murf/bug11210/main/manager.c Wed Feb 27 16:13:24 2008
@@ -3443,7 +3443,12 @@
 		ast_mutex_init(&s->__lock);
 		ast_mutex_lock(&s->__lock);
 		s->inuse = 1;
-		s->managerid = (rand() ^ (unsigned long) s) | 1;	/* make sure it is non-zero */
+		/*!\note There is approximately a 1 in 1.8E19 chance that the following
+		 * calculation will produce 0, which is an invalid ID, but due to the
+		 * properties of the rand() function (and the constantcy of s), that
+		 * won't happen twice in a row.
+		 */
+		while ((s->managerid = rand() ^ (unsigned long) s) == 0);
 		s->last_ev = grab_last();
 		AST_LIST_LOCK(&sessions);
 		AST_LIST_INSERT_HEAD(&sessions, s, list);

Modified: team/murf/bug11210/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/rtp.c?view=diff&rev=104842&r1=104841&r2=104842
==============================================================================
--- team/murf/bug11210/main/rtp.c (original)
+++ team/murf/bug11210/main/rtp.c Wed Feb 27 16:13:24 2008
@@ -3359,7 +3359,8 @@
 		} else if ((fr->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS)) {
 			if ((fr->subclass == AST_CONTROL_HOLD) ||
 			    (fr->subclass == AST_CONTROL_UNHOLD) ||
-			    (fr->subclass == AST_CONTROL_VIDUPDATE)) {
+			    (fr->subclass == AST_CONTROL_VIDUPDATE) ||
+			    (fr->subclass == AST_CONTROL_T38)) {
 				if (fr->subclass == AST_CONTROL_HOLD) {
 					/* If we someone went on hold we want the other side to reinvite back to us */
 					if (who == c0)
@@ -3597,7 +3598,8 @@
 		} else if ((fr->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS)) {
 			if ((fr->subclass == AST_CONTROL_HOLD) ||
 			    (fr->subclass == AST_CONTROL_UNHOLD) ||
-			    (fr->subclass == AST_CONTROL_VIDUPDATE)) {
+			    (fr->subclass == AST_CONTROL_VIDUPDATE) ||
+			    (fr->subclass == AST_CONTROL_T38)) {
 				/* If we are going on hold, then break callback mode and P2P bridging */
 				if (fr->subclass == AST_CONTROL_HOLD) {
 					if (p0_callback)

Modified: team/murf/bug11210/res/res_smdi.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/res/res_smdi.c?view=diff&rev=104842&r1=104841&r2=104842
==============================================================================
--- team/murf/bug11210/res/res_smdi.c (original)
+++ team/murf/bug11210/res/res_smdi.c Wed Feb 27 16:13:24 2008
@@ -1274,7 +1274,9 @@
 	ast_cond_signal(&mwi_monitor.cond);
 	ast_mutex_unlock(&mwi_monitor.lock);
 
-	pthread_join(mwi_monitor.thread, NULL);
+	if (mwi_monitor.thread != AST_PTHREADT_NULL) {
+		pthread_join(mwi_monitor.thread, NULL);
+	}
 
 	ast_custom_function_unregister(&smdi_msg_retrieve_function);
 	ast_custom_function_unregister(&smdi_msg_function);

Modified: team/murf/bug11210/utils/astcanary.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/utils/astcanary.c?view=diff&rev=104842&r1=104841&r2=104842
==============================================================================
--- team/murf/bug11210/utils/astcanary.c (original)
+++ team/murf/bug11210/utils/astcanary.c Wed Feb 27 16:13:24 2008
@@ -67,7 +67,7 @@
 		/* Update the modification times (checked from Asterisk) */
 		if (utime(argv[1], NULL)) {
 			/* Recreate the file if it doesn't exist */
-			if ((fd = open(argv[1], O_RDWR | O_TRUNC | O_CREAT)) > -1)
+			if ((fd = open(argv[1], O_RDWR | O_TRUNC | O_CREAT, 0777)) > -1)
 				close(fd);
 			else
 				exit(1);




More information about the svn-commits mailing list