Version 0.3.0 from FTP
[asterisk/asterisk.git] / channels / chan_alsa.c
index 56fca5c..3e35a82 100755 (executable)
@@ -71,7 +71,7 @@ static int silencethreshold = 1000;
 static char digits[80] = "";
 static char text2send[80] = "";
 
 static char digits[80] = "";
 static char text2send[80] = "";
 
-static pthread_mutex_t usecnt_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
 
 static char *type = "Console";
 static char *desc = "ALSA Console Channel Driver";
 
 static char *type = "Console";
 static char *desc = "ALSA Console Channel Driver";
@@ -506,7 +506,7 @@ static int alsa_answer(struct ast_channel *c)
 {
        ast_verbose( " << Console call has been answered >> \n");
        answer_sound();
 {
        ast_verbose( " << Console call has been answered >> \n");
        answer_sound();
-       c->state = AST_STATE_UP;
+       ast_setstate(c, AST_STATE_UP);
        cursound = -1;
        return 0;
 }
        cursound = -1;
        return 0;
 }
@@ -684,7 +684,7 @@ static struct ast_frame *alsa_read(struct ast_channel *chan)
                needanswer = 0;
                f.frametype = AST_FRAME_CONTROL;
                f.subclass = AST_CONTROL_ANSWER;
                needanswer = 0;
                f.frametype = AST_FRAME_CONTROL;
                f.subclass = AST_CONTROL_ANSWER;
-               chan->state = AST_STATE_UP;
+               ast_setstate(chan, AST_STATE_UP);
                return &f;
        }
        
                return &f;
        }
        
@@ -722,7 +722,7 @@ static struct ast_frame *alsa_read(struct ast_channel *chan)
                /* A real frame */
                readpos = 0;
                left = FRAME_SIZE;
                /* A real frame */
                readpos = 0;
                left = FRAME_SIZE;
-               if (chan->state != AST_STATE_UP) {
+               if (chan->_state != AST_STATE_UP) {
                        /* Don't transmit unless it's up */
                        return &f;
                }
                        /* Don't transmit unless it's up */
                        return &f;
                }
@@ -782,7 +782,7 @@ static int alsa_indicate(struct ast_channel *chan, int cond)
 static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state)
 {
        struct ast_channel *tmp;
 static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state)
 {
        struct ast_channel *tmp;
-       tmp = ast_channel_alloc();
+       tmp = ast_channel_alloc(0);
        if (tmp) {
                snprintf(tmp->name, sizeof(tmp->name), "ALSA/%s", indevname);
                tmp->type = type;
        if (tmp) {
                snprintf(tmp->name, sizeof(tmp->name), "ALSA/%s", indevname);
                tmp->type = type;
@@ -806,7 +806,7 @@ static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state)
                if (strlen(language))
                        strncpy(tmp->language, language, sizeof(tmp->language)-1);
                p->owner = tmp;
                if (strlen(language))
                        strncpy(tmp->language, language, sizeof(tmp->language)-1);
                p->owner = tmp;
-               tmp->state = state;
+               ast_setstate(tmp, state);
                ast_pthread_mutex_lock(&usecnt_lock);
                usecnt++;
                ast_pthread_mutex_unlock(&usecnt_lock);
                ast_pthread_mutex_lock(&usecnt_lock);
                usecnt++;
                ast_pthread_mutex_unlock(&usecnt_lock);
@@ -1087,7 +1087,7 @@ int unload_module()
                close(sndcmd[1]);
        }
        if (alsa.owner)
                close(sndcmd[1]);
        }
        if (alsa.owner)
-               ast_softhangup(alsa.owner);
+               ast_softhangup(alsa.owner, AST_SOFTHANGUP_APPUNLOAD);
        if (alsa.owner)
                return -1;
        return 0;
        if (alsa.owner)
                return -1;
        return 0;