[Asterisk-cvs] asterisk-addons/asterisk-ooh323c/ooh323c/src
ooLogChan.c, NONE, 1.1 ooLogChan.h, NONE, 1.1 Makefile.am, 1.2,
1.3 Makefile.in, 1.2, 1.3 ooCalls.c, 1.3, 1.4 ooCalls.h, 1.1,
1.2 ooCapability.c, 1.1, 1.2 ooCapability.h, 1.3,
1.4 ooGkClient.h, 1.1, 1.2 ooStackCmds.c, 1.2,
1.3 ooStackCmds.h, 1.2, 1.3 oochannels.c, 1.3,
1.4 oochannels.h, 1.3, 1.4 ooh245.c, 1.3, 1.4 ooh245.h, 1.1,
1.2 ooh323.c, 1.2, 1.3 ooh323.h, 1.1, 1.2 ooh323ep.c, 1.2,
1.3 ooh323ep.h, 1.2, 1.3 ooq931.c, 1.2, 1.3 ooq931.h, 1.2,
1.3 ootrace.c, 1.1, 1.2 ootrace.h, 1.1, 1.2 ootypes.h, 1.2, 1.3
vphirke at lists.digium.com
vphirke at lists.digium.com
Fri Jun 3 10:51:10 CDT 2005
Update of /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src
In directory mongoose.digium.com:/tmp/cvs-serv8768/ooh323c/src
Modified Files:
Makefile.am Makefile.in ooCalls.c ooCalls.h ooCapability.c
ooCapability.h ooGkClient.h ooStackCmds.c ooStackCmds.h
oochannels.c oochannels.h ooh245.c ooh245.h ooh323.c ooh323.h
ooh323ep.c ooh323ep.h ooq931.c ooq931.h ootrace.c ootrace.h
ootypes.h
Added Files:
ooLogChan.c ooLogChan.h
Log Message:
Updated stack source
--- NEW FILE: ooLogChan.c ---
/*
* Copyright (C) 2004-2005 by Objective Systems, Inc.
*
* This software is furnished under an open source license and may be
* used and copied only in accordance with the terms of this license.
* The text of the license may generally be found in the root
* directory of this installation in the COPYING file. It
* can also be viewed online at the following URL:
*
* http://www.obj-sys.com/open/license.html
*
* Any redistributions of this file including modified versions must
* maintain this copyright notice.
*
*****************************************************************************/
#include "ooCalls.h"
#include "ooh323ep.h"
/** Global endpoint structure */
extern OOH323EndPoint gH323ep;
OOLogicalChannel* ooAddNewLogicalChannel(OOH323CallData *call, int channelNo,
int sessionID, char *dir,
ooH323EpCapability *epCap)
{
OOLogicalChannel *pNewChannel=NULL, *pChannel=NULL;
OOMediaInfo *pMediaInfo = NULL;
OOTRACEDBGC5("Adding new media channel for cap %d dir %s (%s, %s)\n",
epCap->cap, dir, call->callType, call->callToken);
/* Create a new logical channel entry */
pNewChannel = (OOLogicalChannel*)memAlloc(call->pctxt,
sizeof(OOLogicalChannel));
if(!pNewChannel)
{
OOTRACEERR3("ERROR:Memory - ooAddNewLogicalChannel - pNewChannel "
"(%s, %s)\n", call->callType, call->callToken);
return NULL;
}
memset(pNewChannel, 0, sizeof(OOLogicalChannel));
pNewChannel->channelNo = channelNo;
pNewChannel->sessionID = sessionID;
pNewChannel->state = OO_LOGICALCHAN_IDLE;
pNewChannel->type = epCap->capType;
/* strcpy(pNewChannel->type, type);*/
strcpy(pNewChannel->dir, dir);
pNewChannel->chanCap = epCap;
OOTRACEDBGC4("Adding new channel with cap %d (%s, %s)\n", epCap->cap,
call->callType, call->callToken);
/* As per standards, media control port should be same for all
proposed channels with same session ID. However, most applications
use same media port for transmit and receive of audio streams. Infact,
testing of OpenH323 based asterisk assumed that same ports are used.
Hence we first search for existing media ports for smae session and use
them. This should take care of all cases.
*/
if(call->mediaInfo)
{
pMediaInfo = call->mediaInfo;
while(pMediaInfo)
{
if(!strcmp(pMediaInfo->dir, dir) &&
(pMediaInfo->cap == epCap->cap))
{
break;
}
pMediaInfo = pMediaInfo->next;
}
}
if(pMediaInfo)
{
OOTRACEDBGC3("Using configured media info (%s, %s)\n", call->callType,
call->callToken);
pNewChannel->localRtpPort = pMediaInfo->lMediaPort;
pNewChannel->localRtcpPort = pMediaInfo->lMediaCntrlPort;
strcpy(pNewChannel->localIP, pMediaInfo->lMediaIP);
}else{
OOTRACEDBGC3("Using default media info (%s, %s)\n", call->callType,
call->callToken);
pNewChannel->localRtpPort = ooGetNextPort (OORTP);
/* Ensures that RTP port is an even one */
if((pNewChannel->localRtpPort & 1) == 1)
pNewChannel->localRtpPort = ooGetNextPort (OORTP);
pNewChannel->localRtcpPort = ooGetNextPort (OORTP);
strcpy(pNewChannel->localIP, call->localIP);
}
/* Add new channel to the list */
pNewChannel->next = NULL;
if(!call->logicalChans)
call->logicalChans = pNewChannel;
else{
pChannel = call->logicalChans;
while(pChannel->next) pChannel = pChannel->next;
pChannel->next = pNewChannel;
}
/* increment logical channels */
call->noOfLogicalChannels++;
OOTRACEINFO3("Created new logical channel entry (%s, %s)\n", call->callType,
call->callToken);
return pNewChannel;
}
OOLogicalChannel* ooFindLogicalChannelByLogicalChannelNo(OOH323CallData *call,
int ChannelNo)
{
OOLogicalChannel *pLogicalChannel=NULL;
if(!call->logicalChans)
{
OOTRACEERR3("ERROR: No Open LogicalChannels - Failed "
"FindLogicalChannelByChannelNo (%s, %s\n", call->callType,
call->callToken);
return NULL;
}
pLogicalChannel = call->logicalChans;
while(pLogicalChannel)
{
if(pLogicalChannel->channelNo == ChannelNo)
break;
else
pLogicalChannel = pLogicalChannel->next;
}
return pLogicalChannel;
}
OOLogicalChannel * ooFindLogicalChannelByOLC(OOH323CallData *call,
H245OpenLogicalChannel *olc)
{
H245DataType * psDataType=NULL;
H245H2250LogicalChannelParameters * pslcp=NULL;
OOTRACEDBGC4("ooFindLogicalChannel by olc %d (%s, %s)\n",
olc->forwardLogicalChannelNumber, call->callType, call->callToken);
if(olc->m.reverseLogicalChannelParametersPresent)
{
OOTRACEDBGC3("Finding receive channel (%s,%s)\n", call->callType,
call->callToken);
psDataType = &olc->reverseLogicalChannelParameters.dataType;
/* Only H2250LogicalChannelParameters are supported */
if(olc->reverseLogicalChannelParameters.multiplexParameters.t !=
T_H245OpenLogicalChannel_reverseLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters){
OOTRACEERR4("Error:Invalid olc %d received (%s, %s)\n",
olc->forwardLogicalChannelNumber, call->callType, call->callToken);
return NULL;
}
pslcp = olc->reverseLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters;
return ooFindLogicalChannel(call, pslcp->sessionID, "receive", psDataType);
}
else{
OOTRACEDBGC3("Finding transmit channel (%s, %s)\n", call->callType,
call->callToken);
psDataType = &olc->forwardLogicalChannelParameters.dataType;
/* Only H2250LogicalChannelParameters are supported */
if(olc->forwardLogicalChannelParameters.multiplexParameters.t !=
T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters)
{
OOTRACEERR4("Error:Invalid olc %d received (%s, %s)\n",
olc->forwardLogicalChannelNumber, call->callType, call->callToken);
return NULL;
}
pslcp = olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters;
return ooFindLogicalChannel(call, pslcp->sessionID, "transmit", psDataType);
}
}
OOLogicalChannel * ooFindLogicalChannel(OOH323CallData *call, int sessionID,
char *dir, H245DataType * dataType)
{
OOLogicalChannel * pChannel = NULL;
pChannel = call->logicalChans;
while(pChannel)
{
if(pChannel->sessionID == sessionID)
{
if(!strcmp(pChannel->dir, dir))
{
if(!strcmp(dir, "receive"))
{
if(ooCapabilityCheckCompatibility(call, pChannel->chanCap,
dataType, OORX))
return pChannel;
}else if(!strcmp(dir, "transmit"))
{
if(ooCapabilityCheckCompatibility(call, pChannel->chanCap,
dataType, OOTX))
return pChannel;
}
}
}
pChannel = pChannel->next;
}
return NULL;
}
/* This function is used to get a logical channel with a particular session ID */
OOLogicalChannel* ooGetLogicalChannel
(OOH323CallData *call, int sessionID, char *dir)
{
OOLogicalChannel * pChannel = NULL;
pChannel = call->logicalChans;
while(pChannel)
{
if(pChannel->sessionID == sessionID && !strcmp(pChannel->dir, dir))
return pChannel;
else
pChannel = pChannel->next;
}
return NULL;
}
int ooClearAllLogicalChannels(OOH323CallData *call)
{
OOLogicalChannel * temp = NULL, *prev = NULL;
OOTRACEINFO3("Clearing all logical channels (%s, %s)\n", call->callType,
call->callToken);
temp = call->logicalChans;
while(temp)
{
prev = temp;
temp = temp->next;
ooClearLogicalChannel(call, prev->channelNo);/* TODO: efficiency - This causes re-search
of of logical channel in the list. Can be
easily improved.*/
}
call->logicalChans = NULL;
return OO_OK;
}
int ooClearLogicalChannel(OOH323CallData *call, int channelNo)
{
int ret = OO_OK;
OOLogicalChannel *pLogicalChannel = NULL;
ooH323EpCapability *epCap=NULL;
OOTRACEDBGC4("Clearing logical channel number %d. (%s, %s)\n", channelNo,
call->callType, call->callToken);
pLogicalChannel = ooFindLogicalChannelByLogicalChannelNo(call,channelNo);
if(!pLogicalChannel)
{
OOTRACEWARN4("Logical Channel %d doesn't exist (%s, %s)\n",
channelNo, call->callType, call->callToken);
return OO_OK;
}
epCap = (ooH323EpCapability*) pLogicalChannel->chanCap;
if(!strcmp(pLogicalChannel->dir, "receive"))
{
if(epCap->stopReceiveChannel)
{
epCap->stopReceiveChannel(call, pLogicalChannel);
OOTRACEINFO4("Stopped Receive channel %d (%s, %s)\n",
channelNo, call->callType, call->callToken);
}
else{
OOTRACEERR4("ERROR:No callback registered for stopReceiveChannel %d "
"(%s, %s)\n", channelNo, call->callType, call->callToken);
}
}
else
{
if(pLogicalChannel->state == OO_LOGICALCHAN_ESTABLISHED)
{
if(epCap->stopTransmitChannel)
{
epCap->stopTransmitChannel(call, pLogicalChannel);
OOTRACEINFO4("Stopped Transmit channel %d (%s, %s)\n",
channelNo, call->callType, call->callToken);
}
else{
OOTRACEERR4("ERROR:No callback registered for stopTransmitChannel"
" %d (%s, %s)\n", channelNo, call->callType,
call->callToken);
}
}
}
ooRemoveLogicalChannel(call, channelNo);/* TODO: efficiency - This causes re-search of
of logical channel in the list. Can be
easily improved.*/
return OO_OK;
}
int ooRemoveLogicalChannel(OOH323CallData *call, int ChannelNo)
{
OOLogicalChannel * temp = NULL, *prev=NULL;
if(!call->logicalChans)
{
OOTRACEERR4("ERROR:Remove Logical Channel - Channel %d not found "
"Empty channel List(%s, %s)\n", ChannelNo, call->callType,
call->callToken);
return OO_FAILED;
}
temp = call->logicalChans;
while(temp)
{
if(temp->channelNo == ChannelNo)
{
if(!prev) call->logicalChans = temp->next;
else prev->next = temp->next;
memFreePtr(call->pctxt, temp->chanCap);
memFreePtr(call->pctxt, temp);
OOTRACEDBGC4("Removed logical channel %d (%s, %s)\n", ChannelNo,
call->callType, call->callToken);
call->noOfLogicalChannels--;
return OO_OK;
}
prev = temp;
temp = temp->next;
}
OOTRACEERR4("ERROR:Remove Logical Channel - Channel %d not found "
"(%s, %s)\n", ChannelNo, call->callType, call->callToken);
return OO_FAILED;
}
int ooOnLogicalChannelEstablished
(OOH323CallData *call, OOLogicalChannel * pChannel)
{
OOLogicalChannel * temp = NULL, *prev=NULL;
/* Change the state of the channel as established and close all other
channels with same session IDs. This is useful for handling fastStart,
as the endpoint can open multiple logical channels for same sessionID.
Once the remote endpoint confirms it's selection, all other channels for
the same sessionID must be closed.
*/
OOTRACEDBGC3("In ooOnLogicalChannelEstablished (%s, %s)\n",
call->callType, call->callToken);
pChannel->state = OO_LOGICALCHAN_ESTABLISHED;
temp = call->logicalChans;
while(temp)
{
if(temp->channelNo != pChannel->channelNo &&
temp->sessionID == pChannel->sessionID &&
!strcmp(temp->dir, pChannel->dir) )
{
prev = temp;
temp = temp->next;
ooClearLogicalChannel(call, prev->channelNo);
}
else
temp = temp->next;
}
return OO_OK;
}
--- NEW FILE: ooLogChan.h ---
/*
* Copyright (C) 2004-2005 by Objective Systems, Inc.
*
* This software is furnished under an open source license and may be
* used and copied only in accordance with the terms of this license.
* The text of the license may generally be found in the root
* directory of this installation in the COPYING file. It
* can also be viewed online at the following URL:
*
* http://www.obj-sys.com/open/license.html
*
* Any redistributions of this file including modified versions must
* maintain this copyright notice.
*
*****************************************************************************/
/**
* @file ooLogChan.h
* This file contains structures and functions for maintaining information
* on logical channels within the stack.
*/
#ifndef _OOLOGCHAN_H_
#define _OOLOGCHAN_H_
#include "ootypes.h"
#include "ooCapability.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup logchan H.245 logical channel management
* @{
*/
struct ooH323EpCapability;
struct OOH323CallData;
/**
* Logical channel states.
*/
typedef enum {
OO_LOGICAL_CHAN_UNKNOWN,
OO_LOGICALCHAN_IDLE,
OO_LOGICALCHAN_PROPOSED,
OO_LOGICALCHAN_ESTABLISHED
} OOLogicalChannelState;
/**
* Structure to store information on logical channels for a call.
*/
typedef struct OOLogicalChannel {
int channelNo;
int sessionID;
enum OOCapType type;
char dir[10]; /* receive/transmit */
char remoteIP[20];
int remoteMediaPort;
int remoteMediaControlPort;
int localRtpPort;
int localRtcpPort;
char localIP[20];
OOLogicalChannelState state;
struct ooH323EpCapability *chanCap;
struct OOLogicalChannel *next;
} OOLogicalChannel;
#define ooLogicalChannel OOLogicalChannel
/**
* This function is used to add a new logical channel entry into the list
* of currently active logical channels.
* @param call Pointer to the call for which new logical channel
* entry has to be created.
* @param channelNo Channel number for the new channel entry.
* @param sessionID Session identifier for the new channel.
* @param dir Direction of the channel(transmit/receive)
* @param epCap Capability to be used for the new channel.
*
* @return Pointer to logical channel, on success. NULL, on failure
*/
EXTERN ooLogicalChannel* ooAddNewLogicalChannel
(struct OOH323CallData *call, int channelNo, int sessionID,
char *dir, ooH323EpCapability *epCap);
/**
* This function is used to find a logical channel using the logical
* channel number as a key.
* @param call Pointer to the call for which logical channel is
* required.
* @param channelNo Forward Logical Channel number for the logical channel
*
* @return Pointer to the logical channel if found, NULL
* otherwise.
*/
EXTERN ooLogicalChannel* ooFindLogicalChannelByLogicalChannelNo
(struct OOH323CallData *call, int channelNo);
/**
* This function is called when a new logical channel is established. It is
* particularly useful in case of faststart. When the remote endpoint selects
* one of the proposed alternatives, other channels for the same session type
* need to be closed. This function is used for that.
*
* @param call Handle to the call which owns the logical channel.
* @param pChannel Handle to the newly established logical channel.
* @return OO_OK, on success. OO_FAILED, on failure.
*/
EXTERN int ooOnLogicalChannelEstablished
(struct OOH323CallData *call, OOLogicalChannel * pChannel);
/**
* This function is used to retrieve a logical channel with a particular
* sessionID. Note that there can be two entries of logical channel, one in
* each direction. This function will return the first channel which has the
* same session ID.
* @param call Handle to the call which owns the channels to be searched.
* @param sessionID Session id of the session which is to be searched for.
* @param dir Direction of the channel.(transmit/receive)
*
* @return Returns a pointer to the logical channel if found, NULL
* otherwise.
*/
EXTERN ooLogicalChannel* ooGetLogicalChannel
(struct OOH323CallData *call, int sessionID, char *dir);
/**
* This function is used to remove a logical channel from the list of
* channels within the call structure.
* @param call Pointer to the call from which logical channel has
* to be removed.
* @param ChannelNo Forward logical channel number of the channel to be
* removed.
* @return OO_OK, on success. OO_FAILED, on failure.
*/
EXTERN int ooRemoveLogicalChannel (struct OOH323CallData *call, int ChannelNo);
/**
* This function is used to cleanup a logical channel. It first stops media if
* it is still active and then removes the channel from the list, freeing up
* all the associated memory.
* @param call Handle to the call which owns the logical channel.
* @param channelNo Channel number identifying the channel.
*
* @return OO_OK, on success. OO_FAILED, on failure.
*/
EXTERN int ooClearLogicalChannel (struct OOH323CallData *call, int channelNo);
/**
* This function is used to cleanup all the logical channels associated with
* the call.
* @param call Handle to the call which owns the channels.
*
* @return OO_OK, on success. OO_FAILED, on failure.
*/
EXTERN int ooClearAllLogicalChannels (struct OOH323CallData *call);
/**
* This function is used to find a logical channel from a received
* H.245 Open Logical Channel (OLC) message.
* @param call Handle to the related call.
* @param olc Handle to the received OLC.
*
* @return Returns the corresponding logical channel if found,
* else returns NULL.
*/
EXTERN OOLogicalChannel * ooFindLogicalChannelByOLC
(struct OOH323CallData *call, H245OpenLogicalChannel *olc);
/**
* This function is used to find a logical channel based on session Id,
* direction of channel and datatype.
* @param call Handle to the call
* @param sessionID Session ID for the channel to be searched.
* @param dir Direction of the channel wrt local endpoint.
* (transmit/receive)
* @param dataType Handle to the data type for the channel.
*
* @return Logical channel, if found, NULL otherwise.
*/
EXTERN OOLogicalChannel * ooFindLogicalChannel
(struct OOH323CallData* call, int sessionID, char *dir, H245DataType* dataType);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif
Index: Makefile.am
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Makefile.am 26 May 2005 13:34:36 -0000 1.2
+++ Makefile.am 3 Jun 2005 14:54:06 -0000 1.3
@@ -3,7 +3,7 @@
noinst_LIBRARIES = liboostk.a
#liboostk_la_LDFLAGS = -version-info 1:1:0
-liboostk_a_SOURCES = ooUtils.c ooUtils.h ooGkClient.h ooGkClient.c context.c ooCommon.h ooDateTime.h ooDateTime.c decode.c dlist.c encode.c errmgmt.c memheap.c memheap.h ooasn1.h ootrace.h ootrace.c oochannels.c oochannels.h ooh245.c ooh245.h oohdr.h ooper.h ooports.c ooports.h ooq931.c ooq931.h ooCapability.c ooCapability.h ooSocket.c ooSocket.h ootypes.h perutil.c eventHandler.c eventHandler.h ooCalls.c ooCalls.h ooStackCmds.c ooStackCmds.h ooh323.c ooh323.h ooh323ep.c ooh323ep.h printHandler.c printHandler.h rtctype.c rtctype.h ooTimer.c ooTimer.h h323/H235-SECURITY-MESSAGESDec.c h323/H235-SECURITY-MESSAGESEnc.c h323/H235-SECURITY-MESSAGES.h h323/H323-MESSAGES.c h323/H323-MESSAGESDec.c h323/H323-MESSAGESEnc.c h323/H323-MESSAGES.h h323/MULTIMEDIA-SYSTEM-CONTROL.c h323/MULTIMEDIA-SYSTEM-CONTROLDec.c h323/MULTIMEDIA-SYSTEM-CONTROLEnc.c h323/MULTIMEDIA-SYSTEM-CONTROL.h
+liboostk_a_SOURCES = ooLogChan.h ooLogChan.c ooUtils.c ooUtils.h ooGkClient.h ooGkClient.c context.c ooCommon.h ooDateTime.h ooDateTime.c decode.c dlist.c encode.c errmgmt.c memheap.c memheap.h ooasn1.h ootrace.h ootrace.c oochannels.c oochannels.h ooh245.c ooh245.h oohdr.h ooper.h ooports.c ooports.h ooq931.c ooq931.h ooCapability.c ooCapability.h ooSocket.c ooSocket.h ootypes.h perutil.c eventHandler.c eventHandler.h ooCalls.c ooCalls.h ooStackCmds.c ooStackCmds.h ooh323.c ooh323.h ooh323ep.c ooh323ep.h printHandler.c printHandler.h rtctype.c rtctype.h ooTimer.c ooTimer.h h323/H235-SECURITY-MESSAGESDec.c h323/H235-SECURITY-MESSAGESEnc.c h323/H235-SECURITY-MESSAGES.h h323/H323-MESSAGES.c h323/H323-MESSAGESDec.c h323/H323-MESSAGESEnc.c h323/H323-MESSAGES.h h323/MULTIMEDIA-SYSTEM-CONTROL.c h323/MULTIMEDIA-SYSTEM-CONTROLDec.c h323/MULTIMEDIA-SYSTEM-CONTROLEnc.c h323/MULTIMEDIA-SYSTEM-CONTROL.h
INCLUDES = -Ih323
Index: Makefile.in
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/Makefile.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Makefile.in 26 May 2005 13:34:36 -0000 1.2
+++ Makefile.in 3 Jun 2005 14:54:06 -0000 1.3
@@ -91,7 +91,7 @@
noinst_LIBRARIES = liboostk.a
#liboostk_la_LDFLAGS = -version-info 1:1:0
-liboostk_a_SOURCES = ooUtils.c ooUtils.h ooGkClient.h ooGkClient.c context.c ooCommon.h ooDateTime.h ooDateTime.c decode.c dlist.c encode.c errmgmt.c memheap.c memheap.h ooasn1.h ootrace.h ootrace.c oochannels.c oochannels.h ooh245.c ooh245.h oohdr.h ooper.h ooports.c ooports.h ooq931.c ooq931.h ooCapability.c ooCapability.h ooSocket.c ooSocket.h ootypes.h perutil.c eventHandler.c eventHandler.h ooCalls.c ooCalls.h ooStackCmds.c ooStackCmds.h ooh323.c ooh323.h ooh323ep.c ooh323ep.h printHandler.c printHandler.h rtctype.c rtctype.h ooTimer.c ooTimer.h h323/H235-SECURITY-MESSAGESDec.c h323/H235-SECURITY-MESSAGESEnc.c h323/H235-SECURITY-MESSAGES.h h323/H323-MESSAGES.c h323/H323-MESSAGESDec.c h323/H323-MESSAGESEnc.c h323/H323-MESSAGES.h h323/MULTIMEDIA-SYSTEM-CONTROL.c h323/MULTIMEDIA-SYSTEM-CONTROLDec.c h323/MULTIMEDIA-SYSTEM-CONTROLEnc.c h323/MULTIMEDIA-SYSTEM-CONTROL.h
+liboostk_a_SOURCES = ooLogChan.h ooLogChan.c ooUtils.c ooUtils.h ooGkClient.h ooGkClient.c context.c ooCommon.h ooDateTime.h ooDateTime.c decode.c dlist.c encode.c errmgmt.c memheap.c memheap.h ooasn1.h ootrace.h ootrace.c oochannels.c oochannels.h ooh245.c ooh245.h oohdr.h ooper.h ooports.c ooports.h ooq931.c ooq931.h ooCapability.c ooCapability.h ooSocket.c ooSocket.h ootypes.h perutil.c eventHandler.c eventHandler.h ooCalls.c ooCalls.h ooStackCmds.c ooStackCmds.h ooh323.c ooh323.h ooh323ep.c ooh323ep.h printHandler.c printHandler.h rtctype.c rtctype.h ooTimer.c ooTimer.h h323/H235-SECURITY-MESSAGESDec.c h323/H235-SECURITY-MESSAGESEnc.c h323/H235-SECURITY-MESSAGES.h h323/H323-MESSAGES.c h323/H323-MESSAGESDec.c h323/H323-MESSAGESEnc.c h323/H323-MESSAGES.h h323/MULTIMEDIA-SYSTEM-CONTROL.c h323/MULTIMEDIA-SYSTEM-CONTROLDec.c h323/MULTIMEDIA-SYSTEM-CONTROLEnc.c h323/MULTIMEDIA-SYSTEM-CONTROL.h
INCLUDES = -Ih323
@@ -106,15 +106,15 @@
liboostk_a_AR = $(AR) cru
liboostk_a_LIBADD =
-am_liboostk_a_OBJECTS = ooUtils.$(OBJEXT) ooGkClient.$(OBJEXT) \
- context.$(OBJEXT) ooDateTime.$(OBJEXT) decode.$(OBJEXT) \
- dlist.$(OBJEXT) encode.$(OBJEXT) errmgmt.$(OBJEXT) \
- memheap.$(OBJEXT) ootrace.$(OBJEXT) oochannels.$(OBJEXT) \
- ooh245.$(OBJEXT) ooports.$(OBJEXT) ooq931.$(OBJEXT) \
- ooCapability.$(OBJEXT) ooSocket.$(OBJEXT) perutil.$(OBJEXT) \
- eventHandler.$(OBJEXT) ooCalls.$(OBJEXT) ooStackCmds.$(OBJEXT) \
- ooh323.$(OBJEXT) ooh323ep.$(OBJEXT) printHandler.$(OBJEXT) \
- rtctype.$(OBJEXT) ooTimer.$(OBJEXT) \
+am_liboostk_a_OBJECTS = ooLogChan.$(OBJEXT) ooUtils.$(OBJEXT) \
+ ooGkClient.$(OBJEXT) context.$(OBJEXT) ooDateTime.$(OBJEXT) \
+ decode.$(OBJEXT) dlist.$(OBJEXT) encode.$(OBJEXT) \
+ errmgmt.$(OBJEXT) memheap.$(OBJEXT) ootrace.$(OBJEXT) \
+ oochannels.$(OBJEXT) ooh245.$(OBJEXT) ooports.$(OBJEXT) \
+ ooq931.$(OBJEXT) ooCapability.$(OBJEXT) ooSocket.$(OBJEXT) \
+ perutil.$(OBJEXT) eventHandler.$(OBJEXT) ooCalls.$(OBJEXT) \
+ ooStackCmds.$(OBJEXT) ooh323.$(OBJEXT) ooh323ep.$(OBJEXT) \
+ printHandler.$(OBJEXT) rtctype.$(OBJEXT) ooTimer.$(OBJEXT) \
H235-SECURITY-MESSAGESDec.$(OBJEXT) \
H235-SECURITY-MESSAGESEnc.$(OBJEXT) H323-MESSAGES.$(OBJEXT) \
H323-MESSAGESDec.$(OBJEXT) H323-MESSAGESEnc.$(OBJEXT) \
@@ -144,13 +144,14 @@
@AMDEP_TRUE@ ./$(DEPDIR)/memheap.Po ./$(DEPDIR)/ooCalls.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/ooCapability.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/ooDateTime.Po ./$(DEPDIR)/ooGkClient.Po \
- at AMDEP_TRUE@ ./$(DEPDIR)/ooSocket.Po ./$(DEPDIR)/ooStackCmds.Po \
- at AMDEP_TRUE@ ./$(DEPDIR)/ooTimer.Po ./$(DEPDIR)/ooUtils.Po \
- at AMDEP_TRUE@ ./$(DEPDIR)/oochannels.Po ./$(DEPDIR)/ooh245.Po \
- at AMDEP_TRUE@ ./$(DEPDIR)/ooh323.Po ./$(DEPDIR)/ooh323ep.Po \
- at AMDEP_TRUE@ ./$(DEPDIR)/ooports.Po ./$(DEPDIR)/ooq931.Po \
- at AMDEP_TRUE@ ./$(DEPDIR)/ootrace.Po ./$(DEPDIR)/perutil.Po \
- at AMDEP_TRUE@ ./$(DEPDIR)/printHandler.Po ./$(DEPDIR)/rtctype.Po
+ at AMDEP_TRUE@ ./$(DEPDIR)/ooLogChan.Po ./$(DEPDIR)/ooSocket.Po \
+ at AMDEP_TRUE@ ./$(DEPDIR)/ooStackCmds.Po ./$(DEPDIR)/ooTimer.Po \
+ at AMDEP_TRUE@ ./$(DEPDIR)/ooUtils.Po ./$(DEPDIR)/oochannels.Po \
+ at AMDEP_TRUE@ ./$(DEPDIR)/ooh245.Po ./$(DEPDIR)/ooh323.Po \
+ at AMDEP_TRUE@ ./$(DEPDIR)/ooh323ep.Po ./$(DEPDIR)/ooports.Po \
+ at AMDEP_TRUE@ ./$(DEPDIR)/ooq931.Po ./$(DEPDIR)/ootrace.Po \
+ at AMDEP_TRUE@ ./$(DEPDIR)/perutil.Po ./$(DEPDIR)/printHandler.Po \
+ at AMDEP_TRUE@ ./$(DEPDIR)/rtctype.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
@@ -216,6 +217,7 @@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ooCapability.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ooDateTime.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ooGkClient.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ooLogChan.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ooSocket.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ooStackCmds.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ooTimer.Po at am__quote@
Index: ooCalls.c
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooCalls.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ooCalls.c 26 May 2005 16:48:00 -0000 1.3
+++ ooCalls.c 3 Jun 2005 14:54:06 -0000 1.4
@@ -48,7 +48,7 @@
}
/* memset(call, 0, sizeof(OOH323CallData));*/
call->pctxt = pctxt;
-
+ call->callMode = gH323ep.callMode;
sprintf(call->callToken, "%s", callToken);
sprintf(call->callType, "%s", type);
call->callReference = 0;
@@ -104,6 +104,7 @@
}
call->calledPartyNumber = NULL;
+ call->h245ConnectionAttempts = 0;
call->h245SessionState = OO_H245SESSION_IDLE;
call->dtmfmode = gH323ep.dtmfmode;
call->mediaInfo = NULL;
@@ -128,7 +129,7 @@
dListInit(&call->remoteFastStartOLCs);
call->remoteTermCapSeqNo =0;
call->localTermCapSeqNo = 0;
- memcpy(&call->capPrefs, &gH323ep.capPrefs, sizeof(ooCapPrefs));
+ memcpy(&call->capPrefs, &gH323ep.capPrefs, sizeof(OOCapPrefs));
call->logicalChans = NULL;
call->noOfLogicalChannels = 0;
call->logicalChanNoBase = 1001;
@@ -587,12 +588,13 @@
stopReceiveChannel, stopTransmitChannel, FALSE);
}
-int ooCallAddGSMCapability(OOH323CallData* call, int cap, ASN1USINT framesPerPkt,
- OOBOOL comfortNoise, OOBOOL scrambled, int dir,
- cb_StartReceiveChannel startReceiveChannel,
- cb_StartTransmitChannel startTransmitChannel,
- cb_StopReceiveChannel stopReceiveChannel,
- cb_StopTransmitChannel stopTransmitChannel)
+int ooCallAddGSMCapability
+ (OOH323CallData* call, int cap, ASN1USINT framesPerPkt,
+ OOBOOL comfortNoise, OOBOOL scrambled, int dir,
+ cb_StartReceiveChannel startReceiveChannel,
+ cb_StartTransmitChannel startTransmitChannel,
+ cb_StopReceiveChannel stopReceiveChannel,
+ cb_StopTransmitChannel stopTransmitChannel)
{
return ooCapabilityAddGSMCapability(call, cap, framesPerPkt, comfortNoise,
scrambled, dir, startReceiveChannel,
@@ -601,6 +603,23 @@
}
+int ooCallAddH263VideoCapability
+ (OOH323CallData *call, int cap, unsigned sqcifMPI, unsigned qcifMPI,
+ unsigned cifMPI, unsigned cif4MPI, unsigned cif16MPI, unsigned maxBitRate,
+ int dir, cb_StartReceiveChannel startReceiveChannel,
+ cb_StartTransmitChannel startTransmitChannel,
+ cb_StopReceiveChannel stopReceiveChannel,
+ cb_StopTransmitChannel stopTransmitChannel)
+{
+
+ return ooCapabilityAddH263VideoCapability(call, sqcifMPI, qcifMPI, cifMPI,
+ cif4MPI, cif16MPI, maxBitRate,dir,
+ startReceiveChannel, startTransmitChannel,
+ stopReceiveChannel, stopTransmitChannel,
+ FALSE);
+
+}
+
int ooCallEnableDTMFRFC2833(OOH323CallData *call, int dynamicRTPPayloadType)
{
return ooCapabilityEnableDTMFRFC2833(call, dynamicRTPPayloadType);
@@ -643,206 +662,10 @@
-ooLogicalChannel* ooAddNewLogicalChannel(OOH323CallData *call, int channelNo,
- int sessionID, char *type, char * dir,
- ooH323EpCapability *epCap)
-{
- ooLogicalChannel *pNewChannel=NULL, *pChannel=NULL;
- ooMediaInfo *pMediaInfo = NULL;
- OOTRACEDBGC5("Adding new media channel for cap %d dir %s (%s, %s)\n",
- epCap->cap, dir, call->callType, call->callToken);
- /* Create a new logical channel entry */
- pNewChannel = (ooLogicalChannel*)memAlloc(call->pctxt,
- sizeof(ooLogicalChannel));
- if(!pNewChannel)
- {
- OOTRACEERR3("ERROR:Memory - ooAddNewLogicalChannel - pNewChannel "
- "(%s, %s)\n", call->callType, call->callToken);
- return NULL;
- }
-
- memset(pNewChannel, 0, sizeof(ooLogicalChannel));
- pNewChannel->channelNo = channelNo;
- pNewChannel->sessionID = sessionID;
- pNewChannel->state = OO_LOGICALCHAN_IDLE;
- strcpy(pNewChannel->type, type);
- strcpy(pNewChannel->dir, dir);
-
- pNewChannel->chanCap = epCap;
- OOTRACEDBGC4("Adding new channel with cap %d (%s, %s)\n", epCap->cap,
- call->callType, call->callToken);
- /* As per standards, media control port should be same for all
- proposed channels with same session ID. However, most applications
- use same media port for transmit and receive of audio streams. Infact,
- testing of OpenH323 based asterisk assumed that same ports are used.
- Hence we first search for existing media ports for smae session and use
- them. This should take care of all cases.
- */
- if(call->mediaInfo)
- {
- pMediaInfo = call->mediaInfo;
- while(pMediaInfo)
- {
- if(!strcmp(pMediaInfo->dir, dir) &&
- (pMediaInfo->cap == epCap->cap))
- {
- break;
- }
- pMediaInfo = pMediaInfo->next;
- }
- }
-
- if(pMediaInfo)
- {
- OOTRACEDBGC3("Using configured media info (%s, %s)\n", call->callType,
- call->callToken);
- pNewChannel->localRtpPort = pMediaInfo->lMediaPort;
- pNewChannel->localRtcpPort = pMediaInfo->lMediaCntrlPort;
- strcpy(pNewChannel->localIP, pMediaInfo->lMediaIP);
- }else{
- OOTRACEDBGC3("Using default media info (%s, %s)\n", call->callType,
- call->callToken);
- pNewChannel->localRtpPort = ooGetNextPort (OORTP);
-
- /* Ensures that RTP port is an even one */
- if((pNewChannel->localRtpPort & 1) == 1)
- pNewChannel->localRtpPort = ooGetNextPort (OORTP);
-
- pNewChannel->localRtcpPort = ooGetNextPort (OORTP);
- strcpy(pNewChannel->localIP, call->localIP);
- }
-
- /* Add new channel to the list */
- pNewChannel->next = NULL;
- if(!call->logicalChans)
- call->logicalChans = pNewChannel;
- else{
- pChannel = call->logicalChans;
- while(pChannel->next) pChannel = pChannel->next;
- pChannel->next = pNewChannel;
- }
-
- /* increment logical channels */
- call->noOfLogicalChannels++;
- OOTRACEINFO3("Created new logical channel entry (%s, %s)\n", call->callType,
- call->callToken);
- return pNewChannel;
-}
-
-ooLogicalChannel* ooFindLogicalChannelByLogicalChannelNo(OOH323CallData *call,
- int ChannelNo)
-{
- ooLogicalChannel *pLogicalChannel=NULL;
- if(!call->logicalChans)
- {
- OOTRACEERR3("ERROR: No Open LogicalChannels - Failed "
- "FindLogicalChannelByChannelNo (%s, %s\n", call->callType,
- call->callToken);
- return NULL;
- }
- pLogicalChannel = call->logicalChans;
- while(pLogicalChannel)
- {
- if(pLogicalChannel->channelNo == ChannelNo)
- break;
- else
- pLogicalChannel = pLogicalChannel->next;
- }
-
- return pLogicalChannel;
-}
-
-ooLogicalChannel * ooFindLogicalChannelByOLC(OOH323CallData *call,
- H245OpenLogicalChannel *olc)
-{
- H245DataType * psDataType=NULL;
- H245H2250LogicalChannelParameters * pslcp=NULL;
- OOTRACEDBGC4("ooFindLogicalChannel by olc %d (%s, %s)\n",
- olc->forwardLogicalChannelNumber, call->callType, call->callToken);
- if(olc->m.reverseLogicalChannelParametersPresent)
- {
- OOTRACEDBGC3("Finding receive channel (%s,%s)\n", call->callType,
- call->callToken);
- psDataType = &olc->reverseLogicalChannelParameters.dataType;
- /* Only H2250LogicalChannelParameters are supported */
- if(olc->reverseLogicalChannelParameters.multiplexParameters.t !=
- T_H245OpenLogicalChannel_reverseLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters){
- OOTRACEERR4("Error:Invalid olc %d received (%s, %s)\n",
- olc->forwardLogicalChannelNumber, call->callType, call->callToken);
- return NULL;
- }
- pslcp = olc->reverseLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters;
-
- return ooFindLogicalChannel(call, pslcp->sessionID, "receive", psDataType);
- }
- else{
- OOTRACEDBGC3("Finding transmit channel (%s, %s)\n", call->callType,
- call->callToken);
- psDataType = &olc->forwardLogicalChannelParameters.dataType;
- /* Only H2250LogicalChannelParameters are supported */
- if(olc->forwardLogicalChannelParameters.multiplexParameters.t !=
- T_H245OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters)
- {
- OOTRACEERR4("Error:Invalid olc %d received (%s, %s)\n",
- olc->forwardLogicalChannelNumber, call->callType, call->callToken);
- return NULL;
- }
- pslcp = olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters;
- return ooFindLogicalChannel(call, pslcp->sessionID, "transmit", psDataType);
- }
-}
-
-ooLogicalChannel * ooFindLogicalChannel(OOH323CallData *call, int sessionID,
- char *dir, H245DataType * dataType)
-{
- ooLogicalChannel * pChannel = NULL;
- pChannel = call->logicalChans;
- while(pChannel)
- {
- if(pChannel->sessionID == sessionID)
- {
- if(!strcmp(pChannel->dir, dir))
- {
- if(dataType->t == T_H245DataType_audioData)
- {
- if(!strcmp(dir, "receive"))
- {
- if(ooCheckCompatibility_1(call, pChannel->chanCap,
- dataType->u.audioData, OORX))
- return pChannel;
- }else if(!strcmp(dir, "transmit"))
- {
- if(ooCheckCompatibility_1(call, pChannel->chanCap,
- dataType->u.audioData, OOTX))
- return pChannel;
- }
- }
- }
- }
- pChannel = pChannel->next;
- }
- return NULL;
-}
-
-/* This function is used to get a logical channel with a particular session ID */
-ooLogicalChannel* ooGetLogicalChannel(OOH323CallData *call, int sessionID)
-{
- ooLogicalChannel * pChannel = NULL;
- pChannel = call->logicalChans;
- while(pChannel)
- {
- if(pChannel->sessionID == sessionID)
- return pChannel;
- else
- pChannel = pChannel->next;
- }
- return NULL;
-}
-
/* Checks whether session with suplied ID and direction is already active*/
ASN1BOOL ooIsSessionEstablished(OOH323CallData *call, int sessionID, char* dir)
{
- ooLogicalChannel * temp = NULL;
+ OOLogicalChannel * temp = NULL;
temp = call->logicalChans;
while(temp)
{
@@ -855,178 +678,97 @@
return FALSE;
}
-int ooClearAllLogicalChannels(OOH323CallData *call)
+int ooAddMediaInfo(OOH323CallData *call, OOMediaInfo mediaInfo)
{
- ooLogicalChannel * temp = NULL, *prev = NULL;
+ OOMediaInfo *newMediaInfo=NULL;
- OOTRACEINFO3("Clearing all logical channels (%s, %s)\n", call->callType,
- call->callToken);
-
- temp = call->logicalChans;
- while(temp)
+ if(!call)
{
- prev = temp;
- temp = temp->next;
- ooClearLogicalChannel(call, prev->channelNo);/* TODO: efficiency - This causes re-search
- of of logical channel in the list. Can be
- easily improved.*/
+ OOTRACEERR3("Error:Invalid 'call' param for ooAddMediaInfo.(%s, %s)\n",
+ call->callType, call->callToken);
+ return OO_FAILED;
+ }
+ newMediaInfo = (OOMediaInfo*) memAlloc(call->pctxt, sizeof(OOMediaInfo));
+ if(!newMediaInfo)
+ {
+ OOTRACEERR3("Error:Memory - ooAddMediaInfo - newMediaInfo. "
+ "(%s, %s)\n", call->callType, call->callToken);
+ return OO_FAILED;
+ }
+
+ memcpy (newMediaInfo, &mediaInfo, sizeof(OOMediaInfo));
+
+ OOTRACEDBGC4("Configured mediainfo for cap %s (%s, %s)\n",
+ ooGetCapTypeText(mediaInfo.cap),
+ call->callType, call->callToken);
+ if(!call->mediaInfo) {
+ newMediaInfo->next = NULL;
+ call->mediaInfo = newMediaInfo;
+ }
+ else {
+ newMediaInfo->next = call->mediaInfo;
+ call->mediaInfo = newMediaInfo;
}
return OO_OK;
}
-int ooClearLogicalChannel(OOH323CallData *call, int channelNo)
+unsigned ooCallGenerateSessionID
+ (OOH323CallData *call, OOCapType type, char *dir)
{
- int ret = OO_OK;
- ooLogicalChannel *pLogicalChannel = NULL;
- ooH323EpCapability *epCap=NULL;
-
- OOTRACEDBGC4("Clearing logical channel number %d. (%s, %s)\n", channelNo,
- call->callType, call->callToken);
-
- pLogicalChannel = ooFindLogicalChannelByLogicalChannelNo(call,channelNo);
- if(!pLogicalChannel)
- {
- OOTRACEWARN4("Logical Channel %d doesn't exist (%s, %s)\n",
- channelNo, call->callType, call->callToken);
- return OO_OK;
- }
+ unsigned sessionID=0;
- epCap = (ooH323EpCapability*) pLogicalChannel->chanCap;
- if(!strcmp(pLogicalChannel->dir, "receive"))
+ if(type == OO_CAP_TYPE_AUDIO)
{
- if(epCap->stopReceiveChannel)
+ if(!ooGetLogicalChannel(call, 1, dir))
{
- epCap->stopReceiveChannel(call, pLogicalChannel);
- OOTRACEINFO4("Stopped Receive channel %d (%s, %s)\n",
- channelNo, call->callType, call->callToken);
+ sessionID = 1;
}
else{
- OOTRACEERR4("ERROR:No callback registered for stopReceiveChannel %d "
- "(%s, %s)\n", channelNo, call->callType, call->callToken);
- }
- }
- else
- {
- if(pLogicalChannel->state == OO_LOGICALCHAN_ESTABLISHED)
- {
- if(epCap->stopTransmitChannel)
- {
- epCap->stopTransmitChannel(call, pLogicalChannel);
- OOTRACEINFO4("Stopped Transmit channel %d (%s, %s)\n",
- channelNo, call->callType, call->callToken);
- }
+ if(call->masterSlaveState == OO_MasterSlave_Master)
+ sessionID = call->nextSessionID++;
else{
- OOTRACEERR4("ERROR:No callback registered for stopTransmitChannel"
- " %d (%s, %s)\n", channelNo, call->callType,
- call->callToken);
+ OOTRACEDBGC4("Session id for %s channel of type audio has to be "
+ "provided by remote.(%s, %s)\n", dir, call->callType,
+ call->callToken);
+ sessionID = 0; /* Will be assigned by remote */
}
}
}
- ooRemoveLogicalChannel(call, channelNo);/* TODO: efficiency - This causes re-search of
- of logical channel in the list. Can be
- easily improved.*/
- return OO_OK;
-}
-
-int ooRemoveLogicalChannel(OOH323CallData *call, int ChannelNo)
-{
- ooLogicalChannel * temp = NULL, *prev=NULL;
- if(!call->logicalChans)
- {
- OOTRACEERR4("ERROR:Remove Logical Channel - Channel %d not found "
- "Empty channel List(%s, %s)\n", ChannelNo, call->callType,
- call->callToken);
- return OO_FAILED;
- }
- temp = call->logicalChans;
- while(temp)
+ if(type == OO_CAP_TYPE_VIDEO)
{
- if(temp->channelNo == ChannelNo)
+ if(!ooGetLogicalChannel(call, 2, dir))
{
- if(!prev) call->logicalChans = temp->next;
- else prev->next = temp->next;
- //ASN1MEMFREEPTR(call->pctxt, temp->chanCap->cap);
- memFreePtr(call->pctxt, temp->chanCap);
- memFreePtr(call->pctxt, temp);
- OOTRACEDBGC4("Removed logical channel %d (%s, %s)\n", ChannelNo,
- call->callType, call->callToken);
- call->noOfLogicalChannels--;
- return OO_OK;
+ sessionID = 2;
+ }
+ else{
+ if(call->masterSlaveState == OO_MasterSlave_Master)
+ sessionID = call->nextSessionID++;
+ else{
+ sessionID = 0; /* Will be assigned by remote */
+ OOTRACEDBGC4("Session id for %s channel of type video has to be "
+ "provided by remote.(%s, %s)\n", dir, call->callType,
+ call->callToken);
+ }
}
- prev = temp;
- temp = temp->next;
}
-
- OOTRACEERR4("ERROR:Remove Logical Channel - Channel %d not found "
- "(%s, %s)\n", ChannelNo, call->callType, call->callToken);
- return OO_FAILED;
+ return sessionID;
+
}
-int ooOnLogicalChannelEstablished
- (OOH323CallData *call, ooLogicalChannel * pChannel)
+
+int ooCallH245ConnectionRetryTimerExpired(void *data)
{
- ooLogicalChannel * temp = NULL, *prev=NULL;
- /* Change the state of the channel as established and close all other
- channels with same session IDs. This is useful for handling fastStart,
- as the endpoint can open multiple logical channels for same sessionID.
- Once the remote endpoint confirms it's selection, all other channels for
- the same sessionID must be closed.
- */
- OOTRACEDBGC3("In ooOnLogicalChannelEstablished (%s, %s)\n",
- call->callType, call->callToken);
- pChannel->state = OO_LOGICALCHAN_ESTABLISHED;
- temp = call->logicalChans;
- while(temp)
- {
- if(temp->channelNo != pChannel->channelNo &&
- temp->sessionID == pChannel->sessionID &&
- !strcmp(temp->dir, pChannel->dir) )
- {
- prev = temp;
- temp = temp->next;
- ooClearLogicalChannel(call, prev->channelNo);
- }
- else
- temp = temp->next;
- }
- return OO_OK;
-}
+ ooTimerCallback *cbData = (ooTimerCallback*) data;
+ OOH323CallData *call = cbData->call;
+ OOTRACEINFO3("H245 connection retry timer expired. (%s, %s)\n",
+ call->callType, call->callToken);
+ memFreePtr(call->pctxt, cbData);
+ call->h245ConnectionAttempts++;
-int ooAddMediaInfo(OOH323CallData *call, ooMediaInfo mediaInfo)
-{
- ooMediaInfo *newMediaInfo=NULL;
+ ooCreateH245Connection(call);
- if(!call)
- {
- OOTRACEERR3("Error:Invalid 'call' param for ooAddMediaInfo.(%s, 5s)\n",
- call->callType, call->callToken);
- return OO_FAILED;
- }
- newMediaInfo = (ooMediaInfo*) memAlloc(call->pctxt, sizeof(ooMediaInfo));
- if(!newMediaInfo)
- {
- OOTRACEERR3("Error:Memory - ooAddMediaInfo - newMediaInfo. "
- "(%s, %s)\n", call->callType, call->callToken);
- return OO_FAILED;
- }
- memset(newMediaInfo, 0, sizeof(ooMediaInfo));
- strcpy(newMediaInfo->dir, mediaInfo.dir);
- newMediaInfo->lMediaCntrlPort = mediaInfo.lMediaCntrlPort;
- strcpy(newMediaInfo->lMediaIP,mediaInfo.lMediaIP);
- newMediaInfo->lMediaPort = mediaInfo.lMediaPort;
- newMediaInfo->cap = mediaInfo.cap;
- newMediaInfo->next = NULL;
- OOTRACEDBGC4("Configured mediainfo for cap %s (%s, %s)\n",
- ooGetAudioCapTypeText(mediaInfo.cap),
- call->callType, call->callToken);
- if(!call->mediaInfo)
- call->mediaInfo = newMediaInfo;
- else{
- newMediaInfo->next = call->mediaInfo;
- call->mediaInfo = newMediaInfo;
- }
return OO_OK;
}
Index: ooCalls.h
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooCalls.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ooCalls.h 23 May 2005 21:03:55 -0000 1.1
+++ ooCalls.h 3 Jun 2005 14:54:06 -0000 1.2
@@ -20,19 +20,13 @@
#ifndef _OOCALLS_H_
#define _OOCALLS_H_
+#include "ooLogChan.h"
#include "ooCapability.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef EXTERN
-#ifdef _WIN32
-#define EXTERN __declspec(dllexport)
-#else
-#define EXTERN
-#endif /* _WIN32 */
-#endif /* EXTERN */
/**
* @defgroup callmgmt Call Management
@@ -45,23 +39,91 @@
to or from outside pbx domian. For outgoing calls, ooMakeCallNoGk
disables use of gk for specific call.
*/
-#define OO_M_DATASESSION 0x00800000
-#define OO_M_VIDEOSESSION 0x00400000
-#define OO_M_AUDIOSESSION 0x00200000
-#define OO_M_ENDPOINTCREATED 0x00100000
-#define OO_M_ENDSESSION_BUILT 0x08000000
-#define OO_M_RELEASE_BUILT 0x04000000
-#define OO_M_GKROUTED 0x02000000
-#define OO_M_AUTOANSWER 0x01000000
-#define OO_M_TUNNELING 0x80000000
-#define OO_M_FASTSTART 0x40000000
-#define OO_M_DISABLEGK 0x20000000
-#define OO_M_AUDIO 0x10000000
+
+#define OO_M_ENDPOINTCREATED 0x00800000
+#define OO_M_ENDSESSION_BUILT 0x00400000
+#define OO_M_RELEASE_BUILT 0x00200000
+#define OO_M_GKROUTED 0x00100000
+#define OO_M_AUTOANSWER 0x08000000
+#define OO_M_TUNNELING 0x04000000
+#define OO_M_FASTSTART 0x02000000
+#define OO_M_DISABLEGK 0x01000000
+
+
+
+/**
+ * Call states.
+ */
+typedef enum {
+ OO_CALL_CREATED, /*!< Call created. */
+ OO_CALL_WAITING_ADMISSION, /*!< Call waiting for admission by GK */
+ OO_CALL_CONNECTING, /*!< Call in process of connecting */
+ OO_CALL_CONNECTED, /*!< Call currently connected. */
+ OO_CALL_CLEAR, /*!< Call marked for clearing */
+ OO_CALL_CLEAR_RELEASERECVD, /*!< Release command received. */
+ OO_CALL_CLEAR_RELEASESENT, /*!< Release sent */
+ OO_CALL_CLEARED /*!< Call cleared */
+} OOCallState;
+
+/**
+ * H.245 session states.
+ */
+typedef enum {
+ OO_H245SESSION_IDLE,
+ OO_H245SESSION_ACTIVE,
+ OO_H245SESSION_ENDSENT,
+ OO_H245SESSION_ENDRECVD,
+ OO_H245SESSION_CLOSED
+} OOH245SessionState;
+
+/**
+ * Structure to store local and remote media endpoint info for a
+ * given media type.
+ */
+typedef struct OOMediaInfo{
+ char dir[15]; /* transmit/receive*/
+ int cap;
+ int lMediaPort;
+ int lMediaCntrlPort;
+ char lMediaIP[20];
+ struct OOMediaInfo *next;
+} OOMediaInfo;
+
+#define ooMediaInfo OOMediaInfo
+
+struct OOAliases;
+
+/**
+ * Structure to hold information on a forwarded call.
+ */
+typedef struct OOCallFwdData {
+ char ip[20];
+ int port;
+ struct OOAliases *aliases;
+ OOBOOL fwdedByRemote; /*Set when we are being fwded by remote*/
+} OOCallFwdData;
+
+/**
+ * Structure to store information on an H.323 channel (H.225 or H.245) for
+ * a particular call.
+ */
+typedef struct OOH323Channel {
+ OOSOCKET sock; /*!< Socket connection for the channel */
+ int port; /*!< Port assigned to the channel */
+ DList outQueue; /*!< Output message queue */
+} OOH323Channel;
+
+/**
+ * This structure is used to maintain all information on an active call.
+ * A list of these structures is maintained within the global endpoint
+ * structure.
+ */
typedef struct OOH323CallData {
OOCTXT *pctxt;
char callToken[20]; /* ex: ooh323c_call_1 */
char callType[10]; /* incoming/outgoing */
+ OOCallMode callMode;
ASN1USINT callReference;
char ourCallerId[256];
H225CallIdentifier callIdentifier;/* The call identifier for the active
@@ -72,9 +134,10 @@
ASN1UINT flags;
OOCallState callState;
OOCallClearReason callEndReason;
+ unsigned h245ConnectionAttempts;
OOH245SessionState h245SessionState;
int dtmfmode;
- ooMediaInfo *mediaInfo;
+ OOMediaInfo *mediaInfo;
OOCallFwdData *pCallFwdData;
char localIP[20];/* Local IP address */
OOH323Channel* pH225Channel;
@@ -85,9 +148,9 @@
int remotePort;
int remoteH245Port;
char *remoteDisplayName;
- ooAliases *remoteAliases;
- ooAliases *ourAliases; /*aliases used in the call for us */
- OOMasterSlaveState masterSlaveState; /* Master-Slave state */
+ struct OOAliases *remoteAliases;
+ struct OOAliases *ourAliases; /*aliases used in the call for us */
+ OOMasterSlaveState masterSlaveState; /*!< Master-Slave state */
ASN1UINT statusDeterminationNumber;
OOCapExchangeState localTermCapState;
OOCapExchangeState remoteTermCapState;
@@ -97,8 +160,8 @@
DList remoteFastStartOLCs;
ASN1UINT8 remoteTermCapSeqNo;
ASN1UINT8 localTermCapSeqNo;
- ooCapPrefs capPrefs;
- ooLogicalChannel* logicalChans;
+ OOCapPrefs capPrefs;
+ OOLogicalChannel* logicalChans;
int noOfLogicalChannels;
int logicalChanNoBase;
int logicalChanNoMax;
@@ -106,7 +169,7 @@
unsigned nextSessionID; /* Note by default 1 is audio session, 2 is video and 3 is data, from 3 onwards master decides*/
DList timerList;
ASN1UINT msdRetries;
- void *usrData; /* User can set this to user specific data */
+ void *usrData; /*!<User can set this to user specific data*/
struct OOH323CallData* next;
struct OOH323CallData* prev;
} OOH323CallData;
@@ -114,6 +177,98 @@
#define ooCallData OOH323CallData
/**
+ * This callback function is triggered when a new call structure is
+ * created inside the stack for an incoming or outgoing call.
+ *
+ * @param call H.323 call data structure
+ * @return 0 if callback was successful, non-zero error code if failure.
+ */
+typedef int (*cb_OnNewCallCreated)(OOH323CallData* call);
+
+/**
+ * This callback function is triggered when a Q.931 alerting message is
+ * received for an outgoing call or when a Q.931 alerting message is sent
+ * for an incoming call.
+ *
+ * @param call H.323 call data structure
+ * @return 0 if callback was successful, non-zero error code if failure.
+ */
+typedef int (*cb_OnAlerting)(OOH323CallData * call);
+
+/**
+ * This callback function is triggered when there is an incoming call.
+ * In the case where a gatekeeper is in use, the call must first be
+ * admitted by the gatekeeper before this callback is triggered.
+ *
+ * @param call H.323 call data structure
+ * @return 0 if callback was successful, non-zero error code if failure.
+ */
+typedef int (*cb_OnIncomingCall)(OOH323CallData* call );
+
+/**
+ * This callback function is triggered after a Q.931 setup message
+ * is sent for an outgoing call.
+ *
+ * @param call H.323 call data structure
+ * @return 0 if callback was successful, non-zero error code if failure.
+ */
+typedef int (*cb_OnOutgoingCall)(OOH323CallData* call );
+
+/**
+ * This callback function is triggered when a Q.931 connect message is
+ * sent in case of incoming call. In case of outgoing call, this is invoked
+ * when a Q.931 connect message is received. It is not invoked until after
+ * fast start and H.245 tunneling messages within the connect message are
+ * processed.
+ *
+ * @param call H.323 call data structure
+ * @return 0 if callback was successful, non-zero error code if failure.
+ */
+typedef int (*cb_OnCallEstablished)(struct OOH323CallData* call);
+
+/**
+ * This callback function is triggered when a call is cleared.
+ *
+ * @param call H.323 call data structure
+ * @return 0 if callback was successful, non-zero error code if failure.
+ */
+typedef int (*cb_OnCallCleared)(struct OOH323CallData* call);
+
+/**
+ * This callback function is triggered when master-slave determination
+ * and capabilities negotiation procedures are successfully completed
+ * for a call.
+ *
+ * @param call H.323 call data structure
+ * @return 0 if callback was successful, non-zero error code if failure.
+ */
+typedef int (*cb_OpenLogicalChannels)(struct OOH323CallData* call);
+
+/**
+ * This callback function is triggered when a call is forwarded by
+ * a remote endpoint to another remote destination.
+ * @param call Associated H.323 call data structure
+ * @return 0 if callback was successful, non-zero error code if failure
+ */
+typedef int (*cb_OnCallForwarded)(struct OOH323CallData* call);
+
+/**
+ * This structure holds all of the H.323 signaling callback function
+ * addresses.
+ * @see ooH323EpSetH323Callbacks
+ */
+typedef struct OOH323CALLBACKS {
+ cb_OnAlerting onNewCallCreated;
+ cb_OnAlerting onAlerting;
+ cb_OnIncomingCall onIncomingCall;
+ cb_OnOutgoingCall onOutgoingCall;
+ cb_OnCallEstablished onCallEstablished;
+ cb_OnCallForwarded onCallForwarded;
+ cb_OnCallCleared onCallCleared;
+ cb_OpenLogicalChannels openLogicalChannels;
+} OOH323CALLBACKS;
+
+/**
* This function is used to create a new call entry.
* @param type Type of the call (incoming/outgoing)
* @param callToken Call Token, an uniques identifier for the call
@@ -124,18 +279,16 @@
/**
* This function is used to add a call to the list of existing calls.
- * @param h323ep Pointer to the H323 Endpoint structure.
* @param call Pointer to the call to be added.
- *
* @return OO_OK, on success. OO_FAILED, on failure
*/
EXTERN int ooAddCallToList (OOH323CallData *call);
/**
- * This function is used to set callerid for the call.
- * @param call Handle to the call
- * @param callerid caller id value
+ * This function is used to set the caller ID for a call.
*
+ * @param call Handle to the call
+ * @param callerid caller ID value
* @return OO_OK, on success. OO_FAILED, otherwise.
*/
EXTERN int ooCallSetCallerId
@@ -340,6 +493,47 @@
cb_StopReceiveChannel stopReceiveChannel,
cb_StopTransmitChannel stopTransmitChannel);
+
+
+
+/**
+ * This function is used to add H263 video capability for the call. The
+ * "ooCallAdd...Capability" functions allow to override the global endpoint
+ * capabilities and use specific capabilities for specific calls.
+ * @param call Call for which capability has to be added.
+ * @param cap Capability type - OO_H263VIDEO
+ * @param sqcifMPI Minimum picture interval for encoding/decoding
+ * of SQCIF pictures.
+ * @param qcifMPI Minimum picture interval for encoding/decoding
+ * of QCIF pictures.
+ * @param cifMPI Minimum picture interval for encoding/decoding
+ * of CIF pictures.
+ * @param cif4MPI Minimum picture interval for encoding/decoding
+ * of CIF4 pictures.
+ * @param cif16MPI Minimum picture interval for encoding/decoding
+ * of CIF16 pictures.
+ * @param maxBitRate Maximum bit rate in units of 100 bits/s at
+ * which a transmitter can transmit video or a
+ * receiver can receive video.
+ * @param dir Direction of capability.OORX, OOTX, OORXANDTX
+ * @param startReceiveChannel Callback function to start receive channel.
+ * @param startTransmitChannel Callback function to start transmit channel.
+ * @param stopReceiveChannel Callback function to stop receive channel.
+ * @param stopTransmitChannel Callback function to stop transmit channel.
+ *
+ * @return OO_OK, on success. OO_FAILED, on failure.
+ */
+EXTERN int ooCallAddH263VideoCapability(OOH323CallData *call, int cap,
+ unsigned sqcifMPI, unsigned qcifMPI,
+ unsigned cifMPI, unsigned cif4MPI,
+ unsigned cif16MPI, unsigned maxBitRate,
+ int dir,
+ cb_StartReceiveChannel startReceiveChannel,
+ cb_StartTransmitChannel startTransmitChannel,
+ cb_StopReceiveChannel stopReceiveChannel,
+ cb_StopTransmitChannel stopTransmitChannel);
+
+
/**
* This function is used to enable rfc 2833 capability for the call. By default
* the stack uses the dtmf settings for the endpoint. But if you want to
@@ -350,7 +544,8 @@
*
* @return OO_OK, on success. OO_FAILED, on failure
*/
-EXTERN int ooCallEnableDTMFRFC2833(OOH323CallData *call, int dynamicRTPPayloadType);
+EXTERN int ooCallEnableDTMFRFC2833
+ (OOH323CallData *call, int dynamicRTPPayloadType);
/**
@@ -373,76 +568,33 @@
EXTERN OOH323CallData* ooFindCallByToken(char *callToken);
/**
- * This function is used to clear a call. Based on what stage of clearance the
+ * This function is used to end a call. Based on what stage of clearance the
* call is it takes appropriate action.
- * @param call Handle to the call which has to be cleared.
*
+ * @param call Handle to the call which has to be cleared.
* @return OO_OK, on success. OO_FAILED, on failure.
*/
EXTERN int ooEndCall(OOH323CallData *call);
/**
* This function is used to remove a call from the list of existing calls.
- * @param h323ep Pointer to the H323 Endpoint.
- * @param call Pointer to the call to be removed.
*
+ * @param call Pointer to the call to be removed.
* @return OO_OK, on success. OO_FAILED, on failure.
*/
EXTERN int ooRemoveCallFromList (OOH323CallData *call);
/**
- * This function is used to clean a call. It closes all associated sockets,
- * removes call from list and frees up associated memory.
- * @param call Pointer to the call to be cleared.
+ * This function is used to clean up a call. It closes all associated sockets,
+ * removes the call from the global list and frees up associated memory.
*
+ * @param call Pointer to the call to be cleared.
* @return OO_OK, on success. OO_FAILED, on failure.
*/
EXTERN int ooCleanCall(OOH323CallData *call);
/**
- * This function is used to add a new logical channel entry into the list
- * of currently active logical channels.
- * @param call Pointer to the call for which new logical channel
- * entry has to be created.
- * @param channelNo Channel number for the new channel entry.
- * @param sessionID Session identifier for the new channel.
- * @param type Type of the channel(audio/video/data)
- * @param dir Direction of the channel(transmit/receive)
- * @param epCap Capability to be used for the new channel.
- *
- * @return Pointer to logical channel, on success. NULL, on failure
- */
-EXTERN ooLogicalChannel* ooAddNewLogicalChannel
- (OOH323CallData *call, int channelNo, int sessionID, char *type,
- char * dir, ooH323EpCapability *epCap);
-
-/**
- * This function is used to find a logical channel by logical channel number.
- * @param call Pointer to the call for which logical channel is
- * required.
- * @param channelNo Forward Logical Channel number for the logical channel
- *
- * @return Pointer to the logical channel if found, NULL
- * otherwise.
- */
-EXTERN ooLogicalChannel* ooFindLogicalChannelByLogicalChannelNo
- (OOH323CallData *call,int channelNo);
-
-/**
- * This function is called when a new logical channel is established. It is
- * particularly useful in case of faststart. When the remote endpoint selects
- * one of the proposed alternatives, other channels for the same session type
- * need to be closed. This function is used for that.
- * @param call Handle to the call which owns the logical channel.
- * @param pChannel Handle to the newly established logical channel.
- *
- * @return OO_OK, on success. OO_FAILED, on failure.
- */
-EXTERN int ooOnLogicalChannelEstablished
-(OOH323CallData *call, ooLogicalChannel * pChannel);
-
-/**
- * This fuction is used to check whether a specified session in specified
+ * This function is used to check whether a specified session in specified
* direction is active for the call.
* @param call Handle to call for which session has to be queried.
* @param sessionID Session id to identify the type of session(1 for audio,
@@ -455,87 +607,39 @@
(OOH323CallData *call, int sessionID, char* dir);
/**
- * This function is used to retrieve a logical channel with particular
- * sessionID. Note that there can be two entries of logical channel, one in
- * each direction. This function will return the first channel which has the
- * same session ID.
- * @param call Handle to the call which owns the channels to be searched.
- * @param sessionID Session id of the session which is to be searched for.
- *
- * @return Returns a pointer to the logical channel if found, NULL
- * otherwise.
- */
-EXTERN ooLogicalChannel* ooGetLogicalChannel
-(OOH323CallData *call, int sessionID);
-
-/**
- * This function is used to remove a logical channel from the list of logical
- * channels.
- * @param call Pointer to the call from which logical channel has
- * to be removed.
- * @param ChannelNo Forward logical channel number of the channel to be
- * removed.
- */
-EXTERN int ooRemoveLogicalChannel(OOH323CallData *call, int ChannelNo);
-
-/**
- * This function is used to cleanup a logical channel. It first stops media, if
- * it is still active and then removes the channel from the list, freeing up
- * all the associated memory.
- * @param call Handle to the call which owns the logical channel.
- * @param channelNo Channel number identifying the channel.
- *
- * @return OO_OK, on success. OO_FAILED, on failure.
- */
-EXTERN int ooClearLogicalChannel(OOH323CallData *call, int channelNo);
-
-/**
- * This function is used to cleanup all the logical channels associated with
- * the call.
- * @param call Handle to the call which owns the channels.
- *
- * @return OO_OK, on success. OO_FAILED, on failure.
- */
-EXTERN int ooClearAllLogicalChannels(OOH323CallData *call);
-
-/**
* This function can be used by an application to specify media endpoint
* information for different types of media. The stack by default uses local IP
* and port for media. An application can provide mediainfo if it wants to
* override default.
* @param call Handle to the call
- * @param mediaInfo mediainfo structure which defines the media endpoint to be
+ * @param mediaInfo Structure which defines the media endpoint to be
* used.
*
* @return OO_OK, on success. OO_FAILED, on failure.
*/
-EXTERN int ooAddMediaInfo(OOH323CallData *call, ooMediaInfo mediaInfo);
+EXTERN int ooAddMediaInfo(OOH323CallData *call, OOMediaInfo mediaInfo);
/**
- * This function is used to find a logical channel from a received
- * olc.
- * @param call Handle to the related call.
- * @param olc Handle to the received OLC.
+ * This function is used to generate a media session id for the new media
+ * session for the call.
+ * @param call Handle to the call.
+ * @param type Type of media session.
+ * @param dir Direction of session
*
- * @return Returns the corresponding logical channel if found,
- * else returns NULL.
+ * @return Generated session id.
*/
-EXTERN ooLogicalChannel * ooFindLogicalChannelByOLC
-(OOH323CallData *call, H245OpenLogicalChannel *olc);
+EXTERN unsigned ooCallGenerateSessionID
+ (OOH323CallData *call, OOCapType type, char *dir);
/**
- * This function is used to find a logical channel based on session Id,
- * direction of channel and datatype.
- * @param call Handle to the call
- * @param sessionID Session ID for the channel to be searched.
- * @param dir Direction of the channel wrt local endpoint.
- * (transmit/receive)
- * @param dataType Handle to the data type for the channel.
+ * This is an handler for H245 connection retry timer. When remote end is not
+ * yet listening for H245 connections, this timer provides a wait and retry
+ * mechanism to establish H245 connection.
+ * @param data Timer callback data.
*
- * @return Logical channel, if found, NULL otherwise.
+ * @return OO_OK, on success. OO_FAILED, on failure
*/
-EXTERN ooLogicalChannel * ooFindLogicalChannel
-(OOH323CallData *call, int sessionID, char *dir, H245DataType * dataType);
+EXTERN int ooCallH245ConnectionRetryTimerExpired(void *data);
/**
* @}
@@ -545,6 +649,4 @@
}
#endif
-
-
#endif
Index: ooCapability.c
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooCapability.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ooCapability.c 23 May 2005 21:03:55 -0000 1.1
+++ ooCapability.c 3 Jun 2005 14:54:06 -0000 1.2
@@ -59,6 +59,208 @@
return OO_OK;
}
+
+
+int ooCapabilityAddH263VideoCapability(ooCallData *call,
+ unsigned sqcifMPI, unsigned qcifMPI,
+ unsigned cifMPI, unsigned cif4MPI,
+ unsigned cif16MPI, unsigned maxBitRate, int dir,
+ cb_StartReceiveChannel startReceiveChannel,
+ cb_StartTransmitChannel startTransmitChannel,
[...1467 lines suppressed...]
+ {
+ epCap = ooIsVideoDataTypeH263Supported(call, pH263Cap, dir,
+ OO_PICFORMAT_CIF16);
+ if(epCap)
+ {
+ OOTRACEDBGC3("Adding H263-CIF16 to joint capabilities(%s, %s)\n",
+ call->callType, call->callToken);
+ /* Note:we add jointCaps in remote endpoints preference order.*/
+ if(call->jointCaps)
+ {
+ cur = call->jointCaps;
+ while(cur->next) cur = cur->next;
+ cur->next = epCap;
+ }
+ call->jointCaps = epCap;
+ }
+ }
+
+ return OO_OK;
+}
Index: ooCapability.h
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooCapability.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ooCapability.h 26 May 2005 16:48:00 -0000 1.3
+++ ooCapability.h 3 Jun 2005 14:54:06 -0000 1.4
@@ -30,66 +30,125 @@
#define OORXTX (1<<3) /* For symmetric capabilities */
/* Various types of caps. Note that not all
supported */
+typedef enum OOCapabilities{
+ OO_CAP_AUDIO_BASE = 0,
+ OO_G711ALAW64K = 2,
+ OO_G711ALAW56K = 3,
+ OO_G711ULAW64K = 4,
+ OO_G711ULAW56K = 5,
+ OO_G7231 = 9,
+ OO_G729 = 11,
+ OO_G729A = 12,
+ OO_GSMFULLRATE = 18,
+ OO_GSMHALFRATE = 19,
+ OO_GSMENHANCEDFULLRATE = 20,
+ OO_CAP_VIDEO_BASE = 27,
+ OO_NONSTDVIDEO = 28,
+ OO_H261VIDEO = 29,
+ OO_H262VIDEO = 30,
+ OO_H263VIDEO = 31,
+ OO_IS11172VIDEO = 32, /* mpeg */
+ OO_GENERICVIDEO = 33,
+ OO_EXTELEMVIDEO = 34
+} OOCapabilities;
-#define OO_CAP_AUDIO_BASE 0
-#define OO_G711ALAW64K 2
-#define OO_G711ALAW56K 3
-#define OO_G711ULAW64K 4
-#define OO_G711ULAW56K 5
-#define OO_G7231 9
-#define OO_G729 11
-#define OO_G729A 12
-#define OO_GSMFULLRATE 18
-#define OO_GSMHALFRATE 19
-#define OO_GSMENHANCEDFULLRATE 20
-
-#define OO_CAP_VIDEO_BASE 26
-#define OO_CAP_DATA_BASE -1 /* place holder */
-
-#define OOABSAUDIOCAP(cap) cap-OO_CAP_AUDIO_BASE
-#define OOABSVIDEOCAP(cap) cap-OO_CAP_VIDEO_BASE
-#define OOABSDATACAP(cap) cap-OO_CAP_DATA_BASE
/*DTMF capabilities*/
#define OO_CAP_DTMF_RFC2833 (1<<0)
#define OO_CAP_DTMF_Q931 (1<<1)
#define OO_CAP_DTMF_H245 (1<<2)
+/**
+ * This structure defines the preference order for capabilities.
+ *
+ */
+typedef struct OOCapPrefs {
+ int order[20];
+ int index;
+}OOCapPrefs;
-typedef struct ooCapParams {
- int txframes;
- int rxframes;
- OOBOOL silenceSuppression;
-} ooCapParams;
+typedef struct OOCapParams {
+ int txframes; /*!< Number of frames per packet for transmission */
+ int rxframes; /*!< Number of frames per packet for reception */
+ OOBOOL silenceSuppression;
+} OOCapParams;
-typedef struct ooGSMCapParams {
+typedef struct OOGSMCapParams {
unsigned txframes;
unsigned rxframes;
OOBOOL scrambled;
OOBOOL comfortNoise;
-} ooGSMCapParams;
+} OOGSMCapParams;
+
+typedef enum OOPictureFormat{
+ OO_PICFORMAT_SQCIF,
+ OO_PICFORMAT_QCIF,
+ OO_PICFORMAT_CIF,
+ OO_PICFORMAT_CIF4,
+ OO_PICFORMAT_CIF16
+}OOPictureFormat;
+
+typedef struct OOH263CapParams {
+ enum OOPictureFormat picFormat; /* !< One of sqcif, qcif, cif, cif4, cif16*/
+ unsigned MPI; /* !< Minimum Picture Interval */
+ unsigned maxBitRate; /* !< Maximum bit rate for transmission/reception in units of 100 bits/sec */
+} OOH263CapParams;
struct OOH323CallData;
+struct OOLogicalChannel;
#ifdef __cplusplus
extern "C" {
#endif
-/** Call back for starting media receive channel */
+/**
+ * This callback is used for starting media receive channel. This callback
+ * function is triggered when receive media channel has to be started.
+ * @param call Call for which receive media channel has to be started.
+ * @param pChannel Channel details. This structure has important information
+ * such as rtp ip:port and capability describing media type
+ * to be received.
+ * @return OO_OK, on success. OO_FAILED, on failure
+ */
typedef int (*cb_StartReceiveChannel)
- (struct OOH323CallData *call, ooLogicalChannel *pChannel);
+ (struct OOH323CallData *call, struct OOLogicalChannel *pChannel);
-/** callback for starting media transmit channel */
+
+/**
+ * This callback is used for starting media transmit channel. This callback
+ * function is triggered when transmit media channel has to be started.
+ * @param call Call for which transmit media channel has to be started.
+ * @param pChannel Channel details. This structure has important information
+ * such as rtp ip:port and capability describing media type
+ * to be transmitted.
+ * @return OO_OK, on success. OO_FAILED, on failure
+ */
typedef int (*cb_StartTransmitChannel)
- (struct OOH323CallData *call, ooLogicalChannel *pChannel);
+ (struct OOH323CallData *call, struct OOLogicalChannel *pChannel);
-/** callback to stop media receive channel */
+/**
+ * This callback is used for stopping media receive channel. This callback
+ * function is triggered when receive media channel has to be stopped.
+ * @param call Call for which receive media channel has to be stopped.
+ * @param pChannel Channel details. This structure has important information
+ * such as rtp ip:port and capability describing media type
+ * being received.
+ * @return OO_OK, on success. OO_FAILED, on failure
+ */
typedef int (*cb_StopReceiveChannel)
- (struct OOH323CallData *call, ooLogicalChannel *pChannel);
+ (struct OOH323CallData *call, struct OOLogicalChannel *pChannel);
-/** callback to stop media transmit channel */
+/**
+ * This callback is used for stopping media transmit channel. This callback
+ * function is triggered when transmit media channel has to be stopped.
+ * @param call Call for which transmit media channel has to be stopped.
+ * @param pChannel Channel details. This structure has important information
+ * such as rtp ip:port and capability describing media type
+ * being transmitted.
+ * @return OO_OK, on success. OO_FAILED, on failure
+ */
typedef int (*cb_StopTransmitChannel)
- (struct OOH323CallData *call, ooLogicalChannel *pChannel);
+ (struct OOH323CallData *call, struct OOLogicalChannel *pChannel);
typedef enum OOCapType {
OO_CAP_TYPE_AUDIO,
@@ -114,6 +173,8 @@
} ooH323EpCapability;
+
+
#ifndef EXTERN
#ifdef _WIN32
#define EXTERN __declspec(dllexport)
@@ -177,80 +238,98 @@
cb_StopTransmitChannel stopTransmitChannel,
OOBOOL remote);
-#if 0
+
/**
- * This is an internal helper function which is used to add a G729 capability
+ * This is an internal helper function which is used to add a GSM capability
* to local endpoints capability list or to remote endpoints capability list or
- * to a calls capability list.
+ * to a call's capability list.
* @param call Handle to a call. If this is not Null, then
* capability is added to call's remote enpoint
* capability list, else it is added to local H323
* endpoint list.
- * @param cap Type of G729 capability to be added.
- * @param txframes Number of frames per packet for transmission.
- * @param rxframes Number of frames per packet for reception.
+ * @param cap Type of GSM capability to be added.
+ * @param framesPerPkt Number of GSM frames per packet.
+ * @param comfortNoise Comfort noise spec for the capability.
+ * @param scrambled Scrambled enabled/disabled for the capability.
* @param dir Direction of capability.OORX, OOTX, OORXANDTX
* @param startReceiveChannel Callback function to start receive channel.
* @param startTransmitChannel Callback function to start transmit channel.
* @param stopReceiveChannel Callback function to stop receive channel.
* @param stopTransmitChannel Callback function to stop transmit channel.
- * @param remote TRUE, if adding call's remote capability.
+ * @param remote TRUE, if adding call's remote capabilities.
*
- * @return OO_OK, on success. OO_FAILED, on failure.
- *
+ * @return OO_OK, on success. OO_FAILED, on failure.
*/
-EXTERN int ooCapabilityAddG729Capability(struct OOH323CallData *call, int cap,
- int txframes, int rxframes, int dir,
- cb_StartReceiveChannel startReceiveChannel,
- cb_StartTransmitChannel startTransmitChannel,
- cb_StopReceiveChannel stopReceiveChannel,
- cb_StopTransmitChannel stopTransmitChannel,
- OOBOOL remote);
+int ooCapabilityAddGSMCapability(struct OOH323CallData *call, int cap,
+ unsigned framesPerPkt, OOBOOL comfortNoise,
+ OOBOOL scrambled, int dir,
+ cb_StartReceiveChannel startReceiveChannel,
+ cb_StartTransmitChannel startTransmitChannel,
+ cb_StopReceiveChannel stopReceiveChannel,
+ cb_StopTransmitChannel stopTransmitChannel,
+ OOBOOL remote);
+
/**
- * This is an internal helper function which is used to add a G711 capability
- * to local endpoints capability list or to remote endpoints capability list or
- * to a call's capability list.
+ * This function is used to add H263 video capability to local endpoints
+ * capability list or to remote endpoints capability list or to a call's
+ * capability list.
* @param call Handle to a call. If this is not Null, then
* capability is added to call's remote enpoint
* capability list, else it is added to local H323
* endpoint list.
- * @param cap Type of G711 capability to be added.
- * @param txframes Number of frames per packet for transmission.
- * @param rxframes Number of frames per packet for reception.
+ * @param sqcifMPI Minimum picture interval for encoding/decoding
+ * of SQCIF pictures.
+ * @param qcifMPI Minimum picture interval for encoding/decoding
+ * of QCIF pictures.
+ * @param cifMPI Minimum picture interval for encoding/decoding
+ * of CIF pictures.
+ * @param cif4MPI Minimum picture interval for encoding/decoding
+ * of CIF4 pictures.
+ * @param cif16MPI Minimum picture interval for encoding/decoding
+ * of CIF16 pictures.
+ * @param maxBitRate Maximum bit rate in units of 100 bits/s at
+ * which a transmitter can transmit video or a
+ * receiver can receive video.
* @param dir Direction of capability.OORX, OOTX, OORXANDTX
* @param startReceiveChannel Callback function to start receive channel.
* @param startTransmitChannel Callback function to start transmit channel.
* @param stopReceiveChannel Callback function to stop receive channel.
* @param stopTransmitChannel Callback function to stop transmit channel.
- * @param remote TRUE, if adding call's remote capability.
+ * @param remote TRUE, if adding call's remote capabilities.
*
- * @return OO_OK, on success. OO_FAILED, on failure.
- *
+ * @return OO_OK, on success. OO_FAILED, on failure.
*/
-int ooCapabilityAddG711Capability(struct OOH323CallData *call,
- int cap, int txframes,
- int rxframes, int dir,
- cb_StartReceiveChannel startReceiveChannel,
- cb_StartTransmitChannel startTransmitChannel,
- cb_StopReceiveChannel stopReceiveChannel,
- cb_StopTransmitChannel stopTransmitChannel,
- OOBOOL remote);
-
+EXTERN int ooCapabilityAddH263VideoCapability(struct OOH323CallData *call,
+ unsigned sqcifMPI, unsigned qcifMPI,
+ unsigned cifMPI, unsigned cif4MPI,
+ unsigned cif16MPI, unsigned maxBitRate, int dir,
+ cb_StartReceiveChannel startReceiveChannel,
+ cb_StartTransmitChannel startTransmitChannel,
+ cb_StopReceiveChannel stopReceiveChannel,
+ cb_StopTransmitChannel stopTransmitChannel,
+ OOBOOL remote);
-#endif
/**
- * This is an internal helper function which is used to add a GSM capability
- * to local endpoints capability list or to remote endpoints capability list.
+ * This function is an helper function to ooCapabilityAddH263VideoCapability.
* @param call Handle to a call. If this is not Null, then
* capability is added to call's remote enpoint
* capability list, else it is added to local H323
* endpoint list.
- * @param cap Type of GSM capability to be added.
- * @param framesPerPkt Number of GSM frames per packet.
- * @param comfortNoise Comfort noise spec for the capability.
- * @param scrambled Scrambled enabled/disabled for the capability.
+ * @param sqcifMPI Minimum picture interval for encoding/decoding
+ * of SQCIF pictures.
+ * @param qcifMPI Minimum picture interval for encoding/decoding
+ * of QCIF pictures.
+ * @param cifMPI Minimum picture interval for encoding/decoding
+ * of CIF pictures.
+ * @param cif4MPI Minimum picture interval for encoding/decoding
+ * of CIF4 pictures.
+ * @param cif16MPI Minimum picture interval for encoding/decoding
+ * of CIF16 pictures.
+ * @param maxBitRate Maximum bit rate in units of 100 bits/s at
+ * which a transmitter can transmit video or a
+ * receiver can receive video.
* @param dir Direction of capability.OORX, OOTX, OORXANDTX
* @param startReceiveChannel Callback function to start receive channel.
* @param startTransmitChannel Callback function to start transmit channel.
@@ -260,15 +339,15 @@
*
* @return OO_OK, on success. OO_FAILED, on failure.
*/
-int ooCapabilityAddGSMCapability(struct OOH323CallData *call, int cap,
- unsigned framesPerPkt, OOBOOL comfortNoise,
- OOBOOL scrambled, int dir,
- cb_StartReceiveChannel startReceiveChannel,
- cb_StartTransmitChannel startTransmitChannel,
- cb_StopReceiveChannel stopReceiveChannel,
- cb_StopTransmitChannel stopTransmitChannel,
- OOBOOL remote);
-
+int ooCapabilityAddH263VideoCapability_helper(struct OOH323CallData *call,
+ unsigned sqcifMPI, unsigned qcifMPI,
+ unsigned cifMPI, unsigned cif4MPI,
+ unsigned cif16MPI, unsigned maxBitRate, int dir,
+ cb_StartReceiveChannel startReceiveChannel,
+ cb_StartTransmitChannel startTransmitChannel,
+ cb_StopReceiveChannel stopReceiveChannel,
+ cb_StopTransmitChannel stopTransmitChannel,
+ OOBOOL remote);
/**
* This function is used to add a audio capability to calls remote
@@ -306,28 +385,45 @@
* @return returns OO_OK, if updated else OO_FAILED;
*/
EXTERN int ooCapabilityUpdateJointCapabilities
-(struct OOH323CallData* call, H245Capability *cap);
+ (struct OOH323CallData* call, H245Capability *cap);
+
/**
- * This function is used to test the compatibility of the two capabilities.
- * It checks whether tx capability can be received by rx capability.
- * @param call Handle to the call.
- * @param txCap Transmit capability to be tested for
- * compatibility.
- * @param rxCap Receive capability to be tested for compatibility
+ * This function is used to update joint video capabilities for call. It checks
+ * whether remote capability can be supported by local capabilities for the
+ * call and if supported makes entry into the joint capability list for the
+ * call.
+ * @param call Handle to the call
+ * @param videoCap Remote video capability which will be tested for
+ * compatibility.
*
- * @return TRUE, if compatible, FALSE otherwise.
+ * @return returns OO_OK, if updated else OO_FAILED;
*/
-ASN1BOOL ooCheckCompatibility
-(struct OOH323CallData *call, ooH323EpCapability *txCap,
- ooH323EpCapability *rxCap);
+EXTERN int ooCapabilityUpdateJointCapabilitiesVideo
+ (struct OOH323CallData *call, H245VideoCapability *videoCap, int dir);
+
+
+/**
+ * This function is used to update joint video H263 capabilities for call. It
+ * checks whether remote capability can be supported by local capabilities for
+ * the call and if supported makes entry into the joint capability list for the
+ * call.
+ * @param call Handle to the call
+ * @param pH263Cap Remote H263 video capability which will be tested for
+ * compatibility.
+ *
+ * @return returns OO_OK, if updated else OO_FAILED;
+ */
+EXTERN int ooCapabilityUpdateJointCapabilitiesVideoH263
+ (struct OOH323CallData *call, H245H263VideoCapability *pH263Cap, int dir);
+
/**
* This function is used to test whether the endpoint capability in the
* specified direction can be supported by the audio capability.
* @param call Handle to the call.
* @param epCap Endpoint capability.
- * @param audioCap Audio capability with which compatibility has to
+ * @param dataType Data type with which compatibility has to
* be tested.
* @param dir Direction indicating whether endpoint capability
* will be used for transmission or reception.
@@ -335,9 +431,9 @@
* @return TRUE, if compatible. FALSE, otherwise.
*/
-ASN1BOOL ooCheckCompatibility_1(struct OOH323CallData *call,
+ASN1BOOL ooCapabilityCheckCompatibility(struct OOH323CallData *call,
ooH323EpCapability *epCap,
- H245AudioCapability * audioCap, int dir);
+ H245DataType *dataType, int dir);
/**
@@ -352,10 +448,26 @@
* @return Newly created audio capability on success, NULL on
* failure.
*/
-struct H245AudioCapability* ooCreateAudioCapability
+struct H245AudioCapability* ooCapabilityCreateAudioCapability
(ooH323EpCapability* epCap, OOCTXT *pctxt, int dir);
/**
+ * This function is used to create a video capability structure using the
+ * capability type.
+ * @param epCap Capability.
+ * @param pctxt Handle to OOCTXT which will be used to allocate memory
+ * for new video capability.
+ * @param dir Direction in which the newly created capability will be
+ * used.
+ *
+ * @return Newly created video capability on success, NULL on
+ * failure.
+ */
+struct H245VideoCapability* ooCapabilityCreateVideoCapability
+ (ooH323EpCapability *epCap, OOCTXT *pctxt, int dir);
+
+
+/**
* This function is used to create a dtmf capability which can be added to
* a TCS message.
* @param cap Type of dtmf capability to be created.
@@ -365,7 +477,7 @@
* @return Pointer to the created DTMF capability, NULL in case of
* failure.
*/
-void * ooCreateDTMFCapability(int cap, OOCTXT *pctxt);
+void * ooCapabilityCreateDTMFCapability(int cap, OOCTXT *pctxt);
/**
@@ -378,7 +490,7 @@
* @return Newly created audio capability on success, NULL on
* failure.
*/
-struct H245AudioCapability* ooCreateGSMFullRateCapability
+struct H245AudioCapability* ooCapabilityCreateGSMFullRateCapability
(ooH323EpCapability *epCap, OOCTXT* pctxt, int dir);
/**
@@ -393,11 +505,27 @@
* @return Newly created audio capability on success, NULL on
* failure.
*/
-struct H245AudioCapability* ooCreateSimpleCapability
+struct H245AudioCapability* ooCapabilityCreateSimpleCapability
(ooH323EpCapability *epCap, OOCTXT* pctxt, int dir);
/**
+ * This function is used to create a H263 video capability
+ * structure.
+ * @param epCap Handle to the endpoint capability
+ * @param pctxt Handle to OOCTXT which will be used to allocate memory
+ * for new video capability.
+ * @param dir Direction in which the newly created capability will be
+ * used.
+ *
+ * @return Newly created video capability on success, NULL on
+ * failure.
+ */
+struct H245VideoCapability* ooCapabilityCreateH263VideoCapability
+(ooH323EpCapability *epCap, OOCTXT* pctxt, int dir);
+
+
+/**
* This function is used to determine whether a particular capability
* can be supported by the endpoint.
* @param call Handle to the call.
@@ -411,6 +539,33 @@
(struct OOH323CallData *call, H245AudioCapability* audioCap, int dir);
/**
+ * This function is used to determine whether a particular video capability
+ * can be supported by the endpoint.
+ * @param call Handle to the call.
+ * @param pVideoCap Handle to the video capability.
+ * @param dir Direction in which support is desired.
+ *
+ * @return Handle to the copy of capability which supports video
+ * capability, Null if none found
+ */
+ooH323EpCapability* ooIsVideoDataTypeSupported
+ (struct OOH323CallData *call, H245VideoCapability* pVideoCap, int dir);
+
+/**
+ * This function is used to determine whether a particular H263 capability
+ * can be supported by the endpoint.
+ * @param call Handle to the call.
+ * @param pH263Cap Handle to the H263 video capability.
+ * @param dir Direction in which support is desired.
+ *
+ * @return Handle to the copy of capability which supports H263
+ * capability, Null if none found
+ */
+ooH323EpCapability* ooIsVideoDataTypeH263Supported
+ (struct OOH323CallData *call, H245H263VideoCapability* pH263Cap, int dir,
+ OOPictureFormat picFormat);
+
+/**
* This function is used to determine whether a particular capability type
* can be supported by the endpoint.
* @param call Handle to the call.
Index: ooGkClient.h
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooGkClient.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ooGkClient.h 23 May 2005 21:03:55 -0000 1.1
+++ ooGkClient.h 3 Jun 2005 14:54:06 -0000 1.2
@@ -131,16 +131,20 @@
ASN1USINT irrFrequency;
} RasCallAdmissionInfo;
+struct OOAliases;
+
/** GkClient callbacks:
* The first parameter is the message received. The second parameter provides
* updated list of aliases after the message was processed by the stack.
*/
typedef int (*cb_OnReceivedRegistrationConfirm)
- (H225RegistrationConfirm *rcf, ooAliases *aliases);
+ (H225RegistrationConfirm *rcf, struct OOAliases *aliases);
+
typedef int (*cb_OnReceivedUnregistrationConfirm)
- (H225UnregistrationConfirm *ucf, ooAliases *aliases);
+ (H225UnregistrationConfirm *ucf, struct OOAliases *aliases);
+
typedef int (*cb_OnReceivedUnregistrationRequest)
- (H225UnregistrationRequest *urq, ooAliases *aliases);
+ (H225UnregistrationRequest *urq, struct OOAliases *aliases);
typedef struct OOGKCLIENTCALLBACKS{
cb_OnReceivedRegistrationConfirm onReceivedRegistrationConfirm;
@@ -179,6 +183,7 @@
enum OOGkClientState state;
} ooGkClient;
+struct OOAliases;
struct OOH323CallData;
/**
@@ -367,7 +372,7 @@
*
* @return OO_OK, on success. OO_FAILED, otherwise.
*/
-EXTERN int ooGkClientSendURQ(ooGkClient *pGkClient, ooAliases *aliases);
+EXTERN int ooGkClientSendURQ(ooGkClient *pGkClient, struct OOAliases *aliases);
/**
* This function is used to handle a received Unregistration request message.
Index: ooStackCmds.c
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooStackCmds.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ooStackCmds.c 26 May 2005 13:34:36 -0000 1.2
+++ ooStackCmds.c 3 Jun 2005 14:54:06 -0000 1.3
@@ -18,6 +18,7 @@
#include "ootrace.h"
#include "ooq931.h"
#include "ooh323ep.h"
+#include "oochannels.h"
/** Global endpoint structure */
extern OOH323EndPoint gH323ep;
Index: ooStackCmds.h
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooStackCmds.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ooStackCmds.h 26 May 2005 13:34:36 -0000 1.2
+++ ooStackCmds.h 3 Jun 2005 14:54:06 -0000 1.3
@@ -96,7 +96,7 @@
EXTERN int ooForwardCall(char* callToken, char *dest);
/**
- * This function is used by an user application to hang a call.
+ * This function is used by an user application to terminate a call.
* @param callToken The uinque token for the call.
* @param reason Reason for hanging call.
*
@@ -108,11 +108,10 @@
* This function is invoked from the main event handling loop to
* process queued stack commands.
*/
-EXTERN int ooProcStackCmds ();
+EXTERN int ooProcStackCmds (void);
/**
* This function is used by the user application to stop monitoring calls.
- * @param None
*
* @return OO_OK, on success. OO_FAILED, on failure.
*/
Index: oochannels.c
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/oochannels.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- oochannels.c 26 May 2005 16:48:00 -0000 1.3
+++ oochannels.c 3 Jun 2005 14:54:06 -0000 1.4
@@ -26,6 +26,7 @@
#include "stdio.h"
#include "ooTimer.h"
#include "ooh323ep.h"
+#include "ooStackCmds.h"
/** Global endpoint structure */
extern OOH323EndPoint gH323ep;
@@ -75,6 +76,8 @@
{
int ret=0;
OOSOCKET channelSocket=0;
+ ooTimerCallback *cbData=NULL;
+
OOTRACEINFO1("Creating H245 Connection\n");
if((ret=ooSocketCreate (&channelSocket))!=ASN_OK)
{
@@ -135,101 +138,52 @@
}
else
{
- OOTRACEINFO3("ERROR:Failed to connect to remote destination for H245 "
- "connection (%s, %s)\n", call->callType, call->callToken);
- return OO_FAILED;
- }
- }
- return OO_OK;
-}
-
-int ooSendH245Msg(OOH323CallData *call, H245Message *msg)
-{
- int iRet=0, len=0, msgType=0, tunneledMsgType=0, logicalChannelNo = 0;
- ASN1OCTET * encodebuf;
- ASN1OCTET *msgptr=NULL;
-
- if(!call)
- return OO_FAILED;
-
- encodebuf = (ASN1OCTET*) memAlloc (call->pctxt, MAXMSGLEN);
- if(!encodebuf)
- {
- OOTRACEERR3("Error:Failed to allocate memory for encoding H245 "
- "message(%s, %s)\n", call->callType, call->callToken);
- return OO_FAILED;
- }
- iRet = ooEncodeH245Message(call, msg, encodebuf, MAXMSGLEN);
-
- if(iRet != OO_OK)
- {
- OOTRACEERR3("Error:Failed to encode H245 message. (%s, %s)\n",
- call->callType, call->callToken);
- memFreePtr (call->pctxt, encodebuf);
- return OO_FAILED;
- }
- if(!call->pH245Channel)
- {
- call->pH245Channel =
- (OOH323Channel*) memAllocZ (call->pctxt, sizeof(OOH323Channel));
- if(!call->pH245Channel)
- {
- OOTRACEERR3("Error:Failed to allocate memory for H245Channel "
- "structure. (%s, %s)\n", call->callType, call->callToken);
- memFreePtr (call->pctxt, encodebuf);
- return OO_FAILED;
- }
- }
-
- /* We need to send EndSessionCommand immediately.*/
- if(!OO_TESTFLAG(call->flags, OO_M_TUNNELING)){
- if(encodebuf[0]== OOEndSessionCommand) /* High priority message */
- {
- dListFreeAll(call->pctxt, &call->pH245Channel->outQueue);
- dListAppend (call->pctxt, &call->pH245Channel->outQueue, encodebuf);
- ooSendMsg(call, OOH245MSG);
- }else{
-
- dListAppend (call->pctxt, &call->pH245Channel->outQueue, encodebuf);
- OOTRACEDBGC4("Queued H245 messages %d. (%s, %s)\n",
- call->pH245Channel->outQueue.count,
- call->callType, call->callToken);
- }
- }
- else{
- msgType = encodebuf[0];
-
- logicalChannelNo = encodebuf[1];
- logicalChannelNo = logicalChannelNo << 8;
- logicalChannelNo = (logicalChannelNo | encodebuf[2]);
-
- len = encodebuf[3];
- len = len<<8;
- len = (len | encodebuf[4]);
-
- iRet = ooSendAsTunneledMessage
- (call, encodebuf+5,len,msgType, logicalChannelNo);
-
- if(iRet != OO_OK)
- {
- memFreePtr (call->pctxt, encodebuf);
- OOTRACEERR3("ERROR:Failed to tunnel H.245 message (%s, %s)\n",
- call->callType, call->callToken);
- if(call->callState < OO_CALL_CLEAR)
+ if(call->h245ConnectionAttempts >= 3)
{
- call->callEndReason = OO_REASON_INVALIDMESSAGE;
- call->callState = OO_CALL_CLEAR;
+ OOTRACEERR3("Error:Failed to setup an H245 connection with remote "
+ "destination. (%s, %s)\n", call->callType,
+ call->callToken);
+ if(call->callState < OO_CALL_CLEAR)
+ {
+ call->callEndReason = OO_REASON_TRANSPORTFAILURE;
+ call->callState = OO_CALL_CLEAR;
+ }
+ return OO_FAILED;
+ }
+ else{
+ OOTRACEWARN4("Warn:Failed to connect to remote destination for "
+ "H245 connection - will retry after %d seconds"
+ "(%s, %s)\n", DEFAULT_H245CONNECTION_RETRYTIMEOUT,
+ call->callType, call->callToken);
+
+ cbData = (ooTimerCallback*) memAlloc(call->pctxt,
+ sizeof(ooTimerCallback));
+ if(!cbData)
+ {
+ OOTRACEERR3("Error:Unable to allocate memory for timer "
+ "callback.(%s, %s)\n", call->callType,
+ call->callToken);
+ return OO_FAILED;
+ }
+ cbData->call = call;
+ cbData->timerType = OO_H245CONNECT_TIMER;
+ if(!ooTimerCreate(call->pctxt, &call->timerList,
+ &ooCallH245ConnectionRetryTimerExpired,
+ DEFAULT_H245CONNECTION_RETRYTIMEOUT, cbData,
+ FALSE))
+ {
+ OOTRACEERR3("Error:Unable to create H245 connection retry timer"
+ "(%s, %s)\n", call->callType, call->callToken);
+ memFreePtr(call->pctxt, cbData);
+ return OO_FAILED;
+ }
+ return OO_OK;
}
- return OO_FAILED;
}
- memFreePtr (call->pctxt, encodebuf);
- return OO_OK;
}
-
return OO_OK;
}
-
int ooSendH225Msg(OOH323CallData *call, Q931Message *msg)
{
int iRet=0;
Index: oochannels.h
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/oochannels.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- oochannels.h 26 May 2005 16:48:00 -0000 1.3
+++ oochannels.h 3 Jun 2005 14:54:06 -0000 1.4
@@ -52,9 +52,8 @@
*/
/**
* This function is used to create a listener for incoming calls.
- * @param None
*
- * @return OO_OK, on success. OO_FAILED, on failure.
+ * @return OO_OK, on success. OO_FAILED, on failure.
*/
EXTERN int ooCreateH323Listener(void);
@@ -76,7 +75,6 @@
/**
* This function is used to accept incoming H.225 connections.
- * @param None
*
* @return OO_OK, on success. OO_FAILED, on failure.
*/
@@ -119,8 +117,9 @@
/**
* This function is used to close an H.245 connection for a call.
- * @param call Pointer to call for which H.245 connection has to be closed.
*
+ * @param call Pointer to call for which H.245 connection has
+ * to be closed.
* @return OO_OK, on success. OO_FAILED, on failure.
*/
EXTERN int ooCloseH245Connection(struct OOH323CallData *call);
@@ -128,15 +127,13 @@
/**
* This function is used to start monitoring channels for the calls. It has
* an infinite loop which uses select to monitor various channels.
- * @param None
*
*/
EXTERN int ooMonitorChannels(void);
/**
- * This function is called to stop the monitor channels thread.
- * It cleans up all the active calls, before stopping monitor thread.
- * @param None
+ * This function is called to stop the monitor channels event loop.
+ * It cleans up all the active calls before stopping the monitor.
*
* @return OO_OK, on success. OO_FAILED, on failure
*/
@@ -175,16 +172,6 @@
EXTERN int ooSendH225Msg(struct OOH323CallData *call, struct Q931Message *msg);
/**
- * This function is used to enqueue an H.245 message into an outgoing queue for
- * the call.
- * @param call Pointer to call for which message has to be enqueued.
- * @param msg Pointer to the H.245 message to be sent.
- *
- * @return OO_OK, on success. OO_FAILED, on failure.
- */
-EXTERN int ooSendH245Msg(struct OOH323CallData *call, H245Message *msg);
-
-/**
* This function is used to Send a message on the channel, when channel is
* available for write.
* @param call Pointer to call for which message has to be sent.
Index: ooh245.c
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooh245.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ooh245.c 26 May 2005 16:48:00 -0000 1.3
+++ ooh245.c 3 Jun 2005 14:54:06 -0000 1.4
@@ -130,7 +130,7 @@
#ifndef _COMPACT
static void ooPrintH245Message
-(OOH323CallData* call, ASN1OCTET* msgbuf, ASN1UINT msglen)
+ (OOH323CallData* call, ASN1OCTET* msgbuf, ASN1UINT msglen)
{
OOCTXT ctxt;
H245MultimediaSystemControlMessage mmMsg;
@@ -157,8 +157,8 @@
}
#endif
[...1058 lines suppressed...]
+
+ pH2250lcp2->mediaControlChannel.u.unicastAddress = pUniAddrs;
+
+ pUniAddrs->t = T_H245UnicastAddress_iPAddress;
+
+ pUniAddrs->u.iPAddress = pUniIpAddrs;
+
+ ooConvertIpToNwAddr(pLogicalChannel->localIP, pUniIpAddrs->network.data);
+ pUniIpAddrs->network.numocts = 4;
+ pUniIpAddrs->tsapIdentifier = pLogicalChannel->localRtcpPort;
+
+ }
+
+ pLogicalChannel->state = OO_LOGICALCHAN_ESTABLISHED;
+
+ return OO_OK;
+}
+
+
+
Index: ooh245.h
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooh245.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ooh245.h 23 May 2005 21:03:55 -0000 1.1
+++ ooh245.h 3 Jun 2005 14:54:06 -0000 1.2
@@ -48,6 +48,16 @@
* @{
*/
/**
+ * Defines the H.245 message structure. All request/response
+ * and command messages are represented using this structure.
+ */
+typedef struct H245Message {
+ H245MultimediaSystemControlMessage h245Msg;
+ ASN1UINT msgType;
+ ASN1INT logicalChannelNo;
+} H245Message;
+
+/**
* Creates an outgoing H245 message of the type specified by the type
* argument for the Application context.
*
@@ -72,6 +82,16 @@
EXTERN int ooFreeH245Message(struct OOH323CallData *call, H245Message *pmsg);
/**
+ * This function is used to enqueue an H.245 message into an outgoing queue for
+ * the call.
+ * @param call Pointer to call for which message has to be enqueued.
+ * @param msg Pointer to the H.245 message to be sent.
+ *
+ * @return OO_OK, on success. OO_FAILED, on failure.
+ */
+EXTERN int ooSendH245Msg(struct OOH323CallData *call, H245Message *msg);
+
+/**
* This function is used to retrieve an H.245 message enqueued in the outgoing
* queue.
* @param call Pointer to the call for which message has to be retrieved.
@@ -88,9 +108,10 @@
int *len, int *msgType);
/**
- * This function is used to send out a treminal capability set message.
- * @param call Pointer to a call, for which TerminalCapabilitySet message
- * has to be sent.
+ * This function is used to send out a terminal capability set message.
+ *
+ * @param call Pointer to a call for which TerminalCapabilitySet message
+ * will be sent.
*
* @return OO_OK, on success. OO_FAILED, on failure.
*/
@@ -99,7 +120,6 @@
/**
* This function is used to generate a random status determination number
* for MSD procedure.
- * @param None
*
* @return Generated status determination number.
*/
@@ -172,14 +192,15 @@
(struct OOH323CallData* call, H245OpenLogicalChannel *olc);
/**
- * This function is used to handle a received OpenLogicalChannel message which
- * is trying to open a audio channel.
+ * This is a helper function used to handle a received OpenLogicalChannel
+ * message. It builds an OpenLogicalChannelAck message and sends it.
+ *
* @param call Pointer to cll for which OLC was received.
* @param olc The received OpenLogicalChannel message.
*
* @return OO_OK, on success. OO_FAILED, on failure.
*/
-EXTERN int ooHandleOpenLogicalAudioChannel
+EXTERN int ooHandleOpenLogicalChannel_helper
(struct OOH323CallData *call, H245OpenLogicalChannel*olc);
/**
@@ -330,25 +351,26 @@
EXTERN int ooOpenLogicalChannels(struct OOH323CallData *call);
/**
- * This function is used to send OpenLogicalChannel message for audio channel.
- * It uses the first capability match in the local and remote audio capabilities
- * for the audio channel and calls corresponding helper function.
- * @param call Pointer to call for which audio channel ahs to be opened.
+ * This function is used to send OpenLogicalChannel message for audio/video
+ * channel.
+ * @param call Pointer to call for which channel has to be opened.
+ * @param capType Type of media channel.
*
* @return OO_OK, on success. OO_FAILED, on failure.
*/
-EXTERN int ooOpenLogicalAudioChannel(struct OOH323CallData *call);
+EXTERN int ooOpenLogicalChannel(struct OOH323CallData *call,
+ enum OOCapType capType);
/**
- * This function is used to build aand send OpenLogicalChannel message using
- * audio capability passed as parameter.
+ * This function is used to build and send OpenLogicalChannel message using
+ * capability passed as parameter.
* @param call Pointer to call for which OpenLogicalChannel message
* has to be built.
- * @param epCap Pointer to audio capability
+ * @param epCap Pointer to capability
*
* @return OO_OK, on success. OO_FAILED, on failure.
*/
-EXTERN int ooOpenAudioChannel
+EXTERN int ooOpenChannel
(struct OOH323CallData* call, ooH323EpCapability *epCap);
/**
@@ -411,7 +433,8 @@
(struct OOH323CallData *call, H245RequestChannelCloseAck *rccAck);
/**
- * Builds an OLC with an audio capability passed as parameter.
+ * Builds an OLC for faststart with an audio/video capability passed as
+ * parameter.
* @param call Handle to call for which OLC has to be built.
* @param olc Pointer to an OLC structure which will be populated.
* @param epCap Pointer to the capability which will be used to
@@ -422,12 +445,30 @@
*
* @return OO_OK, on success. OO_FAILED, on failure.
*/
-EXTERN int ooBuildOpenLogicalChannelAudio(struct OOH323CallData *call,
+EXTERN int ooBuildFastStartOLC(struct OOH323CallData *call,
H245OpenLogicalChannel *olc,
ooH323EpCapability *epCap,
OOCTXT*pctxt, int dir);
/**
+ * Prepares a faststart response olc from the olc received in SETUP message.
+ * This function just changes the mediaChannel and mediaControl channel part
+ * of the olc received in SETUP.
+ * @param call Handle to call for which OLC has to be built.
+ * @param olc Pointer to an received OLC structure.
+ * @param epCap Pointer to the capability which will be used for
+ * this channel.
+ * @param pctxt Pointer to an OOCTXT structure which will be used
+ * to allocate additional memory for OLC.
+ * @param dir Direction of channel OORX, OOTX etc.
+ *
+ * @return OO_OK, on success. OO_FAILED, on failure.
+ */
+EXTERN int ooPrepareFastStartResponseOLC
+ (OOH323CallData *call, H245OpenLogicalChannel *olc,
+ ooH323EpCapability *epCap, OOCTXT*pctxt, int dir);
+
+/**
* This function is used to encode an H245 message and return encoded data
* into the buffer passed as a parameter to the function.
* @param call Handle to the call
@@ -472,6 +513,24 @@
*/
int ooSendTerminalCapabilitySetRelease(struct OOH323CallData * call);
+
+/**
+ * This is an helper function used to extract ip address and port info from
+ * H245TransportAddress structure.
+ * @param call Handle to associated call.
+ * @param h245Address Handle to H245TransportAddress structure from which
+ * information has to be extracted.
+ * @param ip Pointer to buffer in which ip address will be
+ * returned. Make sure that buffer has sufficient length.
+ * @param port Pointer to integer in which port number will be
+ * returned.
+ *
+ * @return OO_OK, on success. OO_FAILED, on failure.
+ */
+int ooGetIpPortFromH245TransportAddress
+ (OOH323CallData *call, H245TransportAddress *h245Address, char *ip,
+ int *port);
+
/**
* This is a callback function for handling an expired master-slave
* determination timer.
Index: ooh323.c
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooh323.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ooh323.c 26 May 2005 13:34:36 -0000 1.2
+++ ooh323.c 3 Jun 2005 14:54:06 -0000 1.3
@@ -136,7 +136,7 @@
DListNode* pNode=NULL;
H225AliasAddress *pAliasAddress=NULL;
Q931InformationElement* pDisplayIE=NULL;
- ooAliases *pAlias=NULL;
+ OOAliases *pAlias=NULL;
call->callReference = q931Msg->callReference;
@@ -521,7 +521,8 @@
"(%s, %s)\n", call->callType, call->callToken);
return OO_FAILED;
}
- pChannel->mediaPort = unicastAddress->u.iPAddress->tsapIdentifier;
+ pChannel->remoteMediaPort =
+ unicastAddress->u.iPAddress->tsapIdentifier;
if(!pChannel->chanCap->startTransmitChannel)
{
OOTRACEERR3("ERROR:No callback registered to start transmit "
@@ -574,7 +575,7 @@
{
OOTRACEERR3("Error: H.245 channel creation failed (%s, %s)\n",
call->callType, call->callToken);
- /* Mark call for clearing */
+
if(call->callState < OO_CALL_CLEAR)
{
call->callEndReason = OO_REASON_TRANSPORTFAILURE;
@@ -1026,12 +1027,12 @@
int ooH323RetrieveAliases
(OOH323CallData *call, H225_SeqOfH225AliasAddress *pAddresses,
- ooAliases **aliasList)
+ OOAliases **aliasList)
{
int i=0,j=0,k=0;
DListNode* pNode=NULL;
H225AliasAddress *pAliasAddress=NULL;
- ooAliases *newAlias=NULL;
+ OOAliases *newAlias=NULL;
H225TransportAddress *pTransportAddrss=NULL;
if(!pAddresses)
@@ -1056,14 +1057,14 @@
if(!pAliasAddress)
continue;
- newAlias = (ooAliases*)memAlloc(call->pctxt, sizeof(ooAliases));
+ newAlias = (OOAliases*)memAlloc(call->pctxt, sizeof(OOAliases));
if(!newAlias)
{
OOTRACEERR3("ERROR:Memory - ooH323RetrieveAliases - newAlias "
"(%s, %s)\n", call->callType, call->callToken);
return OO_FAILED;
}
- memset(newAlias, 0, sizeof(ooAliases));
+ memset(newAlias, 0, sizeof(OOAliases));
switch(pAliasAddress->t)
{
case T_H225AliasAddress_dialedDigits:
@@ -1179,11 +1180,11 @@
}
-int ooPopulateAliasList(OOCTXT *pctxt, ooAliases *pAliases,
+int ooPopulateAliasList(OOCTXT *pctxt, OOAliases *pAliases,
H225_SeqOfH225AliasAddress *pAliasList )
{
H225AliasAddress *pAliasEntry=NULL;
- ooAliases * pAlias=NULL;
+ OOAliases * pAlias=NULL;
ASN1BOOL bValid=FALSE;
int i = 0;
@@ -1275,10 +1276,10 @@
}
-ooAliases* ooH323GetAliasFromList(ooAliases *aliasList, int type, char *value)
+OOAliases* ooH323GetAliasFromList(OOAliases *aliasList, int type, char *value)
{
- ooAliases *pAlias = NULL;
+ OOAliases *pAlias = NULL;
if(!aliasList)
{
@@ -1316,20 +1317,21 @@
return NULL;
}
-ooAliases* ooH323AddAliasToList(ooAliases **pAliasList, OOCTXT *pctxt, H225AliasAddress *pAliasAddress)
+OOAliases* ooH323AddAliasToList
+(OOAliases **pAliasList, OOCTXT *pctxt, H225AliasAddress *pAliasAddress)
{
int i=0,j=0,k=0;
DListNode* pNode=NULL;
- ooAliases *newAlias=NULL;
+ OOAliases *newAlias=NULL;
H225TransportAddress *pTransportAddrss=NULL;
- newAlias = (ooAliases*)memAlloc(pctxt, sizeof(ooAliases));
+ newAlias = (OOAliases*) memAlloc(pctxt, sizeof(OOAliases));
if(!newAlias)
{
OOTRACEERR1("Error: Failed to allocate memory for new alias to be added to the alias list\n");
return NULL;
}
- memset(newAlias, 0, sizeof(ooAliases));
+ memset(newAlias, 0, sizeof(OOAliases));
switch(pAliasAddress->t)
{
Index: ooh323.h
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooh323.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ooh323.h 23 May 2005 21:03:55 -0000 1.1
+++ ooh323.h 3 Jun 2005 14:54:06 -0000 1.2
@@ -119,7 +119,7 @@
*/
EXTERN int ooH323RetrieveAliases
(struct OOH323CallData *call, H225_SeqOfH225AliasAddress *pAddresses,
- ooAliases **aliasList);
+ OOAliases **aliasList);
/**
* This is a helper function used to populate alias list using aliases.
@@ -130,7 +130,7 @@
*
* @return OO_OK, on success. OO_FAILED, otherwise.
*/
-EXTERN int ooPopulateAliasList(OOCTXT *pctxt, ooAliases *pAliases,
+EXTERN int ooPopulateAliasList(OOCTXT *pctxt, OOAliases *pAliases,
H225_SeqOfH225AliasAddress *pAliasList);
/**
@@ -142,8 +142,8 @@
* @param value Value of the alias, if the search has to consider value as
* criterion, NULL otherwise.
*/
-EXTERN ooAliases* ooH323GetAliasFromList
- (ooAliases *aliasList, int type, char *value);
+EXTERN OOAliases* ooH323GetAliasFromList
+ (OOAliases *aliasList, int type, char *value);
/**
* This function is used to add a new alias to alias list.
@@ -154,8 +154,9 @@
*
* @return Handle to newly added alias or NULL in case of failure.
*/
-EXTERN ooAliases* ooH323AddAliasToList(ooAliases **pAliasList, OOCTXT *pctxt,
- H225AliasAddress *pAliasAddress);
+EXTERN OOAliases* ooH323AddAliasToList
+(OOAliases **pAliasList, OOCTXT *pctxt, H225AliasAddress *pAliasAddress);
+
/**
* @}
*/
Index: ooh323ep.c
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooh323ep.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ooh323ep.c 26 May 2005 13:34:36 -0000 1.2
+++ ooh323ep.c 3 Jun 2005 14:54:06 -0000 1.3
@@ -326,10 +326,8 @@
gH323ep.h323Callbacks.onAlerting = h323Callbacks.onAlerting;
gH323ep.h323Callbacks.onIncomingCall = h323Callbacks.onIncomingCall;
gH323ep.h323Callbacks.onOutgoingCall = h323Callbacks.onOutgoingCall;
- gH323ep.h323Callbacks.onCallAnswered = h323Callbacks.onCallAnswered;
gH323ep.h323Callbacks.onCallEstablished = h323Callbacks.onCallEstablished;
gH323ep.h323Callbacks.onCallForwarded = h323Callbacks.onCallForwarded;
- gH323ep.h323Callbacks.onOutgoingCallAdmitted = h323Callbacks.onOutgoingCallAdmitted;
gH323ep.h323Callbacks.onCallCleared = h323Callbacks.onCallCleared;
gH323ep.h323Callbacks.openLogicalChannels = h323Callbacks.openLogicalChannels;
return OO_OK;
@@ -609,6 +607,26 @@
stopTransmitChannel, FALSE);
}
+
+int ooH323EpAddH263VideoCapability(int cap, unsigned sqcifMPI,
+ unsigned qcifMPI, unsigned cifMPI,
+ unsigned cif4MPI, unsigned cif16MPI,
+ unsigned maxBitRate, int dir,
+ cb_StartReceiveChannel startReceiveChannel,
+ cb_StartTransmitChannel startTransmitChannel,
+ cb_StopReceiveChannel stopReceiveChannel,
+ cb_StopTransmitChannel stopTransmitChannel)
+{
+
+ return ooCapabilityAddH263VideoCapability(NULL, sqcifMPI, qcifMPI, cifMPI,
+ cif4MPI, cif16MPI, maxBitRate,dir,
+ startReceiveChannel, startTransmitChannel,
+ stopReceiveChannel, stopTransmitChannel,
+ FALSE);
+
+}
+
+
int ooH323EpEnableDTMFRFC2833(int dynamicRTPPayloadType)
{
return ooCapabilityEnableDTMFRFC2833(NULL, dynamicRTPPayloadType);
Index: ooh323ep.h
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooh323ep.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ooh323ep.h 26 May 2005 13:34:36 -0000 1.2
+++ ooh323ep.h 3 Jun 2005 14:54:06 -0000 1.3
@@ -23,6 +23,7 @@
#include "ooCalls.h"
#include "ooGkClient.h"
#include "ooports.h"
+#include "ooq931.h"
#define DEFAULT_TRACEFILE "trace.log"
#define DEFAULT_TERMTYPE 50
@@ -31,6 +32,7 @@
#define DEFAULT_T35COUNTRYCODE 1
#define DEFAULT_T35EXTENSION 0
#define DEFAULT_MANUFACTURERCODE 71
+#define DEFAULT_H245CONNECTION_RETRYTIMEOUT 2
#define DEFAULT_CALLESTB_TIMEOUT 60
#define DEFAULT_MSD_TIMEOUT 30
#define DEFAULT_TCS_TIMEOUT 30
@@ -50,10 +52,29 @@
#endif /* _WIN32 */
#endif /* EXTERN */
+struct OOCapPrefs;
/**
* @defgroup h323ep H323 Endpoint management functions
* @{
*/
+/* Default port ranges */
+#define TCPPORTSSTART 12030 /*!< Starting TCP port number */
+#define TCPPORTSEND 12230 /*!< Ending TCP port number */
+#define UDPPORTSSTART 13030 /*!< Starting UDP port number */
+#define UDPPORTSEND 13230 /*!< Ending UDP port number */
+#define RTPPORTSSTART 14030 /*!< Starting RTP port number */
+#define RTPPORTSEND 14230 /*!< Ending RTP port number */
+
+/**
+ * This structure is used to define the port ranges to be used
+ * by the application.
+ */
+typedef struct OOH323Ports {
+ int start; /*!< Starting port number. */
+ int max; /*!< Maximum port number. */
+ int current; /*!< Current port number. */
+} OOH323Ports;
+
/**
* Structure to store all configuration information related to the
* endpoint created by an application
@@ -75,13 +96,13 @@
FILE * fptraceFile;
/** Range of port numbers to be used for TCP connections */
- struct ooH323Ports tcpPorts;
+ OOH323Ports tcpPorts;
/** Range of port numbers to be used for UDP connections */
- struct ooH323Ports udpPorts;
+ OOH323Ports udpPorts;
/** Range of port numbers to be used for RTP connections */
- struct ooH323Ports rtpPorts;
+ OOH323Ports rtpPorts;
ASN1UINT flags;
@@ -96,12 +117,12 @@
const char *callerid;
char callingPartyNumber[50];
OOSOCKET *stackSocket;
- ooAliases *aliases;
+ OOAliases *aliases;
int callType;
struct ooH323EpCapability *myCaps;
- ooCapPrefs capPrefs;
+ OOCapPrefs capPrefs;
int noOfCaps;
OOH225MsgCallbacks h225Callbacks;
OOH323CALLBACKS h323Callbacks;
@@ -244,7 +265,7 @@
EXTERN int ooH323EpSetH225MsgCallbacks(OOH225MsgCallbacks h225Callbacks);
/**
- * This function is used to set high level H323 call backs for the endpoint.
+ * This function is used to set high level H.323 callbacks for the endpoint.
* Make sure all unused callbacks in the structure are set to NULL before
* calling this function.
* @param h323Callbacks Callback structure containing various high level
@@ -259,8 +280,6 @@
* stack. It closes the H323 Endpoint for an application, releasing all
* the associated memory.
*
- * @param None
- *
* @return OO_OK on success
* OO_FAILED on failure
*/
@@ -451,6 +470,38 @@
cb_StartTransmitChannel startTransmitChannel,
cb_StopReceiveChannel stopReceiveChannel,
cb_StopTransmitChannel stopTransmitChannel);
+/**
+ * This function is used to add H263 video capability to the H323 endpoint.
+ * @param cap Capability type - OO_H263VIDEO
+ * @param sqcifMPI Minimum picture interval for encoding/decoding
+ * of SQCIF pictures.
+ * @param qcifMPI Minimum picture interval for encoding/decoding
+ * of QCIF pictures.
+ * @param cifMPI Minimum picture interval for encoding/decoding
+ * of CIF pictures.
+ * @param cif4MPI Minimum picture interval for encoding/decoding
+ * of CIF4 pictures.
+ * @param cif16MPI Minimum picture interval for encoding/decoding
+ * of CIF16 pictures.
+ * @param maxBitRate Maximum bit rate in units of 100 bits/s at
+ * which a transmitter can transmit video or a
+ * receiver can receive video.
+ * @param dir Direction of capability.OORX, OOTX, OORXANDTX
+ * @param startReceiveChannel Callback function to start receive channel.
+ * @param startTransmitChannel Callback function to start transmit channel.
+ * @param stopReceiveChannel Callback function to stop receive channel.
+ * @param stopTransmitChannel Callback function to stop transmit channel.
+ *
+ * @return OO_OK, on success. OO_FAILED, on failure.
+ */
+EXTERN int ooH323EpAddH263VideoCapability(int cap, unsigned sqcifMPI,
+ unsigned qcifMPI, unsigned cifMPI,
+ unsigned cif4MPI, unsigned cif16MPI,
+ unsigned maxBitRate, int dir,
+ cb_StartReceiveChannel startReceiveChannel,
+ cb_StartTransmitChannel startTransmitChannel,
+ cb_StopReceiveChannel stopReceiveChannel,
+ cb_StopTransmitChannel stopTransmitChannel);
/**
* This function is used to enable rfc 2833 support for the endpoint.
@@ -475,7 +526,7 @@
* the members of the structure are appropriately
* initialized.
*
- * @retun OO_OK, on success. OO_FAILED, on failure.
+ * @return OO_OK, on success. OO_FAILED, on failure.
*/
EXTERN int ooH323EpSetGkClientCallbacks(OOGKCLIENTCALLBACKS gkClientCallbacks);
Index: ooq931.c
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooq931.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ooq931.c 26 May 2005 13:34:36 -0000 1.2
+++ ooq931.c 3 Jun 2005 14:54:06 -0000 1.3
@@ -1127,19 +1127,18 @@
/*TODO: Need to clean logical channel in case of failure after creating one */
int ooAcceptCall(OOH323CallData *call)
{
- int ret = 0, i=0, j=0, mediaPort=0, dir=0;
-
+ int ret = 0, i=0, j=0, remoteMediaPort=0, remoteMediaControlPort = 0, dir=0;
+ char remoteMediaIP[20], remoteMediaControlIP[20];
H225Connect_UUIE *connect;
H225TransportAddress_ipAddress *h245IpAddr;
H225VendorIdentifier *vendor;
Q931Message *q931msg=NULL;
DListNode *pNode = NULL;
- H245OpenLogicalChannel *olc = NULL, *respOlc = NULL;
+ H245OpenLogicalChannel *olc = NULL;
ooH323EpCapability *epCap = NULL;
ASN1DynOctStr *pFS=NULL;
OOCTXT *pctxt = &gH323ep.msgctxt;
- H245H2250LogicalChannelParameters * h2250lcp = NULL;
- H245UnicastAddress *unicastAddress;
+ H245H2250LogicalChannelParameters *h2250lcp = NULL;
ooLogicalChannel* pChannel;
ret = ooCreateQ931Message(&q931msg, Q931ConnectMsg);
@@ -1271,7 +1270,17 @@
pNode = dListFindByIndex(&call->remoteFastStartOLCs, i);
olc = (H245OpenLogicalChannel*)pNode->data;
- /* Forward Channel */
+
+ if(olc->forwardLogicalChannelParameters.dataType.t !=
+ T_H245DataType_nullData &&
+ olc->m.reverseLogicalChannelParametersPresent)
+ {
+ OOTRACEINFO3("Ignoring bidirectional OLC as it is not supported."
+ "(%s, %s)\n", call->callType, call->callToken);
+ continue;
+ }
+
+ /* Forward Channel - remote transmits - local receives */
if(olc->forwardLogicalChannelParameters.dataType.t !=
T_H245DataType_nullData)
{
@@ -1296,15 +1305,36 @@
epCap = NULL;
continue;
}
+ h2250lcp = olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters;
+
if(ooIsSessionEstablished(call, olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters->sessionID, "receive"))
{
+
+ OOTRACEINFO4("Receive channel with sessionID %d already "
+ "established.(%s, %s)\n", olc->forwardLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters->sessionID,
+ call->callType, call->callToken);
memFreePtr(call->pctxt, epCap);
epCap = NULL;
continue;
}
+
+ /* Extract mediaControlChannel info, if supplied */
+ if(h2250lcp->m.mediaControlChannelPresent)
+ {
+ if(OO_OK != ooGetIpPortFromH245TransportAddress(call,
+ &h2250lcp->mediaControlChannel,
+ remoteMediaControlIP, &remoteMediaControlPort))
+ {
+ OOTRACEERR3("Error: Invalid media control channel address "
+ "(%s, %s)\n", call->callType, call->callToken);
+ memFreePtr(call->pctxt, epCap);
+ epCap = NULL;
+ continue;
+ }
+ }
}
else if(olc->m.reverseLogicalChannelParametersPresent)
- {
+ {/* Reverse channel - remote receives - local transmits */
OOTRACEDBGC4("Processing received reverse olc %d (%s, %s)\n",
olc->forwardLogicalChannelNumber, call->callType,
call->callToken);
@@ -1314,7 +1344,9 @@
OOTX);
if(!epCap)
continue;
+
OOTRACEINFO1("Transmit Channel data type supported\n");
+
if(olc->reverseLogicalChannelParameters.multiplexParameters.t !=
T_H245OpenLogicalChannel_reverseLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters)
{
@@ -1328,6 +1360,10 @@
}
if(ooIsSessionEstablished(call, olc->reverseLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters->sessionID, "transmit"))
{
+
+ OOTRACEINFO4("Transmit session with sessionID %d already "
+ "established.(%s, %s)\n", olc->reverseLogicalChannelParameters.multiplexParameters.u.h2250LogicalChannelParameters->sessionID, call->callType, call->callToken);
+
memFreePtr(call->pctxt, epCap);
epCap = NULL;
continue;
@@ -1352,54 +1388,80 @@
epCap = NULL;
return OO_FAILED;
}
- if(h2250lcp->mediaChannel.t !=
- T_H245TransportAddress_unicastAddress)
+ if(OO_OK != ooGetIpPortFromH245TransportAddress(call,
+ &h2250lcp->mediaChannel,
+ remoteMediaIP, &remoteMediaPort))
{
- OOTRACEERR3("ERROR:Unsupported media channel address type "
+ OOTRACEERR3("Error: Invalid media channel address "
"(%s, %s)\n", call->callType, call->callToken);
memFreePtr(call->pctxt, epCap);
epCap = NULL;
- return OO_FAILED;
+ continue;
}
-
- unicastAddress = h2250lcp->mediaChannel.u.unicastAddress;
- if(unicastAddress->t != T_H245UnicastAddress_iPAddress)
+
+ /* Extract mediaControlChannel info, if supplied */
+ if(h2250lcp->m.mediaControlChannelPresent)
{
- OOTRACEERR3("ERROR:media channel address type is not IP"
- "(%s, %s)\n", call->callType, call->callToken);
- memFreePtr(call->pctxt, epCap);
- epCap = NULL;
- return OO_FAILED;
+ if(OO_OK != ooGetIpPortFromH245TransportAddress(call,
+ &h2250lcp->mediaControlChannel,
+ remoteMediaControlIP, &remoteMediaControlPort))
+ {
+ OOTRACEERR3("Error: Invalid media control channel address "
+ "(%s, %s)\n", call->callType, call->callToken);
+ memFreePtr(call->pctxt, epCap);
+ epCap = NULL;
+ continue;
+ }
}
- mediaPort = unicastAddress->u.iPAddress->tsapIdentifier;
}
- respOlc = (H245OpenLogicalChannel*) memAlloc(pctxt,
- sizeof(H245OpenLogicalChannel));
- if(!respOlc)
- {
- OOTRACEERR3("Error:Memory - ooAcceptCall - respOlc."
- "(%s, %s)\n", call->callType, call->callToken);
- return OO_FAILED;
+
+ if(dir & OOTX)
+ { /* According to the spec if we are accepting olc for transmission
+ from called endpoint to calling endpoint, called endpoint should
+ insert a unqiue forwardLogicalChannelNumber into olc
+ */
+ olc->forwardLogicalChannelNumber = call->logicalChanNoCur++;
+ if(call->logicalChanNoCur > call->logicalChanNoMax)
+ call->logicalChanNoCur = call->logicalChanNoBase;
}
- memset(respOlc, 0, sizeof(H245OpenLogicalChannel));
- respOlc->forwardLogicalChannelNumber = olc->forwardLogicalChannelNumber;
- ooBuildOpenLogicalChannelAudio(call, respOlc, epCap, pctxt, dir);
+ ooPrepareFastStartResponseOLC(call, olc, epCap, pctxt, dir);
pChannel = ooFindLogicalChannelByLogicalChannelNo
- (call, respOlc->forwardLogicalChannelNumber);
+ (call, olc->forwardLogicalChannelNumber);
- if(olc->forwardLogicalChannelParameters.dataType.t ==
- T_H245DataType_nullData)
+ if(dir & OORX)
{
- pChannel->mediaPort = mediaPort;
+ strcpy(pChannel->remoteIP, remoteMediaControlIP);
+ pChannel->remoteMediaControlPort = remoteMediaControlPort;
+ if(epCap->startReceiveChannel)
+ {
+ epCap->startReceiveChannel(call, pChannel);
+ OOTRACEINFO4("Receive channel of type %s started (%s, %s)\n",
+ (epCap->capType == OO_CAP_TYPE_AUDIO)?"audio":"video",
+ call->callType, call->callToken);
+ }
+ else{
+ OOTRACEERR4("ERROR:No callback registered to start receive %s"
+ " channel (%s, %s)\n",
+ (epCap->capType == OO_CAP_TYPE_AUDIO)?"audio":"video",
+ call->callType, call->callToken);
+ return OO_FAILED;
+ }
+ }
+ if(dir & OOTX)
+ {
+ pChannel->remoteMediaPort = remoteMediaPort;
+ strcpy(pChannel->remoteIP, remoteMediaIP);
+ pChannel->remoteMediaControlPort = remoteMediaControlPort;
+
if(epCap->startTransmitChannel)
{
epCap->startTransmitChannel(call, pChannel);
OOTRACEINFO3("Transmit channel of type audio started "
"(%s, %s)\n", call->callType, call->callToken);
- OO_SETFLAG (call->flags, OO_M_AUDIO);
+ /*OO_SETFLAG (call->flags, OO_M_AUDIO);*/
}
else{
OOTRACEERR3("ERROR:No callback registered to start transmit"
@@ -1410,7 +1472,7 @@
}
/* Do not specify msg buffer let automatic allocation work */
setPERBuffer(pctxt, NULL, 0, 1);
- if(asn1PE_H245OpenLogicalChannel(pctxt, respOlc) != ASN_OK)
+ if(asn1PE_H245OpenLogicalChannel(pctxt, olc) != ASN_OK)
{
OOTRACEERR3("ERROR:Encoding of olc failed for faststart "
"(%s, %s)\n", call->callType, call->callToken);
@@ -1423,7 +1485,6 @@
return OO_FAILED;
}
pFS[j].data = encodeGetMsgPtr(pctxt, &(pFS[j].numocts));
- respOlc = NULL;
olc = NULL;
j++;
epCap = NULL;
@@ -1611,6 +1672,8 @@
OO_SETFLAG(call->flags, OO_M_DISABLEGK);
else
OO_CLRFLAG(call->flags, OO_M_DISABLEGK);
+
+ call->callMode = opts->callMode;
}
@@ -1669,8 +1732,6 @@
if(!strcmp(call->callType, "outgoing"))
{
- if(gH323ep.h323Callbacks.onOutgoingCallAdmitted)
- gH323ep.h323Callbacks.onOutgoingCallAdmitted(call);
ret = ooCreateH225Connection(call);
if(ret != OO_OK)
{
@@ -1886,7 +1947,7 @@
for(k=0; k< call->capPrefs.index; k++)
{
OOTRACEDBGC5("Preffered capability at index %d is %s. (%s, %s)\n",
- k, ooGetAudioCapTypeText(call->capPrefs.order[k]),
+ k, ooGetCapTypeText(call->capPrefs.order[k]),
call->callType, call->callToken);
if(call->ourCaps)
@@ -1904,20 +1965,22 @@
}
while(epCap){
- if(epCap->cap == call->capPrefs.order[k]) break;
+ if(epCap->cap == call->capPrefs.order[k]) break;
else epCap = epCap->next;
}
if(!epCap)
{
OOTRACEWARN4("Warn:Preferred capability %s is abscent in "
"capability list. (%s, %s)\n",
- ooGetAudioCapTypeText(call->capPrefs.order[k]),
+ ooGetCapTypeText(call->capPrefs.order[k]),
call->callType, call->callToken);
continue;
}
+
+
OOTRACEDBGC4("Building olcs with capability %s. (%s, %s)\n",
- ooGetAudioCapTypeText(epCap->cap), call->callType,
+ ooGetCapTypeText(epCap->cap), call->callType,
call->callToken);
if(epCap->dir & OORX)
{
@@ -1940,7 +2003,7 @@
if(call->logicalChanNoCur > call->logicalChanNoMax)
call->logicalChanNoCur = call->logicalChanNoBase;
- ooBuildOpenLogicalChannelAudio(call, olc, epCap, pctxt, OORX);
+ ooBuildFastStartOLC(call, olc, epCap, pctxt, OORX);
/* Do not specify msg buffer let automatic allocation work */
setPERBuffer(pctxt, NULL, 0, aligned);
if(asn1PE_H245OpenLogicalChannel(pctxt, olc) != ASN_OK)
@@ -1958,7 +2021,9 @@
pFS[i].data = encodeGetMsgPtr(pctxt, &(pFS[i].numocts));
olc = NULL;
i++;
- OOTRACEDBGC2("Added RX fs element %d\n", i);
+ OOTRACEDBGC5("Added RX fs element %d with capability %s(%s, %s)\n",
+ i, ooGetCapTypeText(epCap->cap), call->callType,
+ call->callToken);
}
if(epCap->dir & OOTX)
@@ -1982,7 +2047,7 @@
if(call->logicalChanNoCur > call->logicalChanNoMax)
call->logicalChanNoCur = call->logicalChanNoBase;
- ooBuildOpenLogicalChannelAudio(call, olc, epCap, pctxt, OOTX);
+ ooBuildFastStartOLC(call, olc, epCap, pctxt, OOTX);
/* Do not specify msg buffer let automatic allocation work */
setPERBuffer(pctxt, NULL, 0, aligned);
if(asn1PE_H245OpenLogicalChannel(pctxt, olc) != ASN_OK)
@@ -2000,7 +2065,9 @@
pFS[i].data = encodeGetMsgPtr(pctxt, &(pFS[i].numocts));
olc = NULL;
i++;
- OOTRACEDBGC2("Added TX fs element %d\n", i);
+ OOTRACEDBGC5("Added TX fs element %d with capability %s(%s, %s)\n",
+ i, ooGetCapTypeText(epCap->cap), call->callType,
+ call->callToken);
}
}
Index: ooq931.h
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ooq931.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ooq931.h 26 May 2005 13:34:36 -0000 1.2
+++ ooq931.h 3 Jun 2005 14:54:06 -0000 1.3
@@ -13,7 +13,6 @@
* maintain this copyright notice.
*
*****************************************************************************/
-
/**
* @file ooq931.h
* This file contains functions to support call signalling.
@@ -39,7 +38,7 @@
#endif /* EXTERN */
/**
- * @defgroup q931 Q931/H.2250 Message Handling
+ * @defgroup q931 Q.931/H.2250 Message Handling
* @{
*/
/* Maximum length of the Calling/Called party number number */
@@ -189,7 +188,6 @@
Q931NetworkStd
};
-
enum Q931TransferMode {
Q931TransferCircuitMode, /* 00 */
Q931TransferPacketMode /* 10 */
@@ -249,8 +247,81 @@
H225H323_UserInformation *userInfo;
} Q931Message;
+/**
+ * This structure is used to hold an H.323 alias address.
+ */
+typedef struct OOAliases {
+ int type; /*!< H.225 AliasAddress choice option (t value) */
+ char *value; /*!< H.225 AliasAddress value */
+ OOBOOL registered;
+ struct OOAliases *next;
+} OOAliases;
+
+#define ooAliases OOAliases
+
struct OOH323CallData;
+/*
+ * These are message callbacks which can be used by user applications
+ * to perform application specific things on receiving a particular
+ * message or before sending a particular message. For ex. user application
+ * can change values of some parameters of setup message before it is actually
+ * sent out.
+ */
+/**
+ * This callback is triggered when an H.225 SETUP message is received by
+ * the application.
+ * @param call The call the message is associated with.
+ * @param pmsg Q.931 message structure.
+ * @return OO_OK if message processing successful or OO_FAILED if not.
+ */
+typedef int (*cb_OnReceivedSetup)
+ (struct OOH323CallData *call, struct Q931Message *pmsg);
+
+/**
+ * This callback is triggered when an H.225 CONNECT message is received by
+ * the application.
+ * @param call The call the message is associated with.
+ * @param pmsg Q.931 message structure.
+ * @return OO_OK if message processing successful or OO_FAILED if not.
+ */
+typedef int (*cb_OnReceivedConnect)
+ (struct OOH323CallData *call, struct Q931Message *pmsg);
+
+/**
+ * This callback is triggered after an H.225 SETUP message has been
+ * constructed and is ready to be sent out. It provides the application
+ * with an opportunity to add additional non-standard information.
+ * @param call The call the message is associated with.
+ * @param pmsg Q.931 message structure.
+ * @return OO_OK if message processing successful or OO_FAILED if not.
+ */
+typedef int (*cb_OnBuiltSetup)
+ (struct OOH323CallData *call, struct Q931Message *pmsg);
+
+/**
+ * This callback is triggered after an H.225 CONNECT message has been
+ * constructed and is ready to be sent out. It provides the application
+ * with an opportunity to add additional non-standard information.
+ * @param call The call the message is associated with.
+ * @param pmsg Q.931 message structure.
+ * @return OO_OK if message processing successful or OO_FAILED if not.
+ */
+typedef int (*cb_OnBuiltConnect)
+ (struct OOH323CallData *call, struct Q931Message *pmsg);
+
+/**
+ * This structure holds the various callback functions that are
+ * triggered when H.225 messages are received or constructed.
+ * @see ooH323EpSetH225MsgCallbacks
+ */
+typedef struct OOH225MsgCallbacks {
+ cb_OnReceivedSetup onReceivedSetup;
+ cb_OnReceivedConnect onReceivedConnect;
+ cb_OnBuiltSetup onBuiltSetup;
+ cb_OnBuiltConnect onBuiltConnect;
+} OOH225MsgCallbacks;
+
/**
* This function is invoked to decode a Q931 message.
*
@@ -319,7 +390,6 @@
/**
* This function is invoked to generate a unique call reference number.
- * @param None
*
* @return - call reference number
*/
@@ -496,7 +566,7 @@
* @return OO_OK, on success. OO_FAILED, on failure.
*/
int ooParseDestination(OOCTXT* pctxt, char *dest, char *parsedIP, unsigned len,
- ooAliases**aliasList);
+ OOAliases** aliasList);
/**
* This function is used to generate a new call token
Index: ootrace.c
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ootrace.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ootrace.c 23 May 2005 21:03:55 -0000 1.1
+++ ootrace.c 3 Jun 2005 14:54:06 -0000 1.2
@@ -132,7 +132,15 @@
"OO_VBD",
"OO_AUDIOTELEPHONYEVENT",
"OO_AUDIOTONE",
- "OO_EXTELEM1"
+ "OO_EXTELEM1",
+ "OO_VIDEO_BASE",
+ "OO_NONSTDVIDEO",
+ "OO_H261VIDEO",
+ "OO_H262VIDEO",
+ "OO_H263VIDEO",
+ "OO_IS11172VIDEO", /* mpeg */
+ "OO_GENERICVIDEO",
+ "OO_EXTELEMVIDEO"
};
/*DTMF capabilities*/
@@ -157,7 +165,7 @@
return ooGetText (callState, callStateText, OONUMBEROF(callStateText));
}
-const char* ooGetAudioCapTypeText(int cap)
+const char* ooGetCapTypeText(int cap)
{
return ooGetText (cap, capTypes, OONUMBEROF(capTypes));
}
Index: ootrace.h
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ootrace.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ootrace.h 23 May 2005 21:03:55 -0000 1.1
+++ ootrace.h 3 Jun 2005 14:54:06 -0000 1.2
@@ -65,6 +65,7 @@
#define OOTRACEINFO3(a,b,c) ooTrace(OOTRCLVLINFO,a,b,c)
#define OOTRACEINFO4(a,b,c,d) ooTrace(OOTRCLVLINFO,a,b,c,d)
#define OOTRACEINFO5(a,b,c,d,e) ooTrace(OOTRCLVLINFO,a,b,c,d,e)
+#define OOTRACEINFO6(a,b,c,d,e,f) ooTrace(OOTRCLVLINFO,a,b,c,d,e, f)
#ifndef _COMPACT
#define OOTRACEDBGA1(a) ooTrace(OOTRCLVLDBGA,a)
#define OOTRACEDBGA2(a,b) ooTrace(OOTRCLVLDBGA,a,b)
@@ -137,12 +138,12 @@
const char* ooGetMsgTypeText (int msgType);
/**
- * This function is used to retrieve the description for audio capability
+ * This function is used to retrieve the text description for a capability
* type.
- * @param cap Audio cap type
+ * @param cap Capability
* @return The text description string.
*/
-const char* ooGetAudioCapTypeText(int cap);
+const char* ooGetCapTypeText(int cap);
/**
* This function is used to set the trace level.
Index: ootypes.h
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/ooh323c/src/ootypes.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ootypes.h 26 May 2005 13:34:36 -0000 1.2
+++ ootypes.h 3 Jun 2005 14:54:07 -0000 1.3
@@ -54,8 +54,15 @@
#include "H323-MESSAGES.h"
#include "ooasn1.h"
+#define OOH323C_VERSION "vxx.aa"
-#define OOH323C_VERSION "v0.6.1"
+#ifndef EXTERN
+#ifdef _WIN32
+#define EXTERN __declspec(dllexport)
+#else
+#define EXTERN
+#endif /* _WIN32 */
+#endif /* EXTERN */
/**
* @defgroup ootypes Common type and constant definitions.
@@ -120,41 +127,6 @@
OO_REASON_LOCAL_CONGESTED
} OOCallClearReason;
-/**
- * Call states.
- */
-typedef enum {
- OO_CALL_CREATED, /*!< Call created. */
- OO_CALL_WAITING_ADMISSION, /*!< Call waiting for admission by GK */
- OO_CALL_CONNECTING, /*!< Call in process of connecting */
- OO_CALL_CONNECTED, /*!< Call currently connected. */
- OO_CALL_CLEAR, /*!< Call marked for clearing */
- OO_CALL_CLEAR_RELEASERECVD, /*!< Release command received. */
- OO_CALL_CLEAR_RELEASESENT, /*!< Release sent */
- OO_CALL_CLEARED /*!< Call cleared */
-} OOCallState;
-
-/**
- * H.245 session state
- */
-typedef enum {
- OO_H245SESSION_IDLE,
- OO_H245SESSION_ACTIVE,
- OO_H245SESSION_ENDSENT,
- OO_H245SESSION_ENDRECVD,
- OO_H245SESSION_CLOSED
-} OOH245SessionState;
-
-/**
- * Logical channel states.
- */
-typedef enum {
- OO_LOGICAL_CHAN_UNKNOWN,
- OO_LOGICALCHAN_IDLE,
- OO_LOGICALCHAN_PROPOSED,
- OO_LOGICALCHAN_ESTABLISHED
-} OOLogicalChannelState;
-
/** Terminal type of the endpoint. Default is 60. */
#define OOTERMTYPE 60
@@ -201,7 +173,6 @@
#define OOEndSessionCommand 128
#define OO_MSGTYPE_MAX 128
-
/* Timer types */
#define OO_CALLESTB_TIMER (1<<0)
#define OO_MSD_TIMER (1<<1)
@@ -210,14 +181,7 @@
#define OO_CLC_TIMER (1<<4)
#define OO_RCC_TIMER (1<<5)
#define OO_SESSION_TIMER (1<<6)
-
-/* Default port ranges */
-#define TCPPORTSSTART 12030 /*!< Starting TCP port number */
-#define TCPPORTSEND 12230 /*!< Ending TCP port number */
-#define UDPPORTSSTART 13030 /*!< Starting UDP port number */
-#define UDPPORTSEND 13230 /*!< Ending UDP port number */
-#define RTPPORTSSTART 14030 /*!< Starting RTP port number */
-#define RTPPORTSEND 14230 /*!< Ending RTP port number */
+#define OO_H245CONNECT_TIMER (1<<7)
/** Maximum length for received messages */
#define MAXMSGLEN 4096
@@ -271,80 +235,6 @@
OOCallMode callMode; /*!< Type of channel to setup with FastStart */
}ooCallOptions;
-/**
- * This structure is used to define the port ranges to be used
- * by the application.
- */
-struct ooH323Ports
-{
- int start;
- int max;
- int current;
-};
-
-/**
- Defines the H245 message structure. All request/response
- and command messages are represented using this structure.
-*/
-typedef struct H245Message {
- H245MultimediaSystemControlMessage h245Msg;
- ASN1UINT msgType;
- ASN1INT logicalChannelNo;
-} H245Message;
-
-struct ooH323EpCapability;
-typedef struct ooCapPrefs {
- int order[20];
- int index;
-}ooCapPrefs;
-
-/* Store local and remote media endpoint info, for media type */
-typedef struct ooMediaInfo{
- char dir[15]; /* transmit/receive*/
- int cap;
- int lMediaPort;
- int lMediaCntrlPort;
- char lMediaIP[20];
- struct ooMediaInfo *next;
-} ooMediaInfo;
-
-/**
- * Structure to store information of logical channels for call.
- */
-typedef struct ooLogicalChannel {
- int channelNo;
- int sessionID;
- char type[10]; /* audio/video/data */
- char dir[10]; /* receive/transmit */
- char remoteIP[20];
- int mediaPort;
- int mediaControlPort;
- int localRtpPort;
- int localRtcpPort;
- char localIP[20];
- OOLogicalChannelState state;
- struct ooH323EpCapability *chanCap;
- struct ooLogicalChannel *next;
-} ooLogicalChannel;
-
-typedef struct ooAliases{
- int type;
- char *value;
- OOBOOL registered;
- struct ooAliases *next;
-}ooAliases;
-
-
-/**
- * Structure to store all the information related to a particular
- * call.
- */
-typedef struct OOH323Channel {
- OOSOCKET sock;
- int port;
- DList outQueue;
-} OOH323Channel;
-
struct OOH323CallData;
@@ -354,75 +244,6 @@
ASN1UINT channelNumber;
} ooTimerCallback;
-typedef struct OOCallFwdData{
- char ip[20];
- int port;
- ooAliases *aliases;
- OOBOOL fwdedByRemote; /*Set when we are being fwded by remote*/
-}OOCallFwdData;
-
-struct Q931Message;
-/**
- * These are message callbacks which can be used by user applications
- * to perform application specific things on receiving a particular
- * message or before sending a particular message. For ex. user application
- * can change values of some parameters of setup message before it is actually
- * sent out.
- */
-typedef int (*cb_OnReceivedSetup)
- (struct OOH323CallData *call, struct Q931Message *pmsg);
-
-typedef int (*cb_OnReceivedConnect)
- (struct OOH323CallData *call, struct Q931Message *pmsg);
-
-typedef int (*cb_OnBuiltSetup)
- (struct OOH323CallData *call, struct Q931Message *pmsg);
-
-typedef int (*cb_OnBuiltConnect)
- (struct OOH323CallData *call, struct Q931Message *pmsg);
-
-typedef struct OOH225MsgCallbacks{
- cb_OnReceivedSetup onReceivedSetup;
- cb_OnReceivedConnect onReceivedConnect;
- cb_OnBuiltSetup onBuiltSetup;
- cb_OnBuiltConnect onBuiltConnect;
-}OOH225MsgCallbacks;
-
-
-/**
- * This callback function is triggered when a new call structure is
- * created inside the stack for an incoming or outgoing call.
- *
- * @param call H.323 call data structure
- * @return 0 if callback was successful, non-zero error code if failure.
- */
-typedef int (*cb_OnNewCallCreated)(struct OOH323CallData * call);
-
-typedef int (*cb_OnAlerting)(struct OOH323CallData * call);
-typedef int (*cb_OnIncomingCall)(struct OOH323CallData* call );
-typedef int (*cb_OnOutgoingCall)(struct OOH323CallData* call );
-typedef int (*cb_OnCallAnswered)(struct OOH323CallData* call);
-typedef int (*cb_OnCallEstablished)(struct OOH323CallData* call);
-typedef int (*cb_OnOutgoingCallAdmitted)(struct OOH323CallData* call );
-typedef int (*cb_OnCallCleared)(struct OOH323CallData* call);
-typedef int (*cb_OpenLogicalChannels)(struct OOH323CallData* call);
-typedef int (*cb_OnCallForwarded)(struct OOH323CallData* call);
-
-struct ooGkClient;
-
-typedef struct OOH323CALLBACKS{
- cb_OnAlerting onNewCallCreated;
- cb_OnAlerting onAlerting;
- cb_OnIncomingCall onIncomingCall;
- cb_OnOutgoingCall onOutgoingCall;
- cb_OnCallAnswered onCallAnswered;
- cb_OnCallEstablished onCallEstablished;
- cb_OnCallForwarded onCallForwarded;
- cb_OnOutgoingCallAdmitted onOutgoingCallAdmitted;
- cb_OnCallCleared onCallCleared;
- cb_OpenLogicalChannels openLogicalChannels;
-} OOH323CALLBACKS;
-
/**
* @}
*/
More information about the svn-commits
mailing list