]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
automerge commit
authorAutomerge Script <automerge@asterisk.org>
Thu, 29 Mar 2007 18:54:38 +0000 (18:54 +0000)
committerAutomerge Script <automerge@asterisk.org>
Thu, 29 Mar 2007 18:54:38 +0000 (18:54 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@59413 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_meetme.c
channels/chan_iax2.c
rtp.c

index 9c22ea20d9a20f9b865c9d5d748158671506fba4..8e7f2d8f0abc4c9781cb9d36c2138813154feb70 100644 (file)
@@ -154,6 +154,8 @@ struct ast_conference {
 
 static AST_LIST_HEAD_STATIC(confs, ast_conference);
 
+static unsigned int conf_map[1024] = {0, };
+
 struct volume {
        int desired;                            /* Desired volume adjustment */
        int actual;                             /* Actual volume adjustment (for channels that can't adjust) */
@@ -442,6 +444,7 @@ static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin
 {
        struct ast_conference *cnf;
        struct zt_confinfo ztc;
+       int confno_int = 0;
 
        AST_LIST_LOCK(&confs);
        AST_LIST_TRAVERSE(&confs, cnf, list) {
@@ -493,6 +496,9 @@ static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin
                        if (option_verbose > 2)
                                ast_verbose(VERBOSE_PREFIX_3 "Created MeetMe conference %d for conference '%s'\n", cnf->zapconf, cnf->confno);
                        AST_LIST_INSERT_HEAD(&confs, cnf, list);
+                       /* Reserve conference number in map */
+                       if ((sscanf(cnf->confno, "%d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024))
+                               conf_map[confno_int] = 1;
                } else  
                        ast_log(LOG_WARNING, "Out of memory\n");
        }
@@ -795,9 +801,13 @@ static int conf_free(struct ast_conference *conf)
 static int dispose_conf(struct ast_conference *conf)
 {
        int res = 0;
+       int confno_int = 0;
 
        AST_LIST_LOCK(&confs);
        if (ast_atomic_dec_and_test(&conf->refcount)) {
+               /* Take the conference room number out of an inuse state */
+               if ((sscanf(conf->confno, "%d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024))
+                       conf_map[confno_int] = 0;
                conf_free(conf);
                res = 1;
        }
@@ -1819,20 +1829,9 @@ static int conf_exec(struct ast_channel *chan, void *data)
                if (retrycnt > 3)
                        allowretry = 0;
                if (empty) {
-                       int i, map[1024] = { 0, };
                        struct ast_config *cfg;
                        struct ast_variable *var;
-                       int confno_int;
-
-                       AST_LIST_LOCK(&confs);
-                       AST_LIST_TRAVERSE(&confs, cnf, list) {
-                               if (sscanf(cnf->confno, "%d", &confno_int) == 1) {
-                                       /* Disqualify in use conference */
-                                       if (confno_int >= 0 && confno_int < 1024)
-                                               map[confno_int]++;
-                               }
-                       }
-                       AST_LIST_UNLOCK(&confs);
+                       int i = 0, confno_int = 0;
 
                        /* We only need to load the config file for static and empty_no_pin (otherwise we don't care) */
                        if ((empty_no_pin) || (!dynamic)) {
@@ -1845,13 +1844,6 @@ static int conf_exec(struct ast_channel *chan, void *data)
                                                        if (stringp) {
                                                                char *confno_tmp = strsep(&stringp, "|,");
                                                                int found = 0;
-                                                               if (sscanf(confno_tmp, "%d", &confno_int) == 1) {
-                                                                       if ((confno_int >= 0) && (confno_int < 1024)) {
-                                                                               if (stringp && empty_no_pin) {
-                                                                                       map[confno_int]++;
-                                                                               }
-                                                                       }
-                                                               }
                                                                if (!dynamic) {
                                                                        /* For static:  run through the list and see if this conference is empty */
                                                                        AST_LIST_LOCK(&confs);
@@ -1888,12 +1880,15 @@ static int conf_exec(struct ast_channel *chan, void *data)
 
                        /* Select first conference number not in use */
                        if (ast_strlen_zero(confno) && dynamic) {
-                               for (i = 0; i < sizeof(map) / sizeof(map[0]); i++) {
-                                       if (!map[i]) {
+                               AST_LIST_LOCK(&confs);
+                               for (i = 0; i < sizeof(conf_map) / sizeof(conf_map[0]); i++) {
+                                       if (!conf_map[i]) {
                                                snprintf(confno, sizeof(confno), "%d", i);
+                                               conf_map[i] = 1;
                                                break;
                                        }
                                }
+                               AST_LIST_UNLOCK(&confs);
                        }
 
                        /* Not found? */
index c8c4221df544e6ef487b4ede0b719f4221269c4d..bce9d3e132afaaac32dde82301f26f95aa606579 100644 (file)
@@ -3164,9 +3164,8 @@ static int iax2_setoption(struct ast_channel *c, int option, void *data, int dat
 
 static struct ast_frame *iax2_read(struct ast_channel *c) 
 {
-       static struct ast_frame f = { AST_FRAME_NULL, };
-       ast_log(LOG_NOTICE, "I should never be called!\n");
-       return &f;
+       ast_log(LOG_NOTICE, "I should never be called! Hanging up.\n");
+       return NULL;
 }
 
 static int iax2_start_transfer(unsigned short callno0, unsigned short callno1)
diff --git a/rtp.c b/rtp.c
index 5e034200eae35961581f21aa11340d1fc3efc32b..2f655a6577946a285821d221f94e2493f7af37ed 100644 (file)
--- a/rtp.c
+++ b/rtp.c
@@ -390,10 +390,12 @@ struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
                                        0, (struct sockaddr *)&sin, &len);
        
        if (res < 0) {
-               if (errno != EAGAIN)
-                       ast_log(LOG_WARNING, "RTP Read error: %s\n", strerror(errno));
                if (errno == EBADF)
                        CRASH;
+               if (errno != EAGAIN) {
+                       ast_log(LOG_WARNING, "RTP Read error: %s.  Hanging up now.\n", strerror(errno));
+                       return NULL;
+               }
                return &null_frame;
        }
 
@@ -457,10 +459,12 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
 
        rtpheader = (unsigned int *)(rtp->rawdata + AST_FRIENDLY_OFFSET);
        if (res < 0) {
-               if (errno != EAGAIN)
-                       ast_log(LOG_WARNING, "RTP Read error: %s\n", strerror(errno));
                if (errno == EBADF)
                        CRASH;
+               if (errno != EAGAIN) {
+                       ast_log(LOG_WARNING, "RTP Read error: %s.  Hanging up now.\n", strerror(errno));
+                       return NULL;
+               }
                return &null_frame;
        }
        if (res < hdrlen) {