From c25499d6c75ea145820465178ef982d256432bc6 Mon Sep 17 00:00:00 2001 From: murf Date: Tue, 7 Nov 2006 23:46:41 +0000 Subject: These mods are to solve the problem in bug 7506. It's a lot of rework to solve a fairly small problem... such is life. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@47303 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_oss.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'channels/chan_oss.c') diff --git a/channels/chan_oss.c b/channels/chan_oss.c index 02ba5ad7e..b431f8288 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -997,11 +997,10 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx, { struct ast_channel *c; - c = ast_channel_alloc(1); + c = ast_channel_alloc(1, state, o->cid_num, o->cid_name, "OSS/%s", o->device + 5); if (c == NULL) return NULL; c->tech = &oss_tech; - ast_string_field_build(c, name, "OSS/%s", o->device + 5); if (o->sounddev < 0) setformat(o, O_RDWR); c->fds[0] = o->sounddev; /* -1 if device closed, override later */ @@ -1016,12 +1015,15 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx, ast_copy_string(c->exten, ext, sizeof(c->exten)); if (!ast_strlen_zero(o->language)) ast_string_field_set(c, language, o->language); - ast_set_callerid(c, o->cid_num, o->cid_name, o->cid_num); + /* Don't use ast_set_callerid() here because it will + * generate a needless NewCallerID event */ + c->cid.cid_num = ast_strdup(o->cid_num); + c->cid.cid_ani = ast_strdup(o->cid_num); + c->cid.cid_name = ast_strdup(o->cid_name); if (!ast_strlen_zero(ext)) c->cid.cid_dnid = ast_strdup(ext); o->owner = c; - ast_setstate(c, state); ast_mutex_lock(&usecnt_lock); usecnt++; ast_mutex_unlock(&usecnt_lock); -- cgit v1.2.3