[asterisk-commits] file: branch file/speech-agi r50519 - in /team/file/speech-agi: ./ apps/ cdr/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 11 11:17:56 MST 2007


Author: file
Date: Thu Jan 11 12:17:55 2007
New Revision: 50519

URL: http://svn.digium.com/view/asterisk?view=rev&rev=50519
Log:
Merged revisions 50228,50266,50298,50346,50377,50405,50433,50466,50468 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r50228 | russell | 2007-01-09 22:17:46 -0400 (Tue, 09 Jan 2007) | 14 lines

Merged revisions 50227 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r50227 | russell | 2007-01-09 21:16:45 -0500 (Tue, 09 Jan 2007) | 6 lines

Make the number that represents the major version number a single digit instead
of 2.  Using two digits makes it an octal number when put into version.h, which
breaks the compilation of any out of tree module that checks the version for
any version after 1.2.7 (reported by Matteo Brancaleoni on the asterisk-dev
mailing list, who gave credit to vihai for pointing it out)

........

................
r50266 | file | 2007-01-09 23:51:29 -0400 (Tue, 09 Jan 2007) | 2 lines

Ensure data's existence before trying to access it. (issue #8774 reported by rcourtna)

................
r50298 | file | 2007-01-10 00:55:13 -0400 (Wed, 10 Jan 2007) | 10 lines

Merged revisions 50295 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r50295 | file | 2007-01-09 23:51:06 -0500 (Tue, 09 Jan 2007) | 2 lines

Add another return value to dial_exec_full that indicates execution is going to continuing at a new extension/context/priority and to just let it slide. (issue #8598 reported by jon)

........

................
r50346 | qwell | 2007-01-10 12:45:36 -0400 (Wed, 10 Jan 2007) | 4 lines

Reverse some logic in cdr_manager, which made it fail to load if the config file existed.

Issue 8777

................
r50377 | file | 2007-01-10 14:32:29 -0400 (Wed, 10 Jan 2007) | 2 lines

Fix chan_sip not working issue. Let's not prematurely return 0. (issue #8783 reported by st41ker)

................
r50405 | file | 2007-01-10 15:46:29 -0400 (Wed, 10 Jan 2007) | 2 lines

Fix parsing when using something like ldap settings. (done by anthonyl)

................
r50433 | file | 2007-01-10 16:25:44 -0400 (Wed, 10 Jan 2007) | 2 lines

Merge speech-multi branch which adds support for joining multiple sound files together to be played one after another in SpeechBackground.

................
r50466 | file | 2007-01-11 01:19:39 -0400 (Thu, 11 Jan 2007) | 2 lines

Add support to see whether NAT was detected (yay symmetric RTP) and also add a check in chan_sip so that if NAT has been detected and the reinvite behind nat option has been turned off, then just do partial bridge. (issue #8655 reported by mnicholson)

................
r50468 | file | 2007-01-11 01:53:09 -0400 (Thu, 11 Jan 2007) | 2 lines

Remove check for channel state as it can definitely be something other then ring, and also clean up the code a bit. This should solve the parking issues and maybe some attended transfer issues people have been seeing.

................

Modified:
    team/file/speech-agi/   (props changed)
    team/file/speech-agi/Makefile
    team/file/speech-agi/apps/app_dial.c
    team/file/speech-agi/apps/app_speech_utils.c
    team/file/speech-agi/cdr/cdr_manager.c
    team/file/speech-agi/channels/chan_sip.c
    team/file/speech-agi/include/asterisk/rtp.h
    team/file/speech-agi/main/config.c
    team/file/speech-agi/main/pbx.c
    team/file/speech-agi/main/rtp.c

Propchange: team/file/speech-agi/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/file/speech-agi/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan 11 12:17:55 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-50220
+/branches/1.4:1-50518

Modified: team/file/speech-agi/Makefile
URL: http://svn.digium.com/view/asterisk/team/file/speech-agi/Makefile?view=diff&rev=50519&r1=50518&r2=50519
==============================================================================
--- team/file/speech-agi/Makefile (original)
+++ team/file/speech-agi/Makefile Thu Jan 11 12:17:55 2007
@@ -223,7 +223,7 @@
 ASTERISKVERSION:=$(shell build_tools/make_version .)
 
 ifneq ($(wildcard .version),)
-  ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}' .version)
+  ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
   RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
 else
   RPMVERSION=unknown

Modified: team/file/speech-agi/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/file/speech-agi/apps/app_dial.c?view=diff&rev=50519&r1=50518&r2=50519
==============================================================================
--- team/file/speech-agi/apps/app_dial.c (original)
+++ team/file/speech-agi/apps/app_dial.c Thu Jan 11 12:17:55 2007
@@ -1460,7 +1460,7 @@
 			peer->priority++;
 			ast_pbx_start(peer);
 			hanguptree(outgoing, NULL);
-			res = 0;
+			res = 1;
 			goto done;
 		}
 
@@ -1653,8 +1653,12 @@
 static int dial_exec(struct ast_channel *chan, void *data)
 {
 	struct ast_flags peerflags;
+	int res = 0;
+
 	memset(&peerflags, 0, sizeof(peerflags));
-	return dial_exec_full(chan, data, &peerflags);
+	res = dial_exec_full(chan, data, &peerflags);
+
+	return (res >= 0 ? 0 : -1);
 }
 
 static int retrydial_exec(struct ast_channel *chan, void *data)
@@ -1714,7 +1718,10 @@
 		if (ast_test_flag(chan, AST_FLAG_MOH))
 			ast_moh_stop(chan);
 
-		if ((res = dial_exec_full(chan, dialdata, &peerflags)) == 0) {
+		res = dial_exec_full(chan, dialdata, &peerflags);
+		if (res == 1) {
+			break;
+		} else if (res == 0) {
 			if (ast_test_flag(&peerflags, OPT_DTMF_EXIT)) {
 				if (!(res = ast_streamfile(chan, announce, chan->language)))
 					res = ast_waitstream(chan, AST_DIGIT_ANY);
@@ -1747,10 +1754,13 @@
 	}
 	if (loops == 0)
 		res = 0;
-	
+	else if (res == 1)
+		res = 0;
+
 	if (ast_test_flag(chan, AST_FLAG_MOH))
 		ast_moh_stop(chan);
-done:
+
+ done:
 	ast_module_user_remove(u);
 	return res;
 }

Modified: team/file/speech-agi/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/team/file/speech-agi/apps/app_speech_utils.c?view=diff&rev=50519&r1=50518&r2=50519
==============================================================================
--- team/file/speech-agi/apps/app_speech_utils.c (original)
+++ team/file/speech-agi/apps/app_speech_utils.c Thu Jan 11 12:17:55 2007
@@ -487,24 +487,18 @@
 /*! \brief Helper function used by speech_background to playback a soundfile */
 static int speech_streamfile(struct ast_channel *chan, const char *filename, const char *preflang)
 {
-        struct ast_filestream *fs;
-        struct ast_filestream *vfs=NULL;
-
-        fs = ast_openstream(chan, filename, preflang);
-        if (fs)
-                vfs = ast_openvstream(chan, filename, preflang);
-        if (fs){
-                if (ast_applystream(chan, fs))
-                        return -1;
-                if (vfs && ast_applystream(chan, vfs))
-                        return -1;
-                if (ast_playstream(fs))
-                        return -1;
-                if (vfs && ast_playstream(vfs))
-                        return -1;
-                return 0;
-        }
-        return -1;
+        struct ast_filestream *fs = NULL;
+
+	if (!(fs = ast_openstream(chan, filename, preflang)))
+		return -1;
+	
+	if (ast_applystream(chan, fs))
+		return -1;
+	
+	if (ast_playstream(fs))
+		return -1;
+
+        return 0;
 }
 
 /*! \brief SpeechBackground(Sound File|Timeout) Dialplan Application */
@@ -519,7 +513,7 @@
         char dtmf[AST_MAX_EXTENSION] = "";
         time_t start, current;
         struct ast_datastore *datastore = NULL;
-        char *argv[2], *args = NULL, *filename = NULL, tmp[2] = "";
+        char *argv[2], *args = NULL, *filename_tmp = NULL, *filename = NULL, tmp[2] = "";
 
         args = ast_strdupa(data);
 
@@ -549,17 +543,9 @@
         argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0]));
         if (argc > 0) {
                 /* Yay sound file */
-                filename = argv[0];
+                filename_tmp = ast_strdupa(argv[0]);
                 if (argv[1] != NULL)
                         timeout = atoi(argv[1]);
-        }
-
-        /* Start streaming the file if possible and specified */
-        if (filename != NULL && ast_streamfile(chan, filename, chan->language)) {
-                /* An error occured while streaming */
-                ast_set_read_format(chan, oldreadformat);
-                ast_module_user_remove(u);
-                return -1;
         }
 
         /* Before we go into waiting for stuff... make sure the structure is ready, if not - start it again */
@@ -568,8 +554,19 @@
                 ast_speech_start(speech);
         }
 
+	/* Ensure no streams are currently running */
+	ast_stopstream(chan);
+
         /* Okay it's streaming so go into a loop grabbing frames! */
         while (done == 0) {
+		/* If the filename is null and stream is not running, start up a new sound file */
+		if ((chan->streamid == -1 && chan->timingfunc == NULL) && (filename = strsep(&filename_tmp, "&"))) {
+			/* Discard old stream information */
+			ast_stopstream(chan);
+			/* Start new stream */
+			speech_streamfile(chan, filename, chan->language);
+		}
+
                 /* Run scheduled stuff */
                 ast_sched_runq(chan->sched);
 

Modified: team/file/speech-agi/cdr/cdr_manager.c
URL: http://svn.digium.com/view/asterisk/team/file/speech-agi/cdr/cdr_manager.c?view=diff&rev=50519&r1=50518&r2=50519
==============================================================================
--- team/file/speech-agi/cdr/cdr_manager.c (original)
+++ team/file/speech-agi/cdr/cdr_manager.c Thu Jan 11 12:17:55 2007
@@ -146,7 +146,7 @@
 	int res;
 
 	/* Configuration file */
-	if(loadconfigurationfile())
+	if (!loadconfigurationfile())
 		return AST_MODULE_LOAD_DECLINE;
 	
 	res = ast_cdr_register(name, "Asterisk Manager Interface CDR Backend", manager_log);

Modified: team/file/speech-agi/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/file/speech-agi/channels/chan_sip.c?view=diff&rev=50519&r1=50518&r2=50519
==============================================================================
--- team/file/speech-agi/channels/chan_sip.c (original)
+++ team/file/speech-agi/channels/chan_sip.c Thu Jan 11 12:17:55 2007
@@ -13239,9 +13239,10 @@
 		/* This is a new invite */
 		/* Handle authentication if this is our first invite */
 		res = check_user(p, req, SIP_INVITE, e, XMIT_RELIABLE, sin);
-		if (res == AUTH_CHALLENGE_SENT)
+		if (res == AUTH_CHALLENGE_SENT) {
 			p->invitestate = INV_COMPLETED;		/* Needs to restart in another INVITE transaction */
-			return 0; 
+			return 0;
+		}
 		if (res < 0) { /* Something failed in authentication */
 			if (res == AUTH_FAKE_AUTH) {
 				ast_log(LOG_NOTICE, "Sending fake auth rejection for user %s\n", get_header(req, "From"));
@@ -13553,7 +13554,6 @@
 					/* Chan 2: Call from Asterisk to target */
 	int res = 0;
 	struct sip_pvt *targetcall_pvt;
-	int error = 0;
 
 	/* Check if the call ID of the replaces header does exist locally */
 	if (!(targetcall_pvt = get_sip_pvt_byid_locked(transferer->refer->replaces_callid, transferer->refer->replaces_callid_totag, 
@@ -13581,37 +13581,31 @@
 	if (!targetcall_pvt->owner) {	/* No active channel */
 		if (option_debug > 3)
 			ast_log(LOG_DEBUG, "SIP attended transfer: Error: No owner of target call\n");
-		error = 1;
-	}
-	/* We have a channel, find the bridge */
-	target.chan1 = targetcall_pvt->owner;				/* Transferer to Asterisk */
-
-	if (!error) {
-		target.chan2 = ast_bridged_channel(targetcall_pvt->owner);	/* Asterisk to target */
-
-		if (!target.chan2 || !(target.chan2->_state == AST_STATE_UP || target.chan2->_state == AST_STATE_RINGING) ) {
-			/* Wrong state of new channel */
-			if (option_debug > 3) {
-				if (target.chan2) 
-					ast_log(LOG_DEBUG, "SIP attended transfer: Error: Wrong state of target call: %s\n", ast_state2str(target.chan2->_state));
-				else if (target.chan1->_state != AST_STATE_RING)
-					ast_log(LOG_DEBUG, "SIP attended transfer: Error: No target channel\n");
-				else
-					ast_log(LOG_DEBUG, "SIP attended transfer: Attempting transfer in ringing state\n");
-			}
-			if (target.chan1->_state != AST_STATE_RING)
-				error = 1;
-		}
-	}
-	if (error) {	/* Cancel transfer */
+		/* Cancel transfer */
 		transmit_notify_with_sipfrag(transferer, seqno, "503 Service Unavailable", TRUE);
 		append_history(transferer, "Xfer", "Refer failed");
-		ast_clear_flag(&transferer->flags[0], SIP_GOTREFER);	
+		ast_clear_flag(&transferer->flags[0], SIP_GOTREFER);
 		transferer->refer->status = REFER_FAILED;
 		ast_mutex_unlock(&targetcall_pvt->lock);
 		ast_channel_unlock(current->chan1);
-		ast_channel_unlock(target.chan1);
+		ast_channel_unlock(targetcall_pvt->owner);
 		return -1;
+	}
+
+	/* We have a channel, find the bridge */
+	target.chan1 = targetcall_pvt->owner;				/* Transferer to Asterisk */
+	target.chan2 = ast_bridged_channel(targetcall_pvt->owner);	/* Asterisk to target */
+
+	if (!target.chan2 || !(target.chan2->_state == AST_STATE_UP || target.chan2->_state == AST_STATE_RINGING) ) {
+		/* Wrong state of new channel */
+		if (option_debug > 3) {
+			if (target.chan2) 
+				ast_log(LOG_DEBUG, "SIP attended transfer: Error: Wrong state of target call: %s\n", ast_state2str(target.chan2->_state));
+			else if (target.chan1->_state != AST_STATE_RING)
+				ast_log(LOG_DEBUG, "SIP attended transfer: Error: No target channel\n");
+			else
+				ast_log(LOG_DEBUG, "SIP attended transfer: Attempting transfer in ringing state\n");
+		}
 	}
 
 	/* Transfer */
@@ -16655,7 +16649,9 @@
 
 	*rtp = p->rtp;
 
-	if (ast_test_flag(&p->flags[0], SIP_CAN_REINVITE))
+	if (ast_rtp_getnat(*rtp) && !ast_test_flag(&p->flags[0], SIP_CAN_REINVITE_NAT))
+		res = AST_RTP_TRY_PARTIAL;
+	else if (ast_test_flag(&p->flags[0], SIP_CAN_REINVITE))
 		res = AST_RTP_TRY_NATIVE;
 	else if (ast_test_flag(&global_jbconf, AST_JB_FORCED))
 		res = AST_RTP_GET_FAILED;

Modified: team/file/speech-agi/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/team/file/speech-agi/include/asterisk/rtp.h?view=diff&rev=50519&r1=50518&r2=50519
==============================================================================
--- team/file/speech-agi/include/asterisk/rtp.h (original)
+++ team/file/speech-agi/include/asterisk/rtp.h Thu Jan 11 12:17:55 2007
@@ -179,6 +179,8 @@
 				   const int isAstFormat, enum ast_rtp_options options);
 
 void ast_rtp_setnat(struct ast_rtp *rtp, int nat);
+
+int ast_rtp_getnat(struct ast_rtp *rtp);
 
 /*! \brief Indicate whether this RTP session is carrying DTMF or not */
 void ast_rtp_setdtmf(struct ast_rtp *rtp, int dtmf);

Modified: team/file/speech-agi/main/config.c
URL: http://svn.digium.com/view/asterisk/team/file/speech-agi/main/config.c?view=diff&rev=50519&r1=50518&r2=50519
==============================================================================
--- team/file/speech-agi/main/config.c (original)
+++ team/file/speech-agi/main/config.c Thu Jan 11 12:17:55 2007
@@ -1103,7 +1103,7 @@
 {
 	struct ast_config *config, *configtmp;
 	struct ast_variable *v;
-	char *driver, *table, *database, *stringp;
+	char *driver, *table, *database, *stringp, *tmp;
 
 	clear_config_maps();
 
@@ -1118,6 +1118,9 @@
 	for (v = ast_variable_browse(config, "settings"); v; v = v->next) {
 		stringp = v->value;
 		driver = strsep(&stringp, ",");
+
+		if ((tmp = strchr(stringp, '\"')))
+			stringp = tmp;
 
 		/* check if the database text starts with a double quote */
 		if (*stringp == '"') {

Modified: team/file/speech-agi/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/file/speech-agi/main/pbx.c?view=diff&rev=50519&r1=50518&r2=50519
==============================================================================
--- team/file/speech-agi/main/pbx.c (original)
+++ team/file/speech-agi/main/pbx.c Thu Jan 11 12:17:55 2007
@@ -1709,7 +1709,7 @@
 	memset(passdata, 0, datalen);
 
 	/* No variables or expressions in e->data, so why scan it? */
-	if (!strchr(e->data, '$') && !strstr(e->data,"${") && !strstr(e->data,"$[") && !strstr(e->data,"$(")) {
+	if (e->data && !strchr(e->data, '$') && !strstr(e->data,"${") && !strstr(e->data,"$[") && !strstr(e->data,"$(")) {
 		ast_copy_string(passdata, e->data, datalen);
 		return;
 	}

Modified: team/file/speech-agi/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/file/speech-agi/main/rtp.c?view=diff&rev=50519&r1=50518&r2=50519
==============================================================================
--- team/file/speech-agi/main/rtp.c (original)
+++ team/file/speech-agi/main/rtp.c Thu Jan 11 12:17:55 2007
@@ -589,6 +589,11 @@
 void ast_rtp_setnat(struct ast_rtp *rtp, int nat)
 {
 	rtp->nat = nat;
+}
+
+int ast_rtp_getnat(struct ast_rtp *rtp)
+{
+	return ast_test_flag(rtp, FLAG_NAT_ACTIVE);
 }
 
 void ast_rtp_setdtmf(struct ast_rtp *rtp, int dtmf)



More information about the asterisk-commits mailing list