]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
little fixes (bug #2899)
authorRussell Bryant <russell@russellbryant.com>
Fri, 19 Nov 2004 13:25:17 +0000 (13:25 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 19 Nov 2004 13:25:17 +0000 (13:25 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@4295 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_h323.c

index b64db048e4d7407ae42d3990533ec122df3b32c3..a7437b91d34af2c544744552a46362d96d3724c8 100755 (executable)
@@ -82,7 +82,7 @@ con_established_cb    on_connection_established;
 clear_con_cb           on_connection_cleared;
 answer_call_cb         on_answer_call;
 
-int h323debug;
+int h323debug = 0;
 
 /** String variables required by ASTERISK */
 static char *type      = "H323";
@@ -348,7 +348,9 @@ static struct oh323_peer *build_peer(char *name, struct ast_variable *v)
        } else {
                ast_mutex_unlock(&peerl.lock);
                peer = (struct oh323_peer*)malloc(sizeof(struct oh323_peer));
-               memset(peer, 0, sizeof(struct oh323_peer));
+               if (peer) {
+                       memset(peer, 0, sizeof(struct oh323_peer));
+               }
        }
        if (peer) {
                if (!found) {
@@ -403,7 +405,7 @@ static int oh323_digit(struct ast_channel *c, char digit)
                ast_rtp_senddigit(p->rtp, digit);
        }
        /* If in-band DTMF is desired, send that */
-       if (p->dtmfmode & H323_DTMF_INBAND)
+       if (!(p->dtmfmode & H323_DTMF_RFC2833))
                h323_send_tone(p->cd.call_token, digit);
        return 0;
 }
@@ -442,14 +444,14 @@ static int oh323_call(struct ast_channel *c, char *dest, int timeout)
        /* Clear the call token */
        if ((p->cd).call_token == NULL)
                (p->cd).call_token = (char *)malloc(128);
-
-       memset((char *)(p->cd).call_token, 0, 128);
        
-       if (p->cd.call_token == NULL) {
+       if ((p->cd).call_token == NULL) {
                ast_log(LOG_ERROR, "Not enough memory.\n");
                return -1;
        }
 
+       memset((char *)(p->cd).call_token, 0, 128);
+
        /* Build the address to call */
        memset(called_addr, 0, sizeof(called_addr));
        memcpy(called_addr, dest, strlen(dest));
@@ -601,7 +603,7 @@ static struct ast_frame *oh323_rtp_read(struct oh323_pvt *p)
                        }
                
                        /* Do in-band DTMF detection */
-                       if (p->dtmfmode & H323_DTMF_INBAND) {
+                       if ((p->dtmfmode & H323_DTMF_INBAND) && p->vad) {
                    f = ast_dsp_process(p->owner,p->vad,f);
                                   if (f->frametype == AST_FRAME_DTMF)
                                        ast_log(LOG_DEBUG, "Got in-band digit %c.\n", f->subclass);
@@ -1032,8 +1034,6 @@ struct rtp_info *create_connection(unsigned call_reference, const char * token)
           the oh323_pvt structure XXX */
        static char iabuf[INET_ADDRSTRLEN];
 
-       info = (struct rtp_info *) malloc(sizeof(struct rtp_info));
-
        p = find_call(call_reference, token); 
 
        if (!p) {
@@ -1041,6 +1041,12 @@ struct rtp_info *create_connection(unsigned call_reference, const char * token)
                return NULL;
        }
 
+       info = (struct rtp_info *) malloc(sizeof(struct rtp_info));
+       if (!info) {
+               ast_log(LOG_ERROR, "Unable to allocate rtp_info, this is very bad.\n");
+               return NULL;
+       }
+
        /* figure out our local RTP port and tell the H.323 stack about it*/
        ast_rtp_get_us(p->rtp, &us);
        ast_rtp_get_peer(p->rtp, &them);