diff options
Diffstat (limited to 'channels/chan_phone.c')
-rw-r--r-- | channels/chan_phone.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/channels/chan_phone.c b/channels/chan_phone.c index 26e692127..8312fabf0 100644 --- a/channels/chan_phone.c +++ b/channels/chan_phone.c @@ -385,6 +385,7 @@ static int phone_hangup(struct ast_channel *ast) p->dialtone = 0; memset(p->ext, 0, sizeof(p->ext)); ((struct phone_pvt *)(ast->tech_pvt))->owner = NULL; + ast_module_unref(ast_module_info->self); if (option_verbose > 2) ast_verbose( VERBOSE_PREFIX_3 "Hungup '%s'\n", ast->name); ast->tech_pvt = NULL; @@ -907,6 +908,7 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *conte tmp->cid.cid_name = ast_strdup(i->cid_name); i->owner = tmp; + ast_module_ref(ast_module_info->self); if (state != AST_STATE_DOWN) { if (state == AST_STATE_RING) { ioctl(tmp->fds[0], PHONE_RINGBACK); @@ -987,6 +989,7 @@ static void phone_check_exception(struct phone_pvt *i) if (i->mode == MODE_IMMEDIATE) { phone_new(i, AST_STATE_RING, i->context); } else if (i->mode == MODE_DIALTONE) { + ast_module_ref(ast_module_info->self); /* Reset the extension */ i->ext[0] = '\0'; /* Play the dialtone */ @@ -996,6 +999,7 @@ static void phone_check_exception(struct phone_pvt *i) ioctl(i->fd, PHONE_PLAY_START); i->lastformat = -1; } else if (i->mode == MODE_SIGMA) { + ast_module_ref(ast_module_info->self); /* Reset the extension */ i->ext[0] = '\0'; /* Play the dialtone */ @@ -1003,6 +1007,8 @@ static void phone_check_exception(struct phone_pvt *i) ioctl(i->fd, PHONE_DIALTONE); } } else { + if (i->dialtone) + ast_module_unref(ast_module_info->self); memset(i->ext, 0, sizeof(i->ext)); if (i->cpt) { |