[asterisk-commits] oej: branch oej/fixtoheader-1.2 r53145 - in /team/oej/fixtoheader-1.2: ./ app...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Feb 4 17:45:49 MST 2007


Author: oej
Date: Sun Feb  4 18:45:48 2007
New Revision: 53145

URL: http://svn.digium.com/view/asterisk?view=rev&rev=53145
Log:
Update

Modified:
    team/oej/fixtoheader-1.2/   (props changed)
    team/oej/fixtoheader-1.2/apps/app_chanspy.c
    team/oej/fixtoheader-1.2/apps/app_dial.c
    team/oej/fixtoheader-1.2/apps/app_meetme.c
    team/oej/fixtoheader-1.2/apps/app_page.c
    team/oej/fixtoheader-1.2/apps/app_queue.c
    team/oej/fixtoheader-1.2/apps/app_rpt.c
    team/oej/fixtoheader-1.2/cdr.c
    team/oej/fixtoheader-1.2/channels/chan_h323.c
    team/oej/fixtoheader-1.2/channels/chan_iax2.c
    team/oej/fixtoheader-1.2/channels/chan_mgcp.c
    team/oej/fixtoheader-1.2/channels/chan_sip.c
    team/oej/fixtoheader-1.2/channels/chan_skinny.c
    team/oej/fixtoheader-1.2/channels/chan_zap.c
    team/oej/fixtoheader-1.2/codecs/Makefile
    team/oej/fixtoheader-1.2/codecs/codec_zap.c
    team/oej/fixtoheader-1.2/config.c
    team/oej/fixtoheader-1.2/funcs/func_strings.c
    team/oej/fixtoheader-1.2/manager.c
    team/oej/fixtoheader-1.2/pbx.c
    team/oej/fixtoheader-1.2/pbx/pbx_dundi.c
    team/oej/fixtoheader-1.2/pbx/pbx_spool.c
    team/oej/fixtoheader-1.2/res/res_musiconhold.c
    team/oej/fixtoheader-1.2/rtp.c

Propchange: team/oej/fixtoheader-1.2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Feb  4 18:45:48 2007
@@ -1,1 +1,1 @@
-/branches/1.2:1-52977
+/branches/1.2:1-53144

Modified: team/oej/fixtoheader-1.2/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/apps/app_chanspy.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/apps/app_chanspy.c (original)
+++ team/oej/fixtoheader-1.2/apps/app_chanspy.c Sun Feb  4 18:45:48 2007
@@ -53,7 +53,7 @@
 #define ALL_DONE(u, ret) LOCAL_USER_REMOVE(u); return ret;
 #define get_volfactor(x) x ? ((x > 0) ? (1 << x) : ((1 << abs(x)) * -1)) : 0
 
-static const char *synopsis = "Listen to the audio of an active channel\n";
+static const char *synopsis = "Listen to the audio of an active channel";
 static const char *app = "ChanSpy";
 static const char *desc = 
 "  ChanSpy([chanprefix][|options]): This application is used to listen to the\n"

Modified: team/oej/fixtoheader-1.2/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/apps/app_dial.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/apps/app_dial.c (original)
+++ team/oej/fixtoheader-1.2/apps/app_dial.c Sun Feb  4 18:45:48 2007
@@ -80,7 +80,7 @@
 "    ANSWEREDTIME - This is the amount of time for actual call.\n"
 "    DIALSTATUS   - This is the status of the call:\n"
 "                   CHANUNAVAIL | CONGESTION | NOANSWER | BUSY | ANSWER | CANCEL\n" 
-"                   DONTCALL | TORTURE\n"
+"                   DONTCALL | TORTURE | INVALIDARGS\n"
 "  For the Privacy and Screening Modes, the DIALSTATUS variable will be set to\n"
 "DONTCALL if the called party chooses to send the calling party to the 'Go Away'\n"
 "script. The DIALSTATUS variable will be set to TORTURE if the called party\n"
@@ -759,7 +759,7 @@
 	char *start_sound=NULL;
 	char *dtmfcalled=NULL, *dtmfcalling=NULL;
 	char *var;
-	char status[256];
+	char status[256] = "INVALIDARGS";
 	int play_to_caller=0,play_to_callee=0;
 	int sentringing=0, moh=0;
 	char *outbound_group = NULL;
@@ -780,21 +780,19 @@
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "Dial requires an argument (technology/number)\n");
+		pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
 		return -1;
 	}
 
 	LOCAL_USER_ADD(u);
 
-	if (!(parse = ast_strdupa(data))) {
-		ast_log(LOG_WARNING, "Memory allocation failure\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
+	parse = ast_strdupa(data);
 	
 	AST_STANDARD_APP_ARGS(args, parse);
 
 	if (!ast_strlen_zero(args.options)) {
 		if (ast_app_parse_options(dial_exec_options, &opts, opt_args, args.options)) {
+			pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
 			LOCAL_USER_REMOVE(u);
 			return -1;
 		}
@@ -802,6 +800,7 @@
 
 	if (ast_strlen_zero(args.peers)) {
 		ast_log(LOG_WARNING, "Dial requires an argument (technology/number)\n");
+		pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
 		LOCAL_USER_REMOVE(u);
 		return -1;
 	}

Modified: team/oej/fixtoheader-1.2/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/apps/app_meetme.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/apps/app_meetme.c (original)
+++ team/oej/fixtoheader-1.2/apps/app_meetme.c Sun Feb  4 18:45:48 2007
@@ -862,6 +862,7 @@
 		ast_verbose(VERBOSE_PREFIX_4 "Starting recording of MeetMe Conference %s into file %s.%s.\n",
 			    conf->confno, conf->recordingfilename, conf->recordingformat);
 		ast_pthread_create(&conf->recordthread, &conf->attr, recordthread, conf);
+		pthread_attr_destroy(&conf->attr);
 	}
 
 	time(&user->jointime);

Modified: team/oej/fixtoheader-1.2/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/apps/app_page.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/apps/app_page.c (original)
+++ team/oej/fixtoheader-1.2/apps/app_page.c Sun Feb  4 18:45:48 2007
@@ -135,6 +135,7 @@
 			ast_log(LOG_WARNING, "Unable to create paging thread: %s\n", strerror(errno));
 			free(cd);
 		}
+		pthread_attr_destroy(&attr);
 	}
 }
 

Modified: team/oej/fixtoheader-1.2/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/apps/app_queue.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/apps/app_queue.c (original)
+++ team/oej/fixtoheader-1.2/apps/app_queue.c Sun Feb  4 18:45:48 2007
@@ -562,6 +562,7 @@
 		ast_log(LOG_WARNING, "Failed to create update thread!\n");
 		free(sc);
 	}
+	pthread_attr_destroy(&attr);
 
 	return 0;
 }

Modified: team/oej/fixtoheader-1.2/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/apps/app_rpt.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/apps/app_rpt.c (original)
+++ team/oej/fixtoheader-1.2/apps/app_rpt.c Sun Feb  4 18:45:48 2007
@@ -1521,6 +1521,7 @@
         pthread_attr_init(&attr);
         pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 	ast_pthread_create(&tele->threadid,&attr,rpt_tele_thread,(void *) tele);
+	pthread_attr_destroy(&attr);
 	return;
 }
 
@@ -2153,6 +2154,7 @@
 	pthread_attr_init(&attr);
 	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 	ast_pthread_create(&myrpt->rpt_call_thread,&attr,rpt_call,(void *) myrpt);
+	pthread_attr_destroy(&attr);
 	return DC_COMPLETE;
 }
 
@@ -5239,6 +5241,7 @@
 					        pthread_attr_init(&attr);
 			 		        pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 						ast_pthread_create(&myrpt->rpt_call_thread,&attr,rpt_call,(void *)myrpt);
+						pthread_attr_destroy(&attr);
 						continue;
 					}
 				}
@@ -5781,6 +5784,7 @@
 	        pthread_attr_init(&attr);
 	        pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 		ast_pthread_create(&rpt_vars[i].rpt_thread,&attr,rpt,(void *) &rpt_vars[i]);
+		pthread_attr_destroy(&attr);
 	}
 	usleep(500000);
 	for(;;)
@@ -5816,6 +5820,7 @@
 			        pthread_attr_init(&attr);
 	 		        pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 				ast_pthread_create(&rpt_vars[i].rpt_thread,&attr,rpt,(void *) &rpt_vars[i]);
+				pthread_attr_destroy(&attr);
 				ast_log(LOG_WARNING, "rpt_thread restarted on node %s\n", rpt_vars[i].name);
 			}
 

Modified: team/oej/fixtoheader-1.2/cdr.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/cdr.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/cdr.c (original)
+++ team/oej/fixtoheader-1.2/cdr.c Sun Feb  4 18:45:48 2007
@@ -956,6 +956,7 @@
 			if (option_debug)
 				ast_log(LOG_DEBUG, "CDR multi-threaded batch processing begins now\n");
 		}
+		pthread_attr_destroy(&attr);
 	}
 }
 

Modified: team/oej/fixtoheader-1.2/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/channels/chan_h323.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/channels/chan_h323.c (original)
+++ team/oej/fixtoheader-1.2/channels/chan_h323.c Sun Feb  4 18:45:48 2007
@@ -1642,9 +1642,11 @@
                 /* Start a new monitor */
                 if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
                         ast_mutex_unlock(&monlock);
+						pthread_attr_destroy(&attr);
                         ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
                         return -1;
                 }
+		pthread_attr_destroy(&attr);
 
 	}
 	ast_mutex_unlock(&monlock);

Modified: team/oej/fixtoheader-1.2/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/channels/chan_iax2.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/channels/chan_iax2.c (original)
+++ team/oej/fixtoheader-1.2/channels/chan_iax2.c Sun Feb  4 18:45:48 2007
@@ -6224,6 +6224,7 @@
 		if (ast_pthread_create(&newthread, &attr, dp_lookup_thread, dpr)) {
 			ast_log(LOG_WARNING, "Unable to start lookup thread!\n");
 		}
+		pthread_attr_destroy(&attr);
 	} else
 		ast_log(LOG_WARNING, "Out of memory!\n");
 }
@@ -6304,8 +6305,11 @@
 		memset(d, 0, sizeof(*d));
 		d->chan1 = chan1m;
 		d->chan2 = chan2m;
-		if (!ast_pthread_create(&th, &attr, iax_park_thread, d))
+		if (!ast_pthread_create(&th, &attr, iax_park_thread, d)) {
+			pthread_attr_destroy(&attr);
 			return 0;
+		}
+		pthread_attr_destroy(&attr);
 		free(d);
 	}
 	return -1;

Modified: team/oej/fixtoheader-1.2/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/channels/chan_mgcp.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/channels/chan_mgcp.c (original)
+++ team/oej/fixtoheader-1.2/channels/chan_mgcp.c Sun Feb  4 18:45:48 2007
@@ -2963,6 +2963,7 @@
 			/*ast_queue_control(sub->owner, AST_CONTROL_ANSWER);*/
 		}
 	}
+	pthread_attr_destroy(&attr);
 }
 
 static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req, struct sockaddr_in *sin)

Modified: team/oej/fixtoheader-1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/channels/chan_sip.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/channels/chan_sip.c (original)
+++ team/oej/fixtoheader-1.2/channels/chan_sip.c Sun Feb  4 18:45:48 2007
@@ -408,7 +408,6 @@
 
 /*! \brief Codecs that we support by default: */
 static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
-static int noncodeccapability = AST_RTP_DTMF;
 
 static struct in_addr __ourip;
 static struct sockaddr_in outboundproxyip;
@@ -567,8 +566,7 @@
 #define SIP_CALL_LIMIT		(1 << 29)
 /* Remote Party-ID Support */
 #define SIP_SENDRPID		(1 << 30)
-/* Did this connection increment the counter of in-use calls? */
-#define SIP_INC_COUNT (1 << 31)
+#define SIP_INC_COUNT		(1 << 31)	/* Did this connection increment the counter of in-use calls? */
 
 #define SIP_FLAGS_TO_COPY \
 	(SIP_PROMISCREDIR | SIP_TRUSTRPID | SIP_SENDRPID | SIP_DTMF | SIP_REINVITE | \
@@ -609,6 +607,7 @@
 	int peercapability;			/*!< Supported peer capability */
 	int prefcodec;				/*!< Preferred codec (outbound only) */
 	int noncodeccapability;
+	int jointnoncodeccapability;
 	int callingpres;			/*!< Calling presentation */
 	int authtries;				/*!< Times we've tried to authenticate */
 	int expiry;				/*!< How long we take to expire */
@@ -2085,6 +2084,7 @@
 	if ( res != -1 ) {
 		p->callingpres = ast->cid.cid_pres;
 		p->jointcapability = p->capability;
+		p->jointnoncodeccapability = p->noncodeccapability;
 		transmit_invite(p, SIP_INVITE, 1, 2);
 		if (p->maxtime) {
 			/* Initialize auto-congest time */
@@ -2123,6 +2123,12 @@
 
 	if (sip_debug_test_pvt(p))
 		ast_verbose("Destroying call '%s'\n", p->callid);
+
+	if (ast_test_flag(p, SIP_INC_COUNT)) {
+		update_call_counter(p, DEC_CALL_LIMIT);
+		if (option_debug)
+			ast_log(LOG_DEBUG, "Call did not properly clean up call counter. Call ID %s\n", p->callid);
+	}
 
 	if (dumphistory)
 		sip_dump_history(p);
@@ -2250,8 +2256,10 @@
 		/* incoming and outgoing affects the inUse counter */
 		case DEC_CALL_LIMIT:
 			if ( *inuse > 0 ) {
-			         if (ast_test_flag(fup,SIP_INC_COUNT))
+				if (ast_test_flag(fup, SIP_INC_COUNT)) {
 				         (*inuse)--;
+					ast_clear_flag(fup, SIP_INC_COUNT);
+				}
 			} else {
 				*inuse = 0;
 			}
@@ -3723,11 +3731,11 @@
 				&vpeercapability, &vpeernoncodeccapability);
 	p->jointcapability = p->capability & (peercapability | vpeercapability);
 	p->peercapability = (peercapability | vpeercapability);
-	p->noncodeccapability = noncodeccapability & peernoncodeccapability;
+	p->jointnoncodeccapability = p->noncodeccapability & peernoncodeccapability;
 	
 	if (ast_test_flag(p, SIP_DTMF) == SIP_DTMF_AUTO) {
 		ast_clear_flag(p, SIP_DTMF);
-		if (p->noncodeccapability & AST_RTP_DTMF) {
+		if (p->jointnoncodeccapability & AST_RTP_DTMF) {
 			/* XXX Would it be reasonable to drop the DSP at this point? XXX */
 			ast_set_flag(p, SIP_DTMF_RFC2833);
 		} else {
@@ -3747,9 +3755,9 @@
 			ast_getformatname_multiple(s4, slen, p->jointcapability));
 
 		ast_verbose("Non-codec capabilities: us - %s, peer - %s, combined - %s\n",
-			ast_rtp_lookup_mime_multiple(s1, slen, noncodeccapability, 0),
+			ast_rtp_lookup_mime_multiple(s1, slen, p->noncodeccapability, 0),
 			ast_rtp_lookup_mime_multiple(s2, slen, peernoncodeccapability, 0),
-			ast_rtp_lookup_mime_multiple(s3, slen, p->noncodeccapability, 0));
+			ast_rtp_lookup_mime_multiple(s3, slen, p->jointnoncodeccapability, 0));
 	}
 	if (!p->jointcapability) {
 		ast_log(LOG_NOTICE, "No compatible codecs!\n");
@@ -4645,7 +4653,7 @@
 	}
 
 	for (x = 1; x <= AST_RTP_MAX; x <<= 1) {
-		if (!(p->noncodeccapability & x))
+		if (!(p->jointnoncodeccapability & x))
 			continue;
 
 		add_noncodec_to_sdp(p, x, 8000,
@@ -10416,8 +10424,11 @@
 		copy_request(&d->req, req);
 		d->chan1 = chan1m;
 		d->chan2 = chan2m;
-		if (!ast_pthread_create(&th, &attr, sip_park_thread, d))
+		if (!ast_pthread_create(&th, &attr, sip_park_thread, d)) {
+			pthread_attr_destroy(&attr);
 			return 0;
+		}
+		pthread_attr_destroy(&attr);
 		free(d);
 	}
 	return -1;

Modified: team/oej/fixtoheader-1.2/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/channels/chan_skinny.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/channels/chan_skinny.c (original)
+++ team/oej/fixtoheader-1.2/channels/chan_skinny.c Sun Feb  4 18:45:48 2007
@@ -2977,6 +2977,7 @@
 		ast_verbose("killing accept thread\n");
 	}
 	close(as);
+	pthread_attr_destroy(&attr);
 	return 0;
 }
 

Modified: team/oej/fixtoheader-1.2/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/channels/chan_zap.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/channels/chan_zap.c (original)
+++ team/oej/fixtoheader-1.2/channels/chan_zap.c Sun Feb  4 18:45:48 2007
@@ -3667,9 +3667,6 @@
 	pthread_t threadid;
 	pthread_attr_t attr;
 	struct ast_channel *chan;
-
-	pthread_attr_init(&attr);
-	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 
 	index = zt_get_index(ast, p, 0);
 	p->subs[index].f.frametype = AST_FRAME_NULL;
@@ -4199,6 +4196,8 @@
 						if (res)
 							ast_log(LOG_WARNING, "Unable to start dial recall tone on channel %d\n", p->channel);
 						p->owner = chan;
+						pthread_attr_init(&attr);
+						pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 						if (!chan) {
 							ast_log(LOG_WARNING, "Cannot allocate new structure on channel %d\n", p->channel);
 						} else if (ast_pthread_create(&threadid, &attr, ss_thread, chan)) {
@@ -4212,7 +4211,8 @@
 							/* Start music on hold if appropriate */
 							if (ast_bridged_channel(p->subs[SUB_THREEWAY].owner))
 								ast_moh_start(ast_bridged_channel(p->subs[SUB_THREEWAY].owner), NULL);
-						}		
+						}
+						pthread_attr_destroy(&attr);
 					}
 				} else {
 					/* Already have a 3 way call */
@@ -6579,6 +6579,7 @@
 				"interface %d\n", i->channel);
 		}
 	}
+	pthread_attr_destroy(&attr);
 	return 0;
 }
 
@@ -6838,10 +6839,12 @@
 		if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
 			ast_mutex_unlock(&monlock);
 			ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
+			pthread_attr_destroy(&attr);
 			return -1;
 		}
 	}
 	ast_mutex_unlock(&monlock);
+	pthread_attr_destroy(&attr);
 	return 0;
 }
 
@@ -8193,9 +8196,6 @@
 	char plancallingani[256];
 	char calledtonstr[10];
 	
-	pthread_attr_init(&attr);
-	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-
 	gettimeofday(&lastidle, NULL);
 	if (!ast_strlen_zero(pri->idledial) && !ast_strlen_zero(pri->idleext)) {
 		/* Need to do idle dialing, check to be sure though */
@@ -8683,6 +8683,8 @@
 								pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason));
 							
 							ast_mutex_lock(&pri->lock);
+							pthread_attr_init(&attr);
+							pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 							if (c && !ast_pthread_create(&threadid, &attr, ss_thread, c)) {
 								if (option_verbose > 2)
 									ast_verbose(VERBOSE_PREFIX_3 "Accepting overlap call from '%s' to '%s' on channel %d/%d, span %d\n",
@@ -8698,6 +8700,7 @@
 									pri->pvts[chanpos]->call = NULL;
 								}
 							}
+							pthread_attr_destroy(&attr);
 						} else  {
 							ast_mutex_unlock(&pri->lock);
 							/* Release PRI lock while we create the channel */

Modified: team/oej/fixtoheader-1.2/codecs/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/codecs/Makefile?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/codecs/Makefile (original)
+++ team/oej/fixtoheader-1.2/codecs/Makefile Sun Feb  4 18:45:48 2007
@@ -28,18 +28,18 @@
   LIBG723B=g723.1b/libg723b.a
 endif
 
-# XXX Uncomment this when transcoder support is merged into zaptel 1.2 !
-#ifndef WITHOUT_ZAPTEL
-#ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/pkg/include/zaptel.h),)
-#  ifeq (${OSARCH},NetBSD)
-#    SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/pkg/lib
-#  endif
-#  ifeq (${OSARCH},FreeBSD)
-#    SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
-#  endif
-#  CODECS+=codec_zap.so
-#endif
-#endif # WITHOUT_ZAPTEL
+ifndef WITHOUT_ZAPTEL
+ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/pkg/include/zaptel.h),)
+  ifeq (${OSARCH},NetBSD)
+    SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/pkg/lib
+  endif
+  ifeq (${OSARCH},FreeBSD)
+    SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
+  endif
+  CODECS+=codec_zap.so
+endif
+endif # WITHOUT_ZAPTEL
+
 
 UI_SPEEX=$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/speex.h)
 UIS_SPEEX=$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/speex/speex.h)

Modified: team/oej/fixtoheader-1.2/codecs/codec_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/codecs/codec_zap.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/codecs/codec_zap.c (original)
+++ team/oej/fixtoheader-1.2/codecs/codec_zap.c Sun Feb  4 18:45:48 2007
@@ -241,7 +241,7 @@
 {
 	/* Request translation through zap if possible */
 	int fd;
-	unsigned int x = ZT_TCOP_RESET;
+	unsigned int x = ZT_TCOP_ALLOCATE;
 	struct ast_translator_pvt *ztp;
 	struct zt_transcode_header *hdr;
 	int flags;
@@ -298,7 +298,7 @@
 {
 	/* Request translation through zap if possible */
 	int fd;
-	unsigned int x = ZT_TCOP_RESET;
+	unsigned int x = ZT_TCOP_ALLOCATE;
 	struct ast_translator_pvt *ztp;
 	struct zt_transcode_header *hdr;
 	int flags;
@@ -355,7 +355,7 @@
 {
 	/* Request translation through zap if possible */
 	int fd;
-	unsigned int x = ZT_TCOP_RESET;
+	unsigned int x = ZT_TCOP_ALLOCATE;
 	struct ast_translator_pvt *ztp;
 	struct zt_transcode_header *hdr;
 	int flags;
@@ -412,7 +412,7 @@
 {
 	/* Request translation through zap if possible */
 	int fd;
-	unsigned int x = ZT_TCOP_RESET;
+	unsigned int x = ZT_TCOP_ALLOCATE;
 	struct ast_translator_pvt *ztp;
 	struct zt_transcode_header *hdr;
 	int flags;
@@ -469,7 +469,7 @@
 {
 	/* Request translation through zap if possible */
 	int fd;
-	unsigned int x = ZT_TCOP_RESET;
+	unsigned int x = ZT_TCOP_ALLOCATE;
 	struct ast_translator_pvt *ztp;
 	struct zt_transcode_header *hdr;
 	int flags;
@@ -526,7 +526,7 @@
 {
 	/* Request translation through zap if possible */
 	int fd;
-	unsigned int x = ZT_TCOP_RESET;
+	unsigned int x = ZT_TCOP_ALLOCATE;
 	struct ast_translator_pvt *ztp;
 	struct zt_transcode_header *hdr;
 	int flags;
@@ -583,7 +583,7 @@
 {
 	/* Request translation through zap if possible */
 	int fd;
-	unsigned int x = ZT_TCOP_RESET;
+	unsigned int x = ZT_TCOP_ALLOCATE;
 	struct ast_translator_pvt *ztp;
 	struct zt_transcode_header *hdr;
 	int flags;
@@ -640,7 +640,7 @@
 {
 	/* Request translation through zap if possible */
 	int fd;
-	unsigned int x = ZT_TCOP_RESET;
+	unsigned int x = ZT_TCOP_ALLOCATE;
 	struct ast_translator_pvt *ztp;
 	struct zt_transcode_header *hdr;
 	int flags;

Modified: team/oej/fixtoheader-1.2/config.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/config.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/config.c (original)
+++ team/oej/fixtoheader-1.2/config.c Sun Feb  4 18:45:48 2007
@@ -651,7 +651,7 @@
 				if (process_buf) {
 					char *buf = ast_strip(process_buf);
 					if (!ast_strlen_zero(buf)) {
-						if (process_text_line(cfg, &cat, buf, lineno, filename)) {
+						if (process_text_line(cfg, &cat, buf, lineno, fn)) {
 							cfg = NULL;
 							break;
 						}

Modified: team/oej/fixtoheader-1.2/funcs/func_strings.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/funcs/func_strings.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/funcs/func_strings.c (original)
+++ team/oej/fixtoheader-1.2/funcs/func_strings.c Sun Feb  4 18:45:48 2007
@@ -41,15 +41,18 @@
 
 static char *function_fieldqty(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
 {
-	char *varname, *varval, workspace[256];
+	char *varname, *varsubst, varval[8192] = "", *varval2 = varval;
 	char *delim = ast_strdupa(data);
 	int fieldcount = 0;
 
 	if (delim) {
 		varname = strsep(&delim, "|");
-		pbx_retrieve_variable(chan, varname, &varval, workspace, sizeof(workspace), NULL);
+		varsubst = alloca(strlen(varname) + 4);
+
+		sprintf(varsubst, "${%s}", varname);
+		pbx_substitute_variables_helper(chan, varsubst, varval, sizeof(varval) - 1);
 		if (delim) {
-			while (strsep(&varval, delim))
+			while (strsep(&varval2, delim))
 				fieldcount++;
 		} else if (!ast_strlen_zero(varval)) {
 			fieldcount = 1;

Modified: team/oej/fixtoheader-1.2/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/manager.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/manager.c (original)
+++ team/oej/fixtoheader-1.2/manager.c Sun Feb  4 18:45:48 2007
@@ -1077,6 +1077,7 @@
 			} else {
 				res = 0;
 			}
+			pthread_attr_destroy(&attr);
 		}
 	} else if (!ast_strlen_zero(app)) {
         	res = ast_pbx_outgoing_app(tech, AST_FORMAT_SLINEAR, data, to, app, appdata, &reason, 1, l, n, vars, account, NULL);

Modified: team/oej/fixtoheader-1.2/pbx.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/pbx.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/pbx.c (original)
+++ team/oej/fixtoheader-1.2/pbx.c Sun Feb  4 18:45:48 2007
@@ -974,8 +974,7 @@
 	return ret;
 }
 
-/*! \brief  pbx_retrieve_variable: Support for Asterisk built-in variables and
-      functions in the dialplan
+/*! \brief  pbx_retrieve_variable: Support for Asterisk built-in variables
   ---*/
 void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp)
 {
@@ -2541,8 +2540,10 @@
 	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 	if (ast_pthread_create(&t, &attr, pbx_thread, c)) {
 		ast_log(LOG_WARNING, "Failed to create new channel thread\n");
+		pthread_attr_destroy(&attr);
 		return AST_PBX_FAILED;
 	}
+	pthread_attr_destroy(&attr);
 
 	return AST_PBX_SUCCESS;
 }
@@ -5125,8 +5126,10 @@
 			}
 			ast_hangup(chan);
 			res = -1;
+			pthread_attr_destroy(&attr);
 			goto outgoing_exten_cleanup;
 		}
+		pthread_attr_destroy(&attr);
 		res = 0;
 	}
 outgoing_exten_cleanup:
@@ -5228,6 +5231,7 @@
 							if (locked_channel) 
 								*locked_channel = chan;
 						}
+						pthread_attr_destroy(&attr);
 					}
 				} else {
 					ast_log(LOG_ERROR, "Out of memory :(\n");
@@ -5290,11 +5294,13 @@
 				ast_mutex_unlock(&chan->lock);
 			ast_hangup(chan);
 			res = -1;
+			pthread_attr_destroy(&attr);
 			goto outgoing_app_cleanup;
 		} else {
 			if (locked_channel)
 				*locked_channel = chan;
 		}
+		pthread_attr_destroy(&attr);
 		res = 0;
 	}
 outgoing_app_cleanup:

Modified: team/oej/fixtoheader-1.2/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/pbx/pbx_dundi.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/pbx/pbx_dundi.c (original)
+++ team/oej/fixtoheader-1.2/pbx/pbx_dundi.c Sun Feb  4 18:45:48 2007
@@ -799,8 +799,10 @@
 			memset(&ied, 0, sizeof(ied));
 			dundi_ie_append_cause(&ied, DUNDI_IE_CAUSE, DUNDI_CAUSE_GENERAL, "Out of threads");
 			dundi_send(trans, DUNDI_COMMAND_EIDRESPONSE, 0, 1, &ied);
+			pthread_attr_destroy(&attr);
 			return -1;
 		}
+		pthread_attr_destroy(&attr);
 	} else {
 		ast_log(LOG_WARNING, "Out of memory!\n");
 		memset(&ied, 0, sizeof(ied));
@@ -1030,8 +1032,10 @@
 			memset(&ied, 0, sizeof(ied));
 			dundi_ie_append_cause(&ied, DUNDI_IE_CAUSE, DUNDI_CAUSE_GENERAL, "Out of threads");
 			dundi_send(trans, DUNDI_COMMAND_PRECACHERP, 0, 1, &ied);
+			pthread_attr_destroy(&attr);
 			return -1;
 		}
+		pthread_attr_destroy(&attr);
 	} else {
 		ast_log(LOG_WARNING, "Out of memory!\n");
 		memset(&ied, 0, sizeof(ied));
@@ -1122,8 +1126,10 @@
 			memset(&ied, 0, sizeof(ied));
 			dundi_ie_append_cause(&ied, DUNDI_IE_CAUSE, DUNDI_CAUSE_GENERAL, "Out of threads");
 			dundi_send(trans, DUNDI_COMMAND_DPRESPONSE, 0, 1, &ied);
+			pthread_attr_destroy(&attr);
 			return -1;
 		}
+		pthread_attr_destroy(&attr);
 	} else {
 		ast_log(LOG_WARNING, "Out of memory!\n");
 		memset(&ied, 0, sizeof(ied));

Modified: team/oej/fixtoheader-1.2/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/pbx/pbx_spool.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/pbx/pbx_spool.c (original)
+++ team/oej/fixtoheader-1.2/pbx/pbx_spool.c Sun Feb  4 18:45:48 2007
@@ -295,6 +295,7 @@
 		ast_log(LOG_WARNING, "Unable to create thread :( (returned error: %d)\n", ret);
 		free_outgoing(o);
 	}
+	pthread_attr_destroy(&attr);
 }
 
 static int scan_service(char *fn, time_t now, time_t atime)
@@ -426,6 +427,7 @@
 		ast_log(LOG_WARNING, "Unable to create thread :( (returned error: %d)\n", ret);
 		return -1;
 	}
+	pthread_attr_destroy(&attr);
 	return 0;
 }
 

Modified: team/oej/fixtoheader-1.2/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/res/res_musiconhold.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/res/res_musiconhold.c (original)
+++ team/oej/fixtoheader-1.2/res/res_musiconhold.c Sun Feb  4 18:45:48 2007
@@ -203,28 +203,29 @@
 	struct moh_files_state *state = chan->music_state;
 	int tries;
 
+	/* Discontinue a stream if it is running already */
+	if (chan->stream) {
+		ast_closestream(chan->stream);
+		chan->stream = NULL;
+	}
+
+	/* If a specific file has been saved, use it */
 	if (state->save_pos) {
 		state->pos = state->save_pos;
 		state->save_pos = 0;
-	}
-
-	state->samples = 0;
-	if (chan->stream) {
-		ast_closestream(chan->stream);
-		chan->stream = NULL;
+	} else if (ast_test_flag(state->class, MOH_RANDOMIZE)) {
+		/* Get a random file and ensure we can open it */
+		for (tries = 0; tries < 20; tries++) {
+			state->pos = rand() % state->class->total_files;
+			if (ast_fileexists(state->class->filearray[state->pos], NULL, NULL) > 0)
+				break;
+		}
+		state->samples = 0;
+	} else {
+		/* This is easy, just increment our position and make sure we don't exceed the total file count */
 		state->pos++;
 		state->pos %= state->class->total_files;
-	}
-
-	if (ast_test_flag(state->class, MOH_RANDOMIZE)) {
-		/* Try 20 times to find something good */
-		for (tries = 0; tries < 20; tries++) {
-			state->pos = rand() % state->class->total_files;
-
-			/* check to see if this file's format can be opened */
-			if (ast_fileexists(state->class->filearray[state->pos], NULL, NULL) > 0)
-				break;
-		}
+		state->samples = 0;
 	}
 
 	if (!ast_openstream_full(chan, state->class->filearray[state->pos], chan->language, 1)) {

Modified: team/oej/fixtoheader-1.2/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/fixtoheader-1.2/rtp.c?view=diff&rev=53145&r1=53144&r2=53145
==============================================================================
--- team/oej/fixtoheader-1.2/rtp.c (original)
+++ team/oej/fixtoheader-1.2/rtp.c Sun Feb  4 18:45:48 2007
@@ -522,7 +522,7 @@
 	}
 
 	if(rtp_debug_test_addr(&sin))
-		ast_verbose("Got RTP packet from %s:%d (type %d, seq %d, ts %d, len %d)\n"
+		ast_verbose("Got RTP packet from %s:%u (type %d, seq %u, ts %u, len %d)\n"
 			, ast_inet_ntoa(iabuf, sizeof(iabuf), sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp,res - hdrlen);
 
    rtpPT = ast_rtp_lookup_pt(rtp, payloadtype);



More information about the asterisk-commits mailing list