Don't do reinvite if both parties talk diffrent codecs
[asterisk/asterisk.git] / channels / chan_alsa.c
index 4ae95d3..d17d1e3 100755 (executable)
@@ -71,7 +71,7 @@ static int silencethreshold = 1000;
 static char digits[80] = "";
 static char text2send[80] = "";
 
-static pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
+static ast_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
 
 static char *type = "Console";
 static char *desc = "ALSA Console Channel Driver";
@@ -262,7 +262,7 @@ static void *sound_thread(void *unused)
                                max = readdev;
                }
 #endif
-               res = select(max + 1, &rfds, &wfds, NULL, NULL);
+               res = ast_select(max + 1, &rfds, &wfds, NULL, NULL);
                if (res < 1) {
                        ast_log(LOG_WARNING, "select failed: %s\n", strerror(errno));
                        continue;
@@ -423,7 +423,7 @@ static snd_pcm_t *alsa_card_init(char *dev, snd_pcm_stream_t stream)
        }
 #endif
 
-       err = snd_pcm_sw_params_set_silence_threshold(handle, swparams, buffer_size);
+       err = snd_pcm_sw_params_set_silence_threshold(handle, swparams, silencethreshold);
        if (err < 0) {
                ast_log(LOG_ERROR, "Unable to set silence threshold: %s\n", snd_strerror(err));
        }
@@ -518,9 +518,9 @@ static int alsa_hangup(struct ast_channel *c)
        c->pvt->pvt = NULL;
        alsa.owner = NULL;
        ast_verbose( " << Hangup on console >> \n");
-       ast_pthread_mutex_lock(&usecnt_lock);
+       ast_mutex_lock(&usecnt_lock);
        usecnt--;
-       ast_pthread_mutex_unlock(&usecnt_lock);
+       ast_mutex_unlock(&usecnt_lock);
        needhangup = 0;
        needanswer = 0;
        if (hookstate) {
@@ -807,9 +807,9 @@ static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state)
                        strncpy(tmp->language, language, sizeof(tmp->language)-1);
                p->owner = tmp;
                ast_setstate(tmp, state);
-               ast_pthread_mutex_lock(&usecnt_lock);
+               ast_mutex_lock(&usecnt_lock);
                usecnt++;
-               ast_pthread_mutex_unlock(&usecnt_lock);
+               ast_mutex_unlock(&usecnt_lock);
                ast_update_use_count();
                if (state != AST_STATE_DOWN) {
                        if (ast_pbx_start(tmp)) {
@@ -1039,7 +1039,7 @@ int load_module()
        }
        for (x=0;x<sizeof(myclis)/sizeof(struct ast_cli_entry); x++)
                ast_cli_register(myclis + x);
-       if ((cfg = ast_load(config)) {
+       if ((cfg = ast_load(config))) {
                v = ast_variable_browse(cfg, "general");
                while(v) {
                        if (!strcasecmp(v->name, "autoanswer"))
@@ -1103,9 +1103,9 @@ char *description()
 int usecount()
 {
        int res;
-       ast_pthread_mutex_lock(&usecnt_lock);
+       ast_mutex_lock(&usecnt_lock);
        res = usecnt;
-       ast_pthread_mutex_unlock(&usecnt_lock);
+       ast_mutex_unlock(&usecnt_lock);
        return res;
 }