📄 cmctrlmpoint.c
字号:
pvtSetTree(hVal,tmpId,hVal,channel->pChannelParams.data.h225Params.sendRtcpAddressID);
}
}
/* ADD mediaChannel field */
if (channelSet[i].rtpAddress.ip !=0 || channelSet[i].rtpAddress.port != 0)
{
int tmpId = pvtAdd(hVal, elemId, __h245(mediaChannel), 0, NULL, NULL);
getGoodAddressForCtrl((HCONTROL)ctrl,&channelSet[i].rtpAddress);
cmTAToVt_H245(hVal,tmpId,&channelSet[i].rtpAddress);
}
else if (channel)
{
if (channel->pPartner && channel->pPartner->pChannelParams.data.h225Params.sendRtpAddressID>=0)
{
int tmpId = pvtAdd(hVal, elemId, __h245(mediaChannel), 0, NULL, NULL);
pvtSetTree(hVal,tmpId,hVal,channel->pPartner->pChannelParams.data.h225Params.sendRtpAddressID);
}
else if (channel->pChannelParams.data.h225Params.sendRtpAddressID>=0)
{
int tmpId = pvtAdd(hVal, elemId, __h245(mediaChannel), 0, NULL, NULL);
pvtSetTree(hVal,tmpId,hVal,channel->pChannelParams.data.h225Params.sendRtpAddressID);
}
}
elemId = pvtBrother(hVal,elemId);
}
if (ret>=0)
{
/* ADD sessionDependency field */
if (useNewFields && dependencySet)
{
int i,j, sid, childNodeId_I,childNodeId_J;
childNodeId_I=pvtChild(hVal,tableId);
for (i=0; i<channelSetSize; i++)
{
childNodeId_J=pvtChild(hVal,tableId);
for (j=0; j<channelSetSize; j++)
{
if (channelSet[i].dependency==channelSet[j].uid)
{
pvtGetChildValue(hVal,childNodeId_J,__h245(sessionID),&sid,NULL);
ret=pvtAdd(hVal, childNodeId_J, __h245(sessionDependency), channelSet[i].dependency, NULL, NULL);
}
childNodeId_J=pvtBrother(hVal,childNodeId_J);
}
childNodeId_I=pvtBrother(hVal,childNodeId_I);
}
}
ret = sendMessageH245((HCONTROL)ctrl, message);
}
pvtDelete(hVal,message);
emaUnlock((EMAElement)hsCall);
}
cmiAPIExit(hApp, "cmCallSetChannelsExt: [%d].", ret);
return ret;
}
int communicationModeCommand(H245Control* ctrl, int message)
{
HAPP hApp=(HAPP)emaGetInstance((EMAElement)cmiGetByControl((HCONTROL)ctrl));
HPVT hVal = ((cmElem *)hApp)->hVal;
void* ptr=NULL;
H245Channel* channel;
int tableNodeId,elemNodeId;
if (ctrl->bIsMaster) return RV_TRUE;
tableNodeId = pvtGetChild(hVal,message, __h245(communicationModeTable), NULL);
/* go over all outgoing channels */
while((channel=getNextOutChan((HCONTROL)ctrl, &ptr)))
{
if (emaLock((EMAElement)channel))
{
/* try to match each channel to an entry in the communication mode table */
elemNodeId = pvtChild(hVal,tableNodeId); /* elemNodeId = communicationModeTable.1 */
while(elemNodeId>=0)
{
/* first try to match Session ID */
int sid;
pvtGetChildValue(hVal, elemNodeId, __h245(sessionID), &sid, NULL);
if (sid==channel->sessionId)
{
/* now see if the data type is identical */
int dataTypeId=pvtGetChild(hVal, elemNodeId, __h245(dataType), NULL);
if (pvtCompareTree(hVal, pvtChild(hVal,dataTypeId), hVal, pvtChild(hVal,channel->dataTypeID))==RV_TRUE)
{
/* and make seure the RTCP address is identical */
int mediaControlChannelId=pvtGetChild(hVal, elemNodeId, __h245(mediaControlChannel), NULL);
if (pvtCompareTree(hVal, mediaControlChannelId, hVal, channel->pChannelParams.data.h225Params.recvRtcpAddressID)==RV_TRUE)
{
/* and the redundancy encoding */
int redundancyEncodingId=pvtGetChild(hVal, elemNodeId, __h245(redundancyEncoding), NULL);
if (pvtCompareTree(hVal, redundancyEncodingId, hVal, channel->pChannelParams.data.h225Params.redEncID)==RV_TRUE)
{
/* and lastly, make sure the session dependency is the same */
int sessionDependency;
int sdPresent=(pvtGetChildValue(hVal, elemNodeId, __h245(sessionDependency), &sessionDependency, NULL)>=0);
if (!sdPresent && !channel->pBase)
/* Found */
break;
if (channel->pBase && channel->pBase->sessionId==sessionDependency)
/* Found */
break;
}
}
}
}
elemNodeId = pvtBrother(hVal,elemNodeId); /* elemNodeId = communicationModeTable.(i++) */
}
if (elemNodeId<0)/* Not Found */
{
/* Drop the channel that is not in the table of the communicationModeCommand */
cmChannelDrop((HCHAN)channel);
}
emaUnlock((EMAElement)channel);
}
}
elemNodeId = pvtChild(hVal,tableNodeId); /* elemNodeId = communicationModeTable.1 */
while(elemNodeId>=0)
{
int sid;
int dataTypeId;
int terminalLabelId;
int mediaControlChannelId,mediaChannelId;
int redundancyEncodingId;
int sessionDependency=-1;
cmTerminalLabel termLabel={0,0};
/* get the terminal lable the current table entry is reffering to, if present */
if ((terminalLabelId=pvtGetChild(hVal, elemNodeId, __h245(terminalLabel), NULL))>=0)
{
int tmp;
pvtGetChildValue(hVal, terminalLabelId, __h245(mcuNumber), &tmp, NULL);
termLabel.mcuNumber=(RvUint8)tmp;
pvtGetChildValue(hVal, terminalLabelId, __h245(terminalNumber), &tmp, NULL);
termLabel.terminalNumber=(RvUint8)tmp;
}
/* also get the session ID, data type, RTCP, redundancy encoding and dependency */
pvtGetChildValue(hVal, elemNodeId, __h245(sessionID), &sid, NULL);
dataTypeId=pvtGetChild(hVal, elemNodeId, __h245(dataType), NULL);
mediaControlChannelId=pvtGetChild(hVal, elemNodeId, __h245(mediaControlChannel), NULL);
redundancyEncodingId=pvtGetChild(hVal, elemNodeId, __h245(redundancyEncoding), NULL);
pvtGetChildValue(hVal, elemNodeId, __h245(sessionDependency), &sessionDependency, NULL);
/* see if this entry refers to this terminal */
if (terminalLabelId<0 || (termLabel.mcuNumber==ctrl->myTerminalLabel.mcuNumber && termLabel.terminalNumber==ctrl->myTerminalLabel.terminalNumber))
{
/* try to find the channel it refers to */
ptr=NULL;
while((channel=getNextOutChan((HCONTROL)ctrl, &ptr)))
{
if (sid==channel->sessionId)
if (pvtCompareTree(hVal, pvtChild(hVal,dataTypeId), hVal, pvtChild(hVal,channel->dataTypeID))==RV_TRUE)
if (pvtCompareTree(hVal, mediaControlChannelId, hVal, channel->pChannelParams.data.h225Params.recvRtcpAddressID)==RV_TRUE)
if (pvtCompareTree(hVal, redundancyEncodingId, hVal, channel->pChannelParams.data.h225Params.redEncID)==RV_TRUE)
if ((sessionDependency==-1 && !channel->pBase) ||
(channel->pBase && channel->pBase->sessionId==sessionDependency))
/* Found */
break;
}
if (channel==NULL) /* Not Found */
{
H245Channel* newChannel=allocateChannel((HCONTROL)ctrl);
if (!newChannel)
{
RvLogError(&((cmElem*)hApp)->logERR,
(&((cmElem*)hApp)->logERR, "communicationModeCommand: Unable to allocate channel"));
return RV_TRUE;
}
if(emaLock((EMAElement)newChannel))
{
newChannel->hCtrl=(HCONTROL)ctrl;
newChannel->bOrigin=RV_TRUE;
if (((cmElem*)hApp)->cmMySessionEvent.cmEvCallNewChannel)
{
cmiCBEnter(hApp, "cmEvCallNewChannel:IN: haCall=0x%lx, hsCall=0x%lx. hsChan=0x%lx", emaGetApplicationHandle((EMAElement)cmiGetByControl((HCONTROL)ctrl)),cmiGetByControl((HCONTROL)ctrl),newChannel);
{
HAPPCHAN haChan=NULL;
int nesting = emaPrepareForCallback((EMAElement)newChannel);
((cmElem*)hApp)->cmMySessionEvent.cmEvCallNewChannel((HAPPCALL)emaGetApplicationHandle((EMAElement)cmiGetByControl((HCONTROL)ctrl)), (HCALL)cmiGetByControl((HCONTROL)ctrl),(HCHAN)newChannel, &haChan);
emaReturnFromCallback((EMAElement)newChannel, nesting);
emaSetApplicationHandle((EMAElement)newChannel,(void*)haChan);
}
cmiCBExit(hApp, "cmEvCallNewChannel:IN: haChan=0x%lx.", emaGetApplicationHandle((EMAElement)newChannel));
}
if (emaWasDeleted((EMAElement)newChannel))
continue;
}
if (dataTypeId>=0)
{
confDataType type;
newChannel->dataTypeID=pvtAddRoot(hVal,NULL,0,NULL);
pvtMoveTree(hVal,newChannel->dataTypeID,dataTypeId);
cmcCallChannelParametersCallback(hApp, (HCHAN)newChannel, newChannel->dataTypeID, &type);
if (!emaWasDeleted((EMAElement)newChannel))
cmcCallDataTypeHandleCallback(hApp, (HCHAN)newChannel, newChannel->dataTypeID, type);
if (emaWasDeleted((EMAElement)newChannel))
continue;
}
else
{
RvLogError(&((cmElem*)hApp)->logERR,
(&((cmElem*)hApp)->logERR, "communicationModeCommand: no data type."));
newChannel->eState = ChannelStateReleased;
notifyChannelState(newChannel,cmChannelStateDisconnected,cmChannelStateModeDisconnectedReasonUnknown);
notifyChannelState(newChannel,cmChannelStateIdle, cmChannelStateModeOff);
continue;
}
if (mediaControlChannelId>=0)
{
newChannel->pChannelParams.data.h225Params.recvRtcpAddressID=pvtAddRoot(hVal,NULL,0,NULL);
pvtMoveTree(hVal,newChannel->pChannelParams.data.h225Params.recvRtcpAddressID,mediaControlChannelId);
}
mediaChannelId=pvtGetChild(hVal, elemNodeId, __h245(mediaChannel), NULL);
if (mediaChannelId>=0)
{
newChannel->pChannelParams.data.h225Params.recvRtpAddressID=pvtAddRoot(hVal,NULL,0,NULL);
pvtMoveTree(hVal,newChannel->pChannelParams.data.h225Params.recvRtpAddressID,mediaChannelId);
}
if (redundancyEncodingId>=0)
{
newChannel->pChannelParams.data.h225Params.redEncID=pvtAddRoot(hVal,NULL,0,NULL);
pvtMoveTree(hVal,newChannel->pChannelParams.data.h225Params.redEncID,redundancyEncodingId);
}
if (sessionDependency>=0)
{
int elemNodeId1 = pvtChild(hVal,tableNodeId); /* elemNodeId1 = communicationModeTable.1 */
while(elemNodeId1>=0)
{
int sid1;
pvtGetChildValue(hVal, elemNodeId1, __h245(sessionID), &sid1, NULL);
if (sid1==sessionDependency) newChannel->pBase=getOutChanBySID((HCONTROL)ctrl,sid1);
elemNodeId1 = pvtBrother(hVal,elemNodeId1); /* elemNodeId = communicationModeTable.(i++) */
}
}
newChannel->sessionId=sid;
startEstablishment(hApp, (HCHAN)newChannel);
}
}
elemNodeId = pvtBrother(hVal,elemNodeId); /* elemNodeId = communicationModeTable.(i++) */
}
return RV_TRUE;
}
RVAPI int RVCALLCONV
cmBuildMultimediaSystemControlMessage(IN HAPP hApp,
IN cmH245MessageType messageType,
IN int lcn,
OUT RvPvtNodeId * messageNode,
OUT RvPvtNodeId * insertionNode)
/* This function will build a Multimedia System Control Message, and will return the node ID of the message, and
the node ID to which the message itself (according to the messageType enumerations) should be inserted (if at
all). the function will return 0 on success and -1 on faliure. */
{
HPVT hVal;
if(!hApp || !messageNode || !insertionNode) return RV_ERROR_NULLPTR;
hVal = ((cmElem *)hApp)->hVal;
*messageNode = pvtAddRoot(hVal,((cmElem*)hApp)->synProtH245,0,NULL);
switch(messageType)
{
case h245rqConferenceRequest:
__pvtBuildByFieldIds(*insertionNode, hVal, *messageNode,
{ _h245(request) _h245(conferenceRequest) _h245(terminalListRequest) LAST_TOKEN },
0, NULL);
break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -