diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-06-26 03:50:14 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-06-26 03:50:14 +0000 |
commit | 7148691394ad01d0b2c3a6500913d230c99652ce (patch) | |
tree | feff9533d65b873c284ba444827e32141d0ec6a7 /channels | |
parent | 67168c5f8c300f29c4175b3ea78255b4dd2fac02 (diff) |
Merge source cleanups (bug #1911)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3311 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_alsa.c | 3 | ||||
-rwxr-xr-x | channels/chan_h323.c | 83 | ||||
-rwxr-xr-x | channels/chan_iax2.c | 2 | ||||
-rwxr-xr-x | channels/h323/ast_h323.cpp | 21 | ||||
-rwxr-xr-x | channels/h323/ast_h323.h | 15 | ||||
-rwxr-xr-x | channels/h323/chan_h323.h | 20 |
6 files changed, 88 insertions, 56 deletions
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c index 4eb451e19..1cc14e06d 100755 --- a/channels/chan_alsa.c +++ b/channels/chan_alsa.c @@ -78,6 +78,7 @@ static char digits[80] = ""; static char text2send[80] = ""; AST_MUTEX_DEFINE_STATIC(usecnt_lock); +AST_MUTEX_DEFINE_STATIC(alsalock); static char *type = "Console"; static char *desc = "ALSA Console Channel Driver"; @@ -330,7 +331,9 @@ static snd_pcm_t *alsa_card_init(char *dev, snd_pcm_stream_t stream) snd_pcm_uframes_t buffer_size = 0; unsigned int rate = DESIRED_RATE; +#if 0 unsigned int per_min = 1; +#endif //unsigned int per_max = 8; snd_pcm_uframes_t start_threshold, stop_threshold; diff --git a/channels/chan_h323.c b/channels/chan_h323.c index a2e88662c..879ab6d47 100755 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -27,8 +27,29 @@ */ +#include <sys/socket.h> +#include <sys/signal.h> +#include <sys/param.h> +#if defined(BSD) +#ifndef IPTOS_MINCOST +#define IPTOS_MINCOST 0x02 +#endif +#endif +#include <arpa/inet.h> +#include <net/if.h> +#include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> +#include <unistd.h> +#include <stdlib.h> +#include <netdb.h> #include <stdio.h> #include <string.h> +#include <errno.h> +#include <fcntl.h> +#ifdef __cplusplus +extern "C" { +#endif #include <asterisk/lock.h> #include <asterisk/logger.h> #include <asterisk/channel.h> @@ -46,25 +67,23 @@ #include <asterisk/callerid.h> #include <asterisk/cli.h> #include <asterisk/dsp.h> -#include <sys/socket.h> -#include <net/if.h> -#include <errno.h> -#include <unistd.h> -#include <stdlib.h> -#include <fcntl.h> -#include <netdb.h> -#include <sys/signal.h> -#include <sys/param.h> -#if defined(BSD) -#include <netinet/in_systm.h> -#ifndef IPTOS_MINCOST -#define IPTOS_MINCOST 0x02 -#endif +#ifdef __cplusplus +} #endif -#include <netinet/ip.h> - #include "h323/chan_h323.h" +send_digit_cb on_send_digit; +on_connection_cb on_create_connection; +setup_incoming_cb on_incoming_call; +setup_outbound_cb on_outgoing_call; +start_logchan_cb on_start_logical_channel; +chan_ringing_cb on_chan_ringing; +con_established_cb on_connection_established; +clear_con_cb on_connection_cleared; +answer_call_cb on_answer_call; + +int h323debug; + /** String variables required by ASTERISK */ static char *type = "H323"; static char *desc = "The NuFone Network's Open H.323 Channel Driver"; @@ -322,7 +341,7 @@ static struct oh323_peer *build_peer(char *name, struct ast_variable *v) ast_mutex_unlock(&peerl.lock); } else { ast_mutex_unlock(&peerl.lock); - peer = malloc(sizeof(struct oh323_peer)); + peer = (struct oh323_peer*)malloc(sizeof(struct oh323_peer)); memset(peer, 0, sizeof(struct oh323_peer)); } if (peer) { @@ -373,7 +392,7 @@ static struct oh323_peer *build_peer(char *name, struct ast_variable *v) */ static int oh323_digit(struct ast_channel *c, char digit) { - struct oh323_pvt *p = c->pvt->pvt; + struct oh323_pvt *p = (struct oh323_pvt *) c->pvt->pvt; if (p && p->rtp && (p->dtmfmode & H323_DTMF_RFC2833)) { ast_rtp_senddigit(p->rtp, digit); } @@ -393,7 +412,7 @@ static int oh323_digit(struct ast_channel *c, char digit) static int oh323_call(struct ast_channel *c, char *dest, int timeout) { int res; - struct oh323_pvt *p = c->pvt->pvt; + struct oh323_pvt *p = (struct oh323_pvt *) c->pvt->pvt; char called_addr[256]; char *tmp, *cid, *cidname, oldcid[256]; @@ -480,7 +499,7 @@ static int oh323_answer(struct ast_channel *c) { int res; - struct oh323_pvt *p = c->pvt->pvt; + struct oh323_pvt *p = (struct oh323_pvt *) c->pvt->pvt; res = h323_answering_call(p->cd.call_token, 0); @@ -492,7 +511,7 @@ static int oh323_answer(struct ast_channel *c) static int oh323_hangup(struct ast_channel *c) { - struct oh323_pvt *p = c->pvt->pvt; + struct oh323_pvt *p = (struct oh323_pvt *) c->pvt->pvt; int needcancel = 0; if (h323debug) ast_log(LOG_DEBUG, "oh323_hangup(%s)\n", c->name); @@ -510,7 +529,7 @@ static int oh323_hangup(struct ast_channel *c) if (!c || (c->_state != AST_STATE_UP)) needcancel = 1; /* Disconnect */ - p = c->pvt->pvt; + p = (struct oh323_pvt *) c->pvt->pvt; /* Free dsp used for in-band DTMF detection */ if (p->vad) { @@ -584,7 +603,7 @@ static struct ast_frame *oh323_rtp_read(struct oh323_pvt *p) static struct ast_frame *oh323_read(struct ast_channel *c) { struct ast_frame *fr; - struct oh323_pvt *p = c->pvt->pvt; + struct oh323_pvt *p = (struct oh323_pvt *) c->pvt->pvt; ast_mutex_lock(&p->lock); fr = oh323_rtp_read(p); ast_mutex_unlock(&p->lock); @@ -593,7 +612,7 @@ static struct ast_frame *oh323_read(struct ast_channel *c) static int oh323_write(struct ast_channel *c, struct ast_frame *frame) { - struct oh323_pvt *p = c->pvt->pvt; + struct oh323_pvt *p = (struct oh323_pvt *) c->pvt->pvt; int res = 0; if (frame->frametype != AST_FRAME_VOICE) { if (frame->frametype == AST_FRAME_IMAGE) @@ -623,7 +642,7 @@ static int oh323_write(struct ast_channel *c, struct ast_frame *frame) static int oh323_indicate(struct ast_channel *c, int condition) { - struct oh323_pvt *p = c->pvt->pvt; + struct oh323_pvt *p = (struct oh323_pvt *) c->pvt->pvt; switch(condition) { case AST_CONTROL_RINGING: @@ -668,7 +687,7 @@ static int oh323_indicate(struct ast_channel *c, int condition) // FIXME: WTF is this? Do I need this??? static int oh323_fixup(struct ast_channel *oldchan, struct ast_channel *newchan) { - struct oh323_pvt *p = newchan->pvt->pvt; + struct oh323_pvt *p = (struct oh323_pvt *) newchan->pvt->pvt; ast_mutex_lock(&p->lock); if (p->owner != oldchan) { @@ -755,7 +774,7 @@ static struct oh323_pvt *oh323_alloc(int callid) { struct oh323_pvt *p; - p = malloc(sizeof(struct oh323_pvt)); + p = (struct oh323_pvt *) malloc(sizeof(struct oh323_pvt)); if (!p) { ast_log(LOG_ERROR, "Couldn't allocate private structure. This is bad\n"); return NULL; @@ -796,7 +815,7 @@ static struct oh323_pvt *find_call(int call_reference) p = iflist; while(p) { - if (p->cd.call_reference == call_reference) { + if ((signed int)p->cd.call_reference == call_reference) { /* Found the call */ ast_mutex_unlock(&iflock); return p; @@ -814,7 +833,7 @@ static struct ast_channel *oh323_request(char *type, int format, void *data) int oldformat; struct oh323_pvt *p; struct ast_channel *tmpc = NULL; - char *dest = data; + char *dest = (char *) data; char *ext, *host; char *h323id = NULL; char tmp[256]; @@ -980,7 +999,7 @@ struct rtp_info *create_connection(unsigned call_reference) struct sockaddr_in them; struct rtp_info *info; - info = malloc(sizeof(struct rtp_info)); + info = (struct rtp_info *) malloc(sizeof(struct rtp_info)); p = find_call(call_reference); @@ -1769,7 +1788,7 @@ int reload(void) static struct ast_rtp *oh323_get_rtp_peer(struct ast_channel *chan) { struct oh323_pvt *p; - p = chan->pvt->pvt; + p = (struct oh323_pvt *) chan->pvt->pvt; if (p && p->rtp && p->bridge) { return p->rtp; } @@ -1821,7 +1840,7 @@ static int oh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, str return 0; } - p = chan->pvt->pvt; + p = (struct oh323_pvt *) chan->pvt->pvt; if (!p) { ast_log(LOG_ERROR, "No Private Structure, this is bad\n"); return -1; diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 0d60b963a..cb48f0144 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -2722,7 +2722,7 @@ static unsigned int calc_rxstamp(struct chan_iax2_pvt *p) return ms; } -struct iax2_trunk_peer *find_tpeer(struct sockaddr_in *sin) +static struct iax2_trunk_peer *find_tpeer(struct sockaddr_in *sin) { struct iax2_trunk_peer *tpeer; /* Finds and locks trunk peer */ diff --git a/channels/h323/ast_h323.cpp b/channels/h323/ast_h323.cpp index e1d396999..ad86358c2 100755 --- a/channels/h323/ast_h323.cpp +++ b/channels/h323/ast_h323.cpp @@ -25,9 +25,28 @@ * * Version Info: $Id$ */ +#include <arpa/inet.h> + +#include <list> +#include <string> +#include <algorithm> + +#include <ptlib.h> +#include <h323.h> +#include <h323pdu.h> +#include <mediafmt.h> +#include <lid.h> + +#ifdef __cplusplus +extern "C" { +#endif #include <asterisk/logger.h> -#include "ast_h323.h" +#ifdef __cplusplus +} +#endif +#include "chan_h323.h" +#include "ast_h323.h" /* PWlib Required Components */ #define MAJOR_VERSION 1 diff --git a/channels/h323/ast_h323.h b/channels/h323/ast_h323.h index ab30c4435..5d50b58fb 100755 --- a/channels/h323/ast_h323.h +++ b/channels/h323/ast_h323.h @@ -26,18 +26,8 @@ * Version Info: $Id$ */ - -#include <ptlib.h> -#include <h323.h> -#include <h323pdu.h> -#include <mediafmt.h> -#include <lid.h> - -#include <list> -#include <string> -#include <algorithm> - -#include "chan_h323.h" +#ifndef AST_H323_H +#define AST_H323_H /** These need to be redefined here because the C++ side of this driver is blind to the asterisk headers */ @@ -306,3 +296,4 @@ class MyProcess : public PProcess { }; +#endif /* !defined AST_H323_H */ diff --git a/channels/h323/chan_h323.h b/channels/h323/chan_h323.h index 23e583f89..e45d3c4dc 100755 --- a/channels/h323/chan_h323.h +++ b/channels/h323/chan_h323.h @@ -116,48 +116,48 @@ typedef struct rtp_info { /* This is a callback prototype function, called pass DTMF down the RTP. */ typedef int (*send_digit_cb)(unsigned, char); -send_digit_cb on_send_digit; +extern send_digit_cb on_send_digit; /* This is a callback prototype function, called to collect the external RTP port from Asterisk. */ typedef rtp_info_t *(*on_connection_cb)(unsigned); -on_connection_cb on_create_connection; +extern on_connection_cb on_create_connection; /* This is a callback prototype function, called upon an incoming call happens. */ typedef int (*setup_incoming_cb)(call_details_t); -setup_incoming_cb on_incoming_call; +extern setup_incoming_cb on_incoming_call; /* This is a callback prototype function, called upon an outbound call. */ typedef int (*setup_outbound_cb)(call_details_t); -setup_outbound_cb on_outgoing_call; +extern setup_outbound_cb on_outgoing_call; /* This is a callback prototype function, called when the openh323 OnStartLogicalChannel is invoked. */ typedef void (*start_logchan_cb)(unsigned int, const char *, int); -start_logchan_cb on_start_logical_channel; +extern start_logchan_cb on_start_logical_channel; /* This is a callback prototype function, called when openh323 OnAlerting is invoked */ typedef void (*chan_ringing_cb)(unsigned); -chan_ringing_cb on_chan_ringing; +extern chan_ringing_cb on_chan_ringing; /* This is a callback protoype function, called when the openh323 OnConnectionEstablished is inovked */ typedef void (*con_established_cb)(unsigned); -con_established_cb on_connection_established; +extern con_established_cb on_connection_established; /* This is a callback prototype function, called when the openH323 OnConnectionCleared callback is invoked */ typedef void (*clear_con_cb)(call_details_t); -clear_con_cb on_connection_cleared; +extern clear_con_cb on_connection_cleared; typedef int (*answer_call_cb)(unsigned); -answer_call_cb on_answer_call; +extern answer_call_cb on_answer_call; /* debug flag */ -int h323debug; +extern int h323debug; #define H323_DTMF_RFC2833 (1 << 0) #define H323_DTMF_INBAND (1 << 1) |