|
|
|
@ -93,7 +93,6 @@ static char context[AST_MAX_EXTENSION] = "default";
|
|
|
|
|
|
|
|
|
|
/* Default language */
|
|
|
|
|
static char language[MAX_LANGUAGE] = "";
|
|
|
|
|
static int usecnt =0;
|
|
|
|
|
|
|
|
|
|
static int echocancel = AEC_OFF;
|
|
|
|
|
|
|
|
|
@ -101,8 +100,6 @@ static int silencesupression = 0;
|
|
|
|
|
|
|
|
|
|
static int prefformat = AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW;
|
|
|
|
|
|
|
|
|
|
AST_MUTEX_DEFINE_STATIC(usecnt_lock);
|
|
|
|
|
|
|
|
|
|
/* Protect the interface list (of phone_pvt's) */
|
|
|
|
|
AST_MUTEX_DEFINE_STATIC(iflock);
|
|
|
|
|
|
|
|
|
@ -385,12 +382,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_mutex_lock(&usecnt_lock);
|
|
|
|
|
usecnt--;
|
|
|
|
|
if (usecnt < 0)
|
|
|
|
|
ast_log(LOG_WARNING, "Usecnt < 0???\n");
|
|
|
|
|
ast_mutex_unlock(&usecnt_lock);
|
|
|
|
|
ast_update_use_count();
|
|
|
|
|
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;
|
|
|
|
@ -877,10 +869,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_mutex_lock(&usecnt_lock);
|
|
|
|
|
usecnt++;
|
|
|
|
|
ast_mutex_unlock(&usecnt_lock);
|
|
|
|
|
ast_update_use_count();
|
|
|
|
|
ast_module_ref(ast_module_info->self);
|
|
|
|
|
if (state != AST_STATE_DOWN) {
|
|
|
|
|
if (state == AST_STATE_RING) {
|
|
|
|
|
ioctl(tmp->fds[0], PHONE_RINGBACK);
|
|
|
|
@ -960,10 +949,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_mutex_lock(&usecnt_lock);
|
|
|
|
|
usecnt++;
|
|
|
|
|
ast_mutex_unlock(&usecnt_lock);
|
|
|
|
|
ast_update_use_count();
|
|
|
|
|
ast_module_ref(ast_module_info->self);
|
|
|
|
|
/* Reset the extension */
|
|
|
|
|
i->ext[0] = '\0';
|
|
|
|
|
/* Play the dialtone */
|
|
|
|
@ -973,10 +959,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_mutex_lock(&usecnt_lock);
|
|
|
|
|
usecnt++;
|
|
|
|
|
ast_mutex_unlock(&usecnt_lock);
|
|
|
|
|
ast_update_use_count();
|
|
|
|
|
ast_module_ref(ast_module_info->self);
|
|
|
|
|
/* Reset the extension */
|
|
|
|
|
i->ext[0] = '\0';
|
|
|
|
|
/* Play the dialtone */
|
|
|
|
@ -984,12 +967,8 @@ static void phone_check_exception(struct phone_pvt *i)
|
|
|
|
|
ioctl(i->fd, PHONE_DIALTONE);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (i->dialtone) {
|
|
|
|
|
ast_mutex_lock(&usecnt_lock);
|
|
|
|
|
usecnt--;
|
|
|
|
|
ast_mutex_unlock(&usecnt_lock);
|
|
|
|
|
ast_update_use_count();
|
|
|
|
|
}
|
|
|
|
|
if (i->dialtone)
|
|
|
|
|
ast_module_unref(ast_module_info->self);
|
|
|
|
|
memset(i->ext, 0, sizeof(i->ext));
|
|
|
|
|
if (i->cpt)
|
|
|
|
|
{
|
|
|
|
|