summaryrefslogtreecommitdiff
path: root/channels/chan_dahdi.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2011-06-28 17:38:28 +0000
committerRichard Mudgett <rmudgett@digium.com>2011-06-28 17:38:28 +0000
commit70be58c1a7481a0c347700b65fe0a21cf72d83d6 (patch)
tree2125f5cea298977f348b0d133045b5ffc8aa4ae4 /channels/chan_dahdi.c
parentbacc0a0c91f908fdbc442f2e7c1dc08efcf0a9eb (diff)
Merged revisions 325212 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r325212 | rmudgett | 2011-06-28 12:30:16 -0500 (Tue, 28 Jun 2011) | 7 lines Use the device name and not the channel name to initialize the device state. Correct ASTERISK-11323 implementation as I don't see how it ever worked as claimed when it used the channel name and not the device name. (issue ASTERISK-11323) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@325213 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_dahdi.c')
-rw-r--r--channels/chan_dahdi.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 2fe9e01f6..3a0260fbd 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -9491,6 +9491,8 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
int features;
struct ast_str *chan_name;
struct ast_variable *v;
+ char *dashptr;
+ char device_name[AST_CHANNEL_NAME];
if (i->subs[idx].owner) {
ast_log(LOG_WARNING, "Channel %d already has a %s call\n", i->channel,subnames[idx]);
@@ -9672,7 +9674,13 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
/* Configure the new channel jb */
ast_jb_configure(tmp, &global_jbconf);
- ast_devstate_changed_literal(ast_state_chan2dev(state), tmp->name);
+ /* Set initial device state */
+ ast_copy_string(device_name, tmp->name, sizeof(device_name));
+ dashptr = strrchr(device_name, '-');
+ if (dashptr) {
+ *dashptr = '\0';
+ }
+ ast_devstate_changed_literal(AST_DEVICE_UNKNOWN, device_name);
for (v = i->vars ; v ; v = v->next)
pbx_builtin_setvar_helper(tmp, v->name, v->value);