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";
} 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) {
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;
}
/* 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));
}
/* 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);
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) {
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);