diff options
Diffstat (limited to 'main/channel.c')
-rw-r--r-- | main/channel.c | 13 |
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", |