[asterisk-commits] mmichelson: branch group/manager2 r116630 - in /team/group/manager2: ./ apps/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 15 12:08:12 CDT 2008


Author: mmichelson
Date: Thu May 15 12:08:11 2008
New Revision: 116630

URL: http://svn.digium.com/view/asterisk?view=rev&rev=116630
Log:
Update the manager2 branch


Added:
    team/group/manager2/contrib/scripts/install_prereq
      - copied unchanged from r116594, trunk/contrib/scripts/install_prereq
Modified:
    team/group/manager2/   (props changed)
    team/group/manager2/CHANGES
    team/group/manager2/CREDITS
    team/group/manager2/UPGRADE.txt
    team/group/manager2/apps/app_chanspy.c
    team/group/manager2/apps/app_externalivr.c
    team/group/manager2/apps/app_jack.c
    team/group/manager2/apps/app_queue.c
    team/group/manager2/apps/app_skel.c
    team/group/manager2/apps/app_voicemail.c
    team/group/manager2/apps/app_waituntil.c
    team/group/manager2/channels/chan_agent.c
    team/group/manager2/channels/chan_alsa.c
    team/group/manager2/channels/chan_iax2.c
    team/group/manager2/channels/chan_local.c
    team/group/manager2/channels/chan_sip.c
    team/group/manager2/channels/chan_skinny.c
    team/group/manager2/channels/chan_zap.c
    team/group/manager2/configs/voicemail.conf.sample
    team/group/manager2/doc/tex/channelvariables.tex
    team/group/manager2/funcs/func_speex.c
    team/group/manager2/funcs/func_timeout.c
    team/group/manager2/include/asterisk/channel.h
    team/group/manager2/include/asterisk/frame.h
    team/group/manager2/include/asterisk/lock.h
    team/group/manager2/include/asterisk/rtp.h
    team/group/manager2/include/asterisk/utils.h
    team/group/manager2/main/Makefile
    team/group/manager2/main/abstract_jb.c
    team/group/manager2/main/asterisk.c
    team/group/manager2/main/autoservice.c
    team/group/manager2/main/channel.c
    team/group/manager2/main/features.c
    team/group/manager2/main/frame.c
    team/group/manager2/main/manager.c
    team/group/manager2/main/pbx.c
    team/group/manager2/main/rtp.c
    team/group/manager2/main/sched.c
    team/group/manager2/main/taskprocessor.c
    team/group/manager2/main/udptl.c
    team/group/manager2/main/utils.c
    team/group/manager2/pbx/pbx_spool.c
    team/group/manager2/res/res_agi.c
    team/group/manager2/res/res_config_ldap.c
    team/group/manager2/res/res_smdi.c
    team/group/manager2/sample.call

Propchange: team/group/manager2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/manager2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu May 15 12:08:11 2008
@@ -1,1 +1,1 @@
-/trunk:1-115623
+/trunk:1-116629

Modified: team/group/manager2/CHANGES
URL: http://svn.digium.com/view/asterisk/team/group/manager2/CHANGES?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/CHANGES (original)
+++ team/group/manager2/CHANGES Thu May 15 12:08:11 2008
@@ -59,6 +59,11 @@
    to be spoken instead of the channel name or number. For more information on the
    use of this option, issue the command "core show application ChanSpy" from the 
    Asterisk CLI.
+ * Chanspy has a new option, 'd', which allows the spy to use DTMF to swap between
+   spy modes. Use of this feature overrides the typical use of numeric DTMF. In other
+   words, if using the 'd' option, it is not possible to enter a number to append to
+   the first argument to Chanspy(). Pressing 4 will change to spy mode, pressing 5 will
+   change to whisper mode, and pressing 6 will change to barge mode.
 
 SIP Changes
 -----------
@@ -77,6 +82,8 @@
    testing and problem reporting!
  * Added ability to specify registration expiry time on a per registration basis in
    the register line.
+ * Added support for T140 RED - redundancy in T.140 to prevent text loss due to
+   lost packets.
 
 IAX Changes
 -----------
@@ -166,6 +173,7 @@
   * Originate now requires the Originate privilege and, if you want to call out
     to a subshell, it requires the System privilege, as well.  This was done to
     enhance manager security.
+  * Originate now accepts codec settings with "Codecs: alaw, ulaw, h264" 
   * New command: Atxfer. See doc/manager_1_1.txt for more details or 
     manager show command Atxfer from the CLI
 

Modified: team/group/manager2/CREDITS
URL: http://svn.digium.com/view/asterisk/team/group/manager2/CREDITS?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/CREDITS (original)
+++ team/group/manager2/CREDITS Thu May 15 12:08:11 2008
@@ -19,6 +19,9 @@
 
 John Todd, TalkPlus, Inc.  and JR Richardson, Ntegrated Solutions. - for funding
     the development of SIP Session Timers support.
+
+Omnitor AB, Gunnar Hellström, for funding work with videocaps, T.140 RED,
+originate with video/text and many more contributions.
 
 === WISHLIST CONTRIBUTERS ===
 Jeremy McNamara - SpeeX support

Modified: team/group/manager2/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/group/manager2/UPGRADE.txt?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/UPGRADE.txt (original)
+++ team/group/manager2/UPGRADE.txt Thu May 15 12:08:11 2008
@@ -75,7 +75,7 @@
   Examples of situations that would require this option are web interfaces to
   voicemail or an email client in the case of using IMAP storage.
 * The externnotify script should accept an additional (last) parameter
-  containing the string "URGENT" if there are new urgent messages in the INBOX.
+  containing the number of urgent messages in the INBOX.
 
 Applications:
 

Modified: team/group/manager2/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_chanspy.c?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/apps/app_chanspy.c (original)
+++ team/group/manager2/apps/app_chanspy.c Thu May 15 12:08:11 2008
@@ -64,7 +64,8 @@
 "    - Dialing a series of digits followed by # builds a channel name to append\n"
 "      to 'chanprefix'. For example, executing ChanSpy(Agent) and then dialing\n"
 "      the digits '1234#' while spying will begin spying on the channel\n"
-"      'Agent/1234'.\n"
+"      'Agent/1234'. Note that this feature will be overriden if the 'd' option\n"
+"       is used\n"
 "  Note: The X option supersedes the three features above in that if a valid\n"
 "        single digit extension exists in the correct context ChanSpy will\n"
 "        exit to it. This also disables choosing a channel based on 'chanprefix'\n"
@@ -73,6 +74,11 @@
 "    b                      - Only spy on channels involved in a bridged call.\n"
 "    B                      - Instead of whispering on a single channel barge in on both\n"
 "                             channels involved in the call.\n"
+"    d                      - Override the typical numeric DTMF functionality and instead\n"
+"                             use DTMF to switch between spy modes.\n"
+"                                     4 = spy mode\n"
+"                                     5 = whisper mode\n"
+"                                     6 = barge mode\n"
 "    g(grp)                 - Only spy on channels in which one or more of the groups \n"
 "                             listed in 'grp' matches one or more groups from the\n"
 "                             SPYGROUP variable set on the channel to be spied upon.\n"
@@ -126,6 +132,13 @@
 "        exit to it.\n"
 "  Options:\n"
 "    b                      - Only spy on channels involved in a bridged call.\n"
+"    B                      - Instead of whispering on a single channel barge in on both\n"
+"                             channels involved in the call.\n"
+"    d                      - Override the typical numeric DTMF functionality and instead\n"
+"                             use DTMF to switch between spy modes.\n"
+"                                     4 = spy mode\n"
+"                                     5 = whisper mode\n"
+"                                     6 = barge mode\n"
 "    g(grp)                 - Only spy on channels in which one or more of the groups \n"
 "                             listed in 'grp' matches one or more groups from the\n"
 "                             SPYGROUP variable set on the channel to be spied upon.\n"
@@ -162,19 +175,20 @@
 ;
 
 enum {
-	OPTION_QUIET     = (1 << 0),    /* Quiet, no announcement */
-	OPTION_BRIDGED   = (1 << 1),    /* Only look at bridged calls */
-	OPTION_VOLUME    = (1 << 2),    /* Specify initial volume */
-	OPTION_GROUP     = (1 << 3),    /* Only look at channels in group */
-	OPTION_RECORD    = (1 << 4),
-	OPTION_WHISPER   = (1 << 5),
-	OPTION_PRIVATE   = (1 << 6),    /* Private Whisper mode */
-	OPTION_READONLY  = (1 << 7),    /* Don't mix the two channels */
-	OPTION_EXIT      = (1 << 8),    /* Exit to a valid single digit extension */
-	OPTION_ENFORCED  = (1 << 9),    /* Enforced mode */
-	OPTION_NOTECH    = (1 << 10),   /* Skip technology name playback */
-	OPTION_BARGE     = (1 << 11),   /* Barge mode (whisper to both channels) */
-	OPTION_NAME      = (1 << 12),   /* Say the name of the person on whom we will spy */
+	OPTION_QUIET             = (1 << 0),    /* Quiet, no announcement */
+	OPTION_BRIDGED           = (1 << 1),    /* Only look at bridged calls */
+	OPTION_VOLUME            = (1 << 2),    /* Specify initial volume */
+	OPTION_GROUP             = (1 << 3),    /* Only look at channels in group */
+	OPTION_RECORD            = (1 << 4),
+	OPTION_WHISPER           = (1 << 5),
+	OPTION_PRIVATE           = (1 << 6),    /* Private Whisper mode */
+	OPTION_READONLY          = (1 << 7),    /* Don't mix the two channels */
+	OPTION_EXIT              = (1 << 8),    /* Exit to a valid single digit extension */
+	OPTION_ENFORCED          = (1 << 9),    /* Enforced mode */
+	OPTION_NOTECH            = (1 << 10),   /* Skip technology name playback */
+	OPTION_BARGE             = (1 << 11),   /* Barge mode (whisper to both channels) */
+	OPTION_NAME              = (1 << 12),   /* Say the name of the person on whom we will spy */
+	OPTION_DTMF_SWITCH_MODES = (1 << 13),   /*Allow numeric DTMF to switch between chanspy modes */
 } chanspy_opt_flags;
 
 enum {
@@ -200,6 +214,7 @@
 	AST_APP_OPTION('X', OPTION_EXIT),
 	AST_APP_OPTION('s', OPTION_NOTECH),
 	AST_APP_OPTION_ARG('n', OPTION_NAME, OPT_ARG_NAME),
+	AST_APP_OPTION('d', OPTION_DTMF_SWITCH_MODES),
 });
 
 
@@ -281,8 +296,22 @@
 	ast_mutex_t lock;
 };
 
+static void change_spy_mode(const char digit, struct ast_flags *flags)
+{
+	if (digit == '4') {
+		ast_clear_flag(flags, OPTION_WHISPER);
+		ast_clear_flag(flags, OPTION_BARGE);
+	} else if (digit == '5') {
+		ast_clear_flag(flags, OPTION_BARGE);
+		ast_set_flag(flags, OPTION_WHISPER);
+	} else if (digit == '6') {
+		ast_clear_flag(flags, OPTION_WHISPER);
+		ast_set_flag(flags, OPTION_BARGE);
+	}
+}
+
 static int channel_spy(struct ast_channel *chan, struct chanspy_ds *spyee_chanspy_ds, 
-	int *volfactor, int fd, const struct ast_flags *flags, char *exitcontext) 
+	int *volfactor, int fd, struct ast_flags *flags, char *exitcontext) 
 {
 	struct chanspy_translation_helper csth;
 	int running = 0, res, x = 0;
@@ -327,15 +356,14 @@
 		return 0;
 	}
 
-	if (ast_test_flag(flags, OPTION_BARGE)) {
-  		ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
-		ast_audiohook_init(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "Chanspy");
-  		start_spying(spyee, spyer_name, &csth.whisper_audiohook); /* Unlocks spyee */
-		start_spying(ast_bridged_channel(spyee), spyer_name, &csth.bridge_whisper_audiohook);
-	} else if (ast_test_flag(flags, OPTION_WHISPER)) {
-		ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
-		start_spying(spyee, spyer_name, &csth.whisper_audiohook); /* Unlocks spyee */
-  	}
+	ast_channel_lock(chan);
+	ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY);
+	ast_channel_unlock(chan);
+
+ 	ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
+	ast_audiohook_init(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "Chanspy");
+  	start_spying(spyee, spyer_name, &csth.whisper_audiohook); /* Unlocks spyee */
+	start_spying(ast_bridged_channel(spyee), spyer_name, &csth.bridge_whisper_audiohook);
 
 	ast_channel_unlock(spyee);
 	spyee = NULL;
@@ -417,7 +445,11 @@
 				ast_debug(2, "Exit by single digit did not work in chanspy. Extension %s does not exist in context %s\n", tmp, exitcontext);
 			}
 		} else if (res >= '0' && res <= '9') {
-			inp[x++] = res;
+			if (ast_test_flag(flags, OPTION_DTMF_SWITCH_MODES)) {
+				change_spy_mode(res, flags);
+			} else {
+				inp[x++] = res;
+			}
 		}
 
 		if (res == '*') {
@@ -445,21 +477,18 @@
 	else
 		ast_deactivate_generator(chan);
 
-	if (ast_test_flag(flags, OPTION_BARGE)) {
-		ast_audiohook_lock(&csth.whisper_audiohook);
-		ast_audiohook_detach(&csth.whisper_audiohook);
-		ast_audiohook_unlock(&csth.whisper_audiohook);
-		ast_audiohook_destroy(&csth.whisper_audiohook);
-		ast_audiohook_lock(&csth.bridge_whisper_audiohook);
-		ast_audiohook_detach(&csth.bridge_whisper_audiohook);
-		ast_audiohook_unlock(&csth.bridge_whisper_audiohook);
-		ast_audiohook_destroy(&csth.bridge_whisper_audiohook);
-	} else if (ast_test_flag(flags, OPTION_WHISPER)) {
-		ast_audiohook_lock(&csth.whisper_audiohook);
-		ast_audiohook_detach(&csth.whisper_audiohook);
-		ast_audiohook_unlock(&csth.whisper_audiohook);
-		ast_audiohook_destroy(&csth.whisper_audiohook);
-	}
+	ast_channel_lock(chan);
+	ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
+	ast_channel_unlock(chan);
+
+	ast_audiohook_lock(&csth.whisper_audiohook);
+	ast_audiohook_detach(&csth.whisper_audiohook);
+	ast_audiohook_unlock(&csth.whisper_audiohook);
+	ast_audiohook_destroy(&csth.whisper_audiohook);
+	ast_audiohook_lock(&csth.bridge_whisper_audiohook);
+	ast_audiohook_detach(&csth.bridge_whisper_audiohook);
+	ast_audiohook_unlock(&csth.bridge_whisper_audiohook);
+	ast_audiohook_destroy(&csth.bridge_whisper_audiohook);
 
 	ast_audiohook_lock(&csth.spy_audiohook);
 	ast_audiohook_detach(&csth.spy_audiohook);
@@ -580,7 +609,7 @@
 	return setup_chanspy_ds(next, chanspy_ds);
 }
 
-static int common_exec(struct ast_channel *chan, const struct ast_flags *flags,
+static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
 	int volfactor, const int fd, const char *mygroup, const char *myenforced,
 	const char *spec, const char *exten, const char *context, const char *mailbox,
 	const char *name_context)

Modified: team/group/manager2/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_externalivr.c?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/apps/app_externalivr.c (original)
+++ team/group/manager2/apps/app_externalivr.c Thu May 15 12:08:11 2008
@@ -481,6 +481,7 @@
  	struct ast_channel *rchan;
  	char *command;
  	int res = -1;
+	int test_available_fd = -1;
   
  	FILE *eivr_commands = NULL;
  	FILE *eivr_errors = NULL;
@@ -500,6 +501,8 @@
  			goto exit;
  		}
 	}
+
+	test_available_fd = open("/dev/null", O_RDONLY);
  
  	setvbuf(eivr_events, NULL, _IONBF, 0);
  	setvbuf(eivr_commands, NULL, _IONBF, 0);
@@ -574,7 +577,7 @@
  		} else if (ready_fd == eivr_commands_fd) {
  			char input[1024];
  
- 			if (exception || feof(eivr_commands)) {
+ 			if (exception || (dup2(eivr_commands_fd, test_available_fd) == -1) || feof(eivr_commands)) {
  				ast_chan_log(LOG_WARNING, chan, "Child process went away\n");
  				res = -1;
   				break;
@@ -685,6 +688,10 @@
  
 exit:
  
+	if (test_available_fd > -1) {
+		close(test_available_fd);
+	}
+
 	if (eivr_events)
  		fclose(eivr_events);
  

Modified: team/group/manager2/apps/app_jack.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_jack.c?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/apps/app_jack.c (original)
+++ team/group/manager2/apps/app_jack.c Thu May 15 12:08:11 2008
@@ -977,12 +977,16 @@
 
 static int load_module(void)
 {
-	int res = 0;
-
-	res |= ast_register_application(jack_app, jack_exec, jack_synopsis, jack_desc);
-	res |= ast_custom_function_register(&jack_hook_function);
-
-	return res;
+	if (ast_register_application(jack_app, jack_exec, jack_synopsis, jack_desc)) {
+		return AST_MODULE_LOAD_DECLINE;
+	}
+
+	if (ast_custom_function_register(&jack_hook_function)) {
+		ast_unregister_application(jack_app);
+		return AST_MODULE_LOAD_DECLINE;
+	}
+
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "JACK Interface");

Modified: team/group/manager2/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_queue.c?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/apps/app_queue.c (original)
+++ team/group/manager2/apps/app_queue.c Thu May 15 12:08:11 2008
@@ -199,7 +199,7 @@
 static char *app_aqm = "AddQueueMember" ;
 static char *app_aqm_synopsis = "Dynamically adds queue members" ;
 static char *app_aqm_descrip =
-"   AddQueueMember(queuename[,interface[,penalty[,options[,membername]]]]):\n"
+"   AddQueueMember(queuename[,interface[,penalty[,options[,membername[,stateinterface]]]]]):\n"
 "Dynamically adds interface to an existing queue.\n"
 "If the interface is already in the queue it will return an error.\n"
 "  This application sets the following channel variable upon completion:\n"
@@ -4255,7 +4255,7 @@
 	int penalty = 0;
 
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "AddQueueMember requires an argument (queuename[,[interface],[penalty][,options][,membername]])\n");
+		ast_log(LOG_WARNING, "AddQueueMember requires an argument (queuename[,interface[,penalty[,options[,membername[,stateinterface]]]]])\n");
 		return -1;
 	}
 

Modified: team/group/manager2/apps/app_skel.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_skel.c?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/apps/app_skel.c (original)
+++ team/group/manager2/apps/app_skel.c Thu May 15 12:08:11 2008
@@ -114,7 +114,8 @@
 
 static int load_module(void)
 {
-	return ast_register_application(app, app_exec, synopsis, descrip);
+	return ast_register_application(app, app_exec, synopsis, descrip) ? 
+		AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Skeleton (sample) Application");

Modified: team/group/manager2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_voicemail.c?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/apps/app_voicemail.c (original)
+++ team/group/manager2/apps/app_voicemail.c Thu May 15 12:08:11 2008
@@ -3177,6 +3177,7 @@
 	struct vm_state *vms_p;
 	int ret = 0;
 	int fold = folder_int(folder);
+	int urgent = 0;
 	
 	if (ast_strlen_zero(mailbox))
 		return 0;
@@ -3225,6 +3226,12 @@
 		vms_p = get_vm_state_by_mailbox(mailbox,0);
 	}
 
+	/* If URGENT, then look at INBOX */
+	if (fold == 11) {
+		fold = NEW_FOLDER;
+		urgent = 1;
+	}
+
 	if (!vms_p) {
 		ast_debug(3,"Adding new vmstate for %s\n",vmu->imapuser);
 		if (!(vms_p = ast_calloc(1, sizeof(*vms_p)))) {
@@ -3235,7 +3242,6 @@
 		vms_p->mailstream = NIL; /* save for access from interactive entry point */
 		ast_debug(3, "Copied %s to %s\n",vmu->imapuser,vms_p->imapuser);
 		vms_p->updated = 1;
-		/* set mailbox to INBOX! */
 		ast_copy_string(vms_p->curbox, mbox(fold), sizeof(vms_p->curbox));
 		init_vm_state(vms_p);
 		vmstate_insert(vms_p);
@@ -3261,7 +3267,7 @@
 			pgm->seen = 1;
 		}
 		/* look for urgent messages */
-		if (fold == 11) {
+		if (urgent == 1) {
                 	pgm->flagged = 1;
                 	pgm->unflagged = 0;
 		}
@@ -3270,11 +3276,11 @@
 
 		vms_p->vmArrayIndex = 0;
 		mail_search_full (vms_p->mailstream, NULL, pgm, NIL);
-		if (fold == 0)
+		if (fold == 0 && urgent == 0)
 			vms_p->newmessages = vms_p->vmArrayIndex;
 		if (fold == 1)
 			vms_p->oldmessages = vms_p->vmArrayIndex;
-		if(fold == 11)
+		if (fold == 0 && urgent == 1)
 			vms_p->urgentmessages = vms_p->vmArrayIndex;
 		/*Freeing the searchpgm also frees the searchhdr*/
 		mail_free_searchpgm(&pgm);
@@ -3450,7 +3456,7 @@
 
 	ast_log(AST_LOG_NOTICE, "Copying message from %s@%s to %s@%s\n", vmu->mailbox, vmu->context, recip->mailbox, recip->context);
 
-	if (!strcmp(flag, "Urgent")) { /* If urgent, copy to Urgent folder */
+	if (!ast_strlen_zero(flag) && !strcmp(flag, "Urgent")) { /* If urgent, copy to Urgent folder */
 		create_dirpath(todir, sizeof(todir), recip->context, recip->mailbox, "Urgent");
 	} else {
 		create_dirpath(todir, sizeof(todir), recip->context, recip->mailbox, "INBOX");
@@ -3648,7 +3654,7 @@
 		if (inboxcount(ext_context, &urgentvoicemails, &newvoicemails, &oldvoicemails)) {
 			ast_log(AST_LOG_ERROR, "Problem in calculating number of voicemail messages available for extension %s\n", extension);
 		} else {
-			snprintf(arguments, sizeof(arguments), "%s %s %s %d %s&", externnotify, context, extension, newvoicemails, S_OR(flag,""));
+			snprintf(arguments, sizeof(arguments), "%s %s %s %d %d&", externnotify, context, extension, newvoicemails, urgentvoicemails);
 			ast_debug(1, "Executing %s\n", arguments);
 			ast_safe_system(arguments);
 		}
@@ -3865,7 +3871,7 @@
 		ast_stopstream(chan);
 	/* Check for a '*' here in case the caller wants to escape from voicemail to something
 	 other than the operator -- an automated attendant or mailbox login for example */
-	if (!ast_strlen_zero(vmu->exit) && (res == '*')) {
+	if (res == '*') {
 		chan->exten[0] = 'a';
 		chan->exten[1] = '\0';
 		if (!ast_strlen_zero(vmu->exit)) {
@@ -4121,7 +4127,7 @@
 						}
 					}
 #ifndef IMAP_STORAGE
-					if (!strcmp(flag, "Urgent")) { /* If this is an Urgent message */
+					if (!ast_strlen_zero(flag) && !strcmp(flag, "Urgent")) { /* If this is an Urgent message */
 						/* Move the message from INBOX to Urgent folder if this is urgent! */
 						char sfn[PATH_MAX];
 						char dfn[PATH_MAX];
@@ -10502,7 +10508,7 @@
 		case '4':
 			if (outsidecaller) {  /* only mark vm messages */
 				/* Mark Urgent */
-				if (strcmp(flag, "Urgent")) {
+				if (!ast_strlen_zero(flag) && strcmp(flag, "Urgent")) {
 					ast_verbose(VERBOSE_PREFIX_3 "marking message as Urgent\n");
 					ast_debug(1000, "This message is too urgent!\n");
 					res = ast_play_and_wait(chan, "vm-marked-urgent");
@@ -10573,7 +10579,7 @@
 			if (message_exists) {
 				cmd = ast_play_and_wait(chan, "vm-review");
 				if (!cmd && outsidecaller) {
-					if (strcmp(flag, "Urgent")) {
+					if (!ast_strlen_zero(flag) && strcmp(flag, "Urgent")) {
 						cmd = ast_play_and_wait(chan, "vm-review-urgent");
 					} else {
 						cmd = ast_play_and_wait(chan, "vm-review-unurgent");

Modified: team/group/manager2/apps/app_waituntil.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_waituntil.c?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/apps/app_waituntil.c (original)
+++ team/group/manager2/apps/app_waituntil.c Thu May 15 12:08:11 2008
@@ -48,6 +48,7 @@
 {
 	int res;
 	double fraction;
+	long seconds;
 	struct timeval future = { 0, };
 	struct timeval tv = ast_tvnow();
 	int msec;
@@ -58,12 +59,13 @@
 		return 0;
 	}
 
-	if (sscanf(data, "%ld%lf", (long *)&future.tv_sec, &fraction) == 0) {
+	if (sscanf(data, "%ld%lf", &seconds, &fraction) == 0) {
 		ast_log(LOG_WARNING, "WaitUntil called with non-numeric argument\n");
 		pbx_builtin_setvar_helper(chan, "WAITUNTILSTATUS", "FAILURE");
 		return 0;
 	}
 
+	future.tv_sec = seconds;
 	future.tv_usec = fraction * 1000000;
 
 	if ((msec = ast_tvdiff_ms(future, tv)) < 0) {

Modified: team/group/manager2/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/channels/chan_agent.c?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/channels/chan_agent.c (original)
+++ team/group/manager2/channels/chan_agent.c Thu May 15 12:08:11 2008
@@ -1008,7 +1008,7 @@
 	if (p->chan) {
 		if (ast_test_flag(p->chan, AST_FLAG_BLOCKING)) {
 			ast_log( LOG_ERROR, "A blocker exists after agent channel ownership acquired\n" );
-			CRASH;
+			ast_assert(0);
 		}
 	}
 	return tmp;

Modified: team/group/manager2/channels/chan_alsa.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/channels/chan_alsa.c?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/channels/chan_alsa.c (original)
+++ team/group/manager2/channels/chan_alsa.c Thu May 15 12:08:11 2008
@@ -89,7 +89,6 @@
 static snd_pcm_format_t format = SND_PCM_FORMAT_S16_BE;
 #endif
 
-/* static int block = O_NONBLOCK; */
 static char indevname[50] = ALSA_INDEV;
 static char outdevname[50] = ALSA_OUTDEV;
 
@@ -170,7 +169,7 @@
 	unsigned int rate = DESIRED_RATE;
 	snd_pcm_uframes_t start_threshold, stop_threshold;
 
-	err = snd_pcm_open(&handle, dev, stream, O_NONBLOCK);
+	err = snd_pcm_open(&handle, dev, stream, SND_PCM_NONBLOCK);
 	if (err < 0) {
 		ast_log(LOG_ERROR, "snd_pcm_open failed: %s\n", snd_strerror(err));
 		return NULL;

Modified: team/group/manager2/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/channels/chan_iax2.c?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/channels/chan_iax2.c (original)
+++ team/group/manager2/channels/chan_iax2.c Thu May 15 12:08:11 2008
@@ -3766,8 +3766,11 @@
 	struct timeval waittimer = {0, 0}, tv;
 
 	/* We currently do not support native bridging if a timeoutms value has been provided */
-	if (timeoutms)
+	if (timeoutms > 0) {
 		return AST_BRIDGE_FAILED;
+	}
+
+	timeoutms = 0;
 
 	lock_both(callno0, callno1);
 	if (!iaxs[callno0] || !iaxs[callno1]) {

Modified: team/group/manager2/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/channels/chan_local.c?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/channels/chan_local.c (original)
+++ team/group/manager2/channels/chan_local.c Thu May 15 12:08:11 2008
@@ -195,7 +195,8 @@
 	return bridged;
 }
 
-static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_frame *f, struct ast_channel *us)
+static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_frame *f, 
+	struct ast_channel *us, int us_locked)
 {
 	struct ast_channel *other = NULL;
 
@@ -219,11 +220,13 @@
 	/* Ensure that we have both channels locked */
 	while (other && ast_channel_trylock(other)) {
 		ast_mutex_unlock(&p->lock);
-		if (us)
+		if (us && us_locked) {
 			ast_channel_unlock(us);
+		}
 		usleep(1);
-		if (us)
+		if (us && us_locked) {
 			ast_channel_lock(us);
+		}
 		ast_mutex_lock(&p->lock);
 		other = isoutbound ? p->owner : p->chan;
 	}
@@ -252,7 +255,7 @@
 	if (isoutbound) {
 		/* Pass along answer since somebody answered us */
 		struct ast_frame answer = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
-		res = local_queue_frame(p, isoutbound, &answer, ast);
+		res = local_queue_frame(p, isoutbound, &answer, ast, 1);
 	} else
 		ast_log(LOG_WARNING, "Huh?  Local is being asked to answer?\n");
 	if (!res)
@@ -341,7 +344,7 @@
 	if (f && (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_VIDEO))
 		check_bridge(p, isoutbound);
 	if (!ast_test_flag(p, LOCAL_ALREADY_MASQED))
-		res = local_queue_frame(p, isoutbound, f, ast);
+		res = local_queue_frame(p, isoutbound, f, ast, 1);
 	else {
 		ast_debug(1, "Not posting to queue since already masked on '%s'\n", ast->name);
 		res = 0;
@@ -395,7 +398,7 @@
 		f.subclass = condition;
 		f.data = (void*)data;
 		f.datalen = datalen;
-		if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+		if (!(res = local_queue_frame(p, isoutbound, &f, ast, 1)))
 			ast_mutex_unlock(&p->lock);
 	}
 
@@ -415,7 +418,7 @@
 	ast_mutex_lock(&p->lock);
 	isoutbound = IS_OUTBOUND(ast, p);
 	f.subclass = digit;
-	if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+	if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0)))
 		ast_mutex_unlock(&p->lock);
 
 	return res;
@@ -435,7 +438,7 @@
 	isoutbound = IS_OUTBOUND(ast, p);
 	f.subclass = digit;
 	f.len = duration;
-	if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+	if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0)))
 		ast_mutex_unlock(&p->lock);
 
 	return res;
@@ -455,7 +458,7 @@
 	isoutbound = IS_OUTBOUND(ast, p);
 	f.data = (char *) text;
 	f.datalen = strlen(text) + 1;
-	if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+	if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0)))
 		ast_mutex_unlock(&p->lock);
 	return res;
 }
@@ -475,7 +478,7 @@
 	f.subclass = subclass;
 	f.data = (char *)data;
 	f.datalen = datalen;
-	if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+	if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0)))
 		ast_mutex_unlock(&p->lock);
 	return res;
 }
@@ -600,7 +603,7 @@
 		/* Need to actually hangup since there is no PBX */
 		ochan = p->chan;
 	else
-		res = local_queue_frame(p, isoutbound, &f, NULL);
+		res = local_queue_frame(p, isoutbound, &f, NULL, 1);
 	if (!res)
 		ast_mutex_unlock(&p->lock);
 	if (ochan)

Modified: team/group/manager2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/channels/chan_sip.c?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/channels/chan_sip.c (original)
+++ team/group/manager2/channels/chan_sip.c Thu May 15 12:08:11 2008
@@ -25,15 +25,21 @@
  * See Also:
  * \arg \ref AstCREDITS
  *
- * Implementation of RFC 3261 - without S/MIME, TCP and TLS support
+ * Implementation of RFC 3261 - without S/MIME, and experimental TCP and TLS support
  * Configuration file \link Config_sip sip.conf \endlink
  *
+ * ********** IMPORTANT *
+ * \note TCP/TLS support is EXPERIMENTAL and WILL CHANGE. This applies to configuration
+ *	settings, dialplan commands and dialplans apps/functions
+ * 
  *
+ * TODO:s
  * \todo Better support of forking
  * \todo VIA branch tag transaction checking
  * \todo Transaction support
  * \todo We need to test TCP sessions with SIP proxies and in regards
  *       to the SIP outbound specs.
+ * \todo Fix TCP/TLS handling in dialplan, SRV records, transfers and much more
  *
  * \ingroup channel_drivers
  *
@@ -1317,6 +1323,8 @@
 							(A bit unsure of this, please correct if
 							you know more) */
 	struct sip_st_dlg *stimer;		/*!< SIP Session-Timers */              
+  
+	int red; 
 };
 
 /*! Max entires in the history list for a sip_pvt */
@@ -2085,7 +2093,7 @@
 static int get_rpid_num(const char *input, char *output, int maxlen);
 static int get_rdnis(struct sip_pvt *p, struct sip_request *oreq);
 static int get_destination(struct sip_pvt *p, struct sip_request *oreq);
-static int get_msg_text(char *buf, int len, struct sip_request *req);
+static int get_msg_text(char *buf, int len, struct sip_request *req, int addnewline);
 static int transmit_state_notify(struct sip_pvt *p, int state, int full, int timeout);
 
 /*--- Constructing requests and responses */
@@ -5202,16 +5210,20 @@
 	case AST_FRAME_TEXT:
 		if (p) {
 			sip_pvt_lock(p);
-			if (p->trtp) {
-				/* Activate text early media */
-				if ((ast->_state != AST_STATE_UP) &&
-				    !ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) &&
-				    !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
-					transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE, FALSE);
-					ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);	
+			if (p->red) {
+				red_buffer_t140(p->trtp, frame);
+			} else {
+				if (p->trtp) {
+					/* Activate text early media */
+					if ((ast->_state != AST_STATE_UP) &&
+					    !ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) &&
+					    !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
+						transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE, FALSE);
+						ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);	
+					}
+					p->lastrtptx = time(NULL);
+					res = ast_rtp_write(p->trtp, frame);
 				}
-				p->lastrtptx = time(NULL);
-				res = ast_rtp_write(p->trtp, frame);
 			}
 			sip_pvt_unlock(p);
 		}
@@ -6228,9 +6240,9 @@
 			if (sip_pvt_trylock(p)) {
 				ao2_unlock(dialogs);
 				usleep(1);
-				ao2_lock(dialogs);
 				goto restartsearch;
 			}
+			ao2_unlock(dialogs);
 			return p;
 		}
 		ao2_unlock(dialogs);
@@ -6645,6 +6657,13 @@
 
 	char buf[SIPBUFSIZE];
 	int rua_version;
+	
+	int red_data_pt[10];
+	int red_num_gen = 0;
+	int red_pt = 0;
+
+	char *red_cp; 				/* For T.140 red */
+	char red_fmtp[100] = "empty";		/* For T.140 red */
 
 	if (!p->rtp) {
 		ast_log(LOG_ERROR, "Got SDP but have no RTP session allocated.\n");
@@ -6987,6 +7006,20 @@
 			memset(&found_rtpmap_codecs, 0, sizeof(found_rtpmap_codecs));
 			last_rtpmap_codec = 0;
 			continue;
+			
+		} else if (!strncmp(a, red_fmtp, strlen(red_fmtp))) {
+			/* count numbers of generations in fmtp */
+			red_cp = &red_fmtp[strlen(red_fmtp)];
+			strncpy(red_fmtp, a, 100);
+
+			sscanf(red_cp, "%u", &red_data_pt[red_num_gen]);
+			red_cp = strtok(red_cp, "/");
+			while (red_cp && red_num_gen++ < RED_MAX_GENERATION) {
+				sscanf(red_cp, "%u", &red_data_pt[red_num_gen]);
+				red_cp = strtok(NULL, "/");
+			}
+			red_cp = red_fmtp;
+
 		} else if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) == 2) {
 			/* We have a rtpmap to handle */
 
@@ -7008,6 +7041,15 @@
 					if (p->trtp) {
 						/* ast_verbose("Adding t140 mimeSubtype to textrtp struct\n"); */
 						ast_rtp_set_rtpmap_type(newtextrtp, codec, "text", mimeSubtype, 0);
+					}
+				} else if (!strncasecmp(mimeSubtype, "RED", 3)) { /* Text with Redudancy */
+					if (p->trtp) {
+						ast_rtp_set_rtpmap_type(newtextrtp, codec, "text", mimeSubtype, 0);
+						red_pt = codec;
+						sprintf(red_fmtp, "fmtp:%d ", red_pt); 
+
+						if (debug)
+							ast_verbose("Red submimetype has payload type: %d\n", red_pt);
 					}
 				} else {                                          /* Must be audio?? */
 					if(ast_rtp_set_rtpmap_type(newaudiortp, codec, "audio", mimeSubtype,
@@ -7185,6 +7227,13 @@
 	p->peercapability = newpeercapability;		        /* The other sides capability in latest offer */
 	p->jointnoncodeccapability = newnoncodeccapability;	/* DTMF capabilities */
 
+	if (p->jointcapability & AST_FORMAT_T140RED) {
+		p->red = 1; 
+		rtp_red_init(p->trtp, 300, red_data_pt, 2);
+	} else {
+		p->red = 0; 
+	}
+
 	ast_rtp_pt_copy(p->rtp, newaudiortp);
 	if (p->vrtp)
 		ast_rtp_pt_copy(p->vrtp, newvideortp);
@@ -7953,7 +8002,7 @@
 static int add_text(struct sip_request *req, const char *text)
 {
 	/* XXX Convert \n's to \r\n's XXX */
-	add_header(req, "Content-Type", "text/plain");
+	add_header(req, "Content-Type", "text/plain;charset=UTF-8");
 	add_header_contentLength(req, strlen(text));
 	add_line(req, text);
 	return 0;
@@ -8097,6 +8146,14 @@
 	ast_str_append(a_buf, 0, "a=rtpmap:%d %s/%d\r\n", rtp_code,
 			 ast_rtp_lookup_mime_subtype(1, codec, 0), sample_rate);
 	/* Add fmtp code here */
+
+	if (codec == AST_FORMAT_T140RED) {
+		ast_str_append(a_buf, 0, "a=fmtp:%d %d/%d/%d\r\n", rtp_code, 
+			 ast_rtp_lookup_code(p->trtp, 1, AST_FORMAT_T140),
+			 ast_rtp_lookup_code(p->trtp, 1, AST_FORMAT_T140),
+			 ast_rtp_lookup_code(p->trtp, 1, AST_FORMAT_T140));
+
+	}
 }
 
 
@@ -11940,7 +11997,7 @@
 }
 
 /*! \brief  Get text out of a SIP MESSAGE packet */
-static int get_msg_text(char *buf, int len, struct sip_request *req)
+static int get_msg_text(char *buf, int len, struct sip_request *req, int addnewline)
 {
 	int x;
 	int y;
@@ -11949,12 +12006,12 @@
 	y = len - strlen(buf) - 5;
 	if (y < 0)
 		y = 0;
-	for (x=0;x<req->lines;x++) {
+	for (x=0; x < req->lines; x++) {
 		strncat(buf, req->line[x], y); /* safe */
 		y -= strlen(req->line[x]) + 1;
 		if (y < 0)
 			y = 0;
-		if (y != 0)
+		if (y != 0 && addnewline)
 			strcat(buf, "\n"); /* safe */
 	}
 	return 0;
@@ -11966,18 +12023,18 @@
 	Reference: RFC 3428 */
 static void receive_message(struct sip_pvt *p, struct sip_request *req)
 {
-	char buf[1024];
+	char buf[1400];	
 	struct ast_frame f;
 	const char *content_type = get_header(req, "Content-Type");
 
-	if (strcmp(content_type, "text/plain")) { /* No text/plain attachment */
-		transmit_response(p, "415 Unsupported Media Type", req); 
+	if (strncmp(content_type, "text/plain", strlen("text/plain"))) { /* No text/plain attachment */
+		transmit_response(p, "415 Unsupported Media Type", req); /* Good enough, or? */
 		if (!p->owner)
 			sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 		return;
 	}
 
-	if (get_msg_text(buf, sizeof(buf), req)) {
+	if (get_msg_text(buf, sizeof(buf), req, FALSE)) {
 		ast_log(LOG_WARNING, "Unable to retrieve text from %s\n", p->callid);
 		transmit_response(p, "202 Accepted", req);
 		if (!p->owner)
@@ -11987,7 +12044,7 @@
 
 	if (p->owner) {
 		if (sip_debug_test_pvt(p))
-			ast_verbose("Message received: '%s'\n", buf);
+			ast_verbose("SIP Text message received: '%s'\n", buf);
 		memset(&f, 0, sizeof(f));
 		f.frametype = AST_FRAME_TEXT;
 		f.subclass = 0;
@@ -11996,11 +12053,13 @@
 		f.datalen = strlen(buf);
 		ast_queue_frame(p->owner, &f);
 		transmit_response(p, "202 Accepted", req); /* We respond 202 accepted, since we relay the message */
-	} else { /* Message outside of a call, we do not support that */
-		ast_log(LOG_WARNING, "Received message to %s from %s, dropped it...\n  Content-Type:%s\n  Message: %s\n", get_header(req, "To"), get_header(req, "From"), content_type, buf);
-		transmit_response(p, "405 Method Not Allowed", req);
-		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
-	}
+		return;
+	}
+
+	/* Message outside of a call, we do not support that */
+	ast_log(LOG_WARNING, "Received message to %s from %s, dropped it...\n  Content-Type:%s\n  Message: %s\n", get_header(req, "To"), get_header(req, "From"), content_type, buf);
+	transmit_response(p, "405 Method Not Allowed", req);
+	sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 	return;
 }
 
@@ -14595,7 +14654,7 @@
 			return;
 		}
 
-		get_msg_text(buf, sizeof(buf), req);
+		get_msg_text(buf, sizeof(buf), req, TRUE);
 		duration = 100; /* 100 ms */
 
 		if (ast_strlen_zero(buf)) {
@@ -16877,7 +16936,7 @@
 		}
 
 		/* Get the text of the attachment */
-		if (get_msg_text(buf, sizeof(buf), req)) {
+		if (get_msg_text(buf, sizeof(buf), req, TRUE)) {
 			ast_log(LOG_WARNING, "Unable to retrieve attachment from NOTIFY %s\n", p->callid);
 			transmit_response(p, "400 Bad request", req);
 			sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);

Modified: team/group/manager2/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/channels/chan_skinny.c?view=diff&rev=116630&r1=116629&r2=116630
==============================================================================
--- team/group/manager2/channels/chan_skinny.c (original)
+++ team/group/manager2/channels/chan_skinny.c Thu May 15 12:08:11 2008
@@ -67,6 +67,7 @@
 #include "asterisk/abstract_jb.h"
 #include "asterisk/threadstorage.h"
 #include "asterisk/devicestate.h"
+#include "asterisk/event.h"
 

[... 2763 lines stripped ...]



More information about the asterisk-commits mailing list