summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2008-07-25 17:24:43 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2008-07-25 17:24:43 +0000
commitc780a443bffe3efa5998b78cdc31643235f1e274 (patch)
tree4a04810816158f70796c59c825e7169d5f83417b /main/channel.c
parentdff6f087845124fc32d9ce9d0f7b9aea00042b90 (diff)
Merged revisions 133649 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r133649 | tilghman | 2008-07-25 12:19:39 -0500 (Fri, 25 Jul 2008) | 8 lines Fix some errant device states by making the devicestate API more strict in terms of the device argument (only without the unique identifier appended). (closes issue #12771) Reported by: davidw Patches: 20080717__bug12771.diff.txt uploaded by Corydon76 (license 14) Tested by: davidw, jvandal, murf ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@133665 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/main/channel.c b/main/channel.c
index 443715549..d562afd69 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1277,7 +1277,7 @@ void ast_channel_free(struct ast_channel *chan)
struct ast_frame *f;
struct varshead *headp;
struct ast_datastore *datastore = NULL;
- char name[AST_CHANNEL_NAME];
+ char name[AST_CHANNEL_NAME], *dashptr;
headp=&chan->varshead;
@@ -1310,6 +1310,9 @@ void ast_channel_free(struct ast_channel *chan)
sched_context_destroy(chan->sched);
ast_copy_string(name, chan->name, sizeof(name));
+ if ((dashptr = strrchr(name, '-'))) {
+ *dashptr = '\0';
+ }
/* Stop monitoring */
if (chan->monitor)
@@ -4086,12 +4089,18 @@ void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char
int ast_setstate(struct ast_channel *chan, enum ast_channel_state state)
{
int oldstate = chan->_state;
+ char name[AST_CHANNEL_NAME], *dashptr;
if (oldstate == state)
return 0;
+ ast_copy_string(name, chan->name, sizeof(name));
+ if ((dashptr = strrchr(name, '-'))) {
+ *dashptr = '\0';
+ }
+
chan->_state = state;
- ast_device_state_changed_literal(chan->name);
+ ast_device_state_changed_literal(name);
/* setstate used to conditionally report Newchannel; this is no more */
manager_event(EVENT_FLAG_CALL,
"Newstate",