aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2005-11-21 01:11:40 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2005-11-21 01:11:40 +0000
commitdda02a7ba6137a040a08979c49d27282ee43c63b (patch)
tree8f63a9823dfcaef54ab12ea86c6dfbb332b055d8
parent0e84c0c11364c366ceb0a0c60b07bba251151fc1 (diff)
issue #5800
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7158 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xChangeLog2
-rwxr-xr-xchannels/chan_oss.c16
-rwxr-xr-xconfigs/oss.conf.sample4
3 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9cd3bbe71..e0b6eda96 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2005-11-20 Russell Bryant <russell@digium.com>
+ * channels/chan_oss.c configs/oss.conf.sample: Add the ability to set callerid in oss.conf.
+
* channels/chan_sip.c channels/chan_iax2.c: Change warning messages about the number of scheduled events happening all at once to debug messages. (issue #5794)
2005-11-20 Josh Roberson <josh@asteriasgi.com>
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 913c46c4e..b44cacb3e 100755
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -55,6 +55,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/lock.h"
#include "asterisk/frame.h"
#include "asterisk/logger.h"
+#include "asterisk/callerid.h" /* for ast_callerid_split() */
#include "asterisk/channel.h"
#include "asterisk/module.h"
#include "asterisk/options.h"
@@ -284,6 +285,8 @@ struct chan_oss_pvt {
char ext[AST_MAX_EXTENSION];
char ctx[AST_MAX_CONTEXT];
char language[MAX_LANGUAGE];
+ char cid_name[256]; /*XXX */
+ char cid_num[256]; /*XXX */
/* buffers used in oss_write */
char oss_write_buf[FRAME_SIZE*2];
@@ -892,6 +895,10 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o,
ast_copy_string(c->exten, ext, sizeof(c->exten));
if (!ast_strlen_zero(o->language))
ast_copy_string(c->language, o->language, sizeof(c->language));
+ if (!ast_strlen_zero(o->cid_num))
+ c->cid.cid_num = strdup(o->cid_num);
+ if (!ast_strlen_zero(o->cid_name))
+ c->cid.cid_name = strdup(o->cid_name);
o->owner = c;
ast_setstate(c, state);
@@ -1275,6 +1282,14 @@ static void store_mixer(struct chan_oss_pvt *o, char *s)
}
/*
+ * store the callerid components
+ */
+static void store_callerid(struct chan_oss_pvt *o, char *s)
+{
+ ast_callerid_split(s, o->cid_name, sizeof(o->cid_name), o->cid_num, sizeof(o->cid_num));
+}
+
+/*
* grab fields from the config file, init the descriptor and open the device.
*/
static struct chan_oss_pvt * store_config(struct ast_config *cfg, char *ctg)
@@ -1315,6 +1330,7 @@ static struct chan_oss_pvt * store_config(struct ast_config *cfg, char *ctg)
M_STR("language", o->language)
M_STR("extension", o->ext)
M_F("mixer", store_mixer(o, v->value))
+ M_F("callerid", store_callerid(o, v->value))
M_END(;);
}
if (ast_strlen_zero(o->device))
diff --git a/configs/oss.conf.sample b/configs/oss.conf.sample
index 148a2a656..3b268425a 100755
--- a/configs/oss.conf.sample
+++ b/configs/oss.conf.sample
@@ -25,6 +25,10 @@ extension=s
;
;language=en
;
+; CallerID for outbound calls
+;
+;callerid=John Doe <1234>
+;
; Silence supression can be enabled when sound is over a certain threshold.
; The value for the threshold should probably be between 500 and 2000 or so,
; but your mileage may vary. Use the echo test to evaluate the best setting.