Add H323 to normal build process
authorJeremy McNamara <jj@nufone.net>
Sat, 16 Aug 2003 17:00:22 +0000 (17:00 +0000)
committerJeremy McNamara <jj@nufone.net>
Sat, 16 Aug 2003 17:00:22 +0000 (17:00 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1355 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/Makefile
channels/chan_h323.c [moved from channels/h323/chan_h323.c with 97% similarity]

index fb01896..10a4c41 100755 (executable)
@@ -25,6 +25,7 @@ CHANNEL_LIBS=chan_modem.so chan_iax.so chan_sip.so \
 #CHANNEL_LIBS+=chan_vofr
 
 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+=$(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
         $(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
 #      $(CC) -rdynamic -shared -Xlinker -x -o $@ $<
 
similarity index 97%
rename from channels/h323/chan_h323.c
rename to channels/chan_h323.c
index 9ab6512..f02f00e 100755 (executable)
@@ -56,7 +56,7 @@
 #include <netinet/ip.h>
 
 
-#include "chan_h323.h"
+#include "h323/chan_h323.h"
 
 /** String variables required by ASTERISK */
 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)
 {
-       struct ast_channel *tmp;
+       struct ast_channel *ch;
        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);
-               tmp->nativeformats = i->capability;
-               if (!tmp->nativeformats)
-                       tmp->nativeformats = capability;
-               fmt = ast_best_codec(tmp->nativeformats);
-               tmp->type = type;
-               tmp->fds[0] = ast_rtp_fd(i->rtp);
-               ast_setstate(tmp, state);
+               snprintf(ch->name, sizeof(ch->name)-1, "H323/%s", host);
+               ch->nativeformats = i->capability;
+               if (!ch->nativeformats)
+                       ch->nativeformats = capability;
+               fmt = ast_best_codec(ch->nativeformats);
+               ch->type = type;
+               ch->fds[0] = ast_rtp_fd(i->rtp);
+               ast_setstate(ch, state);
                
                if (state == AST_STATE_RING)
-                       tmp->rings = 1;
+                       ch->rings = 1;
                
-               tmp->writeformat = fmt;
-               tmp->pvt->rawwriteformat = fmt;
-               tmp->readformat = fmt;
-               tmp->pvt->rawreadformat = fmt;
+               ch->writeformat = fmt;
+               ch->pvt->rawwriteformat = fmt;
+               ch->readformat = fmt;
+               ch->pvt->rawreadformat = fmt;
                
                /* Allocate dsp for in-band DTMF support */
                if (i->dtmfmode & H323_DTMF_INBAND) {
                        i->vad = ast_dsp_new();
                        ast_dsp_set_features(i->vad, DSP_FEATURE_DTMF_DETECT);
-        }
+               }
 
                /* Register the OpenH323 channel's functions. */
-               tmp->pvt->pvt = i;
-               tmp->pvt->send_digit = oh323_digit;
-               tmp->pvt->call = oh323_call;
-               tmp->pvt->hangup = oh323_hangup;
-               tmp->pvt->answer = oh323_answer;
-               tmp->pvt->read = oh323_read;
-               tmp->pvt->write = oh323_write;
-               tmp->pvt->indicate = oh323_indicate;
-               tmp->pvt->fixup = oh323_fixup;
-               tmp->pvt->bridge = ast_rtp_bridge;
+               ch->pvt->pvt = i;
+               ch->pvt->send_digit = oh323_digit;
+               ch->pvt->call = oh323_call;
+               ch->pvt->hangup = oh323_hangup;
+               ch->pvt->answer = oh323_answer;
+               ch->pvt->read = oh323_read;
+               ch->pvt->write = oh323_write;
+               ch->pvt->indicate = oh323_indicate;
+               ch->pvt->fixup = oh323_fixup;
+               ch->pvt->bridge = ast_rtp_bridge;
 
                /*  Set the owner of this channel */
-               i->owner = tmp;
+               i->owner = ch;
                
                ast_mutex_lock(&usecnt_lock);
                usecnt++;
                ast_mutex_unlock(&usecnt_lock);
                ast_update_use_count();
-               strncpy(tmp->context, i->context, sizeof(tmp->context)-1);
-               strncpy(tmp->exten, i->exten, sizeof(tmp->exten)-1);            
-               tmp->priority = 1;
+               strncpy(ch->context, i->context, sizeof(ch->context)-1);
+               strncpy(ch->exten, i->exten, sizeof(ch->exten)-1);              
+               ch->priority = 1;
                if (strlen(i->callerid))
-                       tmp->callerid = strdup(i->callerid);
+                       ch->callerid = strdup(i->callerid);
                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)
-                       tmp->amaflags = i->amaflags;
+                       ch->amaflags = i->amaflags;
                if (state != AST_STATE_DOWN) {
-                       if (ast_pbx_start(tmp)) {
-                               ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
-                               ast_hangup(tmp);
-                               tmp = NULL;
+                       if (ast_pbx_start(ch)) {
+                               ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ch->name);
+                               ast_hangup(ch);
+                               ch = NULL;
                        }
                }
        } else
                ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
-       return tmp;
+       return ch;
 }
 
 static struct oh323_pvt *oh323_alloc(int callid)