|
|
|
@ -1365,6 +1365,12 @@ static int gendigittimeout = 8000;
|
|
|
|
|
/* How long to wait for an extra digit, if there is an ambiguous match */
|
|
|
|
|
static int matchdigittimeout = 3000;
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* To apease the stupid compiler option on ast_sched_del()
|
|
|
|
|
* since we don't care about the return value.
|
|
|
|
|
*/
|
|
|
|
|
static int not_used;
|
|
|
|
|
|
|
|
|
|
#define SUBSTATE_UNSET 0
|
|
|
|
|
#define SUBSTATE_OFFHOOK 1
|
|
|
|
|
#define SUBSTATE_ONHOOK 2
|
|
|
|
@ -2264,10 +2270,10 @@ static int skinny_register(struct skinny_req *req, struct skinnysession *s)
|
|
|
|
|
int instance;
|
|
|
|
|
int res = -1;
|
|
|
|
|
|
|
|
|
|
if (s->auth_timeout_sched && ast_sched_del(sched, s->auth_timeout_sched)) {
|
|
|
|
|
return 0;
|
|
|
|
|
if (-1 < s->auth_timeout_sched) {
|
|
|
|
|
not_used = ast_sched_del(sched, s->auth_timeout_sched);
|
|
|
|
|
s->auth_timeout_sched = -1;
|
|
|
|
|
}
|
|
|
|
|
s->auth_timeout_sched = 0;
|
|
|
|
|
|
|
|
|
|
AST_LIST_LOCK(&devices);
|
|
|
|
|
AST_LIST_TRAVERSE(&devices, d, list){
|
|
|
|
@ -5560,12 +5566,12 @@ static void setsubstate(struct skinny_subchannel *sub, int state)
|
|
|
|
|
|
|
|
|
|
skinny_locksub(sub);
|
|
|
|
|
|
|
|
|
|
if (sub->dialer_sched) {
|
|
|
|
|
if (-1 < sub->dialer_sched) {
|
|
|
|
|
skinny_sched_del(sub->dialer_sched, sub);
|
|
|
|
|
sub->dialer_sched = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (state != SUBSTATE_RINGIN && sub->aa_sched) {
|
|
|
|
|
if (state != SUBSTATE_RINGIN && -1 < sub->aa_sched) {
|
|
|
|
|
skinny_sched_del(sub->aa_sched, sub);
|
|
|
|
|
sub->aa_sched = -1;
|
|
|
|
|
sub->aa_beep = 0;
|
|
|
|
@ -5583,6 +5589,7 @@ static void setsubstate(struct skinny_subchannel *sub, int state)
|
|
|
|
|
sub->cfwd_sched = -1;
|
|
|
|
|
} else if (state == SUBSTATE_ONHOOK) {
|
|
|
|
|
skinny_sched_del(sub->cfwd_sched, sub);
|
|
|
|
|
sub->cfwd_sched = -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -6182,9 +6189,7 @@ static int handle_ip_port_message(struct skinny_req *req, struct skinnysession *
|
|
|
|
|
|
|
|
|
|
static void handle_keepalive_message(struct skinny_req *req, struct skinnysession *s)
|
|
|
|
|
{
|
|
|
|
|
if (ast_sched_del(sched, s->keepalive_timeout_sched)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
not_used = ast_sched_del(sched, s->keepalive_timeout_sched);
|
|
|
|
|
|
|
|
|
|
#ifdef AST_DEVMODE
|
|
|
|
|
{
|
|
|
|
@ -6250,7 +6255,7 @@ static int handle_keypad_button_message(struct skinny_req *req, struct skinnyses
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((sub->owner && ast_channel_state(sub->owner) < AST_STATE_UP)) {
|
|
|
|
|
if (sub->dialer_sched && !skinny_sched_del(sub->dialer_sched, sub)) {
|
|
|
|
|
if (-1 < sub->dialer_sched && !skinny_sched_del(sub->dialer_sched, sub)) {
|
|
|
|
|
SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Got a digit and not timed out, so try dialing\n", sub->callid);
|
|
|
|
|
sub->dialer_sched = -1;
|
|
|
|
|
len = strlen(sub->exten);
|
|
|
|
@ -7087,7 +7092,7 @@ static int handle_soft_key_event_message(struct skinny_req *req, struct skinnyse
|
|
|
|
|
case SOFTKEY_BKSPC:
|
|
|
|
|
SKINNY_DEBUG(DEBUG_PACKET, 3, "Received SOFTKEY_BKSPC from %s, inst %d, callref %d\n",
|
|
|
|
|
d->name, instance, callreference);
|
|
|
|
|
if (sub->dialer_sched && !skinny_sched_del(sub->dialer_sched, sub)) {
|
|
|
|
|
if (-1 < sub->dialer_sched && !skinny_sched_del(sub->dialer_sched, sub)) {
|
|
|
|
|
size_t len;
|
|
|
|
|
sub->dialer_sched = -1;
|
|
|
|
|
len = strlen(sub->exten);
|
|
|
|
@ -7427,7 +7432,7 @@ static int skinny_noauth_cb(const void *data)
|
|
|
|
|
{
|
|
|
|
|
struct skinnysession *s = (struct skinnysession *)data;
|
|
|
|
|
ast_log(LOG_WARNING, "Skinny Client failed to authenticate in %d seconds (SCHED %d)\n", auth_timeout, s->auth_timeout_sched);
|
|
|
|
|
s->auth_timeout_sched = 0;
|
|
|
|
|
s->auth_timeout_sched = -1;
|
|
|
|
|
end_session(s);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -7436,7 +7441,7 @@ static int skinny_nokeepalive_cb(const void *data)
|
|
|
|
|
{
|
|
|
|
|
struct skinnysession *s = (struct skinnysession *)data;
|
|
|
|
|
ast_log(LOG_WARNING, "Skinny Client failed to send keepalive in last %d seconds (SCHED %d)\n", keep_alive*3, s->keepalive_timeout_sched);
|
|
|
|
|
s->keepalive_timeout_sched = 0;
|
|
|
|
|
s->keepalive_timeout_sched = -1;
|
|
|
|
|
end_session(s);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -7454,11 +7459,13 @@ static void skinny_session_cleanup(void *data)
|
|
|
|
|
ast_mutex_unlock(&s->lock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (s->auth_timeout_sched && !ast_sched_del(sched, s->auth_timeout_sched)) {
|
|
|
|
|
s->auth_timeout_sched = 0;
|
|
|
|
|
if (-1 < s->auth_timeout_sched) {
|
|
|
|
|
not_used = ast_sched_del(sched, s->auth_timeout_sched);
|
|
|
|
|
s->auth_timeout_sched = -1;
|
|
|
|
|
}
|
|
|
|
|
if (s->keepalive_timeout_sched && !ast_sched_del(sched, s->keepalive_timeout_sched)) {
|
|
|
|
|
s->keepalive_timeout_sched = 0;
|
|
|
|
|
if (-1 < s->keepalive_timeout_sched) {
|
|
|
|
|
not_used = ast_sched_del(sched, s->keepalive_timeout_sched);
|
|
|
|
|
s->keepalive_timeout_sched = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (d) {
|
|
|
|
@ -7661,6 +7668,8 @@ static void *accept_thread(void *ignore)
|
|
|
|
|
ast_mutex_init(&s->lock);
|
|
|
|
|
memcpy(&s->sin, &sin, sizeof(sin));
|
|
|
|
|
s->fd = as;
|
|
|
|
|
s->auth_timeout_sched = -1;
|
|
|
|
|
s->keepalive_timeout_sched = -1;
|
|
|
|
|
|
|
|
|
|
if (ast_pthread_create(&s->t, NULL, skinny_session, s)) {
|
|
|
|
|
destroy_session(s);
|
|
|
|
|