[asterisk-commits] dlee: branch dlee/ASTERISK-22440-swagger-1.2 r400969 - in /team/dlee/ASTERISK...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 15 09:25:57 CDT 2013


Author: dlee
Date: Tue Oct 15 09:25:53 2013
New Revision: 400969

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=400969
Log:
Merged revisions 400910-400958 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    team/dlee/ASTERISK-22440-swagger-1.2/   (props changed)
    team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_dahdi.c
    team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_dahdi.h
    team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_sip.c
    team/dlee/ASTERISK-22440-swagger-1.2/rest-api-templates/asterisk_processor.py

Propchange: team/dlee/ASTERISK-22440-swagger-1.2/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/dlee/ASTERISK-22440-swagger-1.2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Oct 15 09:25:53 2013
@@ -1,1 +1,1 @@
-/branches/12:1-400900
+/branches/12:1-400968

Modified: team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_dahdi.c?view=diff&rev=400969&r1=400968&r2=400969
==============================================================================
--- team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_dahdi.c (original)
+++ team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_dahdi.c Tue Oct 15 09:25:53 2013
@@ -15356,12 +15356,87 @@
 
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "dahdi set hwgain";
+		e->command = "dahdi set hwgain {rx|tx}";
 		e->usage =
 			"Usage: dahdi set hwgain <rx|tx> <chan#> <gain>\n"
-			"	Sets the hardware gain on a a given channel, overriding the\n"
-			"   value provided at module loadtime, whether the channel is in\n"
-			"   use or not.  Changes take effect immediately.\n"
+			"   Sets the hardware gain on a given channel.  Changes take effect\n"
+			"   immediately whether the channel is in use or not.\n"
+			"\n"
+			"   <rx|tx> which direction do you want to change (relative to our module)\n"
+			"   <chan num> is the channel number relative to the device\n"
+			"   <gain> is the gain in dB (e.g. -3.5 for -3.5dB)\n"
+			"\n"
+			"   Please note:\n"
+			"   * This is currently the only way to set hwgain by the channel driver.\n"
+			"   * hwgain is only supportable by hardware with analog ports because\n"
+			"     hwgain works on the analog side of an analog-digital conversion.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 6)
+		return CLI_SHOWUSAGE;
+
+	if (!strcasecmp("rx", a->argv[3]))
+		tx = 0; /* rx */
+	else if (!strcasecmp("tx", a->argv[3]))
+		tx = 1; /* tx */
+	else
+		return CLI_SHOWUSAGE;
+
+	channel = atoi(a->argv[4]);
+	gain = atof(a->argv[5])*10.0;
+
+	ast_mutex_lock(&iflock);
+
+	for (tmp = iflist; tmp; tmp = tmp->next) {
+
+		if (tmp->channel != channel)
+			continue;
+
+		if (tmp->subs[SUB_REAL].dfd == -1)
+			break;
+
+		hwgain.newgain = gain;
+		hwgain.tx = tx;
+		if (ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_SET_HWGAIN, &hwgain) < 0) {
+			ast_cli(a->fd, "Unable to set the hardware gain for channel %d: %s\n", channel, strerror(errno));
+			ast_mutex_unlock(&iflock);
+			return CLI_FAILURE;
+		}
+		ast_cli(a->fd, "hardware %s gain set to %d (%.1f dB) on channel %d\n",
+			tx ? "tx" : "rx", gain, (float)gain/10.0, channel);
+		break;
+	}
+
+	ast_mutex_unlock(&iflock);
+
+	if (tmp)
+		return CLI_SUCCESS;
+
+	ast_cli(a->fd, "Unable to find given channel %d\n", channel);
+	return CLI_FAILURE;
+
+}
+
+static char *dahdi_set_swgain(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	int channel;
+	float gain;
+	int tx;
+	int res;
+	struct dahdi_pvt *tmp = NULL;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "dahdi set swgain {rx|tx}";
+		e->usage =
+			"Usage: dahdi set swgain <rx|tx> <chan#> <gain>\n"
+			"   Sets the software gain on a given channel and overrides the\n"
+			"   value provided at module loadtime.  Changes take effect\n"
+			"   immediately whether the channel is in use or not.\n"
+			"\n"
 			"   <rx|tx> which direction do you want to change (relative to our module)\n"
 			"   <chan num> is the channel number relative to the device\n"
 			"   <gain> is the gain in dB (e.g. -3.5 for -3.5dB)\n";
@@ -15381,75 +15456,6 @@
 		return CLI_SHOWUSAGE;
 
 	channel = atoi(a->argv[4]);
-	gain = atof(a->argv[5])*10.0;
-
-	ast_mutex_lock(&iflock);
-
-	for (tmp = iflist; tmp; tmp = tmp->next) {
-
-		if (tmp->channel != channel)
-			continue;
-
-		if (tmp->subs[SUB_REAL].dfd == -1)
-			break;
-
-		hwgain.newgain = gain;
-		hwgain.tx = tx;
-		if (ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_SET_HWGAIN, &hwgain) < 0) {
-			ast_cli(a->fd, "Unable to set the hardware gain for channel %d: %s\n", channel, strerror(errno));
-			ast_mutex_unlock(&iflock);
-			return CLI_FAILURE;
-		}
-		ast_cli(a->fd, "hardware %s gain set to %d (%.1f dB) on channel %d\n",
-			tx ? "tx" : "rx", gain, (float)gain/10.0, channel);
-		break;
-	}
-
-	ast_mutex_unlock(&iflock);
-
-	if (tmp)
-		return CLI_SUCCESS;
-
-	ast_cli(a->fd, "Unable to find given channel %d\n", channel);
-	return CLI_FAILURE;
-
-}
-
-static char *dahdi_set_swgain(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-	int channel;
-	float gain;
-	int tx;
-	int res;
-	struct dahdi_pvt *tmp = NULL;
-
-	switch (cmd) {
-	case CLI_INIT:
-		e->command = "dahdi set swgain";
-		e->usage =
-			"Usage: dahdi set swgain <rx|tx> <chan#> <gain>\n"
-			"	Sets the software gain on a a given channel, overriding the\n"
-			"   value provided at module loadtime, whether the channel is in\n"
-			"   use or not.  Changes take effect immediately.\n"
-			"   <rx|tx> which direction do you want to change (relative to our module)\n"
-			"   <chan num> is the channel number relative to the device\n"
-			"   <gain> is the gain in dB (e.g. -3.5 for -3.5dB)\n";
-		return NULL;
-	case CLI_GENERATE:
-		return NULL;
-	}
-
-	if (a->argc != 6)
-		return CLI_SHOWUSAGE;
-
-	if (!strcasecmp("rx", a->argv[3]))
-		tx = 0; /* rx */
-	else if (!strcasecmp("tx", a->argv[3]))
-		tx = 1; /* tx */
-	else
-		return CLI_SHOWUSAGE;
-
-	channel = atoi(a->argv[4]);
 	gain = atof(a->argv[5]);
 
 	ast_mutex_lock(&iflock);
@@ -15474,6 +15480,12 @@
 
 		ast_cli(a->fd, "software %s gain set to %.1f on channel %d\n",
 			tx ? "tx" : "rx", gain, channel);
+
+		if (tx) {
+			tmp->txgain = gain;
+		} else {
+			tmp->rxgain = gain;
+		}
 		break;
 	}
 	ast_mutex_unlock(&iflock);

Modified: team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_dahdi.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_dahdi.h?view=diff&rev=400969&r1=400968&r2=400969
==============================================================================
--- team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_dahdi.h (original)
+++ team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_dahdi.h Tue Oct 15 09:25:53 2013
@@ -149,9 +149,9 @@
 	struct dahdi_pvt *oprpeer;				/*!< "Operator Services" peer tech_pvt ptr */
 	/*! \brief Amount of gain to increase during caller id */
 	float cid_rxgain;
-	/*! \brief Rx gain set by chan_dahdi.conf */
+	/*! \brief Software Rx gain set by chan_dahdi.conf */
 	float rxgain;
-	/*! \brief Tx gain set by chan_dahdi.conf */
+	/*! \brief Software Tx gain set by chan_dahdi.conf */
 	float txgain;
 
 	float txdrc; /*!< Dynamic Range Compression factor. a number between 1 and 6ish */

Modified: team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_sip.c?view=diff&rev=400969&r1=400968&r2=400969
==============================================================================
--- team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_sip.c (original)
+++ team/dlee/ASTERISK-22440-swagger-1.2/channels/chan_sip.c Tue Oct 15 09:25:53 2013
@@ -7417,6 +7417,7 @@
 {
 	int res = 0;
 	struct sip_pvt *p = ast_channel_tech_pvt(ast);
+	int oldsdp = FALSE;
 
 	if (!p) {
 		ast_debug(1, "Asked to answer channel %s without tech pvt; ignoring\n",
@@ -7427,10 +7428,14 @@
 	if (ast_channel_state(ast) != AST_STATE_UP) {
 		try_suggested_sip_codec(p);
 
+		if (ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT)) {
+			oldsdp = TRUE;
+		}
+
 		ast_setstate(ast, AST_STATE_UP);
 		ast_debug(1, "SIP answering channel: %s\n", ast_channel_name(ast));
 		ast_rtp_instance_update_source(p->rtp);
-		res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL, FALSE, TRUE);
+		res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL, oldsdp, TRUE);
 		ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
 	}
 	sip_pvt_unlock(p);

Modified: team/dlee/ASTERISK-22440-swagger-1.2/rest-api-templates/asterisk_processor.py
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22440-swagger-1.2/rest-api-templates/asterisk_processor.py?view=diff&rev=400969&r1=400968&r2=400969
==============================================================================
--- team/dlee/ASTERISK-22440-swagger-1.2/rest-api-templates/asterisk_processor.py (original)
+++ team/dlee/ASTERISK-22440-swagger-1.2/rest-api-templates/asterisk_processor.py Tue Oct 15 09:25:53 2013
@@ -218,6 +218,7 @@
         if prop.name != prop.name.lower():
             raise SwaggerError("Property name should be all lowercase",
                                context)
+        prop.wiki_description = wikify(prop.description)
 
     def process_type(self, swagger_type, context):
         swagger_type.c_name = snakify(swagger_type.name)




More information about the asterisk-commits mailing list