Add H323 to normal build process

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1355 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.0
Jeremy McNamara 22 years ago
parent 79bbadc3c4
commit e5f7fd404e

@ -25,6 +25,7 @@ CHANNEL_LIBS=chan_modem.so chan_iax.so chan_sip.so \
#CHANNEL_LIBS+=chan_vofr #CHANNEL_LIBS+=chan_vofr
CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so) CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so)
CHANNEL_LIBS+=$(shell [ -f h323/libchanh323.a ] && echo chan_h323.so)
CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API") CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API")
@ -108,6 +109,10 @@ chan_vpb.o: chan_vpb.c
chan_vpb.so: chan_vpb.o chan_vpb.so: chan_vpb.o
$(CXX) -shared -Xlinker -x -o $@ $< -lvpb -lpthread -lm -ldl $(CXX) -shared -Xlinker -x -o $@ $< -lvpb -lpthread -lm -ldl
chan_h323.so: chan_h323.o h323/libchanh323.a
$(CC) -shared -Xlinker -x -o $@ $< h323/libchanh323.a -L$(PWLIBDIR)/lib -lpt_linux_x86_r -L$(OPENH323DIR)/lib -lh323_linux_x86_r -L/usr/lib -lpthread -ldl -lcrypto -lssl -lexpat
#chan_modem.so : chan_modem.o #chan_modem.so : chan_modem.o
# $(CC) -rdynamic -shared -Xlinker -x -o $@ $< # $(CC) -rdynamic -shared -Xlinker -x -o $@ $<

@ -56,7 +56,7 @@
#include <netinet/ip.h> #include <netinet/ip.h>
#include "chan_h323.h" #include "h323/chan_h323.h"
/** String variables required by ASTERISK */ /** String variables required by ASTERISK */
static char *type = "H323"; static char *type = "H323";
@ -617,73 +617,73 @@ static int oh323_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
static struct ast_channel *oh323_new(struct oh323_pvt *i, int state, const char *host) static struct ast_channel *oh323_new(struct oh323_pvt *i, int state, const char *host)
{ {
struct ast_channel *tmp; struct ast_channel *ch;
int fmt; int fmt;
tmp = ast_channel_alloc(1); ch = ast_channel_alloc(1);
if (tmp) { if (ch) {
snprintf(tmp->name, sizeof(tmp->name)-1, "H323/%s", host); snprintf(ch->name, sizeof(ch->name)-1, "H323/%s", host);
tmp->nativeformats = i->capability; ch->nativeformats = i->capability;
if (!tmp->nativeformats) if (!ch->nativeformats)
tmp->nativeformats = capability; ch->nativeformats = capability;
fmt = ast_best_codec(tmp->nativeformats); fmt = ast_best_codec(ch->nativeformats);
tmp->type = type; ch->type = type;
tmp->fds[0] = ast_rtp_fd(i->rtp); ch->fds[0] = ast_rtp_fd(i->rtp);
ast_setstate(tmp, state); ast_setstate(ch, state);
if (state == AST_STATE_RING) if (state == AST_STATE_RING)
tmp->rings = 1; ch->rings = 1;
tmp->writeformat = fmt; ch->writeformat = fmt;
tmp->pvt->rawwriteformat = fmt; ch->pvt->rawwriteformat = fmt;
tmp->readformat = fmt; ch->readformat = fmt;
tmp->pvt->rawreadformat = fmt; ch->pvt->rawreadformat = fmt;
/* Allocate dsp for in-band DTMF support */ /* Allocate dsp for in-band DTMF support */
if (i->dtmfmode & H323_DTMF_INBAND) { if (i->dtmfmode & H323_DTMF_INBAND) {
i->vad = ast_dsp_new(); i->vad = ast_dsp_new();
ast_dsp_set_features(i->vad, DSP_FEATURE_DTMF_DETECT); ast_dsp_set_features(i->vad, DSP_FEATURE_DTMF_DETECT);
} }
/* Register the OpenH323 channel's functions. */ /* Register the OpenH323 channel's functions. */
tmp->pvt->pvt = i; ch->pvt->pvt = i;
tmp->pvt->send_digit = oh323_digit; ch->pvt->send_digit = oh323_digit;
tmp->pvt->call = oh323_call; ch->pvt->call = oh323_call;
tmp->pvt->hangup = oh323_hangup; ch->pvt->hangup = oh323_hangup;
tmp->pvt->answer = oh323_answer; ch->pvt->answer = oh323_answer;
tmp->pvt->read = oh323_read; ch->pvt->read = oh323_read;
tmp->pvt->write = oh323_write; ch->pvt->write = oh323_write;
tmp->pvt->indicate = oh323_indicate; ch->pvt->indicate = oh323_indicate;
tmp->pvt->fixup = oh323_fixup; ch->pvt->fixup = oh323_fixup;
tmp->pvt->bridge = ast_rtp_bridge; ch->pvt->bridge = ast_rtp_bridge;
/* Set the owner of this channel */ /* Set the owner of this channel */
i->owner = tmp; i->owner = ch;
ast_mutex_lock(&usecnt_lock); ast_mutex_lock(&usecnt_lock);
usecnt++; usecnt++;
ast_mutex_unlock(&usecnt_lock); ast_mutex_unlock(&usecnt_lock);
ast_update_use_count(); ast_update_use_count();
strncpy(tmp->context, i->context, sizeof(tmp->context)-1); strncpy(ch->context, i->context, sizeof(ch->context)-1);
strncpy(tmp->exten, i->exten, sizeof(tmp->exten)-1); strncpy(ch->exten, i->exten, sizeof(ch->exten)-1);
tmp->priority = 1; ch->priority = 1;
if (strlen(i->callerid)) if (strlen(i->callerid))
tmp->callerid = strdup(i->callerid); ch->callerid = strdup(i->callerid);
if (strlen(i->accountcode)) if (strlen(i->accountcode))
strncpy(tmp->accountcode, i->accountcode, sizeof(tmp->accountcode)-1); strncpy(ch->accountcode, i->accountcode, sizeof(ch->accountcode)-1);
if (i->amaflags) if (i->amaflags)
tmp->amaflags = i->amaflags; ch->amaflags = i->amaflags;
if (state != AST_STATE_DOWN) { if (state != AST_STATE_DOWN) {
if (ast_pbx_start(tmp)) { if (ast_pbx_start(ch)) {
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name); ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ch->name);
ast_hangup(tmp); ast_hangup(ch);
tmp = NULL; ch = NULL;
} }
} }
} else } else
ast_log(LOG_WARNING, "Unable to allocate channel structure\n"); ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
return tmp; return ch;
} }
static struct oh323_pvt *oh323_alloc(int callid) static struct oh323_pvt *oh323_alloc(int callid)
Loading…
Cancel
Save