[asterisk-commits] rmudgett: branch group/issue14292 r172702 - in /team/group/issue14292: ./ app...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 30 21:17:55 CST 2009


Author: rmudgett
Date: Fri Jan 30 21:17:55 2009
New Revision: 172702

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=172702
Log:
Resolved conflict and restarted automerge

Merged revisions 172512,172579,172615,172622,172700 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/team/group/issue14068

................
  r172512 | root | 2009-01-30 10:17:43 -0600 (Fri, 30 Jan 2009) | 9 lines
  
  Merged revisions 172511 via svnmerge from 
  file:///srv/subversion/repos/asterisk/team/group/issue8824
  
  ........
    r172511 | mmichelson | 2009-01-30 09:59:30 -0600 (Fri, 30 Jan 2009) | 3 lines
    
    Fix a bad comparison and add a missing 181 case
  ........
................
  r172579 | root | 2009-01-30 14:17:20 -0600 (Fri, 30 Jan 2009) | 16 lines
  
  Merged revisions 172555 via svnmerge from 
  file:///srv/subversion/repos/asterisk/team/group/issue8824
  
  ................
    r172555 | root | 2009-01-30 13:19:02 -0600 (Fri, 30 Jan 2009) | 9 lines
    
    Merged revisions 172548 via svnmerge from 
    file:///srv/subversion/repos/asterisk/trunk
    
    ........
      r172548 | tilghman | 2009-01-30 12:36:56 -0600 (Fri, 30 Jan 2009) | 2 lines
      
      Parameter position reversed in documentation
    ........
  ................
................
  r172615 | rmudgett | 2009-01-30 16:25:55 -0600 (Fri, 30 Jan 2009) | 7 lines
  
  Applied patch to work in progress branch asterisk/team/group/issue14068.
  
  (issue #14068)
  Reported by: nreinartz
  Patches:
        asterisk-issue14068-2009-01-30-colpconp-0.1.5.patch uploaded by nreinartz (license 452)
................
  r172622 | root | 2009-01-30 17:18:39 -0600 (Fri, 30 Jan 2009) | 13 lines
  
  Merged revisions 172588,172616 via svnmerge from 
  file:///srv/subversion/repos/asterisk/team/group/issue8824
  
  ........
    r172588 | root | 2009-01-30 16:19:08 -0600 (Fri, 30 Jan 2009) | 1 line
    
    automerge cancel
  ........
    r172616 | mmichelson | 2009-01-30 16:30:04 -0600 (Fri, 30 Jan 2009) | 3 lines
    
    Resolve conflict and reset automerge
  ........
................
  r172700 | root | 2009-01-30 19:17:22 -0600 (Fri, 30 Jan 2009) | 25 lines
  
  Merged revisions 172649 via svnmerge from 
  file:///srv/subversion/repos/asterisk/team/group/issue8824
  
  ................
    r172649 | root | 2009-01-30 18:19:12 -0600 (Fri, 30 Jan 2009) | 18 lines
    
    Merged revisions 172640 via svnmerge from 
    file:///srv/subversion/repos/asterisk/trunk
    
    ................
      r172640 | twilson | 2009-01-30 18:16:46 -0600 (Fri, 30 Jan 2009) | 11 lines
      
      Blocked revisions 172639 via svnmerge
      
      ........
        r172639 | twilson | 2009-01-30 18:15:09 -0600 (Fri, 30 Jan 2009) | 5 lines
        
        Rename new parkedcallparking option to parkedcallreparking
        
        Since this option actually already existed in 1.6.0+, use the same name so as
        not to confuse people when they upgrade
      ........
    ................
  ................
................

Modified:
    team/group/issue14292/   (props changed)
    team/group/issue14292/CHANGES
    team/group/issue14292/apps/app_dial.c
    team/group/issue14292/channels/chan_dahdi.c
    team/group/issue14292/channels/chan_sip.c
    team/group/issue14292/configs/features.conf.sample
    team/group/issue14292/funcs/func_aes.c
    team/group/issue14292/include/asterisk/channel.h
    team/group/issue14292/include/asterisk/global_datastores.h
    team/group/issue14292/main/features.c
    team/group/issue14292/main/global_datastores.c

Propchange: team/group/issue14292/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/issue14292/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/group/issue14292/
------------------------------------------------------------------------------
--- issue14292-integrated (original)
+++ issue14292-integrated Fri Jan 30 21:17:55 2009
@@ -1,1 +1,1 @@
-/team/group/issue14068:1-172507
+/team/group/issue14068:1-172701

Propchange: team/group/issue14292/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jan 30 21:17:55 2009
@@ -1,1 +1,1 @@
-/trunk:1-172450
+/trunk:1-172648

Modified: team/group/issue14292/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/CHANGES?view=diff&rev=172702&r1=172701&r2=172702
==============================================================================
--- team/group/issue14292/CHANGES (original)
+++ team/group/issue14292/CHANGES Fri Jan 30 21:17:55 2009
@@ -907,6 +907,13 @@
 Call Features (res_features) Changes
 ------------------------------------
   * Added the parkedcalltransfers option to features.conf
+  * Added parkedcallparking option to control one touch parking w/ parking
+    pickup
+  * Added parkedcallhangup option to control disconnect feature w/ parking
+    pickup
+  * Added parkedcallrecording option to control one-touch record w/ parking
+    pickup
+  * Added BRIDGE_FEATURES variable to set available features for a channel
   * The built-in method for doing attended transfers has been updated to
      include some new options that allow you to have the transferee sent
      back to the person that did the transfer if the transfer is not successful.

Modified: team/group/issue14292/apps/app_dial.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/apps/app_dial.c?view=diff&rev=172702&r1=172701&r2=172702
==============================================================================
--- team/group/issue14292/apps/app_dial.c (original)
+++ team/group/issue14292/apps/app_dial.c Fri Jan 30 21:17:55 2009
@@ -1506,19 +1506,6 @@
 	return 1; /* success */
 }
 
-static void set_dial_features(struct ast_flags64 *opts, struct ast_dial_features *features)
-{
-	struct ast_flags64 perm_opts = {.flags = 0};
-
-	ast_copy_flags64(&perm_opts, opts,
-		OPT_CALLER_TRANSFER | OPT_CALLER_PARK | OPT_CALLER_MONITOR | OPT_CALLER_MIXMONITOR | OPT_CALLER_HANGUP |
-		OPT_CALLEE_TRANSFER | OPT_CALLEE_PARK | OPT_CALLEE_MONITOR | OPT_CALLEE_MIXMONITOR | OPT_CALLEE_HANGUP);
-
-	memset(features->options, 0, sizeof(features->options));
-
-	ast_app_options2str64(dial_exec_options, &perm_opts, features->options, sizeof(features->options));
-}
-
 static void end_bridge_callback(void *data)
 {
 	char buf[80];
@@ -1582,9 +1569,6 @@
 	struct ast_flags64 opts = { 0, };
 	char *opt_args[OPT_ARG_ARRAY_SIZE];
 	struct ast_datastore *datastore = NULL;
-	struct ast_datastore *ds_caller_features = NULL;
-	struct ast_datastore *ds_callee_features = NULL;
-	struct ast_dial_features *caller_features;
 	int fulldial = 0, num_dialed = 0;
 
 	/* Reset all DIAL variables back to blank, to prevent confusion (in case we don't reset all of them). */
@@ -1670,28 +1654,6 @@
 	}
 	ast_channel_unlock(chan);	
 	ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING | OPT_IGNORE_CONNECTEDLINE | OPT_FORCE_CALLERID);
-
-	/* Create datastore for channel dial features for caller */
-	if (!(ds_caller_features = ast_datastore_alloc(&dial_features_info, NULL))) {
-		ast_log(LOG_WARNING, "Unable to create channel datastore for dial features. Aborting!\n");
-		goto out;
-	}
-
-	if (!(caller_features = ast_malloc(sizeof(*caller_features)))) {
-		ast_log(LOG_WARNING, "Unable to allocate memory for feature flags. Aborting!\n");
-		goto out;
-	}
-
-	ast_copy_flags(&(caller_features->features_callee), &(config.features_caller), AST_FLAGS_ALL);
-	caller_features->is_caller = 1;
-	set_dial_features(&opts, caller_features);
-
-	ds_caller_features->inheritance = DATASTORE_INHERIT_FOREVER;
-	ds_caller_features->data = caller_features;
-
-	ast_channel_lock(chan);
-	ast_channel_datastore_add(chan, ds_caller_features);
-	ast_channel_unlock(chan);
 
 	/* loop through the list of dial destinations */
 	rest = args.peers;
@@ -1704,7 +1666,6 @@
 		char *tech = strsep(&number, "/");
 		/* find if we already dialed this interface */
 		struct ast_dialed_interface *di;
-		struct ast_dial_features *callee_features;
 		AST_LIST_HEAD(, ast_dialed_interface) *dialed_interfaces;
 		num_dialed++;
 		if (!number) {
@@ -1876,30 +1837,6 @@
 			ast_copy_string(tc->exten, chan->macroexten, sizeof(tc->exten));
 		else
 			ast_copy_string(tc->exten, chan->exten, sizeof(tc->exten));
-
-		/* Save callee features */
-		if (!(ds_callee_features = ast_datastore_alloc(&dial_features_info, NULL))) {
-			ast_log(LOG_WARNING, "Unable to create channel datastore for dial features. Aborting!\n");
-			ast_free(tmp);
-			goto out;
-		}
-
-		if (!(callee_features = ast_malloc(sizeof(*callee_features)))) {
-			ast_log(LOG_WARNING, "Unable to allocate memory for feature flags. Aborting!\n");
-			ast_free(tmp);
-			goto out;
-		}
-
-		ast_copy_flags(&(callee_features->features_callee), &(config.features_callee), AST_FLAGS_ALL);
-		callee_features->is_caller = 0;
-		set_dial_features(&opts, callee_features);
-
-		ds_callee_features->inheritance = DATASTORE_INHERIT_FOREVER;
-		ds_callee_features->data = callee_features;
-
-		ast_channel_lock(chan);
-		ast_channel_datastore_add(tc, ds_callee_features);
-		ast_channel_unlock(chan);
 
 		res = ast_call(tc, numsubst, 0); /* Place the call, but don't wait on the answer */
 

Modified: team/group/issue14292/channels/chan_dahdi.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/channels/chan_dahdi.c?view=diff&rev=172702&r1=172701&r2=172702
==============================================================================
--- team/group/issue14292/channels/chan_dahdi.c (original)
+++ team/group/issue14292/channels/chan_dahdi.c Fri Jan 30 21:17:55 2009
@@ -12861,27 +12861,6 @@
 									dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
 								}
 							}
-							if (pri->pvts[chanpos]->owner) {
-								char dnid[AST_MAX_EXTENSION];
-								char rdnis[AST_MAX_EXTENSION];
-								if (pri->pvts[chanpos]->owner->exten) {
-									int pos = strlen(pri->pvts[chanpos]->owner->exten);
-									if (pos < sizeof(pri->pvts[chanpos]->owner->exten) - 2)
-										ast_copy_string(&pri->pvts[chanpos]->owner->exten[pos], e->ring.callednum, sizeof(pri->pvts[chanpos]->owner->exten) - strlen(e->ring.callednum));
-								}
-								if (pri->pvts[chanpos]->owner->cid.cid_dnid) {
-									ast_copy_string(dnid, pri->pvts[chanpos]->owner->cid.cid_dnid, sizeof(dnid));
-									strncat (dnid, e->ring.callednum, sizeof(dnid) - strlen(dnid) - 1);
-									ast_free(pri->pvts[chanpos]->owner->cid.cid_dnid);
-									pri->pvts[chanpos]->owner->cid.cid_dnid = ast_strdup(dnid);
-								}
-								if (pri->pvts[chanpos]->owner->cid.cid_rdnis) {
-									ast_copy_string(rdnis, pri->pvts[chanpos]->owner->cid.cid_rdnis, sizeof(rdnis));
-									strncat (rdnis, e->ring.callednum, sizeof(rdnis) - strlen(rdnis) - 1);
-									ast_free(pri->pvts[chanpos]->owner->cid.cid_rdnis);
-									pri->pvts[chanpos]->owner->cid.cid_rdnis = ast_strdup(rdnis);
-								}
-							}
 						}
 						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
 					}
@@ -12908,6 +12887,27 @@
 								{
 									struct ast_frame f = { AST_FRAME_DTMF, digit, };
 									dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
+								}
+							}
+							if (pri->pvts[chanpos]->owner) {
+								char dnid[AST_MAX_EXTENSION];
+								char rdnis[AST_MAX_EXTENSION];
+								if (pri->pvts[chanpos]->owner->exten) {
+									int pos = strlen(pri->pvts[chanpos]->owner->exten);
+									if (pos < sizeof(pri->pvts[chanpos]->owner->exten) - 2)
+										ast_copy_string(&pri->pvts[chanpos]->owner->exten[pos], e->ring.callednum, sizeof(pri->pvts[chanpos]->owner->exten) - strlen(e->ring.callednum));
+								}
+								if (pri->pvts[chanpos]->owner->cid.cid_dnid) {
+									ast_copy_string(dnid, pri->pvts[chanpos]->owner->cid.cid_dnid, sizeof(dnid));
+									strncat (dnid, e->ring.callednum, sizeof(dnid) - strlen(dnid) - 1);
+									ast_free(pri->pvts[chanpos]->owner->cid.cid_dnid);
+									pri->pvts[chanpos]->owner->cid.cid_dnid = ast_strdup(dnid);
+								}
+								if (pri->pvts[chanpos]->owner->cid.cid_rdnis) {
+									ast_copy_string(rdnis, pri->pvts[chanpos]->owner->cid.cid_rdnis, sizeof(rdnis));
+									strncat (rdnis, e->ring.callednum, sizeof(rdnis) - strlen(rdnis) - 1);
+									ast_free(pri->pvts[chanpos]->owner->cid.cid_rdnis);
+									pri->pvts[chanpos]->owner->cid.cid_rdnis = ast_strdup(rdnis);
 								}
 							}
 						}
@@ -13227,9 +13227,8 @@
 						}
 #endif
 
-						if (e->ringing.calledname[0] || e->ringing.callednum[0]) {
+						if ((e->ringing.calledname[0] || e->ringing.callednum[0]) && pri->pvts[chanpos]->owner) {
 							struct ast_party_connected_line connected;
-							struct ast_channel *owner = pri->pvts[chanpos]->owner;
 
 							/* Update the connected line information on the other channel */
 							ast_party_connected_line_init(&connected);
@@ -13238,7 +13237,7 @@
 							connected.id.number_type = e->ringing.calledplan;
 							connected.id.number_presentation = pri_to_ast_presentation(e->ringing.calledpres);
 							connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
-							ast_queue_connected_line_update(owner, &connected);
+							ast_queue_connected_line_update(pri->pvts[chanpos]->owner, &connected);
 						}
 
 						ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -13415,44 +13414,48 @@
 									switch (subcmd->cmd) {
 									case CMD_CONNECTEDLINE:
 										{
-											struct ast_party_connected_line connected;
-											cmd_connectedline *cmdcl;
 											struct ast_channel *owner = pri->pvts[chanpos]->owner;
-
-											/* Update the connected line information on the other channel */
-											ast_party_connected_line_init(&connected);
-											cmdcl = &subcmd->connectedline;
-											connected.id.number = cmdcl->connected.id.number;
-											connected.id.name = cmdcl->connected.id.name;
-											connected.id.number_type = cmdcl->connected.id.number_type;
-											connected.id.number_presentation = pri_to_ast_presentation(cmdcl->connected.id.number_presentation);
-											connected.source = pri_to_ast_connected_line_update_source(cmdcl->connected.source);
-											ast_queue_connected_line_update(owner, &connected);
-
-											ast_copy_string(pri->pvts[chanpos]->lastcid_num, cmdcl->connected.id.number, sizeof(pri->pvts[chanpos]->lastcid_num));
-											ast_copy_string(pri->pvts[chanpos]->lastcid_name, cmdcl->connected.id.name, sizeof(pri->pvts[chanpos]->lastcid_name));
-
-											pri->pvts[chanpos]->subs[SUB_REAL].needcallerid =1;
+											if (owner) {
+												struct ast_party_connected_line connected;
+												cmd_connectedline *cmdcl;
+
+												/* Update the connected line information on the other channel */
+												ast_party_connected_line_init(&connected);
+												cmdcl = &subcmd->connectedline;
+												connected.id.number = cmdcl->connected.id.number;
+												connected.id.name = cmdcl->connected.id.name;
+												connected.id.number_type = cmdcl->connected.id.number_type;
+												connected.id.number_presentation = pri_to_ast_presentation(cmdcl->connected.id.number_presentation);
+												connected.source = pri_to_ast_connected_line_update_source(cmdcl->connected.source);
+												ast_queue_connected_line_update(owner, &connected);
+
+												ast_copy_string(pri->pvts[chanpos]->lastcid_num, cmdcl->connected.id.number, sizeof(pri->pvts[chanpos]->lastcid_num));
+												ast_copy_string(pri->pvts[chanpos]->lastcid_name, cmdcl->connected.id.name, sizeof(pri->pvts[chanpos]->lastcid_name));
+
+												pri->pvts[chanpos]->subs[SUB_REAL].needcallerid =1;
+											}
 										}
 										break;
 									case CMD_REDIRECTING:
 										{
-											struct ast_party_redirecting redirecting = {{0,},};
-											cmd_redirecting *cmdr;
 											struct ast_channel *owner = pri->pvts[chanpos]->owner;
-
-											cmdr = &subcmd->redirecting;
-											redirecting.from.number = cmdr->redirecting.from.number;
-											redirecting.from.name = cmdr->redirecting.from.name;
-											redirecting.from.number_type = cmdr->redirecting.from.number_type;
-											redirecting.from.number_presentation = pri_to_ast_presentation(cmdr->redirecting.from.number_presentation);
-											redirecting.to.number = cmdr->redirecting.to.number;
-											redirecting.to.name = cmdr->redirecting.to.name;
-											redirecting.to.number_type = cmdr->redirecting.to.number_type;
-											redirecting.to.number_presentation = pri_to_ast_presentation(cmdr->redirecting.to.number_presentation);
-											redirecting.count = 0;
-											redirecting.reason = pri_to_ast_reason(cmdr->redirecting.reason);
-											ast_queue_redirecting_update(owner, &redirecting);
+											if (owner) {
+												struct ast_party_redirecting redirecting = {{0,},};
+												cmd_redirecting *cmdr;
+
+												cmdr = &subcmd->redirecting;
+												redirecting.from.number = cmdr->redirecting.from.number;
+												redirecting.from.name = cmdr->redirecting.from.name;
+												redirecting.from.number_type = cmdr->redirecting.from.number_type;
+												redirecting.from.number_presentation = pri_to_ast_presentation(cmdr->redirecting.from.number_presentation);
+												redirecting.to.number = cmdr->redirecting.to.number;
+												redirecting.to.name = cmdr->redirecting.to.name;
+												redirecting.to.number_type = cmdr->redirecting.to.number_type;
+												redirecting.to.number_presentation = pri_to_ast_presentation(cmdr->redirecting.to.number_presentation);
+												redirecting.count = 0;
+												redirecting.reason = pri_to_ast_reason(cmdr->redirecting.reason);
+												ast_queue_redirecting_update(owner, &redirecting);
+											}
 										}
 										break;
 									default:
@@ -13578,7 +13581,7 @@
 									PRI_SPAN(e->answer.channel), PRI_CHANNEL(e->answer.channel), pri->span);
 							} else {
 								struct ast_party_connected_line connected;
-								struct ast_channel *owner = pri->pvts[chanpos]->owner;
+								struct ast_channel *owner;
 
 								ast_mutex_lock(&pri->pvts[chanpos]->lock);
 								/* Now we can do call progress detection */
@@ -13618,23 +13621,25 @@
 									dahdi_enable_ec(pri->pvts[chanpos]);
 								}
 
+								owner = pri->pvts[chanpos]->owner;
 #ifdef SUPPORT_USERUSER
 								if (!ast_strlen_zero(e->answer.useruserinfo)) {
-									struct ast_channel *owner = pri->pvts[chanpos]->owner;
 									ast_mutex_unlock(&pri->pvts[chanpos]->lock);
 									pbx_builtin_setvar_helper(owner, "USERUSERINFO", e->answer.useruserinfo);
 									ast_mutex_lock(&pri->pvts[chanpos]->lock);
 								}
 #endif
 
-								/* Update the connected line information on the other channel */
-								ast_party_connected_line_init(&connected);
-								connected.id.name = e->answer.connectedname;
-								connected.id.number = e->answer.connectednum;
-								connected.id.number_type = e->answer.connectedplan;
-								connected.id.number_presentation = pri_to_ast_presentation(e->answer.connectedpres);
-								connected.source = pri_to_ast_connected_line_update_source(e->answer.source);
-								ast_queue_connected_line_update(owner, &connected);
+								if (owner) {
+									/* Update the connected line information on the other channel */
+									ast_party_connected_line_init(&connected);
+									connected.id.name = e->answer.connectedname;
+									connected.id.number = e->answer.connectednum;
+									connected.id.number_type = e->answer.connectedplan;
+									connected.id.number_presentation = pri_to_ast_presentation(e->answer.connectedpres);
+									connected.source = pri_to_ast_connected_line_update_source(e->answer.source);
+									ast_queue_connected_line_update(owner, &connected);
+								}
 
 								ast_mutex_unlock(&pri->pvts[chanpos]->lock);
 							}

Modified: team/group/issue14292/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/channels/chan_sip.c?view=diff&rev=172702&r1=172701&r2=172702
==============================================================================
--- team/group/issue14292/channels/chan_sip.c (original)
+++ team/group/issue14292/channels/chan_sip.c Fri Jan 30 21:17:55 2009
@@ -16842,7 +16842,7 @@
 	/* RFC3261 says we must treat every 1xx response (but not 100)
 	   that we don't recognize as if it was 183.
 	*/
-	if (resp > 100 && resp < 200 && resp!=101 && resp != 180 && res != 181 && resp != 182 && resp != 183)
+	if (resp > 100 && resp < 200 && resp!=101 && resp != 180 && resp != 181 && resp != 182 && resp != 183)
 		resp = 183;
 
  	/* Any response between 100 and 199 is PROCEEDING */
@@ -17659,6 +17659,7 @@
 		case 183:	/* 183 Session Progress */
 		case 180:	/* 180 Ringing */
 		case 182:	/* 182 Queued */
+		case 181:	/* 181 Call Is Being Forwarded */
 			if (sipmethod == SIP_INVITE)
 				handle_response_invite(p, resp, rest, req, seqno);
 			break;

Modified: team/group/issue14292/configs/features.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/configs/features.conf.sample?view=diff&rev=172702&r1=172701&r2=172702
==============================================================================
--- team/group/issue14292/configs/features.conf.sample (original)
+++ team/group/issue14292/configs/features.conf.sample Fri Jan 30 21:17:55 2009
@@ -22,6 +22,10 @@
 ;parkedcalltransfers = caller   ; Enables or disables DTMF based transfers when picking up a parked call.
                                 ; one of: callee, caller, both, no (default is no)
 ;parkedcallreparking = caller   ; Enables or disables DTMF based parking when picking up a parked call.
+                                ; one of: callee, caller, both, no (default is no)
+;parkedcallhangup = caller      ; Enables or disables DTMF based hangups when picking up a parked call.
+                                ; one of: callee, caller, both, no (default is no)
+;parkedcallrecording = caller   ; Enables or disables DTMF based one-touch recording when picking up a parked call.
                                 ; one of: callee, caller, both, no (default is no)
 ;adsipark = yes			; if you want ADSI parking announcements
 ;findslot => next		; Continue to the 'next' free parking space. 

Modified: team/group/issue14292/funcs/func_aes.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/funcs/func_aes.c?view=diff&rev=172702&r1=172701&r2=172702
==============================================================================
--- team/group/issue14292/funcs/func_aes.c (original)
+++ team/group/issue14292/funcs/func_aes.c Fri Jan 30 21:17:55 2009
@@ -40,11 +40,11 @@
 			Encrypt a string with AES given a 16 character key.
 		</synopsis>
 		<syntax>
+			<parameter name="key" required="true">
+				<para>AES Key</para>
+			</parameter>
 			<parameter name="string" required="true">
 				<para>Input string</para>
-			</parameter>
-			<parameter name="key" required="true">
-				<para>AES Key</para>
 			</parameter>
 		</syntax>
 		<description>
@@ -56,13 +56,12 @@
 			Decrypt a string encoded in base64 with AES given a 16 character key.
 		</synopsis>
 		<syntax>
+			<parameter name="key" required="true">
+				<para>AES Key</para>
+			</parameter>
 			<parameter name="string" required="true">
 				<para>Input string.</para>
 			</parameter>
-			<parameter name="key" required="true">
-				<para>AES Key</para>
-			</parameter>
-
 		</syntax>
 		<description>
 			<para>Returns the plain text string.</para>

Modified: team/group/issue14292/include/asterisk/channel.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/include/asterisk/channel.h?view=diff&rev=172702&r1=172701&r2=172702
==============================================================================
--- team/group/issue14292/include/asterisk/channel.h (original)
+++ team/group/issue14292/include/asterisk/channel.h Fri Jan 30 21:17:55 2009
@@ -702,7 +702,7 @@
 	/*! This flag indicates that the hangup exten should NOT be run when the 
 	 *  bridge terminates, this will allow the hangup in the pbx loop to be run instead.
 	 *  */
-	AST_FLAG_BRIDGE_HANGUP_DONT = (1 << 17),
+	AST_FLAG_BRIDGE_HANGUP_DONT = (1 << 18),
 };
 
 /*! \brief ast_bridge_config flags */

Modified: team/group/issue14292/include/asterisk/global_datastores.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/include/asterisk/global_datastores.h?view=diff&rev=172702&r1=172701&r2=172702
==============================================================================
--- team/group/issue14292/include/asterisk/global_datastores.h (original)
+++ team/group/issue14292/include/asterisk/global_datastores.h Fri Jan 30 21:17:55 2009
@@ -26,22 +26,11 @@
 
 #include "asterisk/channel.h"
 
-#define MAX_DIAL_FEATURE_OPTIONS 30
-
 extern const struct ast_datastore_info dialed_interface_info;
-
-extern const struct ast_datastore_info dial_features_info;
 
 struct ast_dialed_interface {
 	AST_LIST_ENTRY(ast_dialed_interface) list;
 	char interface[1];
 };
 
-struct ast_dial_features {
-	struct ast_flags features_caller;
-	struct ast_flags features_callee;
-	char options[MAX_DIAL_FEATURE_OPTIONS];
-	int is_caller;
-};
-
 #endif

Modified: team/group/issue14292/main/features.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/main/features.c?view=diff&rev=172702&r1=172701&r2=172702
==============================================================================
--- team/group/issue14292/main/features.c (original)
+++ team/group/issue14292/main/features.c Fri Jan 30 21:17:55 2009
@@ -166,6 +166,7 @@
 #define DEFAULT_ATXFER_CALLBACK_RETRIES 2
 
 #define AST_MAX_WATCHERS 256
+#define MAX_DIAL_FEATURE_OPTIONS 30
 
 struct feature_group_exten {
 	AST_LIST_ENTRY(feature_group_exten) entry;
@@ -222,6 +223,8 @@
 	int parkaddhints;                               /*!< Add parking hints automatically */
 	int parkedcalltransfers;                        /*!< Enable DTMF based transfers on bridge when picking up parked calls */
 	int parkedcallreparking;                        /*!< Enable DTMF based parking on bridge when picking up parked calls */
+	int parkedcallhangup;                           /*!< Enable DTMF based hangup on a bridge when pickup up parked calls */
+	int parkedcallrecording;                        /*!< Enable DTMF based recording on a bridge when picking up parked calls */
 	AST_LIST_HEAD(parkinglot_parklist, parkeduser) parkings; /*!< List of active parkings in this parkinglot */
 };
 
@@ -262,7 +265,39 @@
 static int stopmixmonitor_ok = 1;
 
 static pthread_t parking_thread;
-
+struct ast_dial_features {
+	struct ast_flags features_caller;
+	struct ast_flags features_callee;
+	int is_caller;
+};
+
+static void *dial_features_duplicate(void *data)
+{
+	struct ast_dial_features *df = data, *df_copy;
+ 
+ 	if (!(df_copy = ast_calloc(1, sizeof(*df)))) {
+ 		return NULL;
+ 	}
+ 
+ 	memcpy(df_copy, df, sizeof(*df));
+ 
+ 	return df_copy;
+ }
+ 
+ static void dial_features_destroy(void *data)
+ {
+ 	struct ast_dial_features *df = data;
+ 	if (df) {
+ 		ast_free(df);
+ 	}
+ }
+ 
+ const struct ast_datastore_info dial_features_info = {
+ 	.type = "dial-features",
+ 	.destroy = dial_features_destroy,
+ 	.duplicate = dial_features_duplicate,
+ };
+ 
 /* Forward declarations */
 static struct ast_parkinglot *parkinglot_addref(struct ast_parkinglot *parkinglot);
 static void parkinglot_unref(struct ast_parkinglot *parkinglot);
@@ -368,7 +403,7 @@
  * bridge call, check if we're going back to dialplan
  * if not hangup both legs of the call
 */
-static void *ast_bridge_call_thread(void *data) 
+static void *ast_bridge_call_thread(void *data)
 {
 	struct ast_bridge_thread_obj *tobj = data;
 	int res;
@@ -880,7 +915,6 @@
 	}
 
 	return res;
-
 }
 
 /*! \brief Play message to both caller and callee in bridged call, plays synchronously, autoservicing the
@@ -1193,7 +1227,7 @@
 	ast_indicate(transferee, AST_CONTROL_HOLD);
 
 	memset(xferto, 0, sizeof(xferto));
-	
+
 	/* Transfer */
 	res = ast_stream_and_wait(transferer, "pbx-transfer", AST_DIGIT_ANY);
 	if (res < 0) {
@@ -1324,6 +1358,8 @@
 	struct ast_frame *f;
 	int l;
 	struct ast_party_connected_line connected_line = {{0,},};
+	struct ast_datastore *features_datastore;
+	struct ast_dial_features *dialfeatures = NULL;
 
 	ast_debug(1, "Executing Attended Transfer %s, %s (sense=%d) \n", chan->name, peer->name, sense);
 	set_peers(&transferer, &transferee, peer, chan, sense);
@@ -1363,6 +1399,13 @@
 			return -1;
 		return AST_FEATURE_RETURN_SUCCESS;
 	}
+
+ 	/* If we are attended transfering to parking, just use builtin_parkcall instead of trying to track all of
+ 	 * the different variables for handling this properly with a builtin_atxfer */
+ 	if (!strcmp(xferto, ast_parking_ext())) {
+ 		finishup(transferee);
+ 		return builtin_parkcall(chan, peer, config, code, sense, data);
+ 	}
 
 	l = strlen(xferto);
 	snprintf(xferto + l, sizeof(xferto) - l, "@%s/n", transferer_real_context);	/* append context */
@@ -1467,6 +1510,30 @@
 			ast_party_connected_line_free(&connected_line);
 			return -1;
 		}
+
+		ast_channel_lock(newchan);
+		if ((features_datastore = ast_channel_datastore_find(newchan, &dial_features_info, NULL))) {
+				dialfeatures = features_datastore->data;
+		}
+		ast_channel_unlock(newchan);
+
+		if (dialfeatures) {
+			/* newchan should always be the callee and shows up as callee in dialfeatures, but for some reason
+			   I don't currently understand, the abilities of newchan seem to be stored on the caller side */
+			ast_copy_flags(&(config->features_callee), &(dialfeatures->features_caller), AST_FLAGS_ALL);
+			dialfeatures = NULL;
+		}
+
+		ast_channel_lock(xferchan);
+		if ((features_datastore = ast_channel_datastore_find(xferchan, &dial_features_info, NULL))) {
+			dialfeatures = features_datastore->data;
+		}
+		ast_channel_unlock(xferchan);
+	 
+		if (dialfeatures) {
+			ast_copy_flags(&(config->features_caller), &(dialfeatures->features_caller), AST_FLAGS_ALL);
+		}
+	 
 		tobj->chan = newchan;
 		tobj->peer = xferchan;
 		tobj->bconfig = *config;
@@ -2240,6 +2307,92 @@
 	return cdr_orig; /* everybody LOCKED or some other weirdness, like a NULL */
 }
 
+static void set_bridge_features_on_config(struct ast_bridge_config *config, const char *features)
+{
+	const char *feature;
+
+	if (ast_strlen_zero(features)) {
+		return;
+	}
+
+	for (feature = features; *feature; feature++) {
+		switch (*feature) {
+		case 'T' :
+		case 't' :
+			ast_set_flag(&(config->features_caller), AST_FEATURE_REDIRECT);
+			break;
+		case 'K' :
+		case 'k' :
+			ast_set_flag(&(config->features_caller), AST_FEATURE_PARKCALL);
+			break;
+		case 'H' :
+		case 'h' :
+			ast_set_flag(&(config->features_caller), AST_FEATURE_DISCONNECT);
+			break;
+		case 'W' :
+		case 'w' :
+			ast_set_flag(&(config->features_caller), AST_FEATURE_AUTOMON);
+			break;
+		default :
+			ast_log(LOG_WARNING, "Skipping unknown feature code '%c'\n", *feature);
+		}
+	}
+}
+
+static void add_features_datastores(struct ast_channel *caller, struct ast_channel *callee, struct ast_bridge_config *config)
+{
+	struct ast_datastore *ds_callee_features = NULL, *ds_caller_features = NULL;
+	struct ast_dial_features *callee_features = NULL, *caller_features = NULL;
+
+	ast_channel_lock(caller);
+	ds_caller_features = ast_channel_datastore_find(caller, &dial_features_info, NULL);
+	ast_channel_unlock(caller);
+	if (!ds_caller_features) {
+		if (!(ds_caller_features = ast_datastore_alloc(&dial_features_info, NULL))) {
+			ast_log(LOG_WARNING, "Unable to create channel datastore for caller features. Aborting!\n");
+			return;
+		}
+		if (!(caller_features = ast_calloc(1, sizeof(*caller_features)))) {
+			ast_log(LOG_WARNING, "Unable to allocate memory for callee feature flags. Aborting!\n");
+			ast_datastore_free(ds_caller_features);
+			return;
+		}
+		ds_caller_features->inheritance = DATASTORE_INHERIT_FOREVER;
+		caller_features->is_caller = 1;
+		ast_copy_flags(&(caller_features->features_callee), &(config->features_callee), AST_FLAGS_ALL);
+		ast_copy_flags(&(caller_features->features_caller), &(config->features_caller), AST_FLAGS_ALL);
+		ds_caller_features->data = caller_features;
+		ast_channel_lock(caller);
+		ast_channel_datastore_add(caller, ds_caller_features);
+		ast_channel_unlock(caller);
+	}
+
+	ast_channel_lock(callee);
+	ds_callee_features = ast_channel_datastore_find(callee, &dial_features_info, NULL);
+	ast_channel_unlock(callee);
+	if (!ds_callee_features) {
+		if (!(ds_callee_features = ast_datastore_alloc(&dial_features_info, NULL))) {
+			ast_log(LOG_WARNING, "Unable to create channel datastore for callee features. Aborting!\n");
+			return;
+		}
+		if (!(callee_features = ast_calloc(1, sizeof(*callee_features)))) {
+			ast_log(LOG_WARNING, "Unable to allocate memory for callee feature flags. Aborting!\n");
+			ast_datastore_free(ds_callee_features);
+			return;
+		}
+		ds_callee_features->inheritance = DATASTORE_INHERIT_FOREVER;
+		callee_features->is_caller = 0;
+		ast_copy_flags(&(callee_features->features_callee), &(config->features_caller), AST_FLAGS_ALL);
+		ast_copy_flags(&(callee_features->features_caller), &(config->features_callee), AST_FLAGS_ALL);
+		ds_callee_features->data = callee_features;
+		ast_channel_lock(callee);
+		ast_channel_datastore_add(callee, ds_callee_features);
+		ast_channel_unlock(callee);
+	}
+
+	return;
+}
+
 /*!
  * \brief bridge the call and set CDR
  * \param chan,peer,config
@@ -2284,6 +2437,9 @@
 		pbx_builtin_setvar_helper(chan, "BLINDTRANSFER", NULL);
 	}
 
+	set_bridge_features_on_config(config, pbx_builtin_getvar_helper(chan, "BRIDGE_FEATURES"));
+	add_features_datastores(chan, peer, config);
+
 	/* This is an interesting case.  One example is if a ringing channel gets redirected to
 	 * an extension that picks up a parked call.  This will make sure that the call taken
 	 * out of parking gets told that the channel it just got bridged to is still ringing. */
@@ -2307,7 +2463,7 @@
 			pbx_exec(src, monitor_app, tmp);
 		}
 	}
-	
+
 	set_config_flags(chan, peer, config);
 	config->firstpass = 1;
 
@@ -2374,7 +2530,7 @@
 	}
 	for (;;) {
 		struct ast_channel *other;	/* used later */
-		
+	
 		res = ast_channel_bridge(chan, peer, config, &f, &who);
 
 		if (config->feature_timer) {
@@ -2716,6 +2872,50 @@
 		);
 }
 
+static char *callback_dialoptions(struct ast_flags *features_callee, struct ast_flags *features_caller, char *options, size_t len)
+{
+	int i = 0;
+	enum {
+		OPT_CALLEE_REDIRECT   = 't',
+		OPT_CALLER_REDIRECT   = 'T',
+		OPT_CALLEE_AUTOMON    = 'w',
+		OPT_CALLER_AUTOMON    = 'W',
+		OPT_CALLEE_DISCONNECT = 'h',
+		OPT_CALLER_DISCONNECT = 'H',
+		OPT_CALLEE_PARKCALL   = 'k',
+		OPT_CALLER_PARKCALL   = 'K',
+	};
+
+	memset(options, 0, len);
+	if (ast_test_flag(features_caller, AST_FEATURE_REDIRECT) && i < len) {
+		options[i++] = OPT_CALLER_REDIRECT;
+	}
+	if (ast_test_flag(features_caller, AST_FEATURE_AUTOMON) && i < len) {
+		options[i++] = OPT_CALLER_AUTOMON;
+	}
+	if (ast_test_flag(features_caller, AST_FEATURE_DISCONNECT) && i < len) {
+		options[i++] = OPT_CALLER_DISCONNECT;
+	}
+	if (ast_test_flag(features_caller, AST_FEATURE_PARKCALL) && i < len) {
+		options[i++] = OPT_CALLER_PARKCALL;
+	}
+
+	if (ast_test_flag(features_callee, AST_FEATURE_REDIRECT) && i < len) {
+		options[i++] = OPT_CALLEE_REDIRECT;
+	}
+	if (ast_test_flag(features_callee, AST_FEATURE_AUTOMON) && i < len) {
+		options[i++] = OPT_CALLEE_AUTOMON;
+	}
+	if (ast_test_flag(features_callee, AST_FEATURE_DISCONNECT) && i < len) {
+		options[i++] = OPT_CALLEE_DISCONNECT;
+	}
+	if (ast_test_flag(features_callee, AST_FEATURE_PARKCALL) && i < len) {
+		options[i++] = OPT_CALLEE_PARKCALL;
+	}
+
+	return options;
+}
+
 /*! \brief Run management on parkinglots, called once per parkinglot */
 int manage_parkinglot(struct ast_parkinglot *curlot, fd_set *rfds, fd_set *efds, fd_set *nrfds, fd_set *nefds, int *ms, int *max)
 {
@@ -2773,10 +2973,13 @@
 						peername += 7;
 					}
 
-					if (dialfeatures)
-						snprintf(returnexten, sizeof(returnexten), "%s,,%s", peername, dialfeatures->options);
-					else /* Existing default */
-						snprintf(returnexten, sizeof(returnexten), "%s,,t", peername);
+					if (dialfeatures) {
+						char buf[MAX_DIAL_FEATURE_OPTIONS] = {0,};
+						snprintf(returnexten, sizeof(returnexten), "%s|30|%s", peername, callback_dialoptions(&(dialfeatures->features_callee), &(dialfeatures->features_caller), buf, sizeof(buf)));
+					} else { /* Existing default */
+						ast_log(LOG_WARNING, "Dialfeatures not found on %s, using default!\n", chan->name);
+						snprintf(returnexten, sizeof(returnexten), "%s|30|t", peername);
+					}
 
 					ast_add_extension2(con, 1, peername_flat, 1, NULL, NULL, "Dial", ast_strdup(returnexten), ast_free_ptr, registrar);
 				}
@@ -3096,8 +3299,11 @@
 	//ASTOBJ_UNLOCK(parkinglot);
 
 	if (peer) {
+		struct ast_datastore *features_datastore;
+		struct ast_dial_features *dialfeatures = NULL;
+
 		/* Play a courtesy to the source(s) configured to prefix the bridge connecting */
-		
+
 		if (!ast_strlen_zero(courtesytone)) {
 			int error = 0;
 			ast_indicate(peer, AST_CONTROL_UNHOLD);
@@ -3122,7 +3328,7 @@
 				return -1;
 			}
 		} else
-			ast_indicate(peer, AST_CONTROL_UNHOLD); 
+			ast_indicate(peer, AST_CONTROL_UNHOLD);
 
 		res = ast_channel_make_compatible(chan, peer);
 		if (res < 0) {
@@ -3137,14 +3343,43 @@
 		pbx_builtin_setvar_helper(chan, "PARKEDCHANNEL", peer->name);
 		ast_cdr_setdestchan(chan->cdr, peer->name);
 		memset(&config, 0, sizeof(struct ast_bridge_config));
-		if ((parkinglot->parkedcalltransfers == AST_FEATURE_FLAG_BYCALLEE) || (parkinglot->parkedcalltransfers == AST_FEATURE_FLAG_BYBOTH))
+
+		/* Get datastore for peer and apply it's features to the callee side of the bridge config */
+		ast_channel_lock(peer);
+		if ((features_datastore = ast_channel_datastore_find(peer, &dial_features_info, NULL))) {
+			dialfeatures = features_datastore->data;
+		}
+		ast_channel_unlock(peer);
+
+		if (dialfeatures) {
+			ast_copy_flags(&(config.features_callee), dialfeatures->is_caller ? &(dialfeatures->features_caller) : &(dialfeatures->features_callee), AST_FLAGS_ALL);
+		}
+
+		if ((parkinglot->parkedcalltransfers == AST_FEATURE_FLAG_BYCALLEE) || (parkinglot->parkedcalltransfers == AST_FEATURE_FLAG_BYBOTH)) {
 			ast_set_flag(&(config.features_callee), AST_FEATURE_REDIRECT);
-		if ((parkinglot->parkedcalltransfers == AST_FEATURE_FLAG_BYCALLER) || (parkinglot->parkedcalltransfers == AST_FEATURE_FLAG_BYBOTH))
+		}
+		if ((parkinglot->parkedcalltransfers == AST_FEATURE_FLAG_BYCALLER) || (parkinglot->parkedcalltransfers == AST_FEATURE_FLAG_BYBOTH)) {
 			ast_set_flag(&(config.features_caller), AST_FEATURE_REDIRECT);
-		if ((parkinglot->parkedcallreparking == AST_FEATURE_FLAG_BYCALLEE) || (parkinglot->parkedcallreparking == AST_FEATURE_FLAG_BYBOTH))
+		}
+		if ((parkinglot->parkedcallreparking == AST_FEATURE_FLAG_BYCALLEE) || (parkinglot->parkedcallreparking == AST_FEATURE_FLAG_BYBOTH)) {
 			ast_set_flag(&(config.features_callee), AST_FEATURE_PARKCALL);
-		if ((parkinglot->parkedcallreparking == AST_FEATURE_FLAG_BYCALLER) || (parkinglot->parkedcallreparking == AST_FEATURE_FLAG_BYBOTH))
+		}
+		if ((parkinglot->parkedcallreparking == AST_FEATURE_FLAG_BYCALLER) || (parkinglot->parkedcallreparking == AST_FEATURE_FLAG_BYBOTH)) {
 			ast_set_flag(&(config.features_caller), AST_FEATURE_PARKCALL);
+		}
+		if ((parkinglot->parkedcallhangup == AST_FEATURE_FLAG_BYCALLEE) || (parkinglot->parkedcallhangup == AST_FEATURE_FLAG_BYBOTH)) {
+			ast_set_flag(&(config.features_callee), AST_FEATURE_DISCONNECT);
+		}

[... 86 lines stripped ...]



More information about the asterisk-commits mailing list