[asterisk-commits] oej: branch oej/multiparking r53284 - in /team/oej/multiparking: ./ apps/ cha...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Feb 6 09:25:52 MST 2007


Author: oej
Date: Tue Feb  6 10:25:51 2007
New Revision: 53284

URL: http://svn.digium.com/view/asterisk?view=rev&rev=53284
Log:
Reset automerge

Added:
    team/oej/multiparking/doc/queue.txt
      - copied unchanged from r53247, trunk/doc/queue.txt
Modified:
    team/oej/multiparking/   (props changed)
    team/oej/multiparking/Makefile
    team/oej/multiparking/UPGRADE.txt
    team/oej/multiparking/apps/app_dial.c
    team/oej/multiparking/apps/app_meetme.c
    team/oej/multiparking/apps/app_playback.c
    team/oej/multiparking/apps/app_queue.c
    team/oej/multiparking/apps/app_setcallerid.c
    team/oej/multiparking/apps/app_userevent.c
    team/oej/multiparking/channels/chan_h323.c
    team/oej/multiparking/channels/chan_iax2.c
    team/oej/multiparking/channels/chan_mgcp.c
    team/oej/multiparking/channels/chan_sip.c
    team/oej/multiparking/channels/chan_skinny.c
    team/oej/multiparking/channels/chan_zap.c
    team/oej/multiparking/channels/h323/ast_h323.cxx
    team/oej/multiparking/codecs/codec_gsm.c
    team/oej/multiparking/configs/sip.conf.sample
    team/oej/multiparking/configure
    team/oej/multiparking/configure.ac
    team/oej/multiparking/contrib/init.d/rc.suse.asterisk
    team/oej/multiparking/doc/cdrdriver.txt
    team/oej/multiparking/funcs/func_callerid.c
    team/oej/multiparking/funcs/func_odbc.c
    team/oej/multiparking/funcs/func_strings.c
    team/oej/multiparking/include/asterisk/autoconfig.h.in
    team/oej/multiparking/main/asterisk.c
    team/oej/multiparking/main/cdr.c
    team/oej/multiparking/main/config.c
    team/oej/multiparking/main/db1-ast/hash/hash.c
    team/oej/multiparking/main/devicestate.c
    team/oej/multiparking/main/http.c
    team/oej/multiparking/main/io.c
    team/oej/multiparking/main/manager.c
    team/oej/multiparking/main/pbx.c
    team/oej/multiparking/main/rtp.c
    team/oej/multiparking/pbx/pbx_dundi.c
    team/oej/multiparking/pbx/pbx_spool.c
    team/oej/multiparking/res/res_musiconhold.c

Propchange: team/oej/multiparking/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

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

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

Propchange: team/oej/multiparking/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Feb  6 10:25:51 2007
@@ -1,1 +1,1 @@
-/trunk:1-52951
+/trunk:1-53282

Modified: team/oej/multiparking/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/Makefile?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/Makefile (original)
+++ team/oej/multiparking/Makefile Tue Feb  6 10:25:51 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/multiparking/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/UPGRADE.txt?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/UPGRADE.txt (original)
+++ team/oej/multiparking/UPGRADE.txt Tue Feb  6 10:25:51 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/multiparking/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_dial.c?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/apps/app_dial.c (original)
+++ team/oej/multiparking/apps/app_dial.c Tue Feb  6 10:25:51 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"
@@ -1183,6 +1183,7 @@
 	struct privacy_args pa = {
 		.sentringing = 0,
 		.privdb_val = 0,
+		.status = "INVALIDARGS",
 	};
 	int sentringing = 0, moh = 0;
 	const char *outbound_group = NULL;
@@ -1201,23 +1202,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;
 	}
 
@@ -1231,6 +1236,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/multiparking/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_meetme.c?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/apps/app_meetme.c (original)
+++ team/oej/multiparking/apps/app_meetme.c Tue Feb  6 10:25:51 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/multiparking/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_playback.c?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/apps/app_playback.c (original)
+++ team/oej/multiparking/apps/app_playback.c Tue Feb  6 10:25:51 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/multiparking/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_queue.c?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/apps/app_queue.c (original)
+++ team/oej/multiparking/apps/app_queue.c Tue Feb  6 10:25:51 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/multiparking/apps/app_setcallerid.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_setcallerid.c?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/apps/app_setcallerid.c (original)
+++ team/oej/multiparking/apps/app_setcallerid.c Tue Feb  6 10:25:51 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/multiparking/apps/app_userevent.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_userevent.c?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/apps/app_userevent.c (original)
+++ team/oej/multiparking/apps/app_userevent.c Tue Feb  6 10:25:51 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/multiparking/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_h323.c?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/channels/chan_h323.c (original)
+++ team/oej/multiparking/channels/chan_h323.c Tue Feb  6 10:25:51 2007
@@ -35,7 +35,7 @@
 
 /*** MODULEINFO
 	<depend>openh323</depend>
-	<defaultenabled>no</defaultenabled>
+	<defaultenabled>yes</defaultenabled>
  ***/
 
 #ifdef __cplusplus
@@ -2610,8 +2610,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/multiparking/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_iax2.c?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/channels/chan_iax2.c (original)
+++ team/oej/multiparking/channels/chan_iax2.c Tue Feb  6 10:25:51 2007
@@ -6176,6 +6176,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 {
@@ -6250,8 +6252,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/multiparking/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_mgcp.c?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/channels/chan_mgcp.c (original)
+++ team/oej/multiparking/channels/chan_mgcp.c Tue Feb  6 10:25:51 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/multiparking/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_sip.c?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/channels/chan_sip.c (original)
+++ team/oej/multiparking/channels/chan_sip.c Tue Feb  6 10:25:51 2007
@@ -526,6 +526,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 */
@@ -562,7 +563,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 */
@@ -944,6 +944,7 @@
 	int peercapability;			/*!< Supported peer capability */
 	int prefcodec;				/*!< Preferred codec (outbound only) */
 	int noncodeccapability;			/*!< DTMF RFC2833 telephony-event */
+	int jointnoncodeccapability;            /*!< Joint Non codec capability */
 	int redircodecs;			/*!< Redirect codecs */
 	int maxcallbitrate;			/*!< Maximum Call Bitrate for Video Calls */	
 	struct t38properties t38;		/*!< T38 settings */
@@ -1095,6 +1096,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 */
@@ -2960,7 +2962,8 @@
 
 	p->callingpres = ast->cid.cid_pres;
 	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);
@@ -3013,6 +3016,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) 
@@ -3155,9 +3164,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)) {
@@ -3642,7 +3652,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);
 		}
@@ -5207,7 +5217,7 @@
 
 	newjointcapability = p->capability & (peercapability | vpeercapability);
 	newpeercapability = (peercapability | vpeercapability);
-	newnoncodeccapability = noncodeccapability & peernoncodeccapability;
+	newnoncodeccapability = p->noncodeccapability & peernoncodeccapability;
 		
 		
 	if (debug) {
@@ -5221,7 +5231,7 @@
 			    ast_getformatname_multiple(s4, 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));
 	}
@@ -5240,9 +5250,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)
@@ -5253,6 +5263,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);
 		}
@@ -6394,7 +6407,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,
@@ -6965,6 +6978,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:
@@ -7060,6 +7077,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:
@@ -9534,7 +9556,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);
@@ -10198,6 +10220,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    : %d kbps\n", peer->maxcallbitrate);
@@ -10285,7 +10309,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: %d kbps\r\n", peer->maxcallbitrate);
 		astman_append(s, "Dynamic: %s\r\n", (ast_test_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC)?"Y":"N"));
 		astman_append(s, "Callerid: %s\r\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, ""));
@@ -10457,6 +10482,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)"));
@@ -15345,9 +15371,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)
 {
@@ -15371,27 +15407,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;
@@ -16301,6 +16348,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);
@@ -16427,6 +16475,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")) {
@@ -16977,6 +17027,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 */
@@ -17074,14 +17129,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/multiparking/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_skinny.c?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/channels/chan_skinny.c (original)
+++ team/oej/multiparking/channels/chan_skinny.c Tue Feb  6 10:25:51 2007
@@ -4307,6 +4307,7 @@
 	if (skinnydebug)
 		ast_verbose("killing accept thread\n");
 	close(as);
+	pthread_attr_destroy(&attr);
 	return 0;
 }
 

Modified: team/oej/multiparking/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_zap.c?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/channels/chan_zap.c (original)
+++ team/oej/multiparking/channels/chan_zap.c Tue Feb  6 10:25:51 2007
@@ -3838,9 +3838,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;
@@ -4440,6 +4437,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)) {
@@ -4457,7 +4456,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 */
@@ -7053,6 +7053,7 @@
 				"interface %d\n", i->channel);
 		}
 	}
+	pthread_attr_destroy(&attr);
 	return 0;
 }
 
@@ -7277,10 +7278,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;
 }
 
@@ -9185,9 +9188,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 */
@@ -9679,6 +9679,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",
@@ -9694,6 +9696,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/multiparking/channels/h323/ast_h323.cxx
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/h323/ast_h323.cxx?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/channels/h323/ast_h323.cxx (original)
+++ team/oej/multiparking/channels/h323/ast_h323.cxx Tue Feb  6 10:25:51 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/multiparking/codecs/codec_gsm.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/codecs/codec_gsm.c?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/codecs/codec_gsm.c (original)
+++ team/oej/multiparking/codecs/codec_gsm.c Tue Feb  6 10:25:51 2007
@@ -50,7 +50,11 @@
 #include "asterisk/channel.h"
 #include "asterisk/utils.h"
 
+#ifdef HAVE_GSM_HEADER
 #include "gsm.h"
+#elif defined(HAVE_GSM_GSM_HEADER)
+#include <gsm/gsm.h>
+#endif
 
 #include "../formats/msgsm.h"
 

Modified: team/oej/multiparking/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/configs/sip.conf.sample?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/configs/sip.conf.sample (original)
+++ team/oej/multiparking/configs/sip.conf.sample Tue Feb  6 10:25:51 2007
@@ -198,6 +198,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.
@@ -330,6 +335,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
@@ -494,6 +505,7 @@
 ; videosupport		      videosupport
 ; maxcallbitrate	      maxcallbitrate
 ; rfc2833compensate           mailbox
+;			      busy-limit
 ;                             username
 ;                             template
 ;                             fromdomain
@@ -527,10 +539,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/multiparking/configure
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/configure?view=diff&rev=53284&r1=53283&r2=53284
==============================================================================
--- team/oej/multiparking/configure (original)
+++ team/oej/multiparking/configure Tue Feb  6 10:25:51 2007
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 51291 .
+# From configure.ac Revision: 52463 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61.
 #
@@ -17421,11 +17421,11 @@
    if test "${GSM_SYSTEM}" = "yes"; then
       gsmlibdir=""
       if test "x${GSM_DIR}" != "x"; then
-      	 if test -d ${GSM_DIR}/lib; then
-	    gsmlibdir="-L${GSM_DIR}/lib"
-	 else
-	    gsmlibdir="-L${GSM_DIR}"
-	 fi
+         if test -d ${GSM_DIR}/lib; then
+            gsmlibdir="-L${GSM_DIR}/lib"
+         else
+            gsmlibdir="-L${GSM_DIR}"
+         fi
       fi
       { echo "$as_me:$LINENO: checking for gsm_create in -lgsm" >&5
 echo $ECHO_N "checking for gsm_create in -lgsm... $ECHO_C" >&6; }
@@ -17497,17 +17497,594 @@
 fi
 
       if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
-	 GSM_LIB="-lgsm"
-	 if test "x${GSM_DIR}" != "x"; then
-	    GSM_LIB="${gsmlibdir} ${GSM_LIB}"
-	    GSM_INCLUDE="-I${GSM_DIR}/include"
-	 fi
-	 PBX_GSM=1
-	 GSM_INTERNAL="no"
+         if test "x${GSM_DIR}" != "x" ; then
+            as_ac_Header=`echo "ac_cv_header_${GSM_DIR}/include/gsm.h" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for ${GSM_DIR}/include/gsm.h" >&5
+echo $ECHO_N "checking for ${GSM_DIR}/include/gsm.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking ${GSM_DIR}/include/gsm.h usability" >&5
+echo $ECHO_N "checking ${GSM_DIR}/include/gsm.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <${GSM_DIR}/include/gsm.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking ${GSM_DIR}/include/gsm.h presence" >&5
+echo $ECHO_N "checking ${GSM_DIR}/include/gsm.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <${GSM_DIR}/include/gsm.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5

[... 1613 lines stripped ...]


More information about the asterisk-commits mailing list