[asterisk-commits] russell: branch russell/chan_console r49050 - in
/team/russell/chan_console: ...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Dec 28 22:26:18 MST 2006
Author: russell
Date: Thu Dec 28 23:26:17 2006
New Revision: 49050
URL: http://svn.digium.com/view/asterisk?view=rev&rev=49050
Log:
- Include the sound info
- Support the overridecontext option in the config
Modified:
team/russell/chan_console/channels/Makefile
team/russell/chan_console/channels/chan_console.c
team/russell/chan_console/configs/console.conf.sample
Modified: team/russell/chan_console/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/channels/Makefile?view=diff&rev=49050&r1=49049&r2=49050
==============================================================================
--- team/russell/chan_console/channels/Makefile (original)
+++ team/russell/chan_console/channels/Makefile Thu Dec 28 23:26:17 2006
@@ -97,6 +97,8 @@
chan_alsa.o: busy.h ringtone.h
+chan_console.o: busy.h ringtone.h
+
ifeq ($(OSARCH),linux-gnu)
chan_h323.so: chan_h323.o h323/libchanh323.a h323/Makefile.ast
$(ECHO_PREFIX) echo " [LD] $^ -> $@"
Modified: team/russell/chan_console/channels/chan_console.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/channels/chan_console.c?view=diff&rev=49050&r1=49049&r2=49050
==============================================================================
--- team/russell/chan_console/channels/chan_console.c (original)
+++ team/russell/chan_console/channels/chan_console.c Thu Dec 28 23:26:17 2006
@@ -50,12 +50,39 @@
#include "asterisk/cli.h"
#include "asterisk/musiconhold.h"
+#include "busy.h"
+#include "ringtone.h"
+#include "ring10.h"
+#include "answer.h"
+
#define SAMPLE_RATE 8000
#define NUM_SAMPLES 160
#define INPUT_CHANNELS 1
#define OUTPUT_CHANNELS 1
#define CONFIG_FILE "console.conf"
+
+/*
+ * Each sound is made of 'datalen' samples of sound, repeated as needed to
+ * generate 'samplen' samples of data, then followed by 'silencelen' samples
+ * of silence. The loop is repeated if 'repeat' is set.
+ */
+static struct sound {
+ const int ind;
+ const char *desc;
+ const short *data;
+ const int datalen;
+ const int samplen;
+ const int silencelen;
+ const int repeat;
+} sounds[] __attribute__ ((unused)) = {
+ { AST_CONTROL_RINGING, "RINGING", ringtone, sizeof(ringtone)/2, 16000, 32000, 1 },
+ { AST_CONTROL_BUSY, "BUSY", busy, sizeof(busy)/2, 4000, 4000, 1 },
+ { AST_CONTROL_CONGESTION, "CONGESTION", busy, sizeof(busy)/2, 2000, 2000, 1 },
+ { AST_CONTROL_RING, "RING10", ring10, sizeof(ring10)/2, 16000, 32000, 1 },
+ { AST_CONTROL_ANSWER, "ANSWER", answer, sizeof(answer)/2, 2200, 0, 0 },
+ { -1, NULL, 0, 0, 0, 0 }, /* end marker */
+};
static struct console_pvt {
struct ast_channel *owner;
@@ -68,6 +95,7 @@
unsigned int write_dst;
ast_cond_t cond;
ast_mutex_t lock;
+ int cur_sound;
unsigned int hookstate:1;
unsigned int overridecontext:1;
unsigned int incallback:1;
@@ -586,6 +614,7 @@
/* default values */
memcpy(&global_jbconf, &default_jbconf, sizeof(global_jbconf));
strcpy(pvt.mohinterpret, "default");
+ pvt.overridecontext = 0;
if (!(cfg = ast_config_load(CONFIG_FILE))) {
ast_log(LOG_NOTICE, "Unable to open configuration file %s!\n", CONFIG_FILE);
@@ -597,6 +626,8 @@
continue;
else if (!strcasecmp(v->name, "mohinterpret"))
ast_copy_string(pvt.mohinterpret, v->value, sizeof(pvt.mohinterpret));
+ else if (!strcasecmp(v->name, "overridecontext"))
+ pvt.overridecontext = ast_true(v->value) ? 1 : 0;
else {
ast_log(LOG_WARNING, "Unknown option '%s' on line '%d' of '%s'!\n",
v->name, v->lineno, CONFIG_FILE);
Modified: team/russell/chan_console/configs/console.conf.sample
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/configs/console.conf.sample?view=diff&rev=49050&r1=49049&r2=49050
==============================================================================
--- team/russell/chan_console/configs/console.conf.sample (original)
+++ team/russell/chan_console/configs/console.conf.sample Thu Dec 28 23:26:17 2006
@@ -3,6 +3,15 @@
;
[general]
+
+; If you set overridecontext to 'yes', then the whole dial string
+; will be interpreted as an extension, which is extremely useful
+; to dial SIP, IAX and other extensions which use the '@' character.
+; The default is 'no'.
+;
+; overridecontext = no ; if 'no', the last @ will start the context
+ ; if 'yes' the whole string is an extension.
+
; Default Music on Hold class to use when this channel is placed on hold in
; the case that the music class is not set on the channel with
More information about the asterisk-commits
mailing list