[asterisk-commits] murf: branch murf/macrogosub r41750 - in /team/murf/macrogosub: ./ apps/ chan...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Sep 1 12:28:33 MST 2006


Author: murf
Date: Fri Sep  1 14:28:32 2006
New Revision: 41750

URL: http://svn.digium.com/view/asterisk?rev=41750&view=rev
Log:
Merged revisions 41689,41692-41696,41715,41717-41718,41735 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r41689 | file | 2006-09-01 10:19:03 -0600 (Fri, 01 Sep 2006) | 2 lines

If no number is specified in the SIP_HEADER dialplan function, then just use the first one. (issue #7854 reported by sxpert and issue #7863 reported by hristo)

................
r41692 | murf | 2006-09-01 10:33:22 -0600 (Fri, 01 Sep 2006) | 3 lines

PCadach wanted better formatting of those 'if' conditions for 7859.


................
r41693 | file | 2006-09-01 10:34:57 -0600 (Fri, 01 Sep 2006) | 10 lines

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

........
r41690 | file | 2006-09-01 12:28:08 -0400 (Fri, 01 Sep 2006) | 2 lines

Don't treat an unexpected control subclass as voice (issue #7858 reported by PCadach)

........

................
r41694 | file | 2006-09-01 10:40:18 -0600 (Fri, 01 Sep 2006) | 2 lines

0 is indeed considered a valid file descriptor (issue #7861 reported by PCadach)

................
r41695 | murf | 2006-09-01 10:48:06 -0600 (Fri, 01 Sep 2006) | 3 lines

Another formatting update for PCadach.


................
r41696 | file | 2006-09-01 10:50:02 -0600 (Fri, 01 Sep 2006) | 2 lines

You see nothing...

................
r41715 | mogorman | 2006-09-01 11:20:48 -0600 (Fri, 01 Sep 2006) | 2 lines

whitespace clean up

................
r41717 | kpfleming | 2006-09-01 11:41:52 -0600 (Fri, 01 Sep 2006) | 2 lines

block this rev... fix is already present in this branch

................
r41718 | file | 2006-09-01 11:54:22 -0600 (Fri, 01 Sep 2006) | 2 lines

If we are doing video and we can't reinvite, then resort to generic bridging instead of Packet2Packet since video isn't supported there yet. (reported by PCadach in #asterisk-bugs)

................
r41735 | file | 2006-09-01 12:57:10 -0600 (Fri, 01 Sep 2006) | 2 lines

Unbridge the RTP streams at the correct place

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

Modified:
    team/murf/macrogosub/   (props changed)
    team/murf/macrogosub/apps/app_voicemail.c
    team/murf/macrogosub/channels/chan_sip.c
    team/murf/macrogosub/main/channel.c
    team/murf/macrogosub/main/file.c
    team/murf/macrogosub/main/pbx.c
    team/murf/macrogosub/main/rtp.c

Propchange: team/murf/macrogosub/
------------------------------------------------------------------------------
    automerge = yes

Propchange: team/murf/macrogosub/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/murf/macrogosub/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/murf/macrogosub/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Sep  1 14:28:32 2006
@@ -1,1 +1,1 @@
-/trunk:1-41681
+/trunk:1-41748

Modified: team/murf/macrogosub/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/macrogosub/apps/app_voicemail.c?rev=41750&r1=41749&r2=41750&view=diff
==============================================================================
--- team/murf/macrogosub/apps/app_voicemail.c (original)
+++ team/murf/macrogosub/apps/app_voicemail.c Fri Sep  1 14:28:32 2006
@@ -89,8 +89,8 @@
 #endif
 
 #ifdef IMAP_STORAGE
-char *curhst = NIL;           /* currently connected host */
-char *curusr = NIL;           /* current login user */
+char *curhst = NIL;/* currently connected host */
+char *curusr = NIL;/* current login user */
 
 char temp[1024];
 
@@ -126,8 +126,8 @@
 /* should define TMP in config file... */
 #define TMP "/tmp"
 struct vmstate {
-      struct vm_state *vms;
-      struct vmstate *next;
+	struct vm_state *vms;
+	struct vmstate *next;
 };
 AST_MUTEX_DEFINE_STATIC(vmstate_lock);
 static struct vmstate *vmstates = NULL;
@@ -309,7 +309,7 @@
 	int saydurationm;
 	int maxmsg;                      /*!< Maximum number of msgs per folder for this mailbox */
 #ifdef IMAP_STORAGE
-		char imapuser[80];	/* IMAP server login */
+	char imapuser[80];	/* IMAP server login */
 #endif
 	double volgain;		/*!< Volume gain for voicemails sent via email */
 	AST_LIST_ENTRY(ast_vm_user) list;
@@ -910,8 +910,8 @@
 	}
 	ast_log(LOG_DEBUG, "deleting msgnum %d, which is mailbox message %lu\n",msgnum,messageNum);
 	/* delete message */
-        sprintf (arg,"%lu",messageNum);
-        mail_setflag (vms->mailstream,arg,"\\DELETED");
+	sprintf (arg,"%lu",messageNum);
+	mail_setflag (vms->mailstream,arg,"\\DELETED");
 }
 
 #endif
@@ -1992,14 +1992,13 @@
 			/* only attach if necessary */
 			ast_log(LOG_DEBUG, "Before second attachment with format set to:%s\n",format);
 			if (strcmp(format, "gsm")) {
-			   fprintf(p, "--%s\n", bound);
-			   fprintf(p, "Content-Type: audio/x-gsm; name=\"msg%04d.%s\"\n", msgnum, format);
-			   fprintf(p, "Content-Transfer-Encoding: base64\n");
-			   fprintf(p, "Content-Description: Voicemail sound attachment.\n");
-			   fprintf(p, "Content-Disposition: attachment; filename=\"msg%04d.gsm\"\n\n", msgnum);
-
-			   snprintf(fname, sizeof(fname), "%s.gsm", attach);
-			   base_encode(fname, p);
+				fprintf(p, "--%s\n", bound);
+				fprintf(p, "Content-Type: audio/x-gsm; name=\"msg%04d.%s\"\n", msgnum, format);
+				fprintf(p, "Content-Transfer-Encoding: base64\n");
+				fprintf(p, "Content-Description: Voicemail sound attachment.\n");
+				fprintf(p, "Content-Disposition: attachment; filename=\"msg%04d.gsm\"\n\n", msgnum);
+				snprintf(fname, sizeof(fname), "%s.gsm", attach);
+				base_encode(fname, p);
 			}
 #endif
 			fprintf(p, "\n\n--%s--\n.\n", bound);
@@ -2151,13 +2150,13 @@
 	static const char *msgs[] = {
 		"INBOX",
 		"Old",
-		"Work",   
+		"Work",
 		"Family",
 		"Friends",
 		"Cust1",
 		"Cust2",
 		"Cust3",
-		"Cust4",  
+		"Cust4",
 		"Cust5",
 	};
 	return (id >= 0 && id < (sizeof(msgs)/sizeof(msgs[0]))) ? msgs[id] : "Unknown";
@@ -2187,10 +2186,10 @@
 	ast_copy_string(tmp, mailbox, sizeof(tmp));
 	
 	context = strchr(tmp, '@');
-	if (context) {   
+	if (context) {
 		*context = '\0';
 		context++;
-	} else  
+	} else
 		context = "default";
 	
 	obj = odbc_request_obj(odbc_database, 0);
@@ -2302,7 +2301,7 @@
 		}
 		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir = '%s%s/%s/%s'", odbc_table, VM_SPOOL_DIR, context, mailbox, folder);
 		res = SQLPrepare(stmt, sql, SQL_NTS);
-		if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {  
+		if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
 			ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
 			SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 			goto yuck;
@@ -2355,8 +2354,8 @@
 #ifdef IMAP_STORAGE
 static int count_messages_imap(const char *mailbox, int *newmsgs, int *oldmsgs)
 {
-   	SEARCHPGM *pgm;
-   	SEARCHHEADER *hdr;
+	SEARCHPGM *pgm;
+	SEARCHHEADER *hdr;
  
  	struct ast_vm_user *vmu;
  	struct vm_state *vms_p;
@@ -2406,15 +2405,15 @@
  	}
  
  	/* We have to get the user before we can open the stream! */
-   	/*ast_log (LOG_DEBUG,"Before find_user, context is %s and mailbox is %s\n",context,mailbox); */
+ 	/*ast_log (LOG_DEBUG,"Before find_user, context is %s and mailbox is %s\n",context,mailbox); */
  	vmu = find_user(NULL, context, mailboxnc);
  	if (vmu == NULL) {
-   		ast_log (LOG_ERROR,"Couldn't find mailbox %s in context %s\n",mailboxnc,context);
+		ast_log (LOG_ERROR,"Couldn't find mailbox %s in context %s\n",mailboxnc,context);
  		return -1;
  	} else {
  		/* No IMAP account available */
  		if (vmu->imapuser[0] == '\0') {
-   			ast_log (LOG_WARNING,"IMAP user not set for mailbox %s\n",vmu->mailbox);
+			ast_log (LOG_WARNING,"IMAP user not set for mailbox %s\n",vmu->mailbox);
  			return -1;
  		}
  	}
@@ -2425,7 +2424,7 @@
  		vms_p = get_vm_state_by_mailbox(mailboxnc,1);
  	}
  	if (vms_p != NULL) {
-   		ast_log (LOG_DEBUG,"Returning before search - user is logged in\n");
+		ast_log (LOG_DEBUG,"Returning before search - user is logged in\n");
  		*newmsgs = vms_p->newmessages;
  		*oldmsgs = vms_p->oldmessages;
  		return 0;
@@ -2438,12 +2437,12 @@
  	}
  
  	if (vms_p == NULL) {
-   		ast_log (LOG_DEBUG,"Adding new vmstate for %s\n",vmu->imapuser);
+		ast_log (LOG_DEBUG,"Adding new vmstate for %s\n",vmu->imapuser);
  		vms_p = (struct vm_state *)malloc(sizeof(struct vm_state));
  		strcpy(vms_p->imapuser,vmu->imapuser);
  		strcpy(vms_p->username,mailboxnc); /* save for access from interactive entry point */
  		vms_p->mailstream = NIL; /* save for access from interactive entry point */
-   		ast_log (LOG_DEBUG,"Copied %s to %s\n",vmu->imapuser,vms_p->imapuser);
+		ast_log (LOG_DEBUG,"Copied %s to %s\n",vmu->imapuser,vms_p->imapuser);
  		vms_p->updated = 1;
  		vms_p->interactive = 0;
  		/* set mailbox to INBOX! */
@@ -2454,13 +2453,13 @@
  	if (vms_p->mailstream == NULL)
  		ret = init_mailstream(vms_p);
  	if (vms_p->mailstream == NULL) {
-   		ast_log (LOG_ERROR,"Houston we have a problem - IMAP mailstream is NULL\n");
+		ast_log (LOG_ERROR,"Houston we have a problem - IMAP mailstream is NULL\n");
  		return -1;
  	}
  	if (newmsgs && ret==0 && vms_p->updated==1 ) {
-   		pgm = mail_newsearchpgm ();
-   		hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", (char *)mailboxnc);
-   		pgm->header = hdr;
+		pgm = mail_newsearchpgm ();
+		hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", (char *)mailboxnc);
+		pgm->header = hdr;
  		pgm->unseen = 1;
  		pgm->seen = 0;
  		pgm->undeleted = 1;
@@ -2468,17 +2467,17 @@
  
  		vms_p->vmArrayIndex = 0;
  	
-   		ast_log (LOG_DEBUG,"Before search of mailbox %s for NEW messages\n",vms_p->mailstream->mailbox);
-   		mail_search_full (vms_p->mailstream, NULL, pgm, NIL);
-   		ast_log (LOG_DEBUG,"After search\n");
+		ast_log (LOG_DEBUG,"Before search of mailbox %s for NEW messages\n",vms_p->mailstream->mailbox);
+		mail_search_full (vms_p->mailstream, NULL, pgm, NIL);
+		ast_log (LOG_DEBUG,"After search\n");
  		*newmsgs = vms_p->vmArrayIndex;
  		vms_p->newmessages = vms_p->vmArrayIndex;
-   		ast_log (LOG_DEBUG,"There are %d NEW messages\n",vms_p->newmessages);
+		ast_log (LOG_DEBUG,"There are %d NEW messages\n",vms_p->newmessages);
  	}
  	if (oldmsgs && ret==0 && vms_p->updated==1 ) {
-   		pgm = mail_newsearchpgm ();
-   		hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", (char *)mailboxnc);
-   		pgm->header = hdr;
+		pgm = mail_newsearchpgm ();
+		hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", (char *)mailboxnc);
+		pgm->header = hdr;
  		pgm->unseen = 0;
  		pgm->seen = 1;
  		pgm->deleted = 0;
@@ -2486,18 +2485,18 @@
  
  		vms_p->vmArrayIndex = 0;
  	
-   		ast_log (LOG_DEBUG,"Before search of mailbox %s for OLD messages\n",vms_p->mailstream->mailbox);
-   		mail_search_full (vms_p->mailstream, NULL, pgm, NIL);
+		ast_log (LOG_DEBUG,"Before search of mailbox %s for OLD messages\n",vms_p->mailstream->mailbox);
+		mail_search_full (vms_p->mailstream, NULL, pgm, NIL);
  		*oldmsgs = vms_p->vmArrayIndex;
  		vms_p->oldmessages = vms_p->vmArrayIndex;
-   		ast_log (LOG_DEBUG,"There are %d OLD messages\n",vms_p->oldmessages);
+		ast_log (LOG_DEBUG,"There are %d OLD messages\n",vms_p->oldmessages);
  	}
  	if (vms_p->updated == 1) {  /* changes, so we did the searches above */
  		vms_p->updated = 0;
  	} else if (vms_p->updated > 1) {  /* decrement delay count */
  		vms_p->updated--;
  	} else {  /* no changes, so don't search */
-   		ast_log (LOG_DEBUG,"Calling mail_ping on mailbox %s\n",vms_p->mailstream->mailbox);
+		ast_log (LOG_DEBUG,"Calling mail_ping on mailbox %s\n",vms_p->mailstream->mailbox);
  		mail_ping(vms_p->mailstream);
  		/* Keep the old data */
  		*newmsgs = vms_p->newmessages;
@@ -2518,7 +2517,7 @@
 	ast_log(LOG_NOTICE, "Copying message from %s@%s to %s@%s\n", vmu->mailbox, vmu->context, recip->mailbox, recip->context);
 
 	create_dirpath(todir, sizeof(todir), recip->context, recip->mailbox, "INBOX");
-  
+
 	make_dir(fromdir, sizeof(fromdir), vmu->context, vmu->mailbox, frombox);
 	make_file(frompath, sizeof(frompath), fromdir, msgnum);
 
@@ -2701,7 +2700,7 @@
 	char callerid[256];
 	FILE *txt;
 	char date[256];
-	int  txtdes;
+	int txtdes;
 #endif
 	int res = 0;
 	int msgnum;
@@ -2783,11 +2782,11 @@
 
 	if (!ast_strlen_zero(vmu->exit)) {
 		if (ast_exists_extension(chan, vmu->exit, "a", 1, chan->cid.cid_num))
-			strncat(ecodes, "*", sizeof(ecodes) -  strlen(ecodes) - 1);
+			strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
 	} else if (ast_exists_extension(chan, chan->context, "a", 1, chan->cid.cid_num))
-		strncat(ecodes, "*", sizeof(ecodes) -  strlen(ecodes) - 1);
+		strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
 	else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "a", 1, chan->cid.cid_num)) {
-		strncat(ecodes, "*", sizeof(ecodes) -  strlen(ecodes) - 1);
+		strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
 		ausemacro = 1;
 	}
 
@@ -2824,7 +2823,7 @@
 	if (res > 0)
 		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 */
+	 other than the operator -- an automated attendant or mailbox login for example */
 	if (res == '*') {
 		chan->exten[0] = 'a';
 		chan->exten[1] = '\0';
@@ -3945,7 +3944,7 @@
  				}
  
  				/* This will only work for new messages... */
-   				header_content = mail_fetchheader (vms->mailstream, vms->msgArray[vms->curmsg]);
+				header_content = mail_fetchheader (vms->mailstream, vms->msgArray[vms->curmsg]);
  				/* empty string means no valid header */
  				if (header_content == "" || header_content == NULL) {
  					ast_log (LOG_ERROR,"Could not fetch header for message number %ld\n",vms->msgArray[vms->curmsg]);
@@ -3971,17 +3970,17 @@
  					fmt = "WAV";
  				
  				ast_log (LOG_DEBUG,"**** format set to %s, vmfmts set to %s\n",fmt,vmfmts);
- 	        		/* ast_copy_string(fmt, vmfmts, sizeof(fmt));*/
+ 				/* ast_copy_string(fmt, vmfmts, sizeof(fmt));*/
  				/* if (!ast_strlen_zero(fmt)) { */
  
  				make_gsm_file(vms->fn, vms->imapuser, TMP, vms->curmsg);
  
  				ast_log (LOG_DEBUG,"Before mail_fetchstructure, message number is %ld, filename is:%s\n",vms->msgArray[vms->curmsg], vms->fn);
-   				/*mail_fetchstructure (mailstream, vmArray[0], &body); */
-   				mail_fetchstructure (vms->mailstream, vms->msgArray[vms->curmsg], &body);
-   				save_body(body,vms,"3","gsm");
+				/*mail_fetchstructure (mailstream, vmArray[0], &body); */
+				mail_fetchstructure (vms->mailstream, vms->msgArray[vms->curmsg], &body);
+				save_body(body,vms,"3","gsm");
  				/* should not assume "fmt" here! */
-   				save_body(body,vms,"2",fmt);
+				save_body(body,vms,"2",fmt);
  
  				char *myserveremail = serveremail;
  				if (!ast_strlen_zero(vmtmp->serveremail))
@@ -3997,7 +3996,7 @@
 				/* if (ast_play_and_wait(chan, "vm-savedto"))
 					break;
 				*/
-				snprintf(todir, sizeof(todir), "%s%s/%s/INBOX",  VM_SPOOL_DIR, vmtmp->context, vmtmp->mailbox);
+				snprintf(todir, sizeof(todir), "%s%s/%s/INBOX", VM_SPOOL_DIR, vmtmp->context, vmtmp->mailbox);
 				snprintf(sys, sizeof(sys), "mkdir -p %s\n", todir);
 				snprintf(ext_context, sizeof(ext_context), "%s@%s", vmtmp->mailbox, vmtmp->context);
 				ast_log(LOG_DEBUG, "%s", sys);
@@ -4300,7 +4299,7 @@
 #ifdef IMAP_STORAGE
 static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms)
 {
-  	BODY *body;
+	BODY *body;
 	char *header_content;
 	char cid[256];
 	char context[256];
@@ -4320,7 +4319,7 @@
 	}
 
 	/* This will only work for new messages... */
-  	header_content = mail_fetchheader (vms->mailstream, vms->msgArray[vms->curmsg]);
+	header_content = mail_fetchheader (vms->mailstream, vms->msgArray[vms->curmsg]);
 	/* empty string means no valid header */
 	if (header_content == "" || header_content == NULL) {
 		ast_log (LOG_ERROR,"Could not fetch header for message number %ld\n",vms->msgArray[vms->curmsg]);
@@ -4331,8 +4330,8 @@
 
 	ast_log (LOG_DEBUG,"Before mail_fetchstructure, message number is %ld, filename is:%s\n",vms->msgArray[vms->curmsg], vms->fn);
 
-  	mail_fetchstructure (vms->mailstream,vms->msgArray[vms->curmsg],&body);
-  	save_body(body,vms,"3","gsm");
+	mail_fetchstructure (vms->mailstream,vms->msgArray[vms->curmsg],&body);
+	save_body(body,vms,"3","gsm");
 
 	adsi_message(chan, vms);
 	if (!vms->curmsg)
@@ -4349,20 +4348,44 @@
 
 	/* Get info from headers!!  */
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:");
-	if (temp != NULL) strcpy(cid,temp); else cid[0] = '\0';
-  	ast_log (LOG_DEBUG,"Caller id was set to: %s\n",cid);
+
+	if (temp != NULL)
+		strcpy(cid,temp); 
+	else 
+		cid[0] = '\0';
+
+	ast_log (LOG_DEBUG,"Caller id was set to: %s\n",cid);
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Context:");
-	if (temp != NULL) strcpy(context,temp); else context[0] = '\0';
-  	ast_log (LOG_DEBUG,"Context was set to: %s\n",context);
+
+	if (temp != NULL)
+		strcpy(context,temp); 
+	else
+		context[0] = '\0';
+
+	ast_log (LOG_DEBUG,"Context was set to: %s\n",context);
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Orig-time:");
-	if (temp != NULL) strcpy(origtime,temp); else origtime[0] = '\0';
-  	ast_log (LOG_DEBUG,"Orig time was set to: %s\n",origtime);
+
+	if (temp != NULL)
+		strcpy(origtime,temp);
+	else
+		origtime[0] = '\0';
+
+	ast_log (LOG_DEBUG,"Orig time was set to: %s\n",origtime);
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Duration:");
-	if (temp != NULL) strcpy(duration,temp); else duration[0] = '\0';
-  	ast_log (LOG_DEBUG,"Duration was set to: %s\n",duration);
+
+	if (temp != NULL)
+		strcpy(duration,temp);
+	else
+		duration[0] = '\0';
+	
+	ast_log (LOG_DEBUG,"Duration was set to: %s\n",duration);
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Category:");
-	if (temp != NULL) strcpy(category,temp); else category[0] = '\0';
-  	ast_log (LOG_DEBUG,"Category was set to: %s\n",category);
+	
+	if (temp != NULL)
+		strcpy(category,temp);
+	else
+		category[0] = '\0';
+	ast_log (LOG_DEBUG,"Category was set to: %s\n",category);
 
 	/*if (!strncasecmp("macro",context,5))  Macro names in contexts are useless for our needs */
 	/*	context = ast_variable_retrieve(msg_cfg, "message","macrocontext"); */
@@ -4384,8 +4407,8 @@
 		res = play_message_callerid(chan, vms, cid, context, 0);
 	ast_log (LOG_DEBUG,"callerid, res is %d\n",res);
 
-        if ((!res) && (ast_test_flag(vmu, VM_SAYDURATION)) && duration[0] != '\0')
-                res = play_message_duration(chan, vms, duration, vmu->saydurationm);
+	if ((!res) && (ast_test_flag(vmu, VM_SAYDURATION)) && duration[0] != '\0')
+		res = play_message_duration(chan, vms, duration, vmu->saydurationm);
 	ast_log (LOG_DEBUG,"duration, res is %d\n",res);
 
 	/* Allow pressing '1' to skip envelope / callerid */
@@ -4508,8 +4531,8 @@
 #ifdef IMAP_STORAGE
 static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box)
 {
-  	SEARCHPGM *pgm;
-  	SEARCHHEADER *hdr;
+	SEARCHPGM *pgm;
+	SEARCHHEADER *hdr;
 	int ret;
 
 	strcpy(vms->imapuser,vmu->imapuser);
@@ -4535,24 +4558,24 @@
 	}
 	*/
 
-  	ast_log(LOG_DEBUG,"Before init_mailstream, user is %s\n",vmu->imapuser);
+	ast_log(LOG_DEBUG,"Before init_mailstream, user is %s\n",vmu->imapuser);
 	ret = init_mailstream(vms);
 	if (ret != 0) {
-  		ast_log (LOG_ERROR,"Could not initialize mailstream\n");
+		ast_log (LOG_ERROR,"Could not initialize mailstream\n");
 		return -1;
 	}
 
 	/* Check Quota (here for now to test) */
-  	ast_log(LOG_DEBUG,"Checking QUOTA...\n");
+	ast_log(LOG_DEBUG,"Checking QUOTA...\n");
 	mail_parameters(NULL, SET_QUOTA, (void *) mm_parsequota);
 	imap_getquotaroot(vms->mailstream,"INBOX");
 
-  	pgm = mail_newsearchpgm();
+	pgm = mail_newsearchpgm();
 
 	/* Check IMAP folder for Asterisk messages only... */
-  	ast_log(LOG_DEBUG,"setting search criteria - mailbox set to %s\n",vmu->mailbox);
-  	hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", vmu->mailbox);
-  	pgm->header = hdr;
+	ast_log(LOG_DEBUG,"setting search criteria - mailbox set to %s\n",vmu->mailbox);
+	hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", vmu->mailbox);
+	pgm->header = hdr;
 	pgm->deleted = 0;
 	pgm->undeleted = 1;
 
@@ -4567,8 +4590,8 @@
 
 	vms->vmArrayIndex = 0;
 
-  	ast_log(LOG_DEBUG,"Before mail_search_full, user is %s\n",vmu->imapuser);
-  	mail_search_full (vms->mailstream, NULL, pgm, NIL);
+	ast_log(LOG_DEBUG,"Before mail_search_full, user is %s\n",vmu->imapuser);
+	mail_search_full (vms->mailstream, NULL, pgm, NIL);
 
 
 	vms->lastmsg = vms->vmArrayIndex - 1;
@@ -4644,7 +4667,7 @@
 			} 
 		} else if (!strcasecmp(vms->curbox, "INBOX") && vms->heard[x] && !vms->deleted[x]) { 
 			/* Move to old folder before deleting */ 
-	        res = save_to_folder(vmu, vms, x, 1);
+			res = save_to_folder(vmu, vms, x, 1);
 			if (res == ERROR_LOCK_PATH) {
 				/* If save failed do not delete the message */
 				vms->deleted[x] = 0;
@@ -4664,10 +4687,10 @@
 	ast_unlock_path(vms->curdir);
 #else
 	for (x=0;x < vmu->maxmsg;x++) { 
-	    if (vms->deleted[x]) { 
-	    	ast_log(LOG_DEBUG,"IMAP delete of %d\n",x);
-		IMAP_DELETE(vms->curdir, x, vms->fn, vms);
-	    }
+		if (vms->deleted[x]) { 
+			ast_log(LOG_DEBUG,"IMAP delete of %d\n",x);
+			IMAP_DELETE(vms->curdir, x, vms->fn, vms);
+		}
 	}
 #endif
 
@@ -6357,7 +6380,7 @@
 	
 		case '8':
 			if (vms.lastmsg > -1) {
-			    cmd = forward_message(chan, context, &vms, vmu, vmfmts, 0, record_gain);
+				cmd = forward_message(chan, context, &vms, vmu, vmfmts, 0, record_gain);
 				if (cmd == ERROR_LOCK_PATH) {
 					res = cmd;
 					goto out;
@@ -6375,13 +6398,13 @@
 				break;
 			} else if (cmd > 0) {
 				box = cmd = cmd - '0';
-		        	cmd = save_to_folder(vmu, &vms, vms.curmsg, cmd);
+				cmd = save_to_folder(vmu, &vms, vms.curmsg, cmd);
 				if (cmd == ERROR_LOCK_PATH) {
 					res = cmd;
 					goto out;
 #ifdef IMAP_STORAGE
 				} else if (cmd == 10) {
-				    goto out;
+					goto out;
 #endif
 				} else if (!cmd) {
 					vms.deleted[vms.curmsg] = 1;
@@ -6471,7 +6494,7 @@
 	ast_log(LOG_DEBUG, "*** Checking if we can expunge, deleted set to %d, expungeonhangup set to %d\n",deleted,expungeonhangup);
 	if (vmu && deleted == 1 && expungeonhangup == 1)  {
 #ifdef HAVE_IMAP_TK2006
-	      	if (LEVELUIDPLUS (vms.mailstream)) {
+		if (LEVELUIDPLUS (vms.mailstream)) {
 			ast_log(LOG_DEBUG, "*** About to expunge messages using UID\n");
 			mail_expunge_full(vms.mailstream,NIL,EX_UID);
 		} else 
@@ -6482,7 +6505,7 @@
 		}
 	}
 	/*  before we delete the state, we should copy pertainent info
-            back to the persistent model */
+	 *  back to the persistent model */
 	vmstate_delete(&vms);
 #endif
 	if (vmu)
@@ -7463,7 +7486,7 @@
 	}
 
 	/* This will only work for new messages... */
-  	header_content = mail_fetchheader (vms->mailstream, vms->msgArray[vms->curmsg]);
+	header_content = mail_fetchheader (vms->mailstream, vms->msgArray[vms->curmsg]);
 	/* empty string means no valid header */
 	if (header_content == "" || header_content == NULL) {
 		ast_log (LOG_ERROR,"Could not fetch header for message number %ld\n",vms->msgArray[vms->curmsg]);
@@ -7472,17 +7495,32 @@
 
 	/* Get info from headers!!  */
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:");
-	if (temp != NULL) strcpy(cidS,temp); else cidS[0] = '\0';
+	
+	if (temp != NULL)
+		strcpy(cidS,temp);
+	else
+		cidS[0] = '\0';
+	
 	cid = &cidS[0];
-  	ast_log (LOG_DEBUG,"Caller id was set to: %s\n",cid);
+	ast_log (LOG_DEBUG,"Caller id was set to: %s\n",cid);
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Context:");
-	if (temp != NULL) strcpy(contextS,temp); else contextS[0] = '\0';
+	
+	if (temp != NULL)
+		strcpy(contextS,temp);
+	else
+		contextS[0] = '\0';
+	
 	context = &contextS[0];
-  	ast_log (LOG_DEBUG,"Context was set to: %s\n",context);
+	ast_log (LOG_DEBUG,"Context was set to: %s\n",context);
 	temp = get_header_by_tag(header_content, "X-Asterisk-VM-Orig-time:");
-	if (temp != NULL) strcpy(origtimeS,temp); else origtimeS[0] = '\0';
+	
+	if (temp != NULL)
+		strcpy(origtimeS,temp);
+	else
+		origtimeS[0] = '\0';
+	
 	origtime = &origtimeS[0];
-  	ast_log (LOG_DEBUG,"Orig time was set to: %s\n",origtime);
+	ast_log (LOG_DEBUG,"Orig time was set to: %s\n",origtime);
 
 	filename = "IMAP_STORAGE";
 #else
@@ -7845,7 +7883,7 @@
 			}
 		}
 	}
-	if (outsidecaller)  
+	if (outsidecaller)
 		ast_play_and_wait(chan, "vm-goodbye");
 	if (cmd == 't')
 		cmd = 0;
@@ -8131,26 +8169,26 @@
 
 void mm_list (MAILSTREAM * stream, int delim, char *mailbox, long attributes)
 {
-	  ast_log (LOG_NOTICE,"****** Entering callback\n");
-	  putchar (' ');
-	  if (delimiter) {
-		  putchar (delimiter);
-		  delimiter = delim;
-		  ast_log (LOG_NOTICE,"Delimiter set to %c\n",delim);
-	  } else {
-		  fputs ("NIL", stdout);
-	  }
-	  putchar (' ');
-	  fputs (mailbox, stdout);
-	  if (attributes & LATT_NOINFERIORS)
-		  fputs (", no inferiors", stdout);
-	  if (attributes & LATT_NOSELECT)
-		  fputs (", no select", stdout);
-	  if (attributes & LATT_MARKED)
-		  fputs (", marked", stdout);
-	  if (attributes & LATT_UNMARKED)
-		  fputs (", unmarked", stdout);
-	  putchar ('\n');
+	ast_log (LOG_NOTICE,"****** Entering callback\n");
+	putchar (' ');
+	if (delimiter) {
+		putchar (delimiter);
+		delimiter = delim;
+		ast_log (LOG_NOTICE,"Delimiter set to %c\n",delim);
+	} else {
+		fputs ("NIL", stdout);
+	}
+	putchar (' ');
+	fputs (mailbox, stdout);
+	if (attributes & LATT_NOINFERIORS)
+		fputs (", no inferiors", stdout);
+	if (attributes & LATT_NOSELECT)
+		fputs (", no select", stdout);
+	if (attributes & LATT_MARKED)
+		fputs (", marked", stdout);
+	if (attributes & LATT_UNMARKED)
+		fputs (", unmarked", stdout);
+	putchar ('\n');
 }
 
 
@@ -8342,32 +8380,32 @@
 }
 
 static struct vm_state * get_vm_state_by_imapuser(char *user, int interactive)
-{ 
-        struct vmstate *vlist = NULL;
-
-        vlist = vmstates;
+{
+	struct vmstate *vlist = NULL;
+
+	vlist = vmstates;
 	/* ast_log(LOG_DEBUG, "user set to:%s\n",user); */
-        while (vlist) {
-                if (vlist->vms != NULL) {
-                    if (vlist->vms->imapuser != NULL) {
-			/* ast_log(LOG_DEBUG, "	comparing user %s to vmstate user %s\n",user,vlist->vms->imapuser); */
-			if (strcmp(vlist->vms->imapuser,user) == 0) {
-				if (interactive == 2) {
-					/* ast_log(LOG_DEBUG, "Interactive set to ANY, current is: %d\n",vlist->vms->interactive); */
-                        		return vlist->vms;
-				} else if (vlist->vms->interactive == interactive) {
-					/* ast_log(LOG_DEBUG, "	Found it!\n"); */
-                        		return vlist->vms;
+	while (vlist) {
+		if (vlist->vms != NULL) {
+			if (vlist->vms->imapuser != NULL) {
+				/* ast_log(LOG_DEBUG, "	comparing user %s to vmstate user %s\n",user,vlist->vms->imapuser); */
+				if (strcmp(vlist->vms->imapuser,user) == 0) {
+					if (interactive == 2) {
+						/* ast_log(LOG_DEBUG, "Interactive set to ANY, current is: %d\n",vlist->vms->interactive); */
+						return vlist->vms;
+					} else if (vlist->vms->interactive == interactive) {
+						/* ast_log(LOG_DEBUG, "	Found it!\n"); */
+						return vlist->vms;
+					}
 				}
-			}
-                    } else {
-			ast_log(LOG_DEBUG, "	error: imapuser is NULL for %s\n",user);
-		    }
-                } else {
+			} else {
+				ast_log(LOG_DEBUG, "	error: imapuser is NULL for %s\n",user);
+			}
+		} else {
 			ast_log(LOG_DEBUG, "	error: vms is NULL for %s\n",user);
 		}
-                vlist = vlist->next;
-        }
+		vlist = vlist->next;
+	}
 	ast_log(LOG_DEBUG, "%s not found in vmstates\n",user);
 	return NULL;
 }
@@ -8484,19 +8522,18 @@
 
 static void set_update(MAILSTREAM * stream) 
 {
-  	struct vm_state *vms;
+	struct vm_state *vms;
 	char *mailbox;
 	char *user;
 
 	mailbox = stream->mailbox;
 	user = get_user_by_mailbox(mailbox);
-  
 	vms = get_vm_state_by_imapuser(user, 0);
 	if (vms != NULL) {
-  		ast_log (LOG_DEBUG, "User %s mailbox set for update.\n",user);
+		ast_log (LOG_DEBUG, "User %s mailbox set for update.\n",user);
 		vms->updated = 2; /* set updated flag since mailbox changed */
 	} else {
-  		ast_log (LOG_WARNING, "User %s mailbox not found for update.\n",user);
+		ast_log (LOG_WARNING, "User %s mailbox not found for update.\n",user);
 	}
 }
 
@@ -8512,13 +8549,13 @@
 static void check_msgArray(struct vm_state *vms) 
 {
 	int x;
-  	ast_log (LOG_DEBUG, "Checking array\n");
+	ast_log (LOG_DEBUG, "Checking array\n");
 	for (x = 0; x<256; x++) {
 		if (vms->msgArray[x]!=0) {
-  			ast_log (LOG_DEBUG, "Item %d set to %ld\n",x,vms->msgArray[x]);
-		}
-	}
-  	ast_log (LOG_DEBUG, "Check complete.\n");
+			ast_log (LOG_DEBUG, "Item %d set to %ld\n",x,vms->msgArray[x]);
+		}
+	}
+	ast_log (LOG_DEBUG, "Check complete.\n");
 }
 
 static void copy_msgArray(struct vm_state *dst, struct vm_state *src)
@@ -8561,4 +8598,4 @@
 		.load = load_module,
 		.unload = unload_module,
 		.reload = reload,
-	       );
+		);

Modified: team/murf/macrogosub/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/macrogosub/channels/chan_sip.c?rev=41750&r1=41749&r2=41750&view=diff
==============================================================================
--- team/murf/macrogosub/channels/chan_sip.c (original)
+++ team/murf/macrogosub/channels/chan_sip.c Fri Sep  1 14:28:32 2006
@@ -10909,9 +10909,13 @@
 	}
 
 	AST_STANDARD_APP_ARGS(args, data);
-	sscanf(args.number, "%d", &number);
-	if (number < 1)
+	if (!args.number) {
 		number = 1;
+	} else {
+		sscanf(args.number, "%d", &number);
+		if (number < 1)
+			number = 1;
+	}
 
 	p = chan->tech_pvt;
 
@@ -16126,7 +16130,7 @@
 		return AST_RTP_GET_FAILED;
 
 	ast_mutex_lock(&p->lock);
-	if (!(p->rtp)) {
+	if (!(p->vrtp)) {
 		ast_mutex_unlock(&p->lock);
 		return AST_RTP_GET_FAILED;
 	}

Modified: team/murf/macrogosub/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/murf/macrogosub/main/channel.c?rev=41750&r1=41749&r2=41750&view=diff
==============================================================================
--- team/murf/macrogosub/main/channel.c (original)
+++ team/murf/macrogosub/main/channel.c Fri Sep  1 14:28:32 2006
@@ -1862,7 +1862,9 @@
 					break;
 				default:
 					ast_log(LOG_WARNING, "Unexpected control subclass '%d'\n", f->subclass);
+					break;
 				}
+				break;
 			case AST_FRAME_VOICE:
 				/* Write audio if appropriate */
 				if (audiofd > -1)

Modified: team/murf/macrogosub/main/file.c
URL: http://svn.digium.com/view/asterisk/team/murf/macrogosub/main/file.c?rev=41750&r1=41749&r2=41750&view=diff
==============================================================================
--- team/murf/macrogosub/main/file.c (original)
+++ team/murf/macrogosub/main/file.c Fri Sep  1 14:28:32 2006
@@ -1002,7 +1002,7 @@
 		}
 		if (ms < 0)
 			ms = 1000;
-		if (!cmdfd) {
+		if (cmdfd < 0) {
 			res = ast_waitfor(c, ms);
 			if (res < 0) {
 				ast_log(LOG_WARNING, "Select failed (%s)\n", strerror(errno));

Modified: team/murf/macrogosub/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/murf/macrogosub/main/pbx.c?rev=41750&r1=41749&r2=41750&view=diff
==============================================================================
--- team/murf/macrogosub/main/pbx.c (original)
+++ team/murf/macrogosub/main/pbx.c Fri Sep  1 14:28:32 2006
@@ -741,7 +741,7 @@
 {
 	mode &= E_MATCH_MASK;	/* only consider the relevant bits */
 
-	if (mode == E_MATCH && pattern[0] == '_' && strcasecmp(pattern,data)==0) /* note: if this test is left out, then _x. will not match _x. !!! */
+	if ( (mode == E_MATCH) && (pattern[0] == '_') && (strcasecmp(pattern,data)==0) ) /* note: if this test is left out, then _x. will not match _x. !!! */
 		return 1;
 
 	if (pattern[0] != '_') { /* not a pattern, try exact or partial match */

Modified: team/murf/macrogosub/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/murf/macrogosub/main/rtp.c?rev=41750&r1=41749&r2=41750&view=diff
==============================================================================
--- team/murf/macrogosub/main/rtp.c (original)
+++ team/murf/macrogosub/main/rtp.c Fri Sep  1 14:28:32 2006
@@ -159,7 +159,7 @@
 	int rtp_lookup_code_cache_code;
 	int rtp_lookup_code_cache_result;
 	struct ast_rtcp *rtcp;
-	struct ast_rtp *bridged;        /*!< Who we are Packet briged to */
+	struct ast_rtp *bridged;        /*!< Who we are Packet bridged to */
 };
 
 /* Forward declarations */
@@ -2967,13 +2967,6 @@
 			*rc = who;
 			if (option_debug)
 				ast_log(LOG_DEBUG, "Oooh, got a %s\n", fr ? "digit" : "hangup");
-			/* Break out of the bridge */
-			p0->bridged = NULL;
-			p1->bridged = NULL;
-			if (vp0) {
-				vp0->bridged = NULL;
-				vp1->bridged = NULL;
-			}
 			res = AST_BRIDGE_COMPLETE;
 			break;
 		} else if ((fr->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS)) {
@@ -3021,6 +3014,14 @@
 	if (p1_callback)
 		p1_callback = p2p_callback_disable(c1, p1, &p1_fds[0], &p1_iod[0]);
 
+	/* Break out of the direct bridge */
+	p0->bridged = NULL;
+	p1->bridged = NULL;
+	if (vp0) {
+		vp0->bridged = NULL;
+		vp1->bridged = NULL;
+	}
+
 	return res;
 }
 
@@ -3070,7 +3071,13 @@
 	audio_p1_res = pr1->get_rtp_info(c1, &p1);
 	video_p1_res = pr1->get_vrtp_info ? pr1->get_vrtp_info(c1, &vp1) : AST_RTP_GET_FAILED;
 
-	/* Check if bridge is still possible (In SIP canreinvite=no stops this, like NAT) */
+	/* If we are carrying video, and both sides are not reinviting... then fail the native bridge */
+	if (video_p0_res != AST_RTP_GET_FAILED && (audio_p0_res != AST_RTP_TRY_NATIVE || video_p0_res != AST_RTP_TRY_NATIVE))
+		audio_p0_res = AST_RTP_GET_FAILED;
+	if (video_p1_res != AST_RTP_GET_FAILED && (audio_p1_res != AST_RTP_TRY_NATIVE || video_p1_res != AST_RTP_TRY_NATIVE))
+		audio_p1_res = AST_RTP_GET_FAILED;
+
+	/* Check if a bridge is possible (partial/native) */
 	if (audio_p0_res == AST_RTP_GET_FAILED || audio_p1_res == AST_RTP_GET_FAILED) {
 		/* Somebody doesn't want to play... */
 		ast_channel_unlock(c0);



More information about the asterisk-commits mailing list