[asterisk-commits] oej: branch group/rana-moh-sip-transfer-1.8 r390010 - in /team/group/rana-moh...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 29 06:50:45 CDT 2013


Author: oej
Date: Wed May 29 06:49:57 2013
New Revision: 390010

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390010
Log:
Making sure we set remote hold in the core so that the channel drivers doesn't have to. Maybe we need a function for local
hold as well.

Added hold states to "core show channel".

Modified:
    team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c
    team/group/rana-moh-sip-transfer-1.8/include/asterisk/channel.h
    team/group/rana-moh-sip-transfer-1.8/include/asterisk/frame.h
    team/group/rana-moh-sip-transfer-1.8/main/channel.c
    team/group/rana-moh-sip-transfer-1.8/main/cli.c

Modified: team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c?view=diff&rev=390010&r1=390009&r2=390010
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c Wed May 29 06:49:57 2013
@@ -4765,16 +4765,6 @@
 		 * implied else case here
 		 */
 		break;
-	case AST_OPTION_LOCAL_HOLD:
-		/* Are we on hold by the device owning this channel */
-		*((unsigned int *) data) = ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD) ? 1 : 0;
-		res = 0;
-		break;
-	case AST_OPTION_BRIDGE_HOLD:
-		/* Are we on hold by the bridged peer to this channel */
-		*((unsigned int *) data) = ast_test_flag(&p->flags[2], SIP_PAGE3_ONHOLD_BY_BRIDGEPEER) ? 1 : 0;
-		res = 0;
-		break;
 	default:
 		break;
 	}
@@ -7504,6 +7494,7 @@
 	ast_channel_lock(tmp);
 	sip_pvt_lock(i);
 	ast_channel_cc_params_init(tmp, i->cc_params);
+	ast_channel_set_musicclass(tmp, i->mohsuggest);
 	tmp->caller.id.tag = ast_strdup(i->cid_tag);
 
 	tmp->tech = ( ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_INFO || ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_SHORTINFO) ?  &sip_tech_info : &sip_tech;
@@ -9902,11 +9893,13 @@
 	}
 
 	if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD) && (!ast_sockaddr_isnull(sa) || !ast_sockaddr_isnull(vsa) || !ast_sockaddr_isnull(tsa) || !ast_sockaddr_isnull(isa)) && (!sendonly || sendonly == -1)) {
+		ast_channel_set_local_hold(p->owner, FALSE);
 		ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
 		/* Activate a re-invite */
 		ast_queue_frame(p->owner, &ast_null_frame);
 		change_hold_state(p, req, FALSE, sendonly);
 	} else if ((sockaddr_is_null_or_any(sa) && sockaddr_is_null_or_any(vsa) && sockaddr_is_null_or_any(tsa) && sockaddr_is_null_or_any(isa)) || (sendonly && sendonly != -1)) {
+		ast_channel_set_local_hold(p->owner, TRUE);
 		ast_queue_control_data(p->owner, AST_CONTROL_HOLD,
 				       S_OR(p->mohsuggest, NULL),
 				       !ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
@@ -20958,8 +20951,7 @@
 			/* Check if the calling channel is on hold */
 			if (p->owner && (bridgedchan = ast_bridged_channel(p->owner)) != NULL) {
 				ast_debug(3, "====> Checking for HOLD state on bridged channel %s\n", bridgedchan->name);
-				ast_channel_queryoption(bridgedchan, AST_OPTION_LOCAL_HOLD, &caller_hold_state, &dummy, 0);
-				if (caller_hold_state) {
+				if (ast_get_local_hold_state(bridgedchan)) {
 					ast_indicate(p->owner, AST_CONTROL_HOLD);
 					ast_debug(3, "====> Bridged channel was on hold, indicating on this channel too \n");
 				}

Modified: team/group/rana-moh-sip-transfer-1.8/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/include/asterisk/channel.h?view=diff&rev=390010&r1=390009&r2=390010
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/include/asterisk/channel.h (original)
+++ team/group/rana-moh-sip-transfer-1.8/include/asterisk/channel.h Wed May 29 06:49:57 2013
@@ -498,7 +498,7 @@
 
 /*! \brief Structure for hold states */
 struct media_hold_state {
-	char musicclass[128];
+	char mohsuggest[128];
 	enum ast_hold_state state;
 };
 
@@ -3534,7 +3534,7 @@
 int ast_channel_get_cc_agent_type(struct ast_channel *chan, char *agent_type, size_t size);
 
 /* \brief Set musicclass used if this channel puts another channel on hold */
-int ast_channel_set_musicclass(struct ast_channel *chan, const char *musicclass);
+int ast_channel_set_hold_musicclass(struct ast_channel *chan, const char *musicclass);
 
 /* \brief Set local hold - the device connected to the line to Asterisk puts a call on hold, i.e. mutes the audio stream */
 int ast_channel_set_local_hold(struct ast_channel *chan, int hold);

Modified: team/group/rana-moh-sip-transfer-1.8/include/asterisk/frame.h
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/include/asterisk/frame.h?view=diff&rev=390010&r1=390009&r2=390010
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/include/asterisk/frame.h (original)
+++ team/group/rana-moh-sip-transfer-1.8/include/asterisk/frame.h Wed May 29 06:49:57 2013
@@ -494,12 +494,6 @@
 #define AST_OPTION_SECURE_SIGNALING        18
 #define AST_OPTION_SECURE_MEDIA            19
 
-/*! Check hold status - hold locally by attached endpoint */
-#define AST_OPTION_LOCAL_HOLD        20
-
-/*! Check hold status - hold by bridged channel */
-#define AST_OPTION_BRIDGE_HOLD        21
-
 struct oprmode {
 	struct ast_channel *peer;
 	int mode;

Modified: team/group/rana-moh-sip-transfer-1.8/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/main/channel.c?view=diff&rev=390010&r1=390009&r2=390010
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/main/channel.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/main/channel.c Wed May 29 06:49:57 2013
@@ -4471,6 +4471,13 @@
 			ast_party_redirecting_free(&redirecting);
 		}
 		break;
+
+	case AST_CONTROL_HOLD:
+		ast_channel_set_remote_hold(chan, 1);
+		break;
+	case AST_CONTROL_UNHOLD:
+		ast_channel_set_remote_hold(chan, 0);
+		break;
 	
 	default:
 		break;
@@ -6820,6 +6827,9 @@
 
 	/* Copy the music class */
 	ast_string_field_set(original, musicclass, clonechan->musicclass);
+
+	/* Copy the hold settings */
+	original->hold_state = clonechan->hold_state;
 
 	/* copy over accuntcode and set peeraccount across the bridge */
 	ast_string_field_set(original, accountcode, S_OR(clonechan->accountcode, ""));
@@ -9733,13 +9743,13 @@
 }
 
 
-int ast_channel_set_musicclass(struct ast_channel *chan, const char *musicclass)
+int ast_channel_set_hold_musicclass(struct ast_channel *chan, const char *musicclass)
 {
 	if (!chan || musicclass == NULL) {
 		return -1;
 	}
 
-	ast_copy_string(chan->hold_state.musicclass, musicclass, sizeof(chan->hold_state.musicclass));
+	ast_copy_string(chan->hold_state.mohsuggest, musicclass, sizeof(chan->hold_state.mohsuggest));
 	return 0;
 }
 

Modified: team/group/rana-moh-sip-transfer-1.8/main/cli.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/main/cli.c?view=diff&rev=390010&r1=390009&r2=390010
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/main/cli.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/main/cli.c Wed May 29 06:49:57 2013
@@ -1470,6 +1470,7 @@
 		"   Elapsed Time: %s\n"
 		"  Direct Bridge: %s\n"
 		"Indirect Bridge: %s\n"
+		"     Hold state: %s %s\n"
 		" --   PBX   --\n"
 		"        Context: %s\n"
 		"      Extension: %s\n"
@@ -1499,6 +1500,8 @@
 		c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
 		(long)c->whentohangup.tv_sec,
 		cdrtime, c->_bridge ? c->_bridge->name : "<none>", ast_bridged_channel(c) ? ast_bridged_channel(c)->name : "<none>", 
+		ast_channel_get_local_hold_state(c) ? "Local" : "",
+		ast_channel_get_remote_hold_state(c) ? "Remote" : "",
 		c->context, c->exten, c->priority, c->callgroup, c->pickupgroup, ( c->appl ? c->appl : "(N/A)" ),
 		( c-> data ? S_OR(c->data, "(Empty)") : "(None)"),
 		(ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)"));




More information about the asterisk-commits mailing list