[Asterisk-cvs] asterisk-addons/asterisk-ooh323c/ooh323c/tests/chansetup Makefile.am, NONE, 1.1 Makefile.in, NONE, 1.1 h323peer.c, NONE, 1.1

vphirke at lists.digium.com vphirke at lists.digium.com
Mon May 23 17:04:00 CDT 2005


Update of /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/tests/chansetup
In directory mongoose.digium.com:/tmp/cvs-serv20564/tests/chansetup

Added Files:
	Makefile.am Makefile.in h323peer.c 
Log Message:
Added

--- NEW FILE: Makefile.am ---
CFLAGS= @OOH323CFLAGS@
noinst_PROGRAMS = h323peer
h323peer_SOURCES = h323peer.c
INCLUDES = -I$(top_builddir)/ooh323c/src -I$(top_builddir)/ooh323c/src/h323 
h323peer_LDADD = -loostk -ldl -lpthread
h323peer_LDFLAGS = -L$(top_builddir)/ooh323c/src

opt:
	$(MAKE) "CFLAGS = -DGNU -D_GNU_SOURCE -D_REENTRANT -D_COMPACT -O2" all

debug:
	$(MAKE) "CFLAGS = -g -DGNU -D_GNU_SOURCE -D_REENTRANT" all

--- NEW FILE: Makefile.in ---
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# @configure_input@

# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

@SET_MAKE@
SHELL = @SHELL@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@

bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../../..

ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@

am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@

EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
AMTAR = @AMTAR@
AS = @AS@
AWK = @AWK@
CC = @CC@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
INSTALLPREFIX = @INSTALLPREFIX@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
OBJDUMP = @OBJDUMP@
OOH323CDRIVERDIR = @OOH323CDRIVERDIR@
OOH323CFLAGS = @OOH323CFLAGS@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
STRIP = @STRIP@
VERSION = @VERSION@
am__include = @am__include@
am__quote = @am__quote@
install_sh = @install_sh@
CFLAGS = @OOH323CFLAGS@
noinst_PROGRAMS = h323peer
h323peer_SOURCES = h323peer.c
INCLUDES = -I$(top_builddir)/ooh323c/src -I$(top_builddir)/ooh323c/src/h323 
h323peer_LDADD = -loostk -ldl -lpthread
h323peer_LDFLAGS = -L$(top_builddir)/ooh323c/src
subdir = ooh323c/tests/chansetup
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
noinst_PROGRAMS = h323peer$(EXEEXT)
PROGRAMS = $(noinst_PROGRAMS)

am_h323peer_OBJECTS = h323peer.$(OBJEXT)
h323peer_OBJECTS = $(am_h323peer_OBJECTS)
h323peer_DEPENDENCIES =

DEFS = @DEFS@
DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE at DEP_FILES = ./$(DEPDIR)/h323peer.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
	$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
	$(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(h323peer_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
SOURCES = $(h323peer_SOURCES)

all: all-am

.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
	cd $(top_srcdir) && \
	  $(AUTOMAKE) --gnu  ooh323c/tests/chansetup/Makefile
Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)

clean-noinstPROGRAMS:
	@list='$(noinst_PROGRAMS)'; for p in $$list; do \
	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
	  echo " rm -f $$p $$f"; \
	  rm -f $$p $$f ; \
	done
h323peer$(EXEEXT): $(h323peer_OBJECTS) $(h323peer_DEPENDENCIES) 
	@rm -f h323peer$(EXEEXT)
	$(LINK) $(h323peer_LDFLAGS) $(h323peer_OBJECTS) $(h323peer_LDADD) $(LIBS)

mostlyclean-compile:
	-rm -f *.$(OBJEXT) core *.core

distclean-compile:
	-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/h323peer.Po at am__quote@

distclean-depend:
	-rm -rf ./$(DEPDIR)

.c.o:
@AMDEP_TRUE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
	$(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<

.c.obj:
@AMDEP_TRUE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
	$(COMPILE) -c `cygpath -w $<`

.c.lo:
@AMDEP_TRUE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@	depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
	$(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
CCDEPMODE = @CCDEPMODE@

mostlyclean-libtool:
	-rm -f *.lo

clean-libtool:
	-rm -rf .libs _libs

distclean-libtool:
	-rm -f libtool
uninstall-info-am:

ETAGS = etags
ETAGSFLAGS =

tags: TAGS

ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	mkid -fID $$unique

TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	tags=; \
	here=`pwd`; \
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	test -z "$(ETAGS_ARGS)$$tags$$unique" \
	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	     $$tags $$unique

GTAGS:
	here=`$(am__cd) $(top_builddir) && pwd` \
	  && cd $(top_srcdir) \
	  && gtags -i $(GTAGS_ARGS) $$here

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)

top_distdir = ../../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)

distdir: $(DISTFILES)
	@list='$(DISTFILES)'; for file in $$list; do \
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
	    dir="/$$dir"; \
	    $(mkinstalldirs) "$(distdir)$$dir"; \
	  else \
	    dir=''; \
	  fi; \
	  if test -d $$d/$$file; then \
	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
	    fi; \
	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
	  else \
	    test -f $(distdir)/$$file \
	    || cp -p $$d/$$file $(distdir)/$$file \
	    || exit 1; \
	  fi; \
	done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)

installdirs:

install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am

install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

installcheck: installcheck-am
install-strip:
	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	  INSTALL_STRIP_FLAG=-s \
	  `test -z '$(STRIP)' || \
	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:

clean-generic:

distclean-generic:
	-rm -f Makefile $(CONFIG_CLEAN_FILES)

maintainer-clean-generic:
	@echo "This command is intended for maintainers to use"
	@echo "it deletes files that may require special tools to rebuild."
clean: clean-am

clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
	mostlyclean-am

distclean: distclean-am

distclean-am: clean-am distclean-compile distclean-depend \
	distclean-generic distclean-libtool distclean-tags

dvi: dvi-am

dvi-am:

info: info-am

info-am:

install-data-am:

install-exec-am:

install-info: install-info-am

install-man:

installcheck-am:

maintainer-clean: maintainer-clean-am

maintainer-clean-am: distclean-am maintainer-clean-generic

mostlyclean: mostlyclean-am

mostlyclean-am: mostlyclean-compile mostlyclean-generic \
	mostlyclean-libtool

uninstall-am: uninstall-info-am

.PHONY: GTAGS all all-am check check-am clean clean-generic \
	clean-libtool clean-noinstPROGRAMS distclean distclean-compile \
	distclean-depend distclean-generic distclean-libtool \
	distclean-tags distdir dvi dvi-am info info-am install \
	install-am install-data install-data-am install-exec \
	install-exec-am install-info install-info-am install-man \
	install-strip installcheck installcheck-am installdirs \
	maintainer-clean maintainer-clean-generic mostlyclean \
	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
	tags uninstall uninstall-am uninstall-info-am


opt:
	$(MAKE) "CFLAGS = -DGNU -D_GNU_SOURCE -D_REENTRANT -D_COMPACT -O2" all

debug:
	$(MAKE) "CFLAGS = -g -DGNU -D_GNU_SOURCE -D_REENTRANT" all
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

--- NEW FILE: h323peer.c ---
/**
 * This sample program demonstrates basic H.323 channel setup and teardown. 
 * It should be run using two instances: 
 *
 * 1. Instance 1 with no parameters will go into listen mode and wait for a 
 *    connection request. 
 *
 * 2. Instance 2 with "[ip[:port]]" will initiate an outgoing call. 
 *    If [ip[:port]] is not specified, call will be made to listener on 
 *    the local machine.
 *
 * Once the channel is setup and established, the receiver will delay for 
 * a short period of time and then hang up the call.
 */
#include "oochannels.h"
#include "ooh323ep.h"
#include "ooCalls.h"
#include "ooCapability.h"
#include "ooStackCmds.h"
#include "ooTimer.h"

#ifndef _WIN32
#include <pthread.h>
#endif

#ifdef _WIN32
#include <process.h>
#define getpid _getpid
#endif
/** Global endpoint structure */
extern ooEndPoint gH323ep;

static int startReceiveChannel (ooCallData *call, ooLogicalChannel *pChannel);
static int startTransmitChannel(ooCallData *call, ooLogicalChannel *pChannel);
static int stopReceiveChannel (ooCallData *call, ooLogicalChannel *pChannel);
static int stopTransmitChannel(ooCallData *call, ooLogicalChannel *pChannel);
static int onIncomingCall (ooCallData* call);
static int onOutgoingCallAdmitted (ooCallData* call);
static int onCallCleared (ooCallData* call);
static int onAlerting (ooCallData* call);
static void* runtest (void*);
static int callDurationTimerExpired (void *pdata);
static int callIntervalTimerExpired(void *pdata);


static char USAGE[]={
   "Listen to incoming calls\n"
   "\th323peer [options] --listen\n"
   "Make test calls\n"
   "\th323peer [options] <remote>\n" 
   "\t                    remote => Remote endpoint to callip:[port]\n"
   "\n\n"
   "options:\n"
   "Common Options for listen and Make call modes\n"
   "\t--help                    -  To display usage information\n"
   "\t--use-ip <ip>             -  local ip to use\n"
   "\t--use-port <port>         -  local port to use\n"
   "Options specific to make call mode\n"
   "\t-n <NoOfCalls>            -  Number of outgoing calls\n"
   "\t-duration <call duration> -  Duration of each call in seconds\n"
   "\t-interval <interval>      -  Interval between successive calls in seconds\n"
};

static int gCalls = 0;
static int gDuration = 5; /*sec*/
static int gInterval = 0; /* 0 interval means let previous call finish */
static char gDest[256];
static int gCallCounter=0;

int main (int argc, char** argv)
{
   char callToken[20], *token=NULL;
   char localIPAddr[20];
   int  localPort = 0;
   OOTimer *pTimer = NULL;
   int ret=0, x;
   OOBOOL isActive = FALSE;
   OOBOOL bDestFound=FALSE;
   OOBOOL bListen = FALSE;
   char logfile[50];

   OOH323CALLBACKS h323Callbacks;

#ifdef _WIN32
   ooSocketsInit (); /* Initialize the windows socket api  */
#endif
   
   localIPAddr[0] = '\0';
   gDest[0] = '\0';
   
   /* parse args */

   if(argc > 12 || argc ==1)
   {
      printf("USAGE:\n%s", USAGE);
      return -1;
   }
   for (x = 1; x < argc; x++) {
      if(!strcmp(argv[x], "--help")) {
         printf("USAGE:\n%s", USAGE);
         return 0;
      }
      else if(!strcmp(argv[x], "--listen"))
      {
         if(!bDestFound)
            bListen=TRUE;
         else{
            printf("USAGE:\n%s",USAGE);
            return -1;
         }
      }
      else if (!strcmp(argv[x], "--use-ip")) {
         x++;
         strncpy (localIPAddr, argv[x], sizeof(localIPAddr)-1);
      }
      else if (!strcmp(argv[x],"--use-port")) {
         x++;
         localPort = atoi (argv[x]);
      }
      else if (!strcmp(argv[x], "-n")){
         x++;
         gCalls= atoi(argv[x]);
      }
      else if(!strcmp(argv[x], "-duration")) {
         x++;
         gDuration = atoi(argv[x]);
      }
      else if(!strcmp(argv[x], "-interval")) {
         x++;
         gInterval = atoi(argv[x]);
      }
      else if (!bDestFound && !bListen) {
         strncpy (gDest, argv[x], sizeof(gDest)-1);
         bDestFound = TRUE;
	 if (0 == gCalls) gCalls++;
      } 
      else {
	 printf("USAGE:\n%s",USAGE);
         return -1;
      }
   }
   
    if(!bListen && !bDestFound)
   {
      printf("USAGE:\n%s",USAGE);
      return -1;
   }
   /* Determine local IP address if not specified by user */

   if (0 == strlen(localIPAddr)) {
      ooGetLocalIPAddress (localIPAddr);
   }

   if (!strcmp (localIPAddr, "127.0.0.1")) {
      printf ("Failed to determine local IP address, "
	      "please specify as command line option\n");
      printf ("USAGE:\n%s", USAGE);
      return -1;
   }

   sprintf(logfile, "h323peer_%d", getpid());       
	   
   /* Initialize the H323 endpoint - faststart and tunneling enabled */
   printf ("Using:\n"
	   "\tCalls to make : %d\n"
	   "\tCall Duration : %d\n"
	   "\tInterval      : %d\n"
	   "\tlocal Address : %s:%d\n"
	   "\tRemote Address: %s\n"
           "\tLog File      : %s\n",
	   gCalls, gDuration, gInterval, localIPAddr, localPort, 
	   gDest, logfile);

   ret = ooH323EpInitialize(OO_CALLMODE_AUDIOCALL, logfile);

   if (ret != OO_OK) {
      printf ("Failed to initialize H.323 endpoint\n");
      return -1;
   }

   ooH323EpSetLocalAddress(localIPAddr, localPort);
   ooH323EpAddAliasH323ID ("objsys");
   ooH323EpAddAliasDialedDigits ("5087556929");
   ooH323EpAddAliasURLID ("http://www.obj-sys.com");

   /* Register callbacks */
   h323Callbacks.onNewCallCreated = NULL;
   h323Callbacks.onAlerting = onAlerting;
   h323Callbacks.onIncomingCall = onIncomingCall;
   h323Callbacks.onOutgoingCall = NULL;
   h323Callbacks.onCallAnswered = NULL;
   h323Callbacks.onCallEstablished = NULL;
   h323Callbacks.onOutgoingCallAdmitted = onOutgoingCallAdmitted;
   h323Callbacks.onCallCleared = onCallCleared;
   h323Callbacks.openLogicalChannels=NULL;
  
   ooH323EpSetH323Callbacks(h323Callbacks);


   /* Add audio capability */

   ooH323EpAddG711Capability 
      (OO_G711ULAW64K,30, 240, OORXANDTX, &startReceiveChannel,
       &startTransmitChannel, &stopReceiveChannel, &stopTransmitChannel);

   /* Create H.323 Listener */
   if(bListen){
      ret = ooCreateH323Listener();

      if (ret != OO_OK) {
         OOTRACEERR1 ("Failed to Create H.323 Listener");
         return -1;
      }
   }

   if(bDestFound)
   {
      ooMakeCall (gDest, callToken, sizeof(callToken), NULL); /* Make call */
      gCallCounter++;
      if(gInterval != 0)
      {
	 token = (char*)malloc(strlen(callToken)+1);
         strcpy(token, callToken);
         pTimer = ooTimerCreate
	    (&gH323ep.ctxt, NULL, callIntervalTimerExpired, 
	     gInterval, token, FALSE);

      }
   }

   /* Loop forever to process events */
   ooMonitorChannels();

   /* Application terminated - clean-up */

   ooH323EpDestroy();

   return 0;
}

/* Callback to start receive media channel */

static int startReceiveChannel (ooCallData *call, ooLogicalChannel *pChannel)
{
   printf ("Starting receive channel at %s:%d - %s\n", 
	   call->localIP, pChannel->localRtpPort, call->callToken);

   /* TODO: user would add application specific logic here to start	*/
   /* the media receive channel..					*/

   return OO_OK;
}

/* Callback to start transmit media channel */

static int startTransmitChannel (ooCallData *call, ooLogicalChannel *pChannel)
{
   OOTimer* timer = NULL;
   char *token=NULL;
   printf ("Starting transmit channel to %s:%d - %s\n", 
	   call->remoteIP, pChannel->mediaPort, call->callToken);
   if(gCalls != 0)
   {
      token = (char*)malloc(strlen(call->callToken)+1);
      strcpy(token, call->callToken);
      timer =  ooTimerCreate
	 (&gH323ep.ctxt, NULL, callDurationTimerExpired, gDuration, 
	  token, FALSE);

   }
   /* TODO: user would add application specific logic here to start	*/
   /* the media transmit channel..					*/

   return OO_OK;
}

/* Callback to stop receive media channel */

static int stopReceiveChannel (ooCallData *call, ooLogicalChannel *pChannel)
{
   printf ("Stopping receive channel - %s\n", call->callToken);

   /* TODO: user would add application specific logic here to stop	*/
   /* the media receive channel..					*/

   return OO_OK;
}

/* Callback to stop transmit media channel */

static int stopTransmitChannel (ooCallData *call, ooLogicalChannel *pChannel)
{
   printf ("Stopping transmit channel - %s\n", call->callToken);

   /* TODO: user would add application specific logic here to stop	*/
   /* the media transmit channel..					*/

   return OO_OK;
}

/* Callback to process alerting signal */

static int onAlerting (ooCallData* call)
{
   printf ("onAlerting - %s\n", call->callToken);

   /* TODO: user would add application specific logic here to handle	*/
   /* an H.225 alerting message..					*/

   return OO_OK;
}

/* Callback to handle an incoming call request */

static int onIncomingCall (ooCallData* call)
{
   printf ("onIncomingCall - %s\n", call->callToken);

   /* TODO: user would add application specific logic here to handle	*/
   /* an incoming call request..					*/

   return OO_OK;
}

/* Callback to handle outgoing call admitted */

static int onOutgoingCallAdmitted (ooCallData* call)
{
   printf ("onOutgoingCallAdmitted - %s\n", call->callToken);

   /* TODO: user would add application specific logic here to handle	*/
   /* outgoing call admitted..						*/

   return OO_OK;
}

/* Callback to handle call cleared */

static int onCallCleared (ooCallData* call)
{
  char callToken[20];
   printf ("onCallCleared - %s\n", call->callToken);
   if (gInterval == 0) {
      if (gCallCounter < gCalls) {
	 ooMakeCall (gDest, callToken, sizeof(callToken), NULL);
	 gCallCounter++;
      }
      else {
	 ooStopMonitor();
      }
   }
   return OO_OK;
}

static int callDurationTimerExpired (void *pdata)
{
   printf("callDurationTimerExpired - %s\n", (char*)pdata);
   ooHangCall((char*)pdata, OO_REASON_LOCAL_CLEARED);
   free(pdata);
   return OO_OK;
}

static int callIntervalTimerExpired(void *pdata)
{
   char callToken[20];
   char *token=NULL;
   OOTimer* pTimer = NULL;
   printf("callIntervalTimerExpired\n");
   memset(callToken, 0, sizeof(callToken));
   if (gCallCounter < gCalls)
   {
      ooMakeCall (gDest, callToken, sizeof(callToken), NULL); /* Make call */
      token = (char*)malloc(strlen(callToken)+1);
      strcpy(token, callToken);
      pTimer =  ooTimerCreate(&gH323ep.ctxt, NULL, callIntervalTimerExpired, 
                               gInterval, token, FALSE);
      gCallCounter++;
   }

   return OO_OK;
}





More information about the svn-commits mailing list