[asterisk-commits] file: branch file/groupcountv2 r61802 - in /team/file/groupcountv2: ./ apps/ ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Apr 25 10:22:13 MST 2007


Author: file
Date: Wed Apr 25 12:22:12 2007
New Revision: 61802

URL: http://svn.digium.com/view/asterisk?view=rev&rev=61802
Log:
Merged revisions 61655,61663,61680,61685,61692,61704,61770-61771,61776-61777,61786,61798 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r61655 | file | 2007-04-13 15:15:12 -0400 (Fri, 13 Apr 2007) | 2 lines

Add OUTBOUND_GROUP_ONCE variable to app_dial. This behaves the same as OUTBOUND_GROUP except it will get unset after use so it won't get accidentally inherited. (issue #BE-140)

........
r61663 | oej | 2007-04-16 10:08:33 -0400 (Mon, 16 Apr 2007) | 9 lines

Don't stop RTP on errors on INFO messages.

Disclaimer: This patch was needed for Edvina AstHoloApp and was
meant to be included in 1.2, but never made it in time so I felt
I could add it now.

No, just joking, patching error found while testing T.140 with Omnitor earlier
this spring.

........
r61680 | tilghman | 2007-04-18 22:30:18 -0400 (Wed, 18 Apr 2007) | 5 lines

Bug 9557 - Specifying the GetVar AMI action without a Channel parameter can
cause Asterisk to crash.  The reason this needs to be fixed in the functions
instead of in AMI is because Channel can legitimately be NULL, such as when
retrieving global variables.

........
r61685 | oej | 2007-04-19 03:56:21 -0400 (Thu, 19 Apr 2007) | 3 lines

Send NOTIFY to Contact: in SUBSCRIBE 
- as reported by Intertex and Citel. Fixed during SIPit 20 in Antwerp.

........
r61692 | qwell | 2007-04-20 15:49:54 -0400 (Fri, 20 Apr 2007) | 5 lines

If the '* to hangup' option is not enabled, we don't need to disable * as a valid exit key.
  If it was enabled, this statement would've never been checked in the first place.

Issue #9552

........
r61704 | qwell | 2007-04-20 17:14:27 -0400 (Fri, 20 Apr 2007) | 4 lines

Fix an issue that I noticed while looking over issue 9571.

The reload timestamp was getting set after reloading the built-in stuff, and before the modules.

........
r61770 | crichter | 2007-04-24 09:50:05 -0400 (Tue, 24 Apr 2007) | 1 line

added lock for sending messages to avoid double sending. shuffled some empty_chans after the cb_event calls, this avoids that a release_complete from a quite different call releases a fresh created setup by accident.
........
r61771 | file | 2007-04-24 12:05:06 -0400 (Tue, 24 Apr 2007) | 2 lines

Allow RFC2833 to be sent in the response SDP when an INVITE comes in without SDP. (issue #9546 reported by mcrawford)

........
r61776 | dhubbard | 2007-04-24 13:42:12 -0400 (Tue, 24 Apr 2007) | 1 line

removed pthread_join in restart_monitor() to make it like chan_zap and other channel drivers
........
r61777 | dhubbard | 2007-04-24 14:20:31 -0400 (Tue, 24 Apr 2007) | 1 line

removed #if 0 block from chan_phone, chan_zap, and chan_modem restart_monitor()
........
r61786 | russell | 2007-04-24 17:33:59 -0400 (Tue, 24 Apr 2007) | 4 lines

Don't crash if a manager connection provides a username that exists in
manager.conf but does not have a password, and also requests MD5 
authentication. (ASA-2007-012)

........
r61798 | russell | 2007-04-25 12:20:38 -0400 (Wed, 25 Apr 2007) | 3 lines

Fix a typo where cid_num got copied instead of cid_ani.  
(issue #9587, reported and patched by xrg)

........

Modified:
    team/file/groupcountv2/   (props changed)
    team/file/groupcountv2/apps/app_dial.c
    team/file/groupcountv2/apps/app_queue.c
    team/file/groupcountv2/channels/chan_modem.c
    team/file/groupcountv2/channels/chan_phone.c
    team/file/groupcountv2/channels/chan_sip.c
    team/file/groupcountv2/channels/chan_zap.c
    team/file/groupcountv2/channels/misdn/isdn_lib.c
    team/file/groupcountv2/channels/misdn/isdn_lib.h
    team/file/groupcountv2/channels/misdn/isdn_lib_intern.h
    team/file/groupcountv2/funcs/func_callerid.c
    team/file/groupcountv2/funcs/func_cdr.c
    team/file/groupcountv2/funcs/func_language.c
    team/file/groupcountv2/funcs/func_moh.c
    team/file/groupcountv2/funcs/func_timeout.c
    team/file/groupcountv2/loader.c
    team/file/groupcountv2/manager.c

Propchange: team/file/groupcountv2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr 25 12:22:12 2007
@@ -1,1 +1,1 @@
-/branches/1.2:1-61483
+/branches/1.2:1-61801

Modified: team/file/groupcountv2/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/apps/app_dial.c?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/apps/app_dial.c (original)
+++ team/file/groupcountv2/apps/app_dial.c Wed Apr 25 12:22:12 2007
@@ -90,7 +90,10 @@
 "ends the call.\n"
 "  The optional URL will be sent to the called party if the channel supports it.\n"
 "  If the OUTBOUND_GROUP variable is set, all peer channels created by this\n"
-"application will be put into that group (as in Set(GROUP()=...).\n\n"
+"application will be put into that group (as in Set(GROUP()=...).\n"
+"  If the OUTBOUND_GROUP_ONCE variable is set, all peer channels created by this\n"
+"application will be put into that group (as in Set(GROUP()=...). Unlike OUTBOUND_GROUP,\n"
+"however, the variable will be unset after use.\n\n"
 "  Options:\n"
 "    A(x) - Play an announcement to the called party, using 'x' as the file.\n"
 "    C    - Reset the CDR for this call.\n"
@@ -1009,10 +1012,15 @@
 
 	if (continue_exec)
 		*continue_exec = 0;
-
+	
 	/* If a channel group has been specified, get it for use when we create peer channels */
-	outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
-
+	if ((outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP_ONCE"))) {
+		outbound_group = ast_strdupa(outbound_group);
+		pbx_builtin_setvar_helper(chan, "OUTBOUND_GROUP_ONCE", NULL);
+	} else {
+		outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
+	}
+	    
 	ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP);
 	cur = args.peers;
 	do {

Modified: team/file/groupcountv2/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/apps/app_queue.c?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/apps/app_queue.c (original)
+++ team/file/groupcountv2/apps/app_queue.c Wed Apr 25 12:22:12 2007
@@ -1990,7 +1990,7 @@
 				ast_frfree(f);
 				return NULL;
 			}
-			if ((f->frametype == AST_FRAME_DTMF) && (f->subclass != '*') && valid_exit(qe, f->subclass)) {
+			if ((f->frametype == AST_FRAME_DTMF) && valid_exit(qe, f->subclass)) {
 				if (option_verbose > 3)
 					ast_verbose(VERBOSE_PREFIX_3 "User pressed digit: %c\n", f->subclass);
 				*to=0;

Modified: team/file/groupcountv2/channels/chan_modem.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/channels/chan_modem.c?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/channels/chan_modem.c (original)
+++ team/file/groupcountv2/channels/chan_modem.c Wed Apr 25 12:22:12 2007
@@ -717,8 +717,8 @@
 		return -1;
 	}
 	if (monitor_thread != AST_PTHREADT_NULL) {
+		/* Wake up the thread */
 		pthread_kill(monitor_thread, SIGURG);
-		pthread_join(monitor_thread, NULL);
 	} else {
 		/* Start a new monitor */
 		if (ast_pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {

Modified: team/file/groupcountv2/channels/chan_phone.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/channels/chan_phone.c?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/channels/chan_phone.c (original)
+++ team/file/groupcountv2/channels/chan_phone.c Wed Apr 25 12:22:12 2007
@@ -1092,10 +1092,8 @@
 		  ast_log(LOG_WARNING, "Unable to lock the interface list\n");
 		  return -1;
 		}
+		/* Wake up the thread */
 		pthread_cancel(monitor_thread);
-#if 0
-		pthread_join(monitor_thread, NULL);
-#endif
 		ast_mutex_unlock(&iflock);
 	}
 	/* Start a new monitor */

Modified: team/file/groupcountv2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/channels/chan_sip.c?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/channels/chan_sip.c (original)
+++ team/file/groupcountv2/channels/chan_sip.c Wed Apr 25 12:22:12 2007
@@ -7338,6 +7338,7 @@
 				p->noncodeccapability |= AST_RTP_DTMF;
 			else
 				p->noncodeccapability &= ~AST_RTP_DTMF;
+			p->jointnoncodeccapability = p->noncodeccapability;
 		}
 		if (user && debug)
 			ast_verbose("Found user '%s'\n", user->name);
@@ -7447,6 +7448,7 @@
 					p->noncodeccapability |= AST_RTP_DTMF;
 				else
 					p->noncodeccapability &= ~AST_RTP_DTMF;
+				p->jointnoncodeccapability = p->noncodeccapability;
 			}
 			ASTOBJ_UNREF(peer,sip_destroy_peer);
 		} else { 
@@ -10201,13 +10203,15 @@
 			if ((resp >= 300) && (resp < 700)) {
 				if ((option_verbose > 2) && (resp != 487))
 					ast_verbose(VERBOSE_PREFIX_3 "Got SIP response %d \"%s\" back from %s\n", resp, rest, ast_inet_ntoa(iabuf, sizeof(iabuf), p->sa.sin_addr));
-				if (p->rtp) {
-					/* Immediately stop RTP */
-					ast_rtp_stop(p->rtp);
-				}
-				if (p->vrtp) {
-					/* Immediately stop VRTP */
-					ast_rtp_stop(p->vrtp);
+				if (sipmethod == SIP_INVITE) {
+					if (p->rtp) {
+						/* Immediately stop RTP */
+						ast_rtp_stop(p->rtp);
+					}
+					if (p->vrtp) {
+						/* Immediately stop VRTP */
+						ast_rtp_stop(p->vrtp);
+					}
 				}
 				/* XXX Locking issues?? XXX */
 				switch(resp) {
@@ -10251,7 +10255,8 @@
 				/* ACK on invite */
 				if (sipmethod == SIP_INVITE) 
 					transmit_request(p, SIP_ACK, seqno, 0, 0);
-				ast_set_flag(p, SIP_ALREADYGONE);	
+				if (sipmethod != SIP_MESSAGE && sipmethod != SIP_INFO)
+					ast_set_flag(p, SIP_ALREADYGONE);	
 				if (!p->owner)
 					ast_set_flag(p, SIP_NEEDDESTROY);	
 			} else if ((resp >= 100) && (resp < 200)) {
@@ -11065,6 +11070,10 @@
 			ast_copy_string(p->context, p->subscribecontext, sizeof(p->context));
 		else if (ast_strlen_zero(p->context))
 			strcpy(p->context, default_context);
+
+		/* Get full contact header - this needs to be used as a request URI in NOTIFY's */
+		parse_ok_contact(p, req);
+
 		/* Get destination right away */
 		build_contact(p);
 		if (gotdest) {

Modified: team/file/groupcountv2/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/channels/chan_zap.c?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/channels/chan_zap.c (original)
+++ team/file/groupcountv2/channels/chan_zap.c Wed Apr 25 12:22:12 2007
@@ -5281,7 +5281,7 @@
 		if (!ast_strlen_zero(i->cid_name))
 			tmp->cid.cid_name = strdup(i->cid_name);
 		if (!ast_strlen_zero(i->cid_ani))
-			tmp->cid.cid_ani = strdup(i->cid_num);
+			tmp->cid.cid_ani = strdup(i->cid_ani);
 		else if (!ast_strlen_zero(i->cid_num))	
 			tmp->cid.cid_ani = strdup(i->cid_num);
 #else
@@ -6836,14 +6836,8 @@
 		return -1;
 	}
 	if (monitor_thread != AST_PTHREADT_NULL) {
-		/* Just signal it to be sure it wakes up */
-#if 0
-		pthread_cancel(monitor_thread);
-#endif
+		/* Wake up the thread */
 		pthread_kill(monitor_thread, SIGURG);
-#if 0
-		pthread_join(monitor_thread, NULL);
-#endif
 	} else {
 		/* Start a new monitor */
 		if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {

Modified: team/file/groupcountv2/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/channels/misdn/isdn_lib.c?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/channels/misdn/isdn_lib.c (original)
+++ team/file/groupcountv2/channels/misdn/isdn_lib.c Wed Apr 25 12:22:12 2007
@@ -1085,6 +1085,10 @@
 	cb_log(8, port, "Init.BC %d.\n",bidx);
 	
 	memset(bc, 0,sizeof(struct misdn_bchannel));
+
+	bc->send_lock=malloc(sizeof(struct send_lock));
+
+	pthread_mutex_init(&bc->send_lock->lock, NULL);
 	
 	if (msn) {
 		int l = sizeof(bc->msn);
@@ -1189,6 +1193,7 @@
 		stack->nt=1;
 		break;
 
+#ifndef MISDN_1_2
 	case ISDN_PID_L0_TE_U:
 		break;
 	case ISDN_PID_L0_NT_U:
@@ -1197,6 +1202,7 @@
 		break;
 	case ISDN_PID_L0_NT_UP2:
 		break;
+#endif
 	case ISDN_PID_L0_TE_E1:
 		cb_log(8, port, "TE S2M Stack\n");
 		stack->nt=0;
@@ -1521,14 +1527,6 @@
 
 		case EVENT_RELEASE_COMPLETE:
 		case EVENT_RELEASE:
-			if (bc->channel>0)
-				empty_chan_in_stack(stack,bc->channel);
-			int tmpcause=bc->cause;	
-			int tmp_out_cause=bc->out_cause;	
-			empty_bc(bc);
-			bc->cause=tmpcause;
-			bc->out_cause=tmp_out_cause;
-			clean_up_bc(bc);
 			break;
 		default:
 			break;
@@ -1584,17 +1582,18 @@
 				cb_log(4, stack->port, " --> lib: CLEANING UP l3id: %x\n",frm->dinfo);
 				if (bc->channel>0)
 					empty_chan_in_stack(stack,bc->channel);
-				empty_bc(bc);
 				
-				clean_up_bc(bc);
-				
-				dump_chan_list(stack);
 				/*bc->pid = 0;*/
 				bc->need_disconnect=0;
 				bc->need_release=0;
 				bc->need_release_complete=0;
-				
+
 				cb_event(EVENT_CLEANUP, bc, glob_mgr->user_data);
+
+				empty_bc(bc);
+				clean_up_bc(bc);
+				dump_chan_list(stack);
+
 				if (bc->stack_holder) {
 					cb_log(4,stack->port, "REMOVEING Holder\n");
 					stack_holder_remove( stack, bc);
@@ -2653,6 +2652,18 @@
 				}
 			}
 
+			if (event == EVENT_RELEASE_COMPLETE) {
+				/* release bchannel only after we've anounced the RELEASE_COMPLETE */
+				if (bc->channel>0)
+					empty_chan_in_stack(stack,bc->channel);
+				int tmpcause=bc->cause;	
+				int tmp_out_cause=bc->out_cause;	
+				empty_bc(bc);
+				bc->cause=tmpcause;
+				bc->out_cause=tmp_out_cause;
+				clean_up_bc(bc);
+			}
+
 			cb_log(5, stack->port, "Freeing Msg on prim:%x \n",frm->prim);
 
 			
@@ -3167,21 +3178,37 @@
 	cb_log(5, stack->port, " --> bc:%x h:%d sh:%d\n", bc, bc->holded, bc->stack_holder);
 }
 
+#define RETURN(a,b) {retval=a; goto b;}
+
+void misdn_send_lock(struct misdn_bchannel *bc)
+{
+	//cb_log(0,bc->port,"Locking bc->pid:%d\n", bc->pid);
+	pthread_mutex_lock(&bc->send_lock->lock);
+}
+
+void misdn_send_unlock(struct misdn_bchannel *bc)
+{
+	//cb_log(0,bc->port,"UnLocking bc->pid:%d\n", bc->pid);
+	pthread_mutex_unlock(&bc->send_lock->lock);
+}
+
 int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event )
 {
 	msg_t *msg; 
-	int err = -1 ;
-	int ret=0;
-  
-	if (!bc) goto ERR; 
+	int retval=0;
+  
+	if (!bc) RETURN(-1,OUT_POST_UNLOCK);
 	
 	struct misdn_stack *stack=get_stack_by_bc(bc);
 	
 	if (!stack) {
 		cb_log(0,bc->port,"SENDEVENT: no Stack for event:%s oad:%s dad:%s \n", isdn_get_info(msgs_g, event, 0), bc->oad, bc->dad);
-		return -1;
-	}
-	
+		RETURN(-1,OUT);
+	}
+	
+	misdn_send_lock(bc);
+
+
 	cb_log(6,stack->port,"SENDEVENT: stack->nt:%d stack->uperid:%x\n",stack->nt, stack->upper_id);
 
 	if ( stack->nt && !stack->l1link) {
@@ -3189,7 +3216,7 @@
 		bc->evq=event;
 		cb_log(1, stack->port, "Queueing Event %s because L1 is down (btw. Activating L1)\n", isdn_get_info(msgs_g, event, 0));
 		misdn_lib_get_l1_up(stack);
-		return 0;
+		RETURN(0,OUT);
 	}
 	
 	cb_log(1, stack->port, "I SEND:%s oad:%s dad:%s pid:%d\n", isdn_get_info(msgs_g, event, 0), bc->oad, bc->dad, bc->pid);
@@ -3201,8 +3228,7 @@
 		if (create_process(glob_mgr->midev, bc)<0) {
 			cb_log(0,  stack->port, " No free channel at the moment @ send_event\n");
 
-			err=-ENOCHAN;
-			goto ERR;
+			RETURN(-ENOCHAN,OUT);
 		}
 #if 0
 	if (stack->nt) {
@@ -3218,8 +3244,6 @@
 	case EVENT_ALERTING:
 	case EVENT_PROCEEDING:
 	case EVENT_SETUP_ACKNOWLEDGE:
-		if (!bc->nt && !stack->ptp) break;
-
 	case EVENT_CONNECT:
 	case EVENT_RETRIEVE_ACKNOWLEDGE:
 
@@ -3229,21 +3253,19 @@
 				if (!bc->channel) {
 					cb_log(0, stack->port, " No free channel at the moment\n");
 					/*FIXME: add disconnect*/
-					err=-ENOCHAN;
-					goto ERR;
+					RETURN(-ENOCHAN,OUT);
 				}
 				
 				if (set_chan_in_stack(stack ,bc->channel)<0) {
 					/*FIXME: add disconnect*/
-					err=-ENOCHAN;
-					goto ERR;
+					RETURN(-ENOCHAN,OUT);
 				}
 			}
 			/* Its that i generate channels */
 		}
 
-		ret=setup_bc(bc);
-		if (ret == -EINVAL) {
+		retval=setup_bc(bc);
+		if (retval == -EINVAL) {
 			cb_log(0,bc->port,"send_event: setup_bc failed\n");
 		}
 
@@ -3276,7 +3298,7 @@
 		struct misdn_bchannel *holded_bc=malloc(sizeof(struct misdn_bchannel));
 		if (!holded_bc) {
 			cb_log(0,bc->port, "Could not allocate holded_bc!!!\n");
-			return -1;
+			RETURN(-1,OUT);
 		}
 
 		/*backup the bc*/
@@ -3311,7 +3333,7 @@
 	case EVENT_DISCONNECT:
 		if (!bc->need_disconnect) {
 			cb_log(0,bc->port," --> we have already send Disconnect\n");
-			return -1;
+			RETURN(-1,OUT);
 		}
 		
 		bc->need_disconnect=0;
@@ -3319,7 +3341,7 @@
 	case EVENT_RELEASE:
 		if (!bc->need_release) {
 			cb_log(0,bc->port," --> we have already send Release\n");
-			return -1;
+			RETURN(-1,OUT);
 		}
 		bc->need_disconnect=0;
 		bc->need_release=0;
@@ -3327,7 +3349,7 @@
 	case EVENT_RELEASE_COMPLETE:
 		if (!bc->need_release_complete) {
 			cb_log(0,bc->port," --> we have already send Release_complete\n");
-			return -1;
+			RETURN(-1,OUT);
 		}
 		bc->need_disconnect=0;
 		bc->need_release=0;
@@ -3349,13 +3371,12 @@
 	case EVENT_CONNECT_ACKNOWLEDGE:
 
 		if ( bc->nt || misdn_cap_is_speech(bc->capability)) {
-			int ret=setup_bc(bc);
-			if (ret == -EINVAL){
+			int retval=setup_bc(bc);
+			if (retval == -EINVAL){
 				cb_log(0,bc->port,"send_event: setup_bc failed\n");
 				
 			}
 		}
-	
 		
 		if (misdn_cap_is_speech(bc->capability)) {
 			if (  !bc->nodsp) manager_ph_control(bc,  DTMF_TONE_START, 0);
@@ -3381,10 +3402,11 @@
 	msg_queue_tail(&stack->downqueue, msg);
 	sem_post(&glob_mgr->new_msg);
   
-	return 0;
-  
- ERR:
-	return -1; 
+OUT:
+	misdn_send_unlock(bc);
+
+OUT_POST_UNLOCK:
+	return retval; 
 }
 
 

Modified: team/file/groupcountv2/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/channels/misdn/isdn_lib.h?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/channels/misdn/isdn_lib.h (original)
+++ team/file/groupcountv2/channels/misdn/isdn_lib.h Wed Apr 25 12:22:12 2007
@@ -213,6 +213,7 @@
 
 
 struct misdn_bchannel {
+	struct send_lock *send_lock;
 
 	int nt;
 	int port;

Modified: team/file/groupcountv2/channels/misdn/isdn_lib_intern.h
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/channels/misdn/isdn_lib_intern.h?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/channels/misdn/isdn_lib_intern.h (original)
+++ team/file/groupcountv2/channels/misdn/isdn_lib_intern.h Wed Apr 25 12:22:12 2007
@@ -23,6 +23,10 @@
 
 ibuffer_t *astbuf;
 ibuffer_t *misdnbuf;
+
+struct send_lock {
+	pthread_mutex_t lock;
+};
 
 
 struct isdn_msg {

Modified: team/file/groupcountv2/funcs/func_callerid.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/funcs/func_callerid.c?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/funcs/func_callerid.c (original)
+++ team/file/groupcountv2/funcs/func_callerid.c Wed Apr 25 12:22:12 2007
@@ -42,6 +42,9 @@
 
 static char *callerid_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) 
 {
+	if (!chan)
+		return "";
+
 	if (!strncasecmp("all", data, 3)) {
 		snprintf(buf, len, "\"%s\" <%s>", chan->cid.cid_name ? chan->cid.cid_name : "", chan->cid.cid_num ? chan->cid.cid_num : "");	
 	} else if (!strncasecmp("name", data, 4)) {
@@ -73,9 +76,9 @@
 
 static void callerid_write(struct ast_channel *chan, char *cmd, char *data, const char *value) 
 {
-	if (!value)
+	if (!value || !chan)
                 return;
-	
+
 	if (!strncasecmp("all", data, 3)) {
 		char name[256];
 		char num[256];

Modified: team/file/groupcountv2/funcs/func_cdr.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/funcs/func_cdr.c?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/funcs/func_cdr.c (original)
+++ team/file/groupcountv2/funcs/func_cdr.c Wed Apr 25 12:22:12 2007
@@ -44,7 +44,7 @@
 	int argc;
 	char *argv[2];
 	int recursive = 0;
-	struct ast_cdr *cdr = chan->cdr;
+	struct ast_cdr *cdr = chan ? chan->cdr : NULL;
 
 	if (ast_strlen_zero(data))
 		return NULL;
@@ -78,9 +78,9 @@
 	char *argv[2];
 	int recursive = 0;
 
-	if (ast_strlen_zero(data) || !value)
+	if (ast_strlen_zero(data) || !value || !chan)
 		return;
-	
+
 	mydata = ast_strdupa(data);
 	argc = ast_app_separate_args(mydata, '|', argv, sizeof(argv) / sizeof(argv[0]));
 

Modified: team/file/groupcountv2/funcs/func_language.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/funcs/func_language.c?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/funcs/func_language.c (original)
+++ team/file/groupcountv2/funcs/func_language.c Wed Apr 25 12:22:12 2007
@@ -36,14 +36,14 @@
 
 static char *builtin_function_language_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) 
 {
-	ast_copy_string(buf, chan->language, len);
+	ast_copy_string(buf, chan ? chan->language : "", len);
 
 	return buf;
 }
 
 static void builtin_function_language_write(struct ast_channel *chan, char *cmd, char *data, const char *value) 
 {
-	if (value)
+	if (chan && value)
 		ast_copy_string(chan->language, value, sizeof(chan->language));
 }
 

Modified: team/file/groupcountv2/funcs/func_moh.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/funcs/func_moh.c?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/funcs/func_moh.c (original)
+++ team/file/groupcountv2/funcs/func_moh.c Wed Apr 25 12:22:12 2007
@@ -32,14 +32,15 @@
 
 static char *function_moh_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
 {
-	ast_copy_string(buf, chan->musicclass, len);
+	ast_copy_string(buf, chan ? chan->musicclass : "", len);
 
 	return buf;
 }
 
 static void function_moh_write(struct ast_channel *chan, char *cmd, char *data, const char *value) 
 {
-	ast_copy_string(chan->musicclass, value, sizeof(chan->musicclass));
+	if (chan)
+		ast_copy_string(chan->musicclass, value, sizeof(chan->musicclass));
 }
 
 #ifndef BUILTIN_FUNC

Modified: team/file/groupcountv2/funcs/func_timeout.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/funcs/func_timeout.c?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/funcs/func_timeout.c (original)
+++ team/file/groupcountv2/funcs/func_timeout.c Wed Apr 25 12:22:12 2007
@@ -42,6 +42,9 @@
 {
 	time_t myt;
 
+	if (!chan)
+		return "";
+
 	if (!data) {
 		ast_log(LOG_ERROR, "Must specify type of timeout to get.\n");
                 return NULL;
@@ -85,6 +88,9 @@
 	int x;
 	char timestr[64];
 	struct tm myt;
+
+	if (!chan)
+		return;
 
 	if (!data) {
 		ast_log(LOG_ERROR, "Must specify type of timeout to set.\n");

Modified: team/file/groupcountv2/loader.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/loader.c?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/loader.c (original)
+++ team/file/groupcountv2/loader.c Wed Apr 25 12:22:12 2007
@@ -215,6 +215,8 @@
 		ast_verbose("The previous reload command didn't finish yet\n");
 		return -1;
 	}
+	time(&ast_lastreloadtime);
+
 	if (!name || !strcasecmp(name, "extconfig")) {
 		read_config_maps();
 		reloaded = 2;
@@ -239,7 +241,6 @@
 		dnsmgr_reload();
 		reloaded = 2;
 	}
-	time(&ast_lastreloadtime);
 
 	ast_mutex_lock(&modlock);
 	oldversion = modlistver;

Modified: team/file/groupcountv2/manager.c
URL: http://svn.digium.com/view/asterisk/team/file/groupcountv2/manager.c?view=diff&rev=61802&r1=61801&r2=61802
==============================================================================
--- team/file/groupcountv2/manager.c (original)
+++ team/file/groupcountv2/manager.c Wed Apr 25 12:22:12 2007
@@ -533,7 +533,8 @@
 				} else if (ha)
 					ast_free_ha(ha);
 				if (!strcasecmp(authtype, "MD5")) {
-					if (!ast_strlen_zero(key) && s->challenge) {
+					if (!ast_strlen_zero(key) && 
+					    !ast_strlen_zero(s->challenge) && !ast_strlen_zero(password)) {
 						int x;
 						int len=0;
 						char md5key[256] = "";



More information about the asterisk-commits mailing list