[asterisk-commits] oej: branch oej/videocaps r53223 - in /team/oej/videocaps: ./ apps/ channels/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Feb 5 16:51:24 MST 2007


Author: oej
Date: Mon Feb  5 17:51:23 2007
New Revision: 53223

URL: http://svn.digium.com/view/asterisk?view=rev&rev=53223
Log:
Update, reset automerge, blame file.

Added:
    team/oej/videocaps/doc/queue.txt
      - copied unchanged from r53200, trunk/doc/queue.txt
Modified:
    team/oej/videocaps/   (props changed)
    team/oej/videocaps/Makefile
    team/oej/videocaps/UPGRADE.txt
    team/oej/videocaps/apps/app_dial.c
    team/oej/videocaps/apps/app_meetme.c
    team/oej/videocaps/apps/app_playback.c
    team/oej/videocaps/apps/app_queue.c
    team/oej/videocaps/apps/app_setcallerid.c
    team/oej/videocaps/apps/app_userevent.c
    team/oej/videocaps/channels/chan_h323.c
    team/oej/videocaps/channels/chan_iax2.c
    team/oej/videocaps/channels/chan_mgcp.c
    team/oej/videocaps/channels/chan_sip.c
    team/oej/videocaps/channels/chan_skinny.c
    team/oej/videocaps/channels/chan_zap.c
    team/oej/videocaps/channels/h323/ast_h323.cxx
    team/oej/videocaps/configs/sip.conf.sample
    team/oej/videocaps/funcs/func_callerid.c
    team/oej/videocaps/funcs/func_odbc.c
    team/oej/videocaps/funcs/func_strings.c
    team/oej/videocaps/main/asterisk.c
    team/oej/videocaps/main/cdr.c
    team/oej/videocaps/main/config.c
    team/oej/videocaps/main/db1-ast/hash/hash.c
    team/oej/videocaps/main/devicestate.c
    team/oej/videocaps/main/http.c
    team/oej/videocaps/main/io.c
    team/oej/videocaps/main/manager.c
    team/oej/videocaps/main/pbx.c
    team/oej/videocaps/main/rtp.c
    team/oej/videocaps/pbx/pbx_dundi.c
    team/oej/videocaps/pbx/pbx_spool.c
    team/oej/videocaps/res/res_features.c
    team/oej/videocaps/res/res_musiconhold.c

Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Feb  5 17:51:23 2007
@@ -1,1 +1,1 @@
-/trunk:1-53023
+/trunk:1-53221

Modified: team/oej/videocaps/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/Makefile?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/Makefile (original)
+++ team/oej/videocaps/Makefile Mon Feb  5 17:51:23 2007
@@ -540,6 +540,7 @@
 		echo "" ; \
 		echo ";[options]" ; \
 		echo ";internal_timing = yes" ; \
+		echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
 		echo "; Changing the following lines may compromise your security." ; \
 		echo ";[files]" ; \
 		echo ";astctlpermissions = 0660" ; \

Modified: team/oej/videocaps/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/UPGRADE.txt?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/UPGRADE.txt (original)
+++ team/oej/videocaps/UPGRADE.txt Mon Feb  5 17:51:23 2007
@@ -34,3 +34,5 @@
 * ChanIsAvail() now has a 't' option, which allows the specified device
   to be queried for state without consulting the channel drivers. This
   performs mostly a 'ChanExists' sort of function.
+* SetCallerPres() has been replaced with the CALLERPRES() dialplan function
+  and is now deprecated.

Modified: team/oej/videocaps/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_dial.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/apps/app_dial.c (original)
+++ team/oej/videocaps/apps/app_dial.c Mon Feb  5 17:51:23 2007
@@ -82,7 +82,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"
@@ -1191,6 +1191,7 @@
 	struct privacy_args pa = {
 		.sentringing = 0,
 		.privdb_val = 0,
+		.status = "INVALIDARGS",
 	};
 	int sentringing = 0, moh = 0;
 	const char *outbound_group = NULL;
@@ -1209,23 +1210,27 @@
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "Dial requires an argument (technology/number)\n");
+		pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
 		return -1;
 	}
 
 	u = ast_module_user_add(chan);	/* XXX is this the right place ? */
 
 	parse = ast_strdupa(data);
-
+	
 	AST_STANDARD_APP_ARGS(args, parse);
 
 	memset(&config,0,sizeof(struct ast_bridge_config));
 
 	if (!ast_strlen_zero(args.options) &&
-			ast_app_parse_options(dial_exec_options, &opts, opt_args, args.options))
+			ast_app_parse_options(dial_exec_options, &opts, opt_args, args.options)) {
+		pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
 		goto done;
+	}
 
 	if (ast_strlen_zero(args.peers)) {
 		ast_log(LOG_WARNING, "Dial requires an argument (technology/number)\n");
+		pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
 		goto done;
 	}
 
@@ -1239,6 +1244,7 @@
 		calldurationlimit = atoi(opt_args[OPT_ARG_DURATION_STOP]);
 		if (!calldurationlimit) {
 			ast_log(LOG_WARNING, "Dial does not accept S(%s), hanging up.\n", opt_args[OPT_ARG_DURATION_STOP]);
+			pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
 			goto done;
 		}
 		if (option_verbose > 2)

Modified: team/oej/videocaps/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_meetme.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/apps/app_meetme.c (original)
+++ team/oej/videocaps/apps/app_meetme.c Mon Feb  5 17:51:23 2007
@@ -1081,6 +1081,7 @@
 		pthread_attr_init(&conf->attr);
 		pthread_attr_setdetachstate(&conf->attr, PTHREAD_CREATE_DETACHED);
 		ast_pthread_create_background(&conf->recordthread, &conf->attr, recordthread, conf);
+		pthread_attr_destroy(&conf->attr);
 	}
 
 	time(&user->jointime);

Modified: team/oej/videocaps/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_playback.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/apps/app_playback.c (original)
+++ team/oej/videocaps/apps/app_playback.c Mon Feb  5 17:51:23 2007
@@ -68,7 +68,7 @@
 ;
 
 
-static struct ast_config *say_cfg;
+static struct ast_config *say_cfg = NULL;
 /* save the say' api calls.
  * The first entry is NULL if we have the standard source,
  * otherwise we are sourcing from here.
@@ -468,6 +468,8 @@
 
 	res = ast_unregister_application(app);
 
+	ast_cli_unregister_multiple(cli_playback, sizeof(cli_playback) / sizeof(struct ast_cli_entry));
+
 	ast_module_user_hangup_all();
 
 	if (say_cfg)

Modified: team/oej/videocaps/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_queue.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/apps/app_queue.c (original)
+++ team/oej/videocaps/apps/app_queue.c Mon Feb  5 17:51:23 2007
@@ -564,7 +564,7 @@
 	AST_LIST_UNLOCK(&interfaces);
 
 	if (!curint) {
-		if (option_debug)
+		if (option_debug > 2)
 			ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s) but we don't care because they're not a member of any queue.\n", technology, loc, sc->state, devstate2str(sc->state));
 		free(sc);
 		return NULL;
@@ -631,6 +631,7 @@
 		ast_log(LOG_WARNING, "Failed to create update thread!\n");
 		free(sc);
 	}
+	pthread_attr_destroy(&attr);
 
 	return 0;
 }
@@ -956,10 +957,11 @@
 	}
 }
 
-static void rt_handle_member_record(struct call_queue *q, char *interface, const char *membername, const char *penalty_str)
+static void rt_handle_member_record(struct call_queue *q, char *interface, const char *membername, const char *penalty_str, const char *paused_str)
 {
 	struct member *m, *prev_m;
 	int penalty = 0;
+	int paused  = 0;
 
 	if (penalty_str) {
 		penalty = atoi(penalty_str);
@@ -967,6 +969,12 @@
 			penalty = 0;
 	}
 
+	if (paused_str) {
+		paused = atoi(paused_str);
+		if (paused < 0)
+			paused = 0;
+	}
+
 	/* Find the member, or the place to put a new one. */
 	for (m = q->members, prev_m = NULL;
 		m && strcmp(m->interface, interface);
@@ -974,7 +982,7 @@
 
 	/* Create a new one if not found, else update penalty */
 	if (!m) {
-		if ((m = create_queue_member(interface, membername, penalty, 0))) {
+		if ((m = create_queue_member(interface, membername, penalty, paused))) {
 			m->dead = 0;
 			add_to_interfaces(interface);
 			if (prev_m) {
@@ -985,6 +993,8 @@
 		}
 	} else {
 		m->dead = 0;	/* Do not delete this one. */
+		if (paused_str)
+			m->paused = paused;
 		m->penalty = penalty;
 	}
 }
@@ -1106,7 +1116,8 @@
 	while ((interface = ast_category_browse(member_config, interface))) {
 		rt_handle_member_record(q, interface,
 			S_OR(ast_variable_retrieve(member_config, interface, "membername"), interface),
-			ast_variable_retrieve(member_config, interface, "penalty"));
+			ast_variable_retrieve(member_config, interface, "penalty"),
+			ast_variable_retrieve(member_config, interface, "paused"));
 	}
 
 	/* Delete all realtime members that have been deleted in DB. */

Modified: team/oej/videocaps/apps/app_setcallerid.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_setcallerid.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/apps/app_setcallerid.c (original)
+++ team/oej/videocaps/apps/app_setcallerid.c Mon Feb  5 17:51:23 2007
@@ -68,9 +68,14 @@
 {
 	struct ast_module_user *u;
 	int pres = -1;
+	static int deprecated = 0;
 
 	u = ast_module_user_add(chan);
-	
+
+	if (!deprecated) {
+		deprecated = 1;
+		ast_log(LOG_WARNING, "SetCallerPres is deprecated.  Please use Set(CALLERPRES()=%s) instead.\n", (char *)data);
+	}
 	pres = ast_parse_caller_presentation(data);
 
 	if (pres < 0) {

Modified: team/oej/videocaps/apps/app_userevent.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_userevent.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/apps/app_userevent.c (original)
+++ team/oej/videocaps/apps/app_userevent.c Mon Feb  5 17:51:23 2007
@@ -83,7 +83,7 @@
 		buflen += 2;
 	}
 
-	manager_event(EVENT_FLAG_USER, "UserEvent", "UserEvent: %s\r\n%s\r\n", args.eventname, buf);
+	manager_event(EVENT_FLAG_USER, "UserEvent", "UserEvent: %s\r\n%s", args.eventname, buf);
 
 	ast_module_user_remove(u);
 

Modified: team/oej/videocaps/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/channels/chan_h323.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/channels/chan_h323.c (original)
+++ team/oej/videocaps/channels/chan_h323.c Mon Feb  5 17:51:23 2007
@@ -35,7 +35,7 @@
 
 /*** MODULEINFO
 	<depend>openh323</depend>
-	<defaultenabled>no</defaultenabled>
+	<defaultenabled>yes</defaultenabled>
  ***/
 
 #ifdef __cplusplus
@@ -2612,8 +2612,10 @@
 			monitor_thread = AST_PTHREADT_NULL;
 			ast_mutex_unlock(&monlock);
 			ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
+			pthread_attr_destroy(&attr);
 			return -1;
 		}
+		pthread_attr_destroy(&attr);
 	}
 	ast_mutex_unlock(&monlock);
 	return 0;

Modified: team/oej/videocaps/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/channels/chan_iax2.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/channels/chan_iax2.c (original)
+++ team/oej/videocaps/channels/chan_iax2.c Mon Feb  5 17:51:23 2007
@@ -6163,6 +6163,8 @@
 	if (ast_pthread_create(&newthread, &attr, dp_lookup_thread, dpr)) {
 		ast_log(LOG_WARNING, "Unable to start lookup thread!\n");
 	}
+
+	pthread_attr_destroy(&attr);
 }
 
 struct iax_dual {
@@ -6237,8 +6239,11 @@
 
 		d->chan1 = chan1m;
 		d->chan2 = chan2m;
-		if (!ast_pthread_create_background(&th, &attr, iax_park_thread, d))
+		if (!ast_pthread_create_background(&th, &attr, iax_park_thread, d)) {
+			pthread_attr_destroy(&attr);
 			return 0;
+		}
+		pthread_attr_destroy(&attr);
 		free(d);
 	}
 	return -1;

Modified: team/oej/videocaps/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/channels/chan_mgcp.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/channels/chan_mgcp.c (original)
+++ team/oej/videocaps/channels/chan_mgcp.c Mon Feb  5 17:51:23 2007
@@ -3007,6 +3007,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/videocaps/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/channels/chan_sip.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/channels/chan_sip.c (original)
+++ team/oej/videocaps/channels/chan_sip.c Mon Feb  5 17:51:23 2007
@@ -536,6 +536,7 @@
 static struct ast_codec_pref default_prefs;		/*!< Default codec prefs */
 
 /* Global settings only apply to the channel */
+static int global_directrtpsetup;	/*!< Enable support for Direct RTP setup (no re-invites) */
 static int global_limitonpeers;		/*!< Match call limit on peers only */
 static int global_rtautoclear;
 static int global_notifyringing;	/*!< Send notifications on ringing */
@@ -573,7 +574,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;
 
 /* Object counters */
 static int suserobjs = 0;                /*!< Static users */
@@ -966,6 +966,7 @@
 	struct ast_capabilities peercaps; /*!< Video capapbilities taken from the sdp */
 	int prefcodec;				/*!< Preferred codec (outbound only) */
 	int noncodeccapability;			/*!< DTMF RFC2833 telephony-event */
+	int jointnoncodeccapability;            /*!< Joint Non codec capability */
 	int redircodecs;			/*!< Redirect codecs */
 	struct t38properties t38;		/*!< T38 settings */
 	struct sockaddr_in udptlredirip;	/*!< Where our T.38 UDPTL should be going if not to us */
@@ -1119,6 +1120,7 @@
 	int inRinging;			/*!< Number of calls ringing */
 	int onHold;                     /*!< Peer has someone on hold */
 	int call_limit;			/*!< Limit of concurrent calls */
+	int busy_limit;			/*!< Limit where we signal busy */
 	enum transfermodes allowtransfer;	/*! SIP Refer restriction scheme */
 	char vmexten[AST_MAX_EXTENSION]; /*!< Dialplan extension for MWI notify message*/
 	char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox setting for MWI checks */
@@ -3019,7 +3021,8 @@
 			ast_verbose("SIPCALL: Setting sip_pvt call rate to %d for %s in sip_call()\n", p->caps.maxcallbitrate, p->username);
 	}
 	p->jointcapability = ast_translate_available_formats(p->capability, p->prefcodec);
-	
+	p->jointnoncodeccapability = p->noncodeccapability;
+
 	/* If there are no audio formats left to offer, punt */
 	if (!(p->jointcapability & AST_FORMAT_AUDIO_MASK)) {
 		ast_log(LOG_WARNING, "No audio format found to offer. Cancelling call to %s\n", p->username);
@@ -3072,6 +3075,12 @@
 
 	if (sip_debug_test_pvt(p) || option_debug > 2)
 		ast_verbose("Really destroying SIP dialog '%s' Method: %s\n", p->callid, sip_methods[p->method].text);
+
+	if (ast_test_flag(&p->flags[0], SIP_INC_COUNT)) {
+		update_call_counter(p, DEC_CALL_LIMIT);
+		if (option_debug > 1)
+			ast_log(LOG_DEBUG, "This call did not properly clean up call limits. Call ID %s\n", p->callid);
+	}
 
 	/* Remove link from peer to subscription of MWI */
 	if (p->relatedpeer && p->relatedpeer->mwipvt) 
@@ -3216,9 +3225,10 @@
 	/* incoming and outgoing affects the inUse counter */
 	case DEC_CALL_LIMIT:
 		/* Decrement inuse count if applicable */
-		if (inuse && ast_test_flag(&fup->flags[0], SIP_INC_COUNT))
+		if (inuse && ast_test_flag(&fup->flags[0], SIP_INC_COUNT)) {
 			ast_atomic_fetchadd_int(inuse, -1);
-		else
+			ast_clear_flag(&fup->flags[0], SIP_INC_COUNT);
+		} else
 			*inuse = 0;
 		/* Decrement ringing count if applicable */
 		if (inringing && ast_test_flag(&fup->flags[1], SIP_PAGE2_INC_RINGING)) {
@@ -3727,7 +3737,7 @@
 				we simply forget the frames if we get modem frames before the bridge is up.
 				Fax will re-transmit.
 			*/
-			if (p->udptl && ast->_state != AST_STATE_UP) 
+			if (p->udptl && ast->_state == AST_STATE_UP) 
 				res = ast_udptl_write(p->udptl, frame);
 			sip_pvt_unlock(p);
 		}
@@ -5754,7 +5764,7 @@
 
 	newjointcapability = p->capability & (peercapability | vpeercapability | tpeercapability);
 	newpeercapability = (peercapability | vpeercapability | tpeercapability);
-	newnoncodeccapability = noncodeccapability & peernoncodeccapability;
+	newnoncodeccapability = p->noncodeccapability & peernoncodeccapability;
 		
 		
 	if (sipdebug_caps) {
@@ -5769,7 +5779,7 @@
 			    ast_getformatname_multiple(s5, BUFSIZ, newjointcapability));
 
 		ast_verbose("Non-codec capabilities (dtmf): us - %s, peer - %s, combined - %s\n",
-			    ast_rtp_lookup_mime_multiple(s1, BUFSIZ, noncodeccapability, 0, 0),
+			    ast_rtp_lookup_mime_multiple(s1, BUFSIZ, p->noncodeccapability, 0, 0),
 			    ast_rtp_lookup_mime_multiple(s2, BUFSIZ, peernoncodeccapability, 0, 0),
 			    ast_rtp_lookup_mime_multiple(s3, BUFSIZ, newnoncodeccapability, 0, 0));
 	}
@@ -5788,9 +5798,9 @@
 
 	/* We are now ready to change the sip session and p->rtp and p->vrtp with the offered codecs, since
 		they are acceptable */
-	p->jointcapability = newjointcapability;	/* Our joint codec profile for this call */
-	p->peercapability = newpeercapability;		/* The other sides capability in latest offer */
-	p->noncodeccapability = newnoncodeccapability;	/* DTMF capabilities */
+	p->jointcapability = newjointcapability;	        /* Our joint codec profile for this call */
+	p->peercapability = newpeercapability;		        /* The other sides capability in latest offer */
+	p->jointnoncodeccapability = newnoncodeccapability;	/* DTMF capabilities */
 
 	ast_rtp_pt_copy(p->rtp, newaudiortp);
 	if (p->vrtp)
@@ -5803,6 +5813,9 @@
 		if (newnoncodeccapability & AST_RTP_DTMF) {
 			/* XXX Would it be reasonable to drop the DSP at this point? XXX */
 			ast_set_flag(&p->flags[0], SIP_DTMF_RFC2833);
+			/* Since RFC2833 is now negotiated we need to change some properties of the RTP stream */
+			ast_rtp_setdtmf(p->rtp, 1);
+			ast_rtp_setdtmfcompensate(p->rtp, ast_test_flag(&p->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
 		} else {
 			ast_set_flag(&p->flags[0], SIP_DTMF_INBAND);
 		}
@@ -7149,7 +7162,7 @@
 
 	/* Now add DTMF RFC2833 telephony-event as a codec */
 	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,
@@ -7744,6 +7757,10 @@
 		pidfnote = "Unavailable";
 		break;
 	case AST_EXTENSION_ONHOLD:
+		statestring = "confirmed";
+		local_state = NOTIFY_INUSE;
+		pidfstate = "busy";
+		pidfnote = "On hold";
 		break;
 	case AST_EXTENSION_NOT_INUSE:
 	default:
@@ -7839,6 +7856,11 @@
 		else
 			ast_build_string(&t, &maxbytes, "<dialog id=\"%s\">\n", p->exten);
 		ast_build_string(&t, &maxbytes, "<state>%s</state>\n", statestring);
+		if (state == AST_EXTENSION_ONHOLD) {
+			ast_build_string(&t, &maxbytes, "<local>\n<target uri=\"%s\">\n"
+			                                "<param pname=\"+sip.rendering\" pvalue=\"no\">\n"
+			                                "</target>\n</local>\n", mto);
+		}
 		ast_build_string(&t, &maxbytes, "</dialog>\n</dialog-info>\n");
 		break;
 	case NONE:
@@ -10334,7 +10356,7 @@
 			snprintf(ilimits, sizeof(ilimits), "%d", iterator->call_limit);
 		else 
 			ast_copy_string(ilimits, "N/A", sizeof(ilimits));
-		snprintf(iused, sizeof(iused), "%d/%d", iterator->inUse, iterator->inRinging);
+		snprintf(iused, sizeof(iused), "%d/%d/%d", iterator->inUse, iterator->inRinging, iterator->onHold);
 		if (showall || iterator->call_limit)
 			ast_cli(fd, FORMAT2, iterator->name, iused, ilimits);
 		ASTOBJ_UNLOCK(iterator);
@@ -11000,6 +11022,8 @@
 		ast_cli(fd, "  VM Extension : %s\n", peer->vmexten);
 		ast_cli(fd, "  LastMsgsSent : %d/%d\n", (peer->lastmsgssent & 0x7fff0000) >> 16, peer->lastmsgssent & 0xffff);
 		ast_cli(fd, "  Call limit   : %d\n", peer->call_limit);
+		if (peer->busy_limit)
+			ast_cli(fd, "  Busy limit   : %d\n", peer->busy_limit);
 		ast_cli(fd, "  Dynamic      : %s\n", (ast_test_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC)?"Yes":"No"));
 		ast_cli(fd, "  Callerid     : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "<unspecified>"));
 		ast_cli(fd, "  MaxCallBR    : %dkbps\n", peer->caps.maxcallbitrate/1000);
@@ -11090,7 +11114,8 @@
 		astman_append(s, "VoiceMailbox: %s\r\n", peer->mailbox);
 		astman_append(s, "TransferMode: %s\r\n", transfermode2str(peer->allowtransfer));
 		astman_append(s, "LastMsgsSent: %d\r\n", peer->lastmsgssent);
-		astman_append(s, "Call limit: %d\r\n", peer->call_limit);
+		astman_append(s, "Call-limit: %d\r\n", peer->call_limit);
+		astman_append(s, "Busy-limit: %d\r\n", peer->busy_limit);
 		astman_append(s, "MaxCallBR: %dkbps\r\n", peer->caps.maxcallbitrate/1000);
 		astman_append(s, "VideoUpdate: %s\n", (peer->videoupdate == 0) ? "none" : (peer->videoupdate == VIDEO_UPDATE_XML) ? "XML" : (peer->videoupdate == VIDEO_UPDATE_RTCP) ? "RTCP": "XML and RTCP");
 		astman_append(s, "Dynamic: %s\r\n", (ast_test_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC)?"Y":"N"));
@@ -11265,6 +11290,7 @@
 	ast_cli(fd, "  Realm. auth:            %s\n", authl ? "Yes": "No");
  	ast_cli(fd, "  Always auth rejects:    %s\n", global_alwaysauthreject ? "Yes" : "No");
 	ast_cli(fd, "  Call limit peers only:  %s\n", global_limitonpeers ? "Yes" : "No");
+	ast_cli(fd, "  Direct RTP setup:       %s\n", global_directrtpsetup ? "Yes" : "No");
 	ast_cli(fd, "  User Agent:             %s\n", global_useragent);
 	ast_cli(fd, "  MWI checking interval:  %d secs\n", global_mwitime);
 	ast_cli(fd, "  Reg. context:           %s\n", S_OR(global_regcontext, "(not set)"));
@@ -13657,8 +13683,10 @@
 			/* Could not start thread */
 			free(d);	/* We don't need it anymore. If thread is created, d will be free'd
 					   by sip_park_thread() */
+			pthread_attr_destroy(&attr);
 			return 0;
 		}
+		pthread_attr_destroy(&attr);
 	} 
 	return -1;
 }
@@ -16171,9 +16199,19 @@
 		- not registered			AST_DEVICE_UNAVAILABLE
 		- registered				AST_DEVICE_NOT_INUSE
 		- fixed IP (!dynamic)			AST_DEVICE_NOT_INUSE
+	
+	Peers that does not have a known call and can't be reached by OPTIONS
+		- unreachable				AST_DEVICE_UNAVAILABLE
 
 	If we return AST_DEVICE_UNKNOWN, the device state engine will try to find
 	out a state by walking the channel list.
+
+	The queue system (\ref app_queue.c) treats a member as "active"
+	if devicestate is != AST_DEVICE_UNAVAILBALE && != AST_DEVICE_INVALID
+
+	When placing a call to the queue member, queue system sets a member to busy if
+	!= AST_DEVICE_NOT_INUSE and != AST_DEVICE_UNKNOWN
+
 */
 static int sip_devicestate(void *data)
 {
@@ -16197,27 +16235,38 @@
 	if ((p = find_peer(host, NULL, 1))) {
 		if (p->addr.sin_addr.s_addr || p->defaddr.sin_addr.s_addr) {
 			/* we have an address for the peer */
-			/* if qualify is turned on, check the status */
-			if (p->maxms && (p->lastms > p->maxms)) {
+		
+			/* Check status in this order
+				- Hold
+				- Ringing
+				- Busy (enforced only by call limit)
+				- Inuse (we have a call)
+				- Unreachable (qualify)
+			   If we don't find any of these state, report AST_DEVICE_NOT_INUSE
+			   for registered devices */
+
+			if (p->onHold)
+				/* First check for hold or ring states */
+				res = AST_DEVICE_ONHOLD;
+			else if (p->inRinging) {
+				if (p->inRinging == p->inUse)
+					res = AST_DEVICE_RINGING;
+				else
+					res = AST_DEVICE_RINGINUSE;
+			} else if (p->call_limit && (p->inUse == p->call_limit))
+				/* check call limit */
+				res = AST_DEVICE_BUSY;
+			else if (p->call_limit && p->busy_limit && p->inUse >= p->busy_limit)
+				/* We're forcing busy before we've reached the call limit */
+				res = AST_DEVICE_BUSY;
+			else if (p->call_limit && p->inUse)
+				/* Not busy, but we do have a call */
+				res = AST_DEVICE_INUSE;
+			else if (p->maxms && (p->lastms > p->maxms)) 
+				/* We don't have a call. Are we reachable at all? Requires qualify= */
 				res = AST_DEVICE_UNAVAILABLE;
-			} else {
-				/* qualify is not on, or the peer is responding properly */
-				/* check call limit */
-				if (p->call_limit && (p->inUse == p->call_limit))
-					res = AST_DEVICE_BUSY;
-				else if (p->call_limit && p->inUse)
-					res = AST_DEVICE_INUSE;
-				else
-					res = AST_DEVICE_NOT_INUSE;
-				if (p->onHold)
-					res = AST_DEVICE_ONHOLD;
-				else if (p->inRinging) {
-					if (p->inRinging == p->inUse)
-						res = AST_DEVICE_RINGING;
-					else
-						res = AST_DEVICE_RINGINUSE;
-				}
-			}
+			else	/* Default reply if we're registered and have no other data */
+				res = AST_DEVICE_NOT_INUSE;
 		} else {
 			/* there is no address, it's unavailable */
 			res = AST_DEVICE_UNAVAILABLE;
@@ -17177,6 +17226,7 @@
 	global_notifyringing = DEFAULT_NOTIFYRINGING;
 	global_limitonpeers = FALSE;		/*!< Match call limit on peers only */
 	global_notifyhold = FALSE;		/*!< Keep track of hold status for a peer */
+	global_directrtpsetup = FALSE;		/* Experimental feature, disabled by default */
 	global_alwaysauthreject = 0;
 	global_allowsubscribe = FALSE;
 	snprintf(global_useragent, sizeof(global_useragent), "%s %s", DEFAULT_USERAGENT, ASTERISK_VERSION);
@@ -17305,6 +17355,8 @@
 			ast_copy_string(default_notifymime, v->value, sizeof(default_notifymime));
 		} else if (!strcasecmp(v->name, "limitonpeers")) {
 			global_limitonpeers = ast_true(v->value);
+		} else if (!strcasecmp(v->name, "directrtpsetup")) {
+			global_directrtpsetup = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "notifyringing")) {
 			global_notifyringing = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "notifyhold")) {
@@ -17903,6 +17955,11 @@
 	p = chan->tech_pvt;
 	if (!p) 
 		return -1;
+
+	/* Disable early RTP bridge  */
+	if (chan->_state != AST_STATE_UP && !global_directrtpsetup) 	/* We are in early state */
+		return 0;
+
 	sip_pvt_lock(p);
 	if (ast_test_flag(&p->flags[0], SIP_ALREADYGONE)) {
 		/* If we're destroyed, don't bother */
@@ -18006,14 +18063,19 @@
 	if (!strcasecmp(mode,"info")) {
 		ast_clear_flag(&p->flags[0], SIP_DTMF);
 		ast_set_flag(&p->flags[0], SIP_DTMF_INFO);
+		p->jointnoncodeccapability &= ~AST_RTP_DTMF;
 	} else if (!strcasecmp(mode,"rfc2833")) {
 		ast_clear_flag(&p->flags[0], SIP_DTMF);
 		ast_set_flag(&p->flags[0], SIP_DTMF_RFC2833);
+		p->jointnoncodeccapability |= AST_RTP_DTMF;
 	} else if (!strcasecmp(mode,"inband")) { 
 		ast_clear_flag(&p->flags[0], SIP_DTMF);
 		ast_set_flag(&p->flags[0], SIP_DTMF_INBAND);
+		p->jointnoncodeccapability &= ~AST_RTP_DTMF;
 	} else
 		ast_log(LOG_WARNING, "I don't know about this dtmf mode: %s\n",mode);
+	if (p->rtp)
+		ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
 	if (ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_INBAND) {
 		if (!p->vad) {
 			p->vad = ast_dsp_new();

Modified: team/oej/videocaps/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/channels/chan_skinny.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/channels/chan_skinny.c (original)
+++ team/oej/videocaps/channels/chan_skinny.c Mon Feb  5 17:51:23 2007
@@ -4307,6 +4307,7 @@
 	if (skinnydebug)
 		ast_verbose("killing accept thread\n");
 	close(as);
+	pthread_attr_destroy(&attr);
 	return 0;
 }
 

Modified: team/oej/videocaps/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/channels/chan_zap.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/channels/chan_zap.c (original)
+++ team/oej/videocaps/channels/chan_zap.c Mon Feb  5 17:51:23 2007
@@ -3836,9 +3836,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);
 	mysig = p->sig;
@@ -4438,6 +4435,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)) {
@@ -4455,7 +4454,8 @@
 									!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
 							}
 							p->subs[SUB_THREEWAY].needhold = 1;
-						}		
+						}
+						pthread_attr_destroy(&attr);
 					}
 				} else {
 					/* Already have a 3 way call */
@@ -7049,6 +7049,7 @@
 				"interface %d\n", i->channel);
 		}
 	}
+	pthread_attr_destroy(&attr);
 	return 0;
 }
 
@@ -7273,10 +7274,12 @@
 		if (ast_pthread_create_background(&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;
 }
 
@@ -9180,9 +9183,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 */
@@ -9674,6 +9674,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",
@@ -9689,6 +9691,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/videocaps/channels/h323/ast_h323.cxx
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/channels/h323/ast_h323.cxx?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/channels/h323/ast_h323.cxx (original)
+++ team/oej/videocaps/channels/h323/ast_h323.cxx Mon Feb  5 17:51:23 2007
@@ -177,7 +177,7 @@
 	};
 };
 
-MyProcess::MyProcess(): PProcess("The NuFone Network's",
+MyProcess::MyProcess(): PProcess("The NuFone Networks",
 			"H.323 Channel Driver for Asterisk",
 			MAJOR_VERSION, MINOR_VERSION, BUILD_TYPE, BUILD_NUMBER)
 {

Modified: team/oej/videocaps/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/configs/sip.conf.sample?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/configs/sip.conf.sample (original)
+++ team/oej/videocaps/configs/sip.conf.sample Mon Feb  5 17:51:23 2007
@@ -197,6 +197,11 @@
 ; for a device. When the call limit is filled, we will indicate busy. Note that
 ; you need at least 2 in order to be able to do attended transfers.
 ;
+; If you set the busy-limit in addition to the call limit, we will indicate busy
+; when we have a number of calls that matches busy-limit, but still allow calls
+; up to the call-limit. This allows for transfers while still having blinking
+; lamps and queues understanding that a device is busy.
+;
 ; For queues, you will need this level of detail in status reporting, regardless
 ; if you use SIP subscriptions. Queues and manager use the same internal interface
 ; for reading status information.
@@ -329,6 +334,12 @@
 				; at call setup (a new feature in 1.4 - setting up the
 				; call directly between the endpoints instead of sending
 				; a re-INVITE).
+
+;directrtpsetup=yes		; Enable the new experimental direct RTP setup. This sets up
+				; the call directly with media peer-2-peer without re-invites.
+				; Will not work for video and cases where the callee sends 
+				; RTP payloads and fmtp headers in the 200 OK that does not match the
+				; callers INVITE.
 
 ;canreinvite=nonat		; An additional option is to allow media path redirection
 				; (reinvite) but only when the peer where the media is being
@@ -508,6 +519,7 @@
 ; videosupport		      videosupport
 ; maxcallbitrate	      maxcallbitrate
 ; rfc2833compensate           mailbox
+;			      busy-limit
 ;                             username
 ;                             template
 ;                             fromdomain
@@ -541,10 +553,12 @@
 ;host=box.provider.com
 ;usereqphone=yes			; This provider requires ";user=phone" on URI
 ;call-limit=5				; permit only 5 simultaneous outgoing calls to this peer
+;busy-limit=2				; Signal busy at 2 or more calls
 ;outboundproxy=proxy.provider.domain	; send outbound signaling to this proxy, not directly to the peer
 					; Call-limits will not be enforced on real-time peers,
 					; since they are not stored in-memory
 ;port=80				; The port number we want to connect to on the remote side
+					; Also used as "defaultport" in combination with "defaultip" settings
 
 ;--- sample definition for a provider
 ;[provider1]

Modified: team/oej/videocaps/funcs/func_callerid.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/funcs/func_callerid.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/funcs/func_callerid.c (original)
+++ team/oej/videocaps/funcs/func_callerid.c Mon Feb  5 17:51:23 2007
@@ -38,6 +38,22 @@
 #include "asterisk/app.h"
 #include "asterisk/options.h"
 #include "asterisk/callerid.h"
+
+static int callerpres_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
+{
+	ast_copy_string(buf, ast_named_caller_presentation(chan->cid.cid_pres), len);
+	return 0;
+}
+
+static int callerpres_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
+{
+	int pres = ast_parse_caller_presentation(value);
+	if (pres < 0)
+		ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show function CALLERPRES')\n", value);
+	else
+		chan->cid.cid_pres = pres;
+	return 0;
+}
 
 static int callerid_read(struct ast_channel *chan, const char *cmd, char *data,
 			 char *buf, size_t len)
@@ -173,14 +189,38 @@
 	.write = callerid_write,
 };
 
+static struct ast_custom_function callerpres_function = {
+	.name = "CALLERPRES",
+	.synopsis = "Gets or sets Caller*ID presentation on the channel.",
+	.syntax = "CALLERPRES()",
+	.desc =
+"Gets or sets Caller*ID presentation on the channel.  The following values\n"
+"are valid:\n"
+"      allowed_not_screened    : Presentation Allowed, Not Screened\n"
+"      allowed_passed_screen   : Presentation Allowed, Passed Screen\n" 
+"      allowed_failed_screen   : Presentation Allowed, Failed Screen\n" 
+"      allowed                 : Presentation Allowed, Network Number\n"
+"      prohib_not_screened     : Presentation Prohibited, Not Screened\n" 
+"      prohib_passed_screen    : Presentation Prohibited, Passed Screen\n"
+"      prohib_failed_screen    : Presentation Prohibited, Failed Screen\n"
+"      prohib                  : Presentation Prohibited, Network Number\n"
+"      unavailable             : Number Unavailable\n",
+	.read = callerpres_read,
+	.write = callerpres_write,
+};
+
 static int unload_module(void)
 {
-	return ast_custom_function_unregister(&callerid_function);
+	int res = ast_custom_function_unregister(&callerpres_function);
+	res |= ast_custom_function_unregister(&callerid_function);
+	return res;
 }
 
 static int load_module(void)
 {
-	return ast_custom_function_register(&callerid_function);
-}
-
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Caller ID related dialplan function");
+	int res = ast_custom_function_register(&callerpres_function);
+	res |= ast_custom_function_register(&callerid_function);
+	return res;
+}
+
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Caller ID related dialplan functions");

Modified: team/oej/videocaps/funcs/func_odbc.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/funcs/func_odbc.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/funcs/func_odbc.c (original)
+++ team/oej/videocaps/funcs/func_odbc.c Mon Feb  5 17:51:23 2007
@@ -107,7 +107,7 @@
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(field)[100];
 	);
-	SQLHSTMT stmt;
+	SQLHSTMT stmt = NULL;
 	SQLLEN rows=0;
 
 	AST_LIST_LOCK(&queries);
@@ -204,7 +204,7 @@
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(field)[100];
 	);
-	SQLHSTMT stmt;
+	SQLHSTMT stmt = NULL;
 	SQLSMALLINT colcount=0;
 	SQLLEN indicator;
 	SQLSMALLINT collength;

Modified: team/oej/videocaps/funcs/func_strings.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/funcs/func_strings.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================
--- team/oej/videocaps/funcs/func_strings.c (original)
+++ team/oej/videocaps/funcs/func_strings.c Mon Feb  5 17:51:23 2007
@@ -48,7 +48,7 @@
 static int function_fieldqty(struct ast_channel *chan, const char *cmd,
 			     char *parse, char *buf, size_t len)
 {
-	char *varval;
+	char *varsubst, varval[8192] = "", *varval2 = varval;
 	int fieldcount = 0;
 	AST_DECLARE_APP_ARGS(args,
 			     AST_APP_ARG(varname);
@@ -57,7 +57,6 @@
 
 	AST_STANDARD_APP_ARGS(args, parse);
 	if (args.delim) {
-		pbx_retrieve_variable(chan, args.varname, &varval, buf, len, NULL);
 		if (args.delim[0] == '\\') {
 			if (args.delim[1] == 'n')
 				ast_copy_string(args.delim, "\n", 2);
@@ -68,7 +67,11 @@
 			else
 				ast_copy_string(args.delim, "-", 2);
 		}
-		while (strsep(&varval, args.delim))
+		varsubst = alloca(strlen(args.varname) + 4);
+
+		sprintf(varsubst, "${%s}", args.varname);
+		pbx_substitute_variables_helper(chan, varsubst, varval, sizeof(varval) - 1);
+		while (strsep(&varval2, args.delim))
 			fieldcount++;
 	} else {
 		fieldcount = 1;

Modified: team/oej/videocaps/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/main/asterisk.c?view=diff&rev=53223&r1=53222&r2=53223
==============================================================================

[... 816 lines stripped ...]


More information about the asterisk-commits mailing list