[Asterisk-cvs]
asterisk-addons/asterisk-ooh323c/ooh323c/tests/chansetup
h323peer.c, 1.1, 1.2
vphirke at lists.digium.com
vphirke at lists.digium.com
Fri Jun 3 10:51:09 CDT 2005
Update of /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/tests/chansetup
In directory mongoose.digium.com:/tmp/cvs-serv8768/ooh323c/tests/chansetup
Modified Files:
h323peer.c
Log Message:
Updated stack source
Index: h323peer.c
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/tests/chansetup/h323peer.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- h323peer.c 23 May 2005 21:08:22 -0000 1.1
+++ h323peer.c 3 Jun 2005 14:54:07 -0000 1.2
@@ -35,7 +35,8 @@
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 onNewCallCreated (ooCallData* call);
+static int onCallEstablished(ooCallData *call);
static int onCallCleared (ooCallData* call);
static int onAlerting (ooCallData* call);
static void* runtest (void*);
@@ -66,7 +67,7 @@
static int gInterval = 0; /* 0 interval means let previous call finish */
static char gDest[256];
static int gCallCounter=0;
-
+static OOBOOL bListen = FALSE;
int main (int argc, char** argv)
{
char callToken[20], *token=NULL;
@@ -74,9 +75,7 @@
int localPort = 0;
OOTimer *pTimer = NULL;
int ret=0, x;
- OOBOOL isActive = FALSE;
OOBOOL bDestFound=FALSE;
- OOBOOL bListen = FALSE;
char logfile[50];
OOH323CALLBACKS h323Callbacks;
@@ -140,7 +139,7 @@
}
}
- if(!bListen && !bDestFound)
+ if((!bListen && !bDestFound) || (bListen && bDestFound))
{
printf("USAGE:\n%s",USAGE);
return -1;
@@ -178,19 +177,24 @@
return -1;
}
+ if(bListen)
+ {
+ ooH323EpSetTCPPortRange(20050, 20250);
+ ooH323EpSetUDPPortRange(21050, 21250);
+ ooH323EpSetRTPPortRange(22050, 22250);
+ }
+ ooH323EpSetTraceLevel(OOTRCLVLDBGC);
ooH323EpSetLocalAddress(localIPAddr, localPort);
ooH323EpAddAliasH323ID ("objsys");
ooH323EpAddAliasDialedDigits ("5087556929");
ooH323EpAddAliasURLID ("http://www.obj-sys.com");
/* Register callbacks */
- h323Callbacks.onNewCallCreated = NULL;
+ h323Callbacks.onNewCallCreated = onNewCallCreated;
h323Callbacks.onAlerting = onAlerting;
h323Callbacks.onIncomingCall = onIncomingCall;
h323Callbacks.onOutgoingCall = NULL;
- h323Callbacks.onCallAnswered = NULL;
- h323Callbacks.onCallEstablished = NULL;
- h323Callbacks.onOutgoingCallAdmitted = onOutgoingCallAdmitted;
+ h323Callbacks.onCallEstablished = onCallEstablished;
h323Callbacks.onCallCleared = onCallCleared;
h323Callbacks.openLogicalChannels=NULL;
@@ -258,7 +262,7 @@
OOTimer* timer = NULL;
char *token=NULL;
printf ("Starting transmit channel to %s:%d - %s\n",
- call->remoteIP, pChannel->mediaPort, call->callToken);
+ call->remoteIP, pChannel->remoteMediaPort, call->callToken);
if(gCalls != 0)
{
token = (char*)malloc(strlen(call->callToken)+1);
@@ -324,9 +328,9 @@
/* Callback to handle outgoing call admitted */
-static int onOutgoingCallAdmitted (ooCallData* call)
+static int onNewCallCreated (ooCallData* call)
{
- printf ("onOutgoingCallAdmitted - %s\n", call->callToken);
+ printf ("onNewCallCreated - %s\n", call->callToken);
/* TODO: user would add application specific logic here to handle */
/* outgoing call admitted.. */
@@ -334,19 +338,30 @@
return OO_OK;
}
+/* Callback to handle call established event */
+
+int onCallEstablished(ooCallData *call)
+{
+ printf("onCallEstablished - %s\n", call->callToken);
+ 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) {
+ if(gInterval == 0 && !bListen)
+ {
+ if(gCallCounter < gCalls)
+ {
ooMakeCall (gDest, callToken, sizeof(callToken), NULL);
gCallCounter++;
}
- else {
- ooStopMonitor();
+ else{
+ printf("Issuing StopMonitor command\n");
+ ooStopMonitor();
}
}
return OO_OK;
More information about the svn-commits
mailing list