[svn-commits] diruggles: trunk r230584 - in /trunk: apps/app_externalivr.c doc/externalivr.txt

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Nov 20 11:28:03 CST 2009


Author: diruggles
Date: Fri Nov 20 11:28:01 2009
New Revision: 230584

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=230584
Log:
Fix/Implement error events for non-existing files
also include a better cmd define for S command

Review: https://reviewboard.asterisk.org/r/430/

Modified:
    trunk/apps/app_externalivr.c
    trunk/doc/externalivr.txt

Modified: trunk/apps/app_externalivr.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_externalivr.c?view=diff&rev=230584&r1=230583&r2=230584
==============================================================================
--- trunk/apps/app_externalivr.c (original)
+++ trunk/apps/app_externalivr.c Fri Nov 20 11:28:01 2009
@@ -98,7 +98,7 @@
 /* Commands */
 #define EIVR_CMD_PARM 'P' /* return supplied params */
 #define EIVR_CMD_ANS 'T'  /* answer channel */
-#define EIVR_CMD_STRT 'S' /* start prompt queue over */
+#define EIVR_CMD_SQUE 'S' /* (re)set prompt queue */
 #define EIVR_CMD_APND 'A' /* append to prompt queue */
 #define EIVR_CMD_GET 'G'  /* get channel varable(s) */
 #define EIVR_CMD_SVAR 'V' /* set channel varable(s) */
@@ -706,23 +706,23 @@
 						u->gen_active = 1;
 					}
 				}
- 			} else if (input[0] == EIVR_CMD_STRT) {
+ 			} else if (input[0] == EIVR_CMD_SQUE) {
 				if (chan->_state != AST_STATE_UP || ast_check_hangup(chan)) {
-					ast_chan_log(LOG_WARNING, chan, "Queue 'S'et called on unanswered channel\n");
+					ast_chan_log(LOG_WARNING, chan, "Queue re'S'et called on unanswered channel\n");
 					send_eivr_event(eivr_events, 'Z', NULL, chan);
 					continue;
 				}
- 				if (ast_fileexists(&input[2], NULL, u->chan->language) == -1) {
+ 				if (!ast_fileexists(&input[2], NULL, u->chan->language)) {
  					ast_chan_log(LOG_WARNING, chan, "Unknown file requested '%s'\n", &input[2]);
- 					send_eivr_event(eivr_events, 'Z', NULL, chan);
- 					strcpy(&input[2], "exception");
- 				}
- 				if (!u->abort_current_sound && !u->playing_silence)
- 					send_eivr_event(eivr_events, 'T', NULL, chan);
- 				AST_LIST_LOCK(&u->playlist);
- 				while ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list))) {
- 					send_eivr_event(eivr_events, 'D', entry->filename, chan);
- 					ast_free(entry);
+ 					send_eivr_event(eivr_events, 'Z', &input[2], chan);
+ 				} else {
+	 				if (!u->abort_current_sound && !u->playing_silence)
+ 						send_eivr_event(eivr_events, 'T', NULL, chan);
+ 					AST_LIST_LOCK(&u->playlist);
+ 					while ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list))) {
+ 						send_eivr_event(eivr_events, 'D', entry->filename, chan);
+ 						ast_free(entry);
+					}
  				}
  				if (!u->playing_silence)
  					u->abort_current_sound = 1;
@@ -736,16 +736,16 @@
 					send_eivr_event(eivr_events, 'Z', NULL, chan);
 					continue;
 				}
- 				if (ast_fileexists(&input[2], NULL, u->chan->language) == -1) {
+ 				if (!ast_fileexists(&input[2], NULL, u->chan->language)) {
  					ast_chan_log(LOG_WARNING, chan, "Unknown file requested '%s'\n", &input[2]);
- 					send_eivr_event(eivr_events, 'Z', NULL, chan);
- 					strcpy(&input[2], "exception");
- 				}
- 				entry = make_entry(&input[2]);
- 				if (entry) {
- 					AST_LIST_LOCK(&u->playlist);
- 					AST_LIST_INSERT_TAIL(&u->playlist, entry, list);
- 					AST_LIST_UNLOCK(&u->playlist);
+ 					send_eivr_event(eivr_events, 'Z', &input[2], chan);
+ 				} else {
+	 				entry = make_entry(&input[2]);
+ 					if (entry) {
+ 						AST_LIST_LOCK(&u->playlist);
+ 						AST_LIST_INSERT_TAIL(&u->playlist, entry, list);
+ 						AST_LIST_UNLOCK(&u->playlist);
+					}
  				}
  			} else if (input[0] == EIVR_CMD_GET) {
  				char response[2048];

Modified: trunk/doc/externalivr.txt
URL: http://svnview.digium.com/svn/asterisk/trunk/doc/externalivr.txt?view=diff&rev=230584&r1=230583&r2=230584
==============================================================================
--- trunk/doc/externalivr.txt (original)
+++ trunk/doc/externalivr.txt Fri Nov 20 11:28:01 2009
@@ -103,10 +103,11 @@
 the specified name, and if so, clear's the generator's playlist and
 places the file onto the list. Note that the playability check does
 not take into account transcoding requirements, so it is possible for
-the file to not be played even though it was found. If the generator
-is not currently playing silence, then T and D events will be sent
-to the child to signal the playlist interruption and notify it of
-the files that will not be played.
+the file to not be played even though it was found. If the file does
+not exist it sends a Z response with the data element set to the file
+requested. If the generator is not currently playing silence, then T
+and D events will be sent to the child to signal the playlist
+interruption and notify it of the files that will not be played.
 
 The 'A' command checks to see if there is a playable audio file with
 the specified name, and if so, adds it to the generator's




More information about the svn-commits mailing list