summaryrefslogtreecommitdiffstats
path: root/data/mnet/GP10/Host/cc
diff options
context:
space:
mode:
Diffstat (limited to 'data/mnet/GP10/Host/cc')
-rw-r--r--data/mnet/GP10/Host/cc/Makefile18
-rw-r--r--data/mnet/GP10/Host/cc/cc.dsp402
-rw-r--r--data/mnet/GP10/Host/cc/src/A_Handover_Common.cpp133
-rw-r--r--data/mnet/GP10/Host/cc/src/A_Handover_Complete_Msg.cpp99
-rw-r--r--data/mnet/GP10/Host/cc/src/A_Handover_Detect_Msg.cpp80
-rw-r--r--data/mnet/GP10/Host/cc/src/A_Handover_Failure_Msg.cpp180
-rw-r--r--data/mnet/GP10/Host/cc/src/A_Handover_Ie.cpp1335
-rw-r--r--data/mnet/GP10/Host/cc/src/A_Handover_Request_Ack_Msg.cpp235
-rw-r--r--data/mnet/GP10/Host/cc/src/A_Handover_Request_Msg.cpp600
-rw-r--r--data/mnet/GP10/Host/cc/src/CCBldMSMsg.cpp523
-rw-r--r--data/mnet/GP10/Host/cc/src/CCExtHoTrgHnd.cpp3591
-rw-r--r--data/mnet/GP10/Host/cc/src/CCH323Util.cpp413
-rw-r--r--data/mnet/GP10/Host/cc/src/CCHalfCall.cpp563
-rw-r--r--data/mnet/GP10/Host/cc/src/CCHandover.cpp2191
-rw-r--r--data/mnet/GP10/Host/cc/src/CCHndUtil.cpp168
-rw-r--r--data/mnet/GP10/Host/cc/src/CCHoSrcHnd.cpp2922
-rw-r--r--data/mnet/GP10/Host/cc/src/CCHoSrcHndExt.cpp2350
-rw-r--r--data/mnet/GP10/Host/cc/src/CCHoTrgHnd.cpp704
-rw-r--r--data/mnet/GP10/Host/cc/src/CCMobExtHnd.cpp1422
-rw-r--r--data/mnet/GP10/Host/cc/src/CCMobIntHnd.cpp696
-rw-r--r--data/mnet/GP10/Host/cc/src/CCMobRemHnd.cpp870
-rw-r--r--data/mnet/GP10/Host/cc/src/CCMsgAnal.cpp356
-rw-r--r--data/mnet/GP10/Host/cc/src/CCOamHnd.cpp768
-rw-r--r--data/mnet/GP10/Host/cc/src/CCSessionHandler.cpp3580
-rw-r--r--data/mnet/GP10/Host/cc/src/CCTask.cpp1995
-rw-r--r--data/mnet/GP10/Host/cc/src/CCUtil.cpp222
-rw-r--r--data/mnet/GP10/Host/cc/src/CCconfig.cpp62
-rw-r--r--data/mnet/GP10/Host/cc/src/CallConfig.cpp73
-rw-r--r--data/mnet/GP10/Host/cc/src/CallLeg.cpp558
-rw-r--r--data/mnet/GP10/Host/cc/src/CallTask.cpp358
-rw-r--r--data/mnet/GP10/Host/cc/src/CissCallLeg.cpp262
-rw-r--r--data/mnet/GP10/Host/cc/src/HOCallLeg.cpp353
-rw-r--r--data/mnet/GP10/Host/cc/src/HOHalfCall.cpp808
-rw-r--r--data/mnet/GP10/Host/cc/src/Makefile52
-rw-r--r--data/mnet/GP10/Host/cc/src/SmsCommon.cpp53
-rw-r--r--data/mnet/GP10/Host/cc/src/SmsFsm.cpp222
-rw-r--r--data/mnet/GP10/Host/cc/src/SmsHalfCall.cpp263
-rw-r--r--data/mnet/GP10/Host/cc/src/SmsHandlers.cpp537
-rw-r--r--data/mnet/GP10/Host/cc/src/SmsLeg.cpp405
-rw-r--r--data/mnet/GP10/Host/cc/src/SmsMsgBuilder.cpp368
-rw-r--r--data/mnet/GP10/Host/cc/src/hortp.cpp217
-rw-r--r--data/mnet/GP10/Host/cc/src/smqueue.cpp120
-rw-r--r--data/mnet/GP10/Host/cc/src_api/CCMobUtil.cpp124
-rw-r--r--data/mnet/GP10/Host/cc/src_api/CCapiH323.cpp450
-rw-r--r--data/mnet/GP10/Host/cc/src_api/CCapiViperLink.cpp150
-rw-r--r--data/mnet/GP10/Host/cc/src_api/Makefile52
-rw-r--r--data/mnet/GP10/Host/cc/src_api/SmsVblink.cpp169
-rw-r--r--data/mnet/GP10/Host/cc/src_api/ccutil2.cpp201
-rw-r--r--data/mnet/GP10/Host/cc/src_init/CCinit.cpp30
-rw-r--r--data/mnet/GP10/Host/cc/src_init/Makefile52
-rw-r--r--data/mnet/GP10/Host/cc/test/CCtestUpdateVC.cpp54
-rw-r--r--data/mnet/GP10/Host/cc/test/ForC.h83
-rw-r--r--data/mnet/GP10/Host/cc/test/Makefile52
-rw-r--r--data/mnet/GP10/Host/cc/test/ccVarTest.cpp441
-rw-r--r--data/mnet/GP10/Host/cc/test/closeLogFile5
-rw-r--r--data/mnet/GP10/Host/cc/test/disconnecTerm18
-rw-r--r--data/mnet/GP10/Host/cc/test/disconnectOrig17
-rw-r--r--data/mnet/GP10/Host/cc/test/integ101
-rw-r--r--data/mnet/GP10/Host/cc/test/kill37
-rw-r--r--data/mnet/GP10/Host/cc/test/makeOrigCall23
-rw-r--r--data/mnet/GP10/Host/cc/test/makeTermCall27
-rw-r--r--data/mnet/GP10/Host/cc/test/setLogFile8
-rw-r--r--data/mnet/GP10/Host/cc/test/test1.zipbin0 -> 8355 bytes
63 files changed, 33221 insertions, 0 deletions
diff --git a/data/mnet/GP10/Host/cc/Makefile b/data/mnet/GP10/Host/cc/Makefile
new file mode 100644
index 0000000..ded5f26
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/Makefile
@@ -0,0 +1,18 @@
+##########################################################
+#
+# (c) Copyright Cisco 2000
+# All Rights Reserved
+#
+##########################################################
+
+
+SUBDIRS=src src_api src_init test
+
+# TOP_OF_VOB must be defined before including l3defs.mk
+TOP_OF_VOB = ..\..
+
+include $(TOP_OF_VOB)\l3defs.mk
+
+
+copyall:
+ $(CP) bin\*.out $(TOP_OF_VOB)\bin\*.out \ No newline at end of file
diff --git a/data/mnet/GP10/Host/cc/cc.dsp b/data/mnet/GP10/Host/cc/cc.dsp
new file mode 100644
index 0000000..3793762
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/cc.dsp
@@ -0,0 +1,402 @@
+# Microsoft Developer Studio Project File - Name="cc" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=cc - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "cc.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "cc.mak" CFG="cc - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "cc - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "cc - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName "cc"
+# PROP Scc_LocalPath "."
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "cc - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF "$(CFG)" == "cc - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "%WIND_BASE%\target\config\all" /I "%WIND_BASE%\target\src\config" /I "%WIND_BASE%\target\src\drv" /I "\ViperCell" /I "\vipercell\cc\include" /I "jcc\include" /I "cdc_bsp" /I "oam\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D CPU=PPC860 /D "VXWORKS" /D "H323_Exist" /D "__VXWORKS__" /D "VIPER_IP" /D "FAST_RTP_READ" /D "VX_IGNORE_GNU_LIBS" /D "__PROTOTYPE_5_0" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ENDIF
+
+# Begin Target
+
+# Name "cc - Win32 Release"
+# Name "cc - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\src\CallConfig.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CallLeg.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CallTask.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCBldMSMsg.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCconfig.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCH323Util.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCHalfCall.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCHandover.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCHndUtil.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCHoSrcHnd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCHoTrgHnd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src_init\CCinit.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCMobExtHnd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCMobIntHnd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCMobRemHnd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCMsgAnal.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCOamHnd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCSessionHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCTask.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CCUtil.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\CissCallLeg.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\hortp.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\smqueue.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\SmsCommon.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\SmsFsm.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\SmsHalfCall.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\SmsHandlers.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\SmsLeg.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\SmsMsgBuilder.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\CallConfig.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\CallLeg.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\cc_util_ext.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\CCconfig.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\CCH323Util.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\CCHalfCall.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\CCHandover.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\CCInt.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\CCMsgAnal.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\CCSessionHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\CCTypes.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\CCUtil.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\hortp.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\jcc\JCCComMsg.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\jcc\JCCL3Msg.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\smqueue.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\SmsCommonDef.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\SmsHalfCall.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\SmsHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\SMSLeg.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common_To_Host\cc\SmsMsgBuilder.h
+# End Source File
+# End Group
+# Begin Group "Source API files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\src_api\CCapiH323.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src_api\CCapiViperLink.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src_api\CCMobUtil.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src_api\ccutil2.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src_api\SmsVblink.cpp
+# End Source File
+# End Group
+# Begin Group "Docs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=".\encode cc.txt"
+
+!IF "$(CFG)" == "cc - Win32 Release"
+
+!ELSEIF "$(CFG)" == "cc - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=".\procs sms.txt"
+
+!IF "$(CFG)" == "cc - Win32 Release"
+
+!ELSEIF "$(CFG)" == "cc - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Logging Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\logging\src\l3MsLog.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\logging\src\logging.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\logging\include\VCLOGGING.H
+# End Source File
+# Begin Source File
+
+SOURCE=..\logging\include\vcmodules.h
+# End Source File
+# End Group
+# Begin Group "L1Proxy Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\l1proxy\src\l1MsMsgProc.cpp
+# End Source File
+# End Group
+# Begin Group "RM API Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;h"
+# Begin Source File
+
+SOURCE=..\rm\Include\rm_ccintf.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\rm\Src_api\rm_EntryIdVsTrxSlot.cpp
+# End Source File
+# End Group
+# Begin Group "MM source files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;h"
+# Begin Source File
+
+SOURCE=..\mm\src\MMMdMsgProc.cpp
+# End Source File
+# End Group
+# Begin Group "LUDB Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;h"
+# Begin Source File
+
+SOURCE=..\jcc\src\LUDBVoipMsgProc.cpp
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/data/mnet/GP10/Host/cc/src/A_Handover_Common.cpp b/data/mnet/GP10/Host/cc/src/A_Handover_Common.cpp
new file mode 100644
index 0000000..e21e120
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/A_Handover_Common.cpp
@@ -0,0 +1,133 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2001
+// All Rights Reserved
+//
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : ($CC)/src/A_Handover_Common.cpp
+// Author(s) : Tai Yu
+// Description :
+//
+// FILE DESCRIPTION:
+//
+//
+// CHANGE HISTORY:
+//
+// Date Description
+// ---------- --------------------------------------------
+// 2001-05-15 First Incarnation
+//
+// =================================================================
+
+#include "CC\A_Handover_Common.h"
+
+A_Result_t
+AIF_Encode(
+ T_AIF_MSG *AIF_Msg,
+ T_AIF_MessageUnit *AIF_MsgUnit)
+{
+ unsigned char *buffer = AIF_MsgUnit->buffer;
+ int length = AIF_MSG_LENGTH;
+ A_Result_t result;
+
+ if (length < 2) return A_INCORRECT_LENGTH;
+
+ switch(AIF_Msg->header.msgType)
+ {
+ case A_HANDOVER_REQUEST_TYPE:
+ result = A_EncodeHandoverRequest(
+ AIF_Msg->handoverRequest,
+ buffer,
+ length);
+ AIF_MsgUnit->msgLength = length;
+ return result;
+ case A_HANDOVER_REQUEST_ACK_TYPE:
+ result = A_EncodeHandoverRequestAck(
+ AIF_Msg->handoverRequestAck,
+ buffer,
+ length);
+ AIF_MsgUnit->msgLength = length;
+ return result;
+ case A_HANDOVER_COMPLETE_TYPE:
+ result = A_EncodeHandoverComplete(
+ AIF_Msg->handoverComplete,
+ buffer,
+ length);
+ AIF_MsgUnit->msgLength = length;
+ return result;
+ case A_HANDOVER_FAILURE_TYPE:
+ result = A_EncodeHandoverFailure(
+ AIF_Msg->handoverFailure,
+ buffer,
+ length);
+ AIF_MsgUnit->msgLength = length;
+ return result;
+ case A_HANDOVER_DETECT_TYPE:
+ result = A_EncodeHandoverDetect(
+ AIF_Msg->handoverDetect,
+ buffer,
+ length);
+ AIF_MsgUnit->msgLength = length;
+ return result;
+ case A_QUEUING_INDICATION_TYPE:
+ result = A_EncodeMessageType(
+ A_RESULT_SUCCESS,
+ length,
+ buffer);
+ AIF_MsgUnit->msgLength = length;
+ return result;
+ default:
+ return A_UNKNOWN_MESSAGE_TYPE;
+ }
+}
+
+A_Result_t
+AIF_Decode(
+ T_AIF_MessageUnit *AIF_MsgUnit,
+ T_AIF_MSG *AIF_Msg)
+{
+ unsigned char *buffer = AIF_MsgUnit->buffer;
+ int length = AIF_MsgUnit->msgLength;
+
+ if (length < 2) return A_INCORRECT_LENGTH;
+
+ AIF_Msg->header.msgType = AIF_MsgUnit->buffer[0];
+
+ switch(AIF_Msg->header.msgType)
+ {
+ case A_HANDOVER_REQUEST_TYPE:
+ return A_DecodeHandoverRequest(
+ &buffer[1],
+ length,
+ AIF_Msg->handoverRequest);
+ case A_HANDOVER_REQUEST_ACK_TYPE:
+ return A_DecodeHandoverRequestAck(
+ &buffer[1],
+ length,
+ AIF_Msg->handoverRequestAck);
+ case A_HANDOVER_COMPLETE_TYPE:
+ return A_DecodeHandoverComplete(
+ &buffer[1],
+ length,
+ AIF_Msg->handoverComplete);
+ case A_HANDOVER_FAILURE_TYPE:
+ return A_DecodeHandoverFailure(
+ &buffer[1],
+ length,
+ AIF_Msg->handoverFailure);
+ case A_HANDOVER_DETECT_TYPE:
+ return A_DecodeHandoverDetect(
+ &buffer[1],
+ length,
+ AIF_Msg->handoverDetect);
+ case A_QUEUING_INDICATION_TYPE:
+ AIF_Msg->msgType = A_QUEUING_INDICATION_TYPE;
+ return A_RESULT_SUCCESS;
+ default:
+ return A_UNKNOWN_MESSAGE_TYPE;
+ }
+}
+
diff --git a/data/mnet/GP10/Host/cc/src/A_Handover_Complete_Msg.cpp b/data/mnet/GP10/Host/cc/src/A_Handover_Complete_Msg.cpp
new file mode 100644
index 0000000..a8f4a6b
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/A_Handover_Complete_Msg.cpp
@@ -0,0 +1,99 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2001
+// All Rights Reserved
+//
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : ($CC)/src/A_Handover_Complete_Msg.cpp
+// Author(s) : Tai Yu
+// Create Date : 05-22-01
+// Description : Source Vipercell Exteral Handover Complete Message
+// Encode and Decode Functions
+//
+// FILE DESCRIPTION:
+//
+//
+// CHANGE HISTORY:
+//
+// Date Description
+// ---------- --------------------------------------------
+// 2001-05-22 First Incarnation
+//
+// =================================================================
+
+#include "CC\A_Handover_Complete_Msg.h"
+
+// 3.2.1.12
+A_Result_t
+A_EncodeHandoverComplete(
+ A_Handover_Complete_t &handoverComplete,
+ unsigned char *buffer,
+ int &length
+ )
+{
+ A_Result_t resultCode;
+ int ieLength = 1;
+ int bufferIndex = 1;
+
+ if (length < 4)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+
+ // Encode message header
+ A_EncodeMessageType((A_Ie_Message_Type_t)A_HANDOVER_COMPLETE_TYPE,
+ ieLength,
+ &buffer[0]);
+
+ if(handoverComplete.rrCause.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeRRCause(
+ handoverComplete.rrCause,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ length = bufferIndex;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeHandoverComplete(
+ unsigned char *buffer,
+ int length,
+ A_Handover_Complete_t &handoverComplete
+ )
+{
+ if(length < 4)
+ {
+ return A_MANDATORY_IE_MISSING;
+ }
+
+ A_Result_t resultCode;
+ int ieLength = 0;
+ int bufferIndex = 0;
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_RR_CAUSE_TYPE))
+ {
+ resultCode = A_DecodeRRCause(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverComplete.rrCause);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ return A_RESULT_SUCCESS;
+}
diff --git a/data/mnet/GP10/Host/cc/src/A_Handover_Detect_Msg.cpp b/data/mnet/GP10/Host/cc/src/A_Handover_Detect_Msg.cpp
new file mode 100644
index 0000000..2efa6d3
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/A_Handover_Detect_Msg.cpp
@@ -0,0 +1,80 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2001
+// All Rights Reserved
+//
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : ($CC)/src/A_Handover_Detect_Msg.cpp
+// Author(s) : Tai Yu
+// Create Date : 05-22-01
+// Description : Source Vipercell Exteral Handover Detect Message
+// Encode and Decode Functions
+//
+// FILE DESCRIPTION:
+//
+//
+// CHANGE HISTORY:
+//
+// Date Description
+// ---------- --------------------------------------------
+// 2001-05-22 First Incarnation
+//
+// =================================================================
+
+#include "CC\A_Handover_Detect_Msg.h"
+
+// 3.2.1.40
+A_Result_t
+A_EncodeHandoverDetect(
+ A_Handover_Detect_t &handoverDetect,
+ unsigned char *buffer,
+ int &length
+ )
+{
+ A_Result_t resultCode;
+ int ieLength = 1;
+
+ if (length < 1)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+
+ // Encode message header
+ A_EncodeMessageType((A_Ie_Message_Type_t)A_HANDOVER_DETECT_TYPE,
+ ieLength,
+ &buffer[0]);
+
+ length = 1;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeHandoverDetect(
+ unsigned char *buffer,
+ int length,
+ A_Handover_Detect_t &handoverDetect
+ )
+{
+ int decodedLength;
+
+ if(length < 1)
+ {
+ return A_MANDATORY_IE_MISSING;
+ }
+
+ if(buffer[0] != A_HANDOVER_DETECT_TYPE)
+ {
+ return A_UNKNOWN_MESSAGE_TYPE;
+ }
+
+ // Decode message header
+ A_DecodeMessageType(&buffer[0],
+ decodedLength,
+ handoverDetect.msgType);
+
+ return A_RESULT_SUCCESS;
+}
diff --git a/data/mnet/GP10/Host/cc/src/A_Handover_Failure_Msg.cpp b/data/mnet/GP10/Host/cc/src/A_Handover_Failure_Msg.cpp
new file mode 100644
index 0000000..a729582
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/A_Handover_Failure_Msg.cpp
@@ -0,0 +1,180 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2001
+// All Rights Reserved
+//
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : ($CC)/src/A_Handover_Failure_Msg.cpp
+// Author(s) : Tai Yu
+// Create Date : 05-15-01
+// Description : Source Vipercell Exteral Handover Failure Message
+// Encode and Decode Functions
+//
+// FILE DESCRIPTION:
+//
+//
+// CHANGE HISTORY:
+//
+// Date Description
+// ---------- --------------------------------------------
+// 2001-05-15 First Incarnation
+//
+// =================================================================
+
+#include "CC\A_Handover_Failure_Msg.h"
+
+// 3.2.1.16
+A_Result_t
+A_EncodeHandoverFailure(
+ A_Handover_Failure_t &handoverFailure,
+ unsigned char *buffer,
+ int &length
+ )
+{
+ A_Result_t resultCode;
+ int ieLength = 1;
+ int bufferIndex = 1;
+
+ if (length < 4)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+
+ // Encode message header
+ A_EncodeMessageType(A_HANDOVER_FAILURE_TYPE,
+ ieLength,
+ &buffer[0]);
+
+ if(handoverFailure.cause.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeCause(
+ handoverFailure.cause,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_MANDATORY_IE_RETURN_CODE(resultCode);
+ }
+ else
+ return A_MANDATORY_IE_MISSING;
+
+ if(handoverFailure.rrCause.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeRRCause(
+ handoverFailure.rrCause,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverFailure.circuitPool.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeCircuitPool(
+ handoverFailure.circuitPool,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverFailure.circuitPoolList.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeCircuitPoolList(
+ handoverFailure.circuitPoolList,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ length = bufferIndex;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeHandoverFailure(
+ unsigned char *buffer,
+ int length,
+ A_Handover_Failure_t &handoverFailure
+ )
+{
+ if(length < 4)
+ {
+ return A_MANDATORY_IE_MISSING;
+ }
+
+ A_Result_t resultCode;
+ int ieLength = 0;
+ int bufferIndex = 0;
+
+ resultCode = A_DecodeCause(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverFailure.cause);
+
+ A_CHECK_MANDATORY_IE_RETURN_CODE(resultCode);
+
+ bufferIndex += ieLength;
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_RR_CAUSE_TYPE))
+ {
+ resultCode = A_DecodeRRCause(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverFailure.rrCause);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CIRCUIT_POOL_TYPE))
+ {
+ resultCode = A_DecodeCircuitPool(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverFailure.circuitPool);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CIRCUIT_POOL_LIST_TYPE))
+ {
+ resultCode = A_DecodeCircuitPoolList(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverFailure.circuitPoolList);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ return A_RESULT_SUCCESS;
+}
diff --git a/data/mnet/GP10/Host/cc/src/A_Handover_Ie.cpp b/data/mnet/GP10/Host/cc/src/A_Handover_Ie.cpp
new file mode 100644
index 0000000..2649a33
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/A_Handover_Ie.cpp
@@ -0,0 +1,1335 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2001
+// All Rights Reserved
+//
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : ($CC)/src/A_Handover_Ie.cpp
+// Author(s) : Tai Yu
+// Description :
+//
+// FILE DESCRIPTION:
+//
+//
+// CHANGE HISTORY:
+//
+// Date Description
+// ---------- --------------------------------------------
+// 2001-05-15 First Incarnation
+//
+// =================================================================
+
+#include "CC\A_Handover_Ie.h"
+
+// 3.2.2.1 Message_Type
+/*
+typedef unsigned char A_Ie_Message_Type_t;
+*/
+
+A_Result_t
+A_EncodeMessageType(
+ A_Ie_Message_Type_t messageType,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ buffer[0] = messageType;
+
+ ieLength = 1;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeMessageType(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Message_Type_t &messageType)
+{
+
+ messageType = buffer[0];
+
+ ieLength = 1;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.2 Circuit_Identity_Code
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned short pcmMultiplex:11;
+ unsigned short timeslot:5;
+} A_Ie_Circuit_Identity_Code_t;
+*/
+
+A_Result_t
+A_EncodeCircuitIdentityCode(
+ A_Ie_Circuit_Identity_Code_t &cirIdenCode,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(cirIdenCode.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_CIRCUIT_IDENTITY_CODE_TYPE;
+
+ buffer[1] = (unsigned char)(cirIdenCode.pcmMultiplex >> 3);
+
+ buffer[2] = ((unsigned char)((cirIdenCode.pcmMultiplex & 0x07) << 5) |
+ (unsigned char)(cirIdenCode.timeslot & 0x1F));
+
+ ieLength = 3;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeCircuitIdentityCode(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Circuit_Identity_Code_t &cirIdenCode)
+{
+ cirIdenCode.ie_present = true;
+
+ cirIdenCode.elementIdentifier = buffer[0];
+
+ cirIdenCode.pcmMultiplex = ((buffer[1] << 3) | ((buffer[2] >> 5) & 0x7));
+
+ cirIdenCode.timeslot = (buffer[2] & 0x1F);
+
+ ieLength = 3;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.5 Cause
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char length;
+ unsigned char cause;
+ unsigned char cause2;
+} A_Ie_Cause_t;
+*/
+
+A_Result_t
+A_EncodeCause(
+ A_Ie_Cause_t &cause,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(cause.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_CAUSE_TYPE;
+
+ buffer[1] = (cause.cause & 0x8 == 0x8) ? 1 : 2;
+
+ buffer[2] = cause.cause;
+
+ ieLength = 3;
+ if (cause.cause & 0x8 == 0x8)
+ {
+ buffer[3] = cause.cause2;
+ ieLength = 4;
+ }
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeCause(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Cause_t &cause)
+{
+ cause.ie_present = true;
+
+ cause.elementIdentifier = buffer[0];
+
+ cause.length = buffer[1];
+
+ cause.cause = buffer[2];
+
+ if (cause.cause & 0x8 == 0x8)
+ cause.cause2 = buffer[3];
+
+ ieLength = cause.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.10 Encryption_Information
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char length;
+ unsigned char permittedAlgorithm;
+ unsigned char key[8];
+} A_Ie_Encryption_Information_t;
+*/
+
+A_Result_t
+A_EncodeEncryptInformation(
+ A_Ie_Encryption_Information_t &encryptInfo,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(encryptInfo.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_ENCRYPTION_INFORMATION_TYPE;
+
+ buffer[1] = encryptInfo.length;
+
+ buffer[2] = encryptInfo.permittedAlgorithm;
+
+ if (encryptInfo.length > 1)
+ memcpy(&buffer[3], encryptInfo.key, 8);
+
+ ieLength = 11;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeEncryptInformation(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Encryption_Information_t &encryptInfo)
+{
+ encryptInfo.ie_present = true;
+
+ encryptInfo.elementIdentifier = buffer[0];
+
+ encryptInfo.length = buffer[1];
+
+ encryptInfo.permittedAlgorithm = buffer[2];
+
+ if (encryptInfo.length > 1)
+ memcpy(encryptInfo.key, &buffer[3], 8);
+
+ ieLength = encryptInfo.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.11
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char length;
+ unsigned char speechDataIndicator;
+ unsigned char channelRateAndType;
+ unsigned char permittedIndicator[8];
+} A_Ie_Channel_Type_t;
+*/
+
+A_Result_t
+A_EncodeChannelType(
+ A_Ie_Channel_Type_t &channelType,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(channelType.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_CHANNEL_TYPE_TYPE;
+
+ buffer[1] = channelType.length;
+
+ buffer[2] = channelType.speechDataIndicator & 0x0F;
+
+ buffer[3] = channelType.channelRateAndType;
+
+ if (channelType.length > 2)
+ {
+ memcpy(&buffer[4], channelType.permittedIndicator, channelType.length - 2);
+ }
+
+ ieLength = channelType.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeChannelType(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Channel_Type_t &channelType)
+{
+ channelType.ie_present = true;
+
+ channelType.elementIdentifier = buffer[0];
+
+ channelType.length = buffer[1];
+
+ channelType.speechDataIndicator = buffer[2];
+
+ channelType.channelRateAndType = buffer[3];
+
+ if (channelType.length > 2)
+ {
+ memcpy(channelType.permittedIndicator, &buffer[4], channelType.length - 2);
+ }
+
+ ieLength = channelType.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+
+// 3.2.2.17
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char length;
+ unsigned char cellIdDescriminator;
+ unsigned char mcc[3];
+ unsigned char mnc[3];
+ unsigned short lac;
+ unsigned short ci;
+} A_Ie_Cell_Identifier_t;
+*/
+
+A_Result_t
+A_EncodeCellIdentifier(
+ A_Ie_Cell_Identifier_t &cellIdentifier,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(cellIdentifier.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_CELL_IDENTIFIER_TYPE;
+
+ buffer[1] = cellIdentifier.length;
+
+ buffer[2] = cellIdentifier.cellIdDescriminator & 0xF;
+
+ switch (cellIdentifier.cellIdDescriminator)
+ {
+ case 0:
+ buffer[3] = ((unsigned char)(cellIdentifier.mcc[1]) << 4 |
+ (unsigned char)(cellIdentifier.mcc[0]));
+ buffer[4] = ((unsigned char)(cellIdentifier.mnc[2]) << 4 |
+ (unsigned char)(cellIdentifier.mcc[2]));
+ buffer[5] = ((unsigned char)(cellIdentifier.mnc[1]) << 4 |
+ (unsigned char)(cellIdentifier.mnc[0]));
+ buffer[6] = (unsigned char)(cellIdentifier.lac >> 8);
+ buffer[7] = (unsigned char)(cellIdentifier.lac & 0xFF);
+ buffer[8] = (unsigned char)(cellIdentifier.ci >> 8);
+ buffer[9] = (unsigned char)(cellIdentifier.ci & 0xFF);
+
+ ieLength = 10;
+ break;
+ case 1:
+ buffer[3] = (unsigned char)(cellIdentifier.lac >> 8);
+ buffer[4] = (unsigned char)(cellIdentifier.lac & 0xFF);
+ buffer[5] = (unsigned char)(cellIdentifier.ci >> 8);
+ buffer[6] = (unsigned char)(cellIdentifier.ci & 0xFF);
+
+ ieLength = 7;
+ break;
+ case 2:
+ buffer[3] = (unsigned char)(cellIdentifier.ci >> 8);
+ buffer[4] = (unsigned char)(cellIdentifier.ci & 0xFF);
+
+ ieLength = 5;
+ break;
+ default:
+ break;
+ }
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeCellIdentifier(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Cell_Identifier_t &cellIdentifier)
+{
+ cellIdentifier.ie_present = true;
+
+ cellIdentifier.elementIdentifier = buffer[0];
+
+ cellIdentifier.length = buffer[1];
+
+ cellIdentifier.cellIdDescriminator = buffer[2] & 0x0F;
+
+ switch (cellIdentifier.cellIdDescriminator)
+ {
+ case 0:
+ cellIdentifier.mcc[1] = (buffer[3] >> 4);
+ cellIdentifier.mcc[0] = (buffer[3] & 0xF);
+ cellIdentifier.mcc[2] = (buffer[4] & 0xF);
+ cellIdentifier.mnc[2] = (buffer[4] >> 4);
+ cellIdentifier.mnc[1] = (buffer[5] >> 4);
+ cellIdentifier.mnc[0] = (buffer[5] & 0xF);
+ cellIdentifier.lac = (unsigned short)(buffer[6] << 8) | (unsigned short)buffer[7];
+ cellIdentifier.ci = (unsigned short)(buffer[8] << 8) | (unsigned short)buffer[9];
+
+ ieLength = 10;
+ break;
+ case 1:
+ cellIdentifier.lac = (unsigned short)(buffer[3] << 8) | (unsigned short)buffer[4];
+ cellIdentifier.ci = (unsigned short)(buffer[5] << 8) | (unsigned short)buffer[6];
+
+ ieLength = 7;
+ break;
+ case 2:
+ cellIdentifier.ci = (unsigned short)(buffer[3] << 8) | (unsigned short)buffer[4];
+
+ ieLength = 5;
+ break;
+ default:
+ break;
+ }
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.18
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char length;
+ unsigned char priority;
+} A_Ie_Priority_t;
+*/
+
+A_Result_t
+A_EncodePriority(
+ A_Ie_Priority_t &priority,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(priority.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_PRIORITY_TYPE;
+
+ buffer[1] = priority.length;
+
+ buffer[2] = priority.priority;
+
+ ieLength = 3;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodePriority(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Priority_t &priority)
+{
+ priority.ie_present = true;
+
+ priority.elementIdentifier = buffer[0];
+
+ priority.length = buffer[1];
+
+ priority.priority = buffer[2];
+
+ ieLength = 3;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.9
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char length;
+ unsigned char protocolDisc;
+ unsigned char transactionID;
+} A_Ie_Layer3_Header_Information_t;
+*/
+
+A_Result_t
+A_EncodeLayer3HeaderInformation(
+ A_Ie_Layer3_Header_Information_t &layer3HeaderInfo,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(layer3HeaderInfo.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_LAYER3_HEADER_INFORMATION_TYPE;
+
+ buffer[1] = layer3HeaderInfo.length;
+
+ buffer[2] = layer3HeaderInfo.protocolDisc;
+
+ buffer[3] = layer3HeaderInfo.transactionID;
+
+ ieLength = 4;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeLayer3HeaderInformation(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Layer3_Header_Information_t &layer3HeaderInfo)
+{
+ layer3HeaderInfo.ie_present = true;
+
+ layer3HeaderInfo.elementIdentifier = buffer[0];
+
+ layer3HeaderInfo.length = buffer[1];
+
+ layer3HeaderInfo.protocolDisc = buffer[2];
+
+ layer3HeaderInfo.transactionID = buffer[3];
+
+ ieLength = layer3HeaderInfo.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.19
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char length;
+ unsigned char classmark[3];
+} A_Ie_Classmark_Information2_t;
+*/
+
+A_Result_t
+A_EncodeClassmarkInformation2(
+ A_Ie_Classmark_Information2_t &classmarkInfo2,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(classmarkInfo2.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_CLASSMARK_INFORMATION2_TYPE;
+
+ buffer[1] = classmarkInfo2.length;
+
+ memcpy(&buffer[2], classmarkInfo2.classmark, classmarkInfo2.length);
+
+ ieLength = classmarkInfo2.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeClassmarkInformation2(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Classmark_Information2_t &classmarkInfo2)
+{
+ classmarkInfo2.ie_present = true;
+
+ classmarkInfo2.elementIdentifier = buffer[0];
+
+ classmarkInfo2.length = buffer[1];
+
+ if (classmarkInfo2.length > 0)
+ memcpy(classmarkInfo2.classmark, &buffer[2], classmarkInfo2.length);
+
+ ieLength = classmarkInfo2.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.20
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char length;
+ unsigned char classmark[12];
+} A_Ie_Classmark_Information3_t;
+*/
+
+A_Result_t
+A_EncodeClassmarkInformation3(
+ A_Ie_Classmark_Information3_t &classmarkInfo3,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(classmarkInfo3.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_CLASSMARK_INFORMATION3_TYPE;
+
+ buffer[1] = classmarkInfo3.length;
+
+ memcpy(&buffer[2], classmarkInfo3.classmark, classmarkInfo3.length);
+
+ ieLength = classmarkInfo3.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeClassmarkInformation3(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Classmark_Information3_t &classmarkInfo3)
+{
+ classmarkInfo3.ie_present = true;
+
+ classmarkInfo3.elementIdentifier = buffer[0];
+
+ classmarkInfo3.length = buffer[1];
+
+ if (classmarkInfo3.length > 0)
+ memcpy(classmarkInfo3.classmark, &buffer[2], classmarkInfo3.length);
+
+ ieLength = classmarkInfo3.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.21
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char bandToBeUsed;
+} A_Ie_Interference_Band_To_Be_Used_t;
+*/
+
+A_Result_t
+A_EncodeInterferenceBandToBeUsed(
+ A_Ie_Interference_Band_To_Be_Used_t &interferenceBandToBeUsed,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(interferenceBandToBeUsed.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_INTERFERENCE_BAND_TO_BE_USED_TYPE;
+
+ buffer[1] = interferenceBandToBeUsed.bandToBeUsed;
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeInterferenceBandToBeUsed(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Interference_Band_To_Be_Used_t &interferenceBandToBeUsed)
+{
+ interferenceBandToBeUsed.ie_present = true;
+
+ interferenceBandToBeUsed.elementIdentifier = buffer[0];
+
+ interferenceBandToBeUsed.bandToBeUsed = buffer[1];
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.22
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char rrCause;
+} A_Ie_RR_Cause_t;
+*/
+
+A_Result_t
+A_EncodeRRCause(
+ A_Ie_RR_Cause_t &rrCause,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(rrCause.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_RR_CAUSE_TYPE;
+
+ buffer[1] = rrCause.rrCause;
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeRRCause(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_RR_Cause_t &rrCause)
+{
+ rrCause.ie_present = true;
+
+ rrCause.elementIdentifier = buffer[0];
+
+ rrCause.rrCause = buffer[1];
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.24
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char length;
+ unsigned char layer3Info[256];
+} A_Ie_Layer3_Information_t;
+*/
+
+A_Result_t
+A_EncodeLayer3Information(
+ A_Ie_Layer3_Information_t &layer3Info,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(layer3Info.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_LAYER3_INFORMATION_TYPE;
+
+ buffer[1] = layer3Info.length;
+
+ memcpy(&buffer[2], layer3Info.layer3Info, layer3Info.length);
+
+ ieLength = layer3Info.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeLayer3Information(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Layer3_Information_t &layer3Info)
+{
+ layer3Info.ie_present = true;
+
+ layer3Info.elementIdentifier = buffer[0];
+
+ layer3Info.length = buffer[1];
+
+ if (layer3Info.length > 0)
+ memcpy(layer3Info.layer3Info, &buffer[2], layer3Info.length);
+
+ ieLength = layer3Info.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.26
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char downlinkDTXFlag;
+} A_Ie_Downlink_DTX_Flag_t;
+*/
+
+A_Result_t
+A_EncodeDownlinkDTXFlag(
+ A_Ie_Downlink_DTX_Flag_t &downlinkDTXFlag,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(downlinkDTXFlag.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_DOWNLINK_DTX_FLAG_TYPE;
+
+ buffer[1] = downlinkDTXFlag.downlinkDTXFlag;
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeDownlinkDTXFlag(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Downlink_DTX_Flag_t &downlinkDTXFlag)
+{
+ downlinkDTXFlag.ie_present = true;
+
+ downlinkDTXFlag.elementIdentifier = buffer[0];
+
+ downlinkDTXFlag.downlinkDTXFlag = buffer[1];
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.30 (One of Information1 or Information2)
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char classmark;
+} A_Ie_Classmark_Information1_t;
+*/
+
+A_Result_t
+A_EncodeClassmarkInformation1(
+ A_Ie_Classmark_Information1_t &classmarkInfo1,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(classmarkInfo1.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_CLASSMARK_INFORMATION1_TYPE;
+
+ buffer[1] = classmarkInfo1.classmark;
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeClassmarkInformation1(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Classmark_Information1_t &classmarkInfo1)
+{
+ classmarkInfo1.ie_present = true;
+
+ classmarkInfo1.elementIdentifier = buffer[0];
+
+ classmarkInfo1.classmark = buffer[1];
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.33
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char channelMode:4;
+ unsigned char channel:4;
+} A_Ie_Chosen_Channel_t;
+*/
+
+A_Result_t
+A_EncodeChosenChannel(
+ A_Ie_Chosen_Channel_t &chosenChannel,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(chosenChannel.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_CHOSEN_CHANNEL_TYPE;
+
+ buffer[1] = ((chosenChannel.channelMode << 4) & 0xF0) | (chosenChannel.channel & 0x0F);
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeChosenChannel(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Chosen_Channel_t &chosenChannel)
+{
+ chosenChannel.ie_present = true;
+
+ chosenChannel.elementIdentifier = buffer[0];
+
+ chosenChannel.channelMode = buffer[1] >> 4;
+
+ chosenChannel.channel = buffer[1] & 0x0F;
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.44
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char algorithmId;
+} A_Ie_Chosen_Encrypt_Algorithm_t;
+*/
+
+A_Result_t
+A_EncodeChosenEncryptAlorithm(
+ A_Ie_Chosen_Encrypt_Algorithm_t &chosenAlgorithm,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(chosenAlgorithm.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_CHOSEN_ENCRYPTION_ALGORITHM_TYPE;
+
+ buffer[1] = chosenAlgorithm.algorithmId;
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeChosenEncryptAlorithm(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Chosen_Encrypt_Algorithm_t &chosenAlgorithm)
+{
+ chosenAlgorithm.ie_present = true;
+
+ chosenAlgorithm.elementIdentifier = buffer[0];
+
+ chosenAlgorithm.algorithmId = buffer[1];
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.45
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char circuitPoolNumber;
+} A_Ie_Circuit_Pool_t;
+*/
+
+A_Result_t
+A_EncodeCircuitPool(
+ A_Ie_Circuit_Pool_t &circuitPool,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(circuitPool.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_CIRCUIT_POOL_TYPE;
+
+ buffer[1] = circuitPool.circuitPoolNumber;
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeCircuitPool(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Circuit_Pool_t &circuitPool)
+{
+ circuitPool.ie_present = true;
+
+ circuitPool.elementIdentifier = buffer[0];
+
+ circuitPool.circuitPoolNumber = buffer[1];
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.46
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char length;
+ unsigned char circuitPoolList[32];
+} A_Ie_Circuit_Pool_List_t;
+*/
+
+A_Result_t
+A_EncodeCircuitPoolList(
+ A_Ie_Circuit_Pool_List_t &circuitPoolList,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(circuitPoolList.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_CIRCUIT_POOL_LIST_TYPE;
+
+ buffer[1] = circuitPoolList.length;
+
+ memcpy(&buffer[2], circuitPoolList.circuitPoolList, circuitPoolList.length);
+
+ ieLength = circuitPoolList.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeCircuitPoolList(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Circuit_Pool_List_t &circuitPoolList)
+{
+ circuitPoolList.ie_present = true;
+
+ circuitPoolList.elementIdentifier = buffer[0];
+
+ circuitPoolList.length = buffer[1];
+
+ if (circuitPoolList.length > 0)
+ memcpy(circuitPoolList.circuitPoolList, &buffer[2], circuitPoolList.length);
+
+ ieLength = circuitPoolList.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.49
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char channelMode:4;
+ unsigned char channel:4;
+} A_Ie_Current_Channel_Type1_t;
+*/
+
+A_Result_t
+A_EncodeCurrentChannelType1(
+ A_Ie_Current_Channel_Type1_t &currentChannelType,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(currentChannelType.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_CURRENT_CHANNEL_TYPE1_TYPE;
+
+ buffer[1] = ((currentChannelType.channelMode << 4) & 0xF0) | (currentChannelType.channel & 0x0F);
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeCurrentChannelType1(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Current_Channel_Type1_t &currentChannelType)
+{
+ currentChannelType.ie_present = true;
+
+ currentChannelType.elementIdentifier = buffer[0];
+
+ currentChannelType.channelMode = buffer[1] >> 4;
+
+ currentChannelType.channel = buffer[1] & 0x0F;
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.51
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char speechVersionId;
+} A_Ie_Speech_Version_t;
+*/
+
+A_Result_t
+A_EncodeSpeechVersion(
+ A_Ie_Speech_Version_t &speechVersion,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(speechVersion.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_SPEECH_VERSION_TYPE;
+
+ buffer[1] = speechVersion.speechVersionId & 0x7F;
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeSpeechVersion(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Speech_Version_t &speechVersion)
+{
+ speechVersion.ie_present = true;
+
+ speechVersion.elementIdentifier = buffer[0];
+
+ speechVersion.speechVersionId = buffer[1];
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.54
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+} A_Ie_Talker_Flag_t;
+*/
+
+A_Result_t
+A_EncodeTalkerFlag(
+ A_Ie_Talker_Flag_t &talkerFlag,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(talkerFlag.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_SPEECH_VERSION_TYPE;
+
+ ieLength = 1;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeTalkerFlag(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Talker_Flag_t &talkerFlag)
+{
+ talkerFlag.ie_present = true;
+
+ talkerFlag.elementIdentifier = buffer[0];
+
+ ieLength = 1;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.55
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char length;
+ unsigned char groupDesc[4];
+} A_Ie_Group_Call_Reference_t;
+*/
+
+A_Result_t
+A_EncodeGroupCallReference(
+ A_Ie_Group_Call_Reference_t &groupCallReference,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(groupCallReference.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_GROUP_CALL_REFERENCE_TYPE;
+
+ buffer[1] = groupCallReference.length;
+
+ memcpy(&buffer[2], groupCallReference.groupDesc, groupCallReference.length);
+
+ ieLength = groupCallReference.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeGroupCallReference(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Group_Call_Reference_t &groupCallReference)
+{
+ groupCallReference.ie_present = true;
+
+ groupCallReference.elementIdentifier = buffer[0];
+
+ groupCallReference.length = buffer[1];
+
+ if (groupCallReference.length > 0)
+ memcpy(groupCallReference.groupDesc, &buffer[2], groupCallReference.length);
+
+ ieLength = groupCallReference.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.57
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char SMI;
+} A_Ie_Config_Evolution_Indication_t;
+*/
+
+A_Result_t
+A_EncodeConfigEvolutionIndication(
+ A_Ie_Config_Evolution_Indication_t &configEvolutionIndication,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(configEvolutionIndication.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_GROUP_CALL_REFERENCE_TYPE;
+
+ buffer[1] = configEvolutionIndication.SMI & 0xF;
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeConfigEvolutionIndication(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Config_Evolution_Indication_t &configEvolutionIndication)
+{
+ configEvolutionIndication.ie_present = true;
+
+ configEvolutionIndication.elementIdentifier = buffer[0];
+
+ configEvolutionIndication.SMI = buffer[1] & 0xF;
+
+ ieLength = 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+// 3.2.2.59
+/*
+typedef struct {
+ bool ie_present:1;
+ unsigned char elementIdentifier;
+ unsigned char length;
+ unsigned char oldBssToNewBssIe[256];
+} A_Ie_Old_BSS_To_New_BSS_Info_t;
+*/
+
+A_Result_t
+A_EncodeBssToNewBssInfo(
+ A_Ie_Old_BSS_To_New_BSS_Info_t &oldBssToNewBssInfo,
+ int &ieLength,
+ unsigned char *buffer)
+{
+ if(oldBssToNewBssInfo.ie_present != true)
+ {
+ return A_IE_MISSING;
+ }
+
+ buffer[0] = A_OLD_BSS_TO_NEW_BSS_INFORMATION_TYPE;
+
+ buffer[1] = oldBssToNewBssInfo.length;
+
+ memcpy(&buffer[2], oldBssToNewBssInfo.oldBssToNewBssIe, oldBssToNewBssInfo.length);
+
+ ieLength = oldBssToNewBssInfo.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeBssToNewBssInfo(
+ unsigned char *buffer,
+ int &ieLength,
+ A_Ie_Old_BSS_To_New_BSS_Info_t &oldBssToNewBssInfo)
+{
+ oldBssToNewBssInfo.ie_present = true;
+
+ oldBssToNewBssInfo.elementIdentifier = buffer[0];
+
+ oldBssToNewBssInfo.length = buffer[1];
+
+ if (oldBssToNewBssInfo.length > 0)
+ memcpy(oldBssToNewBssInfo.oldBssToNewBssIe, &buffer[2], oldBssToNewBssInfo.length);
+
+ ieLength = oldBssToNewBssInfo.length + 2;
+
+ return A_RESULT_SUCCESS;
+}
diff --git a/data/mnet/GP10/Host/cc/src/A_Handover_Request_Ack_Msg.cpp b/data/mnet/GP10/Host/cc/src/A_Handover_Request_Ack_Msg.cpp
new file mode 100644
index 0000000..da22395
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/A_Handover_Request_Ack_Msg.cpp
@@ -0,0 +1,235 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2001
+// All Rights Reserved
+//
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : ($CC)/src/A_Handover_Request_Ack_Msg.cpp
+// Author(s) : Tai Yu
+// Create Date : 05-15-01
+// Description : Source Vipercell Exteral Handover Request Ack Message
+// Encode and Decode Functions
+//
+// FILE DESCRIPTION:
+//
+//
+// CHANGE HISTORY:
+//
+// Date Description
+// ---------- --------------------------------------------
+// 2001-05-15 First Incarnation
+//
+// =================================================================
+
+#include "CC\A_Handover_Request_Ack_Msg.h"
+
+// 3.2.1.16
+A_Result_t
+A_EncodeHandoverRequestAck(
+ A_Handover_Request_Ack_t &handoverRequestAck,
+ unsigned char *buffer,
+ int &length
+ )
+{
+ A_Result_t resultCode;
+ int ieLength = 1;
+ int bufferIndex = 1;
+
+ if (length < 12)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+
+ // Encode message header
+ A_EncodeMessageType(A_HANDOVER_REQUEST_ACK_TYPE,
+ ieLength,
+ &buffer[0]);
+
+
+ if(handoverRequestAck.layer3Information.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeLayer3Information(
+ handoverRequestAck.layer3Information,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_MANDATORY_IE_RETURN_CODE(resultCode);
+ }
+ else
+ return A_MANDATORY_IE_MISSING;
+
+ if(handoverRequestAck.chosenChannel.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeChosenChannel(
+ handoverRequestAck.chosenChannel,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequestAck.chosenEncryptAlgorithm.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeChosenEncryptAlorithm(
+ handoverRequestAck.chosenEncryptAlgorithm,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequestAck.circuitPool.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeCircuitPool(
+ handoverRequestAck.circuitPool,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequestAck.speechVersionChosen.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeSpeechVersion(
+ handoverRequestAck.speechVersionChosen,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequestAck.circuitIdentityCode.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeCircuitIdentityCode(
+ handoverRequestAck.circuitIdentityCode,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ length = bufferIndex;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeHandoverRequestAck(
+ unsigned char *buffer,
+ int length,
+ A_Handover_Request_Ack_t &handoverRequestAck
+ )
+{
+ if(length < 12)
+ {
+ return A_MANDATORY_IE_MISSING;
+ }
+
+ A_Result_t resultCode;
+ int ieLength = 0;
+ int bufferIndex = 0;
+
+ resultCode = A_DecodeLayer3Information(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequestAck.layer3Information);
+
+ A_CHECK_MANDATORY_IE_RETURN_CODE(resultCode);
+
+ bufferIndex += ieLength;
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CHOSEN_CHANNEL_TYPE))
+ {
+ resultCode = A_DecodeChosenChannel(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequestAck.chosenChannel);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CHOSEN_ENCRYPTION_ALGORITHM_TYPE))
+ {
+ resultCode = A_DecodeChosenEncryptAlorithm(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequestAck.chosenEncryptAlgorithm);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CIRCUIT_POOL_TYPE))
+ {
+ resultCode = A_DecodeCircuitPool(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequestAck.circuitPool);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_SPEECH_VERSION_TYPE))
+ {
+ resultCode = A_DecodeSpeechVersion(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequestAck.speechVersionChosen);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CIRCUIT_IDENTITY_CODE_TYPE))
+ {
+ resultCode = A_DecodeCircuitIdentityCode(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequestAck.circuitIdentityCode);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ return A_RESULT_SUCCESS;
+}
diff --git a/data/mnet/GP10/Host/cc/src/A_Handover_Request_Msg.cpp b/data/mnet/GP10/Host/cc/src/A_Handover_Request_Msg.cpp
new file mode 100644
index 0000000..7eb6b53
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/A_Handover_Request_Msg.cpp
@@ -0,0 +1,600 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2001
+// All Rights Reserved
+//
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : ($CC)/src/A_Handover_Request_Msg.cpp
+// Author(s) : Tai Yu
+// Create Date : 05-15-01
+// Description : Source Vipercell Exteral Handover Request Message
+// Encode and Decode Functions
+//
+// FILE DESCRIPTION:
+//
+//
+// CHANGE HISTORY:
+//
+// Date Description
+// ---------- --------------------------------------------
+// 2001-05-15 First Incarnation
+//
+// =================================================================
+
+#include "CC\A_Handover_Request_Msg.h"
+
+// 3.2.1.16
+A_Result_t
+A_EncodeHandoverRequest(
+ A_Handover_Request_t &handoverRequest,
+ unsigned char *buffer,
+ int &length
+ )
+{
+ A_Result_t resultCode;
+ int ieLength = 1;
+ int bufferIndex = 1;
+
+ if (length < 23)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+
+ // Encode message header
+ A_EncodeMessageType(A_HANDOVER_REQUEST_TYPE,
+ ieLength,
+ &buffer[0]);
+
+ ieLength = 1;
+
+ if(handoverRequest.channelType.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeChannelType(
+ handoverRequest.channelType,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_MANDATORY_IE_RETURN_CODE(resultCode);
+ }
+ else
+ return A_MANDATORY_IE_MISSING;
+
+ if(handoverRequest.encryptionInformation.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeEncryptInformation(
+ handoverRequest.encryptionInformation,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_MANDATORY_IE_RETURN_CODE(resultCode);
+ }
+ else
+ return A_MANDATORY_IE_MISSING;
+
+ if(handoverRequest.classmarkInformation1.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeClassmarkInformation1(
+ handoverRequest.classmarkInformation1,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_MANDATORY_IE_RETURN_CODE(resultCode);
+ }
+ else
+ if(handoverRequest.classmarkInformation2.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeClassmarkInformation2(
+ handoverRequest.classmarkInformation2,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_MANDATORY_IE_RETURN_CODE(resultCode);
+ }
+ else
+ return A_MANDATORY_IE_MISSING;
+
+ if(handoverRequest.cellIdentifierServing.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeCellIdentifier(
+ handoverRequest.cellIdentifierServing,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_MANDATORY_IE_RETURN_CODE(resultCode);
+ }
+ else
+ return A_MANDATORY_IE_MISSING;
+
+ if(handoverRequest.priority.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodePriority(
+ handoverRequest.priority,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequest.circuitIdentityCode.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeCircuitIdentityCode(
+ handoverRequest.circuitIdentityCode,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequest.downlinkDTXFlag.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeDownlinkDTXFlag(
+ handoverRequest.downlinkDTXFlag,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequest.cellIdentifierTarget.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeCellIdentifier(
+ handoverRequest.cellIdentifierTarget,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_MANDATORY_IE_RETURN_CODE(resultCode);
+ }
+ else
+ return A_MANDATORY_IE_MISSING;
+
+ if(handoverRequest.interferenceBandToBeUsed.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeInterferenceBandToBeUsed(
+ handoverRequest.interferenceBandToBeUsed,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequest.cause.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeCause(
+ handoverRequest.cause,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequest.classmarkInformation3.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeClassmarkInformation3(
+ handoverRequest.classmarkInformation3,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequest.currentChannelType1.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeCurrentChannelType1(
+ handoverRequest.currentChannelType1,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequest.speechVersionUsed.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeSpeechVersion(
+ handoverRequest.speechVersionUsed,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequest.groupCallReference.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeGroupCallReference(
+ handoverRequest.groupCallReference,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequest.talkerFlag.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeTalkerFlag(
+ handoverRequest.talkerFlag,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequest.configEvolIndication.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeConfigEvolutionIndication(
+ handoverRequest.configEvolIndication,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequest.chosenEncryptAlgorithmServing.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeChosenEncryptAlorithm(
+ handoverRequest.chosenEncryptAlgorithmServing,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ if(handoverRequest.oldBSSToNewBSSInfo.ie_present)
+ {
+ if(length <= bufferIndex)
+ {
+ return A_INCORRECT_LENGTH;
+ }
+ resultCode = A_EncodeBssToNewBssInfo(
+ handoverRequest.oldBSSToNewBSSInfo,
+ ieLength,
+ &buffer[bufferIndex]);
+ bufferIndex += ieLength;
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ }
+
+ length = bufferIndex;
+
+ return A_RESULT_SUCCESS;
+}
+
+A_Result_t
+A_DecodeHandoverRequest(
+ unsigned char *buffer,
+ int length,
+ A_Handover_Request_t &handoverRequest
+ )
+{
+ if(length < 12)
+ {
+ return A_MANDATORY_IE_MISSING;
+ }
+
+ A_Result_t resultCode;
+ int ieLength = 0;
+ int bufferIndex = 0;
+
+ resultCode = A_DecodeChannelType(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.channelType);
+
+ A_CHECK_MANDATORY_IE_RETURN_CODE(resultCode);
+
+ bufferIndex += ieLength;
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_ENCRYPTION_INFORMATION_TYPE))
+ {
+ resultCode = A_DecodeEncryptInformation(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.encryptionInformation);
+
+ A_CHECK_MANDATORY_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+ else
+ return A_MANDATORY_IE_MISSING;
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CLASSMARK_INFORMATION1_TYPE))
+ {
+ resultCode = A_DecodeClassmarkInformation1(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.classmarkInformation1);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ } else
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CLASSMARK_INFORMATION2_TYPE))
+ {
+ resultCode = A_DecodeClassmarkInformation2(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.classmarkInformation2);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+ else
+ return A_MANDATORY_IE_MISSING;
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CELL_IDENTIFIER_TYPE))
+ {
+ resultCode = A_DecodeCellIdentifier(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.cellIdentifierServing);
+
+ A_CHECK_MANDATORY_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+ else
+ return A_MANDATORY_IE_MISSING;
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_PRIORITY_TYPE))
+ {
+ resultCode = A_DecodePriority(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.priority);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CIRCUIT_IDENTITY_CODE_TYPE))
+ {
+ resultCode = A_DecodeCircuitIdentityCode(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.circuitIdentityCode);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_DOWNLINK_DTX_FLAG_TYPE))
+ {
+ resultCode = A_DecodeDownlinkDTXFlag(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.downlinkDTXFlag);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CELL_IDENTIFIER_TYPE))
+ {
+ resultCode = A_DecodeCellIdentifier(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.cellIdentifierTarget);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_INTERFERENCE_BAND_TO_BE_USED_TYPE))
+ {
+ resultCode = A_DecodeInterferenceBandToBeUsed(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.interferenceBandToBeUsed);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CAUSE_TYPE))
+ {
+ resultCode = A_DecodeCause(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.cause);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CLASSMARK_INFORMATION3_TYPE))
+ {
+ resultCode = A_DecodeClassmarkInformation3(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.classmarkInformation3);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CURRENT_CHANNEL_TYPE1_TYPE))
+ {
+ resultCode = A_DecodeCurrentChannelType1(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.currentChannelType1);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_SPEECH_VERSION_TYPE))
+ {
+ resultCode = A_DecodeSpeechVersion(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.speechVersionUsed);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_GROUP_CALL_REFERENCE_TYPE))
+ {
+ resultCode = A_DecodeGroupCallReference(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.groupCallReference);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_TALKER_FLAG_TYPE))
+ {
+ resultCode = A_DecodeTalkerFlag(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.talkerFlag);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CONFIGURATION_EVOLUTION_INDICATION))
+ {
+ resultCode = A_DecodeConfigEvolutionIndication(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.configEvolIndication);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_CHOSEN_ENCRYPTION_ALGORITHM_TYPE))
+ {
+ resultCode = A_DecodeChosenEncryptAlorithm(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.chosenEncryptAlgorithmServing);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ if((length > bufferIndex) &&
+ (buffer[bufferIndex] == A_OLD_BSS_TO_NEW_BSS_INFORMATION_TYPE))
+ {
+ resultCode = A_DecodeBssToNewBssInfo(
+ &buffer[bufferIndex],
+ ieLength,
+ handoverRequest.oldBSSToNewBSSInfo);
+
+ A_CHECK_OPTIONAL_IE_RETURN_CODE(resultCode);
+ bufferIndex += ieLength;
+ }
+
+ return A_RESULT_SUCCESS;
+}
diff --git a/data/mnet/GP10/Host/cc/src/CCBldMSMsg.cpp b/data/mnet/GP10/Host/cc/src/CCBldMSMsg.cpp
new file mode 100644
index 0000000..f8e6387
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCBldMSMsg.cpp
@@ -0,0 +1,523 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCBldMSMsg.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+// included VxWorks headers
+#include "vxWorks.h"
+
+#include "JCC/JCCLog.h"
+#include "Logging/VCLOGGING.h"
+
+// included L3 Message header for messages from other Layer 3 modules (CC, RR)
+#include "JCC/JCCL3Msg.h"
+
+#include "CC/CCHalfCall.h"
+
+#include "CC/CCSessionHandler.h"
+
+#include "ril3/ril3_common.h"
+
+#include "ril3/ril3md.h"
+
+#include "pm/pm_class.h"
+
+#include "CC/CallLeg.h"
+
+void
+CCHalfCall::buildMSMsgCommon()
+{
+ // But, before we start populating the message content,
+ // zap it clean first.
+ DBG_FUNC("CCHalfCall::buildMSMsgCommon", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ CNI_RIL3_ZAPMSG(&msOutMsg, sizeof(T_CNI_RIL3CC_MSG));
+
+ // header portion --------------------------------------------------
+ msOutMsg.header.protocol_descriminator = CNI_RIL3_PD_CC;
+ msOutMsg.header.si_ti = ti;
+ DBG_LEAVE();
+}
+
+T_CNI_RIL3_RESULT
+CCHalfCall::buildMSMsg(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+
+ DBG_FUNC("CCHalfCall::buildMSMsg", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // call the Encoder function to encode the message
+ msOutResult = CNI_RIL3CC_Encode(&msOutMsg, // input message definition
+ msEncodedMsg // encoded layer-3 message
+ );
+
+ // check the encoding result before sending the message
+ if (msOutResult != CNI_RIL3_RESULT_SUCCESS)
+ {
+ JCCLog1("CC Error : Encoding MS Message (Problem = %d) \n ",
+ msOutResult);
+ DBG_ERROR("CC Error : Encoding MS Message (Problem = %d) \n ",
+ msOutResult);
+ }
+ else
+ {
+ // encoding successful, send the message to LAPDm for delivery
+ parent->parent->sendL2Msg(msEncodedMsg);
+
+ JCCLog1("CC Call Log: Sent Message to LAPDm, (Message Type = %d)\n",
+ msOutMsg.header.message_type);
+ DBG_TRACE("CC Call Log: Sent Message to LAPDm, (Message Type = %d)\n",
+ msOutMsg.header.message_type);
+
+ }
+
+ DBG_LEAVE();
+ return (msOutResult);
+}
+
+T_CNI_RIL3_RESULT
+CCHalfCall::buildStartDtmfAck(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ T_CNI_RIL3CC_MSG_START_DTMF_ACK
+ *startDTMFAck
+ = &msOutMsg.startDTMFAck ;
+
+ DBG_FUNC("CCHalfCall::buildStartDtmfAck", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_START_DTMF_ACKNOWLEDGE;
+ startDTMFAck->keypadFacility = currKeypadFacility_;
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+}
+
+T_CNI_RIL3_RESULT
+CCHalfCall::buildStartDtmfRej(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ T_CNI_RIL3CC_MSG_START_DTMF_REJECT
+ *startDTMFReject
+ = &msOutMsg.startDTMFReject ;
+
+ DBG_FUNC("CCHalfCall::buildStartDtmfRej", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_START_DTMF_REJECT;
+
+ // Worry about exact reason later!
+ startDTMFReject->cause = rlsCause;
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+}
+
+T_CNI_RIL3_RESULT
+CCHalfCall::buildStopDtmfAck(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ T_CNI_RIL3CC_MSG_STOP_DTMF_ACK
+ *stopDTMFAck
+ = &msOutMsg.stopDTMFAck ;
+
+ DBG_FUNC("CCHalfCall::buildStopDtmfAck", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_STOP_DTMF_ACKNOWLEDGE;
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+}
+
+T_CNI_RIL3_RESULT
+CCHalfCall::buildAlerting(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ T_CNI_RIL3CC_MSG_ALERTING
+ *alerting
+ = &msOutMsg.alerting ;
+
+ DBG_FUNC("CCHalfCall::buildAlerting", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_ALERTING;
+
+ //Test Code
+ //msOutMsg.alerting.progressInd = h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE;
+ DBG_TRACE("CC CALL LOG: progressIE info exist(%d) codingStd(%d) loc(%d) desc(%d)\n",
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.ie_present,
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.codingStandard,
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.location,
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.progressDesp);
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+}
+
+
+T_CNI_RIL3_RESULT
+CCHalfCall::buildProgress(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ T_CNI_RIL3CC_MSG_PROGRESS
+ *progress
+ = &msOutMsg.progress ;
+
+ DBG_FUNC("CCHalfCall::buildProgress", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ //Test Code
+ DBG_TRACE("CC CALL LOG: buildProgress progress IE info exist(%d) codingStd(%d) loc(%d) desc(%d)\n",
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.ie_present,
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.codingStandard,
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.location,
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.progressDesp);
+
+ buildMSMsgCommon();
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_PROGRESS;
+ msOutMsg.progress.progressInd = h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE;
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+}
+
+T_CNI_RIL3_RESULT
+CCHalfCall::buildCallProceeding(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ T_CNI_RIL3CC_MSG_CALL_PROCEEDING
+ *callProceeding
+ = &msOutMsg.callProceeding ;
+
+ DBG_FUNC("CCHalfCall::buildCallProceeding", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_CALL_PROCEEDING;
+
+ // Add Bearer Capability standard one from the local variable.
+ callProceeding->bearCap1 = bearerCap;
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+}
+
+T_CNI_RIL3_RESULT
+CCHalfCall::buildConnect(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ T_CNI_RIL3CC_MSG_CONNECT
+ *connect
+ = &msOutMsg.connect;
+
+ DBG_FUNC("CCHalfCall::buildConnect", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_CONNECT;
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+}
+
+T_CNI_RIL3_RESULT
+CCHalfCall::buildConnectAck(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ DBG_FUNC("CCHalfCall::buildConnectAck", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ // No IEs in this message other than header.
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_CONNECT_ACKNOWLEDGE;
+
+ // peg
+ PM_CCMeasurement.ansMobileTerminatingCalls.increment();
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+}
+
+T_CNI_RIL3_RESULT
+CCHalfCall::buildDisconnect(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ T_CNI_RIL3CC_MSG_DISCONNECT
+ *disconnect
+ = &msOutMsg.disconnect ;
+
+ DBG_FUNC("CCHalfCall::buildDisconnect", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_DISCONNECT;
+
+ disconnect->cause = rlsCause;
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+}
+
+T_CNI_RIL3_RESULT
+CCHalfCall::buildReleaseComplete(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ T_CNI_RIL3CC_MSG_RELEASE_COMPLETE
+ *releaseComplete
+ = &msOutMsg.releaseComplete;
+
+ DBG_FUNC("CCHalfCall::buildReleaseComplete", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type =CNI_RIL3CC_MSGID_RELEASE_COMPLETE;
+
+ releaseComplete->cause = rlsCause;
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+}
+
+T_CNI_RIL3_RESULT
+CCHalfCall::buildReleaseReq(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ T_CNI_RIL3CC_MSG_RELEASE
+ *release
+ = &msOutMsg.release ;
+
+ DBG_FUNC("CCHalfCall::buildReleaseReq", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_RELEASE;
+
+ release->cause = rlsCause;
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+}
+
+T_CNI_RIL3_RESULT
+CCHalfCall::buildSetup(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ T_CNI_RIL3CC_MSG_SETUP
+ *setup
+ = &msOutMsg.setup ;
+
+ DBG_FUNC("CCHalfCall::buildSetup", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_SETUP;
+
+ // Add Bearer Capability standard one from the local variable.
+ setup->bearCap1 = bearerCap;
+
+ setup->callingBCD = callingPartyNum;
+
+ if(parent->waitingCallLeg)
+ {
+ // Add signal Information Element
+ setup->signal.ie_present = true;
+ setup->signal.signalValue = CNI_RIL3_SIGNAL_CALL_WAITING_TONE_ON;
+ }
+
+ // peg
+ PM_CCMeasurement.attMobileTerminatingCalls.increment();
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+}
+
+
+//CH<xxu:11-10-99>
+T_CNI_RIL3_RESULT
+CCHalfCall::buildHoldAck(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ DBG_FUNC("CCHalfCall::buildHoldAck", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_HOLD_ACKNOWLEDGE;
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+
+}
+
+//CH<xxu:11-10-99>
+T_CNI_RIL3_RESULT
+CCHalfCall::buildRetvAck(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ DBG_FUNC("CCHalfCall::buildRetvAck", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_RETRIEVE_ACKNOWLEDGE;
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+
+}
+
+//CH<xxu:11-10-99>
+T_CNI_RIL3_RESULT
+CCHalfCall::buildHoldRej(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ T_CNI_RIL3CC_MSG_HOLD_REJECT
+ *holdReject
+ = &msOutMsg.holdReject ;
+
+ DBG_FUNC("CCHalfCall::buildHoldRej", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_HOLD_REJECT;
+
+ //Mandatory IE: cause
+ holdReject->cause.ie_present = true;
+ holdReject->cause.codingStandard = CNI_RIL3_GSMPLMN_CODING;
+ holdReject->cause.location =CNI_RIL3_LOCATION_PRIVATE_NETWORK_LOCAL_USER;
+ holdReject->cause.causeValue = chCause_;
+ holdReject->cause.diagnosticsLength = 0;
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+}
+
+//CH<xxu:11-10-99>
+T_CNI_RIL3_RESULT
+CCHalfCall::buildRetvRej(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ T_CNI_RIL3CC_MSG_RETRIEVE_REJECT
+ *retvReject
+ = &msOutMsg.retrieveReject;
+
+ DBG_FUNC("CCHalfCall::buildRetvRej", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_RETRIEVE_REJECT;
+
+ //Mandatory IE: cause
+ retvReject->cause.ie_present = true;
+ retvReject->cause.codingStandard = CNI_RIL3_GSMPLMN_CODING;
+ retvReject->cause.location =CNI_RIL3_LOCATION_PRIVATE_NETWORK_LOCAL_USER;
+ retvReject->cause.causeValue = chCause_;
+ retvReject->cause.diagnosticsLength = 0;
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+
+}
+
+T_CNI_RIL3_RESULT
+CCHalfCall::buildStatusInfo(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ T_CNI_RIL3CC_MSG_STATUS
+ *statusMsg
+ = &msOutMsg.status;
+
+ DBG_FUNC("CCHalfCall::buildStatusInfo", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ buildMSMsgCommon();
+
+ msOutMsg.header.message_type = CNI_RIL3CC_MSGID_STATUS;
+
+ // Mandatory IE: cause
+ statusMsg->cause = rlsCause;
+ if (msDecodeResult == CNI_RIL3_RESULT_SUCCESS) // not caused by protocol errors
+ {
+ DBG_TRACE("CC Call Log: Response to status enquiry\n");
+ statusMsg->cause.causeValue = CNI_RIL3_CAUSE_RESPONSE_TO_STATUS_ENQUIRY;
+ }
+ else
+ {
+ DBG_TRACE("CC Call Log: status message because of decoding error, (dec.res.=%d)\n",
+ msDecodeResult);
+ }
+
+ // Mandatory IE: call state
+ statusMsg->callState.ie_present = true;
+ statusMsg->callState.codingStandard = CNI_RIL3_GSMPLMN_CODING;
+
+ switch(callState_) {
+ case HC_ST_DISCONNECT_IND:
+ statusMsg->callState.state = CNI_RIL3_CALL_STATE_DISCONNECT_INDICATION;
+ break;
+ case HC_ST_RELEASE_REQ:
+ statusMsg->callState.state = CNI_RIL3_CALL_STATE_RELEASE_REQUEST;
+ break;
+ case HC_ST_ACTIVE:
+ statusMsg->callState.state = CNI_RIL3_CALL_STATE_ACTIVE;
+ break;
+ case THC_ST_MM_CONN_REQ:
+ statusMsg->callState.state = CNI_RIL3_CALL_STATE_MM_CONNECTION_PENDING;
+ break;
+ case THC_ST_CALL_CONFIRMED:
+ statusMsg->callState.state = CNI_RIL3_CALL_STATE_MT_CALL_CONFIRMED;
+ break;
+ case THC_ST_ALERTING:
+ statusMsg->callState.state = CNI_RIL3_CALL_STATE_CALL_RECEIVED;
+ break;
+ case THC_ST_PRESENTING_CALL:
+ statusMsg->callState.state = CNI_RIL3_CALL_STATE_CALL_PRESENT;
+ break;
+ case OHC_ST_CONNECT_INDICATION:
+ statusMsg->callState.state = CNI_RIL3_CALL_STATE_CONNECT_INDICATION;
+ break;
+ case OHC_ST_ANSWER_PENDING:
+ statusMsg->callState.state = CNI_RIL3_CALL_STATE_CALL_DELIVERED;
+ break;
+ case OHC_ST_CALL_PROCEEDING:
+ case OHC_ST_OFFERING_CALL:
+ statusMsg->callState.state = CNI_RIL3_CALL_STATE_MO_CALL_PROCEEDING;
+ break;
+ case HC_ST_NULL:
+ statusMsg->callState.state = CNI_RIL3_CALL_STATE_NULL;
+ break;
+ default:
+ statusMsg->callState.state = CNI_RIL3_CALL_STATE_NULL;
+
+ }
+
+ if (chState_ != CH_ST_IDLE)
+ {
+ statusMsg->auxStates.ie_present = true;
+ statusMsg->auxStates.holdState = (T_CNI_RIL3_HOLD_AUXILIARY_STATES)(chState_ - 1);
+ // Change when multiparty is implemented.
+ statusMsg->auxStates.mptyState = CNI_RIL3_MPTY_STATE_IDLE;
+ }
+
+ DBG_LEAVE();
+ return (buildMSMsg(msEncodedMsg));
+
+}
diff --git a/data/mnet/GP10/Host/cc/src/CCExtHoTrgHnd.cpp b/data/mnet/GP10/Host/cc/src/CCExtHoTrgHnd.cpp
new file mode 100644
index 0000000..ef2ee0e
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCExtHoTrgHnd.cpp
@@ -0,0 +1,3591 @@
+
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCExtHoTrgHnd.cpp
+// Author(s) : Xiaode Xu
+// Create Date : 06-07-01
+// Description : External Handover--Handin&PostHandin trg-GP handlers
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+//
+
+#include "CC/CCHandover.h"
+
+#include "CC/CCSessionHandler.h"
+
+#include "CC/CCUtil.h"
+
+#include "CC/CallConfig.h"
+
+#include "jcc/JCCLog.h"
+#include "logging/VCLOGGING.h"
+
+#include "stdio.h"
+
+// Temporarily use csu_head instead of csu_intf
+#include "csunew/csu_head.h"
+
+#include "CC/hortp.h"
+
+#include "lapdm/cni_debug.h"
+
+#include "pm/pm_class.h"
+
+extern MSG_Q_ID ccMsgQId;
+
+#include "cc/a_handover_common.h"
+#include "voip/vblink.h"
+#include "voip/exchangeho.h"
+
+#define TICKS_PER_10MS (sysClkRateGet()) / 100
+
+extern bool useViperBase;
+extern GlobalCellId_t MY_GLOBALCELL_ID;
+extern INT32 forcedHandover;
+extern INT32 forcedHandmsc3;
+extern GlobalCellId_t ccHoTrgGlobalCellId;
+extern UINT32 ccHoTrgCellIpAddress;
+
+
+extern T_CNI_LAPDM_OID rm_GetOid (T_CNI_IRT_ID entryId, T_CNI_LAPDM_SAPI sapi);
+
+// *******************************************************************
+// forward declarations.
+// *******************************************************************
+int
+CCTargetHandoverExtHo::handleHoaCcMsg(InterHoaVcMsg_t *hoaCcInMsg)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleHoaCcMsg", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ CCHandover::handleHoaCcMsg(hoaCcInMsg);
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+}
+
+int
+CCTargetHandoverExtHo::smHandleEvent(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::smHandleEvent", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ int returnValue = 0;
+
+ if (currEvent != JCC_NULL_EVENT)
+ {
+ currEvent =
+ (this->*extHoTrgHandler[hoState_][currEvent - HAND_SRC_EVENT_BASE])();
+ }
+
+ switch(currEvent)
+ {
+ case CC_RELEASE_CALL:
+ returnValue = ccReleaseCall();
+ break;
+
+ case CC_RELEASE_OWN:
+ returnValue = ccReleaseOwn();
+ break;
+
+ case CC_RELEASE_GP_HO:
+ ccReleaseGpHo();
+ break;
+
+ case CC_RELEASE_GP_HB:
+ ccReleaseGpHb();
+ break;
+
+ case CC_RELEASE_GP_H3:
+ ccReleaseGpH3();
+ break;
+
+ case CC_RELEASE_EH_HB:
+ ccReleaseEhHb();
+ break;
+
+ case CC_RELEASE_GP_EH_HB:
+ ccReleaseGpEhHb();
+ break;
+
+ case CC_MESSAGE_PROCESSING_COMPLT:
+ case JCC_NULL_EVENT:
+ // Do Nothing
+ break;
+
+ default:
+ DBG_ERROR("{\nMNETeiTRACE(etgt::smHandleEvent): Got Bad Event (event=%d, hoState=%d, callId=%d)\n}\n",
+ currEvent, hoState_, callIndex);
+ break;
+ }
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::smHandleEvent): Event Handled (event=%d, currEvent=%d)\n}\n",
+ currEvent, returnValue);
+
+ DBG_LEAVE();
+ return(returnValue);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleAnchToTrgPerfHoReq(void)
+{
+ int i;
+ A_Result_t result;
+ bool found = false;
+ T_CNI_RIL3_SPEECH_VERSION speechVer;
+ int choosenEncryption;
+
+ DBG_FUNC("CCTargetHandoverExtHo::handleAnchToTrgPerfHoReq", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ //Copy the Anchor information.
+ hoAgId_ = hoaInMsg->origSubId;
+ hoNumber_ = hoaInMsg->msgData.perfExtHandoverReq.handoverNumber;
+
+ DBG_CALL_TRACE(hoaInMsg->origSubId, "{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHoReq): [<==HOA PERFORM_HANDOVER_REQ] (hoAgId=%d, callId=%d)\n}\n",
+ hoaInMsg->origSubId, hoaInMsg->destSubId);
+
+ //Decode A-interface message
+ memset( (char*)&aifMsg, 0, sizeof(T_AIF_MSG));
+
+ if ( A_RESULT_SUCCESS != (result=
+ AIF_Decode((T_AIF_MessageUnit*)&(hoaInMsg->msgData.perfExtHandoverReq.A_HANDOVER_REQUEST), &aifMsg)) )
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleAnchToTrgPerfHoReq): A-MSG decoding err (err=%d, hoAgId_=%d)\nA-MSG:\n",
+ result, hoAgId_);
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHoReq) Received A-HANDOVER_REQ DUMP (length=%d): \n",
+ hoaInMsg->msgData.perfExtHandoverReq.A_HANDOVER_REQUEST.msglength);
+
+ DBG_HEXDUMP(
+ (unsigned char*)hoaInMsg->msgData.perfExtHandoverReq.A_HANDOVER_REQUEST.A_INTERFACE_DATA,
+ (int)hoaInMsg->msgData.perfExtHandoverReq.A_HANDOVER_REQUEST.msglength
+ );
+ DBG_TRACE("\n END-OF-DUMP\n}\n");
+
+ DBG_ERROR("\n}\n");
+
+ //remember reason
+ hoEndCause_ = MC_HO_UNEXPECTED_DATA_VALUE; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHoReq) Received A-INTERFACE-MSG DUMP (length=%d): \n",
+ hoaInMsg->msgData.perfExtHandoverReq.A_HANDOVER_REQUEST.msglength);
+ DBG_HEXDUMP(
+ (unsigned char*)hoaInMsg->msgData.perfExtHandoverReq.A_HANDOVER_REQUEST.A_INTERFACE_DATA,
+ (int)hoaInMsg->msgData.perfExtHandoverReq.A_HANDOVER_REQUEST.msglength
+ );
+ DBG_TRACE("\n END-OF-DUMP\n}\n");
+
+ if (aifMsg.msgType != A_HANDOVER_REQUEST_TYPE)
+ {
+ //Unexpected A-MSG received, ignore but report
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleAnchToTrgPerfHoReq): unexpected A-MSG (msgType=%d,hoState_=%d)\n}\n",
+ aifMsg.msgType, hoState_);
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ //Build a message sent to MM for Handover Req. Only allow voice handover now
+ A_Handover_Request_t *pRequest = (A_Handover_Request_t*)&aifMsg.handoverRequest;
+
+ //Check if a good Current Channel IE contained in the A-MESSAGE
+ if ( (pRequest->channelType.speechDataIndicator != 1) || //1-speech
+ (pRequest->channelType.channelRateAndType != 8) ) //8-TCH F
+ {
+ DBG_WARNING("{\nMNETeiWARNING(etrg::handleAnchToTrgPerfHoReq): bad currChannel IE (iePresent=%d, speechDataIndicator=%d, channelRateAndType=%d)\n}\n",
+ pRequest->channelType.ie_present,
+ pRequest->channelType.speechDataIndicator,
+ pRequest->channelType.channelRateAndType);
+
+ hoEndCause_ = MC_HO_UNEXPECTED_DATA_VALUE; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+////Check if a good Speech Version (used) IE contained in the A-MESSAGE
+//if ( !(pRequest->speechVersionUsed.ie_present) ||
+// !( (pRequest->speechVersionUsed.speechVersionId == 0x01) || //FR
+// (pRequest->speechVersionUsed.speechVersionId == 0x21) ) ) //EFR
+//{
+// DBG_WARNING("{\nMNETeiWARNING(etrg::handleAnchToTrgPerfHoReq): bad speechVersionUsed IE (iePresent=%d, speechVerison=%x)\n}\n",
+// pRequest->speechVersionUsed.ie_present,
+// pRequest->speechVersionUsed.speechVersionId);
+//
+// hoEndCause_ = MC_HO_UNEXPECTED_DATA_VALUE; //EHOcause
+
+// DBG_LEAVE();
+// return (CC_RELEASE_CALL);
+//}
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHoReq) MESSAGE DATA:\n");
+ DBG_TRACE(" : hoAgId_=%d, callId=%d\n",hoAgId_, callIndex);
+ DBG_TRACE(" : hoGlobalCellId_ (type=%d, mcc[1-3]:%x,%x,%x; mnc[1-3]:%x,%x,%x;lac=%x,ci=%x)\n",
+ hoGlobalCellId_.ci_disc,hoGlobalCellId_.mcc[0],hoGlobalCellId_.mcc[1],hoGlobalCellId_.mcc[2],
+ hoGlobalCellId_.mnc[0],hoGlobalCellId_.mnc[1],hoGlobalCellId_.mnc[2],hoGlobalCellId_.lac,hoGlobalCellId_.ci);
+ DBG_TRACE(" : hoNumber_ (present=%d,numberType=%d,numberingPlan=%d,numDigits=%d)\n",
+ hoNumber_.ie_present,hoNumber_.numberType,hoNumber_.numberingPlan,hoNumber_.numDigits);
+ DBG_TRACE(" (digits[1-10]:%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x)\n",
+ hoNumber_.digits[0],hoNumber_.digits[1],hoNumber_.digits[1],
+ hoNumber_.digits[3],hoNumber_.digits[4],hoNumber_.digits[5],
+ hoNumber_.digits[6],hoNumber_.digits[7],hoNumber_.digits[8],
+ hoNumber_.digits[9],hoNumber_.digits[10]);
+ DBG_TRACE("\n : Handover Number Hex Dump:\n");
+ DBG_HEXDUMP( (unsigned char*) &hoNumber_, sizeof(T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER));
+ DBG_TRACE("\n");
+ DBG_TRACE(" : speechDataIndicator=%d, channelRateAndType=%d, permittedIndicator[0-7]=%x,%x,%x,%x,%x,%x,%x,%x\n",
+ pRequest->channelType.speechDataIndicator,
+ pRequest->channelType.channelRateAndType,
+ pRequest->channelType.permittedIndicator[0],
+ pRequest->channelType.permittedIndicator[1],
+ pRequest->channelType.permittedIndicator[2],
+ pRequest->channelType.permittedIndicator[3],
+ pRequest->channelType.permittedIndicator[4],
+ pRequest->channelType.permittedIndicator[5],
+ pRequest->channelType.permittedIndicator[6],
+ pRequest->channelType.permittedIndicator[7]);
+
+ DBG_TRACE(" : ciphData (ciphAlog=%d, ciphKey[1-8]: %x,%x,%x,%x,%x,%x,%x,%x)\n}\n",
+ pRequest->encryptionInformation.permittedAlgorithm,
+ pRequest->encryptionInformation.key[0],
+ pRequest->encryptionInformation.key[1],
+ pRequest->encryptionInformation.key[2],
+ pRequest->encryptionInformation.key[3],
+ pRequest->encryptionInformation.key[4],
+ pRequest->encryptionInformation.key[5],
+ pRequest->encryptionInformation.key[6],
+ pRequest->encryptionInformation.key[7]);
+
+ // Store requested encryption and channel type info for negotiation
+ reqEncrypt_ = pRequest->encryptionInformation;
+ reqChannelType_ = pRequest->channelType;
+
+ // Negotiate encryption
+ choosenEncryption = selectEncryption();
+
+ if (choosenEncryption == -1)
+ {
+ currEncrypt_.cmd.cipherModeSetting.ciphering = CNI_RIl3_CIPHER_NO_CIPHERING;
+ }
+ else
+ {
+ currEncrypt_.cmd.cipherModeSetting.ciphering = CNI_RIl3_CIPHER_START_CIPHERING;
+ currEncrypt_.cmd.cipherModeSetting.algorithm = (T_CNI_RIL3_CIPHER_ALGORITHM) choosenEncryption;
+
+ memcpy( (unsigned char*) currEncrypt_.Kc, (unsigned char*) pRequest->encryptionInformation.key, 8);
+ }
+
+ // Negotiate codec
+ speechVer = (T_CNI_RIL3_SPEECH_VERSION) selectChannelType();
+
+ if (speechVer == -1)
+ {
+ DBG_WARNING("{\nMNETeiWARNING(etrg::handleAnchToTrgPerfHoReq): bad currChannel IE (permittedIndicator[0-7]=%x,%x,%x,%x,%x,%x,%x.%x)\n}\n",
+ pRequest->channelType.permittedIndicator[0],
+ pRequest->channelType.permittedIndicator[1],
+ pRequest->channelType.permittedIndicator[2],
+ pRequest->channelType.permittedIndicator[3],
+ pRequest->channelType.permittedIndicator[4],
+ pRequest->channelType.permittedIndicator[5],
+ pRequest->channelType.permittedIndicator[6],
+ pRequest->channelType.permittedIndicator[7]);
+
+ hoEndCause_ = MC_HO_UNEXPECTED_DATA_VALUE; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ currSpeechCh_.version = speechVer;
+ currChannel_.bearerType = BEARER_SPEECH;
+ currChannel_.speechChann.version = speechVer;
+ currClassmark_ = pRequest->classmarkInformation2;
+
+ memcpy( (unsigned char*) &(mmOutMsg.l3_data.handReq.cipherCmd), (unsigned char*) &currEncrypt_,
+ sizeof(IntraL3CipherModeCommand_t) );
+ mmOutMsg.l3_data.handReq.channelType = currChannel_;
+ mmOutMsg.l3_data.handReq.qid = msgQId;
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHoReq): [==>MM MM_EST_REQ] (hoAgId_=%d, callId=%d)\n}\n",
+ hoAgId_, callIndex);
+
+ // Send internal MM msg -
+ sendMM(INTRA_L3_MM_EST_REQ, INTRA_L3_RR_HANDOVER_REQ, parent->entryId, &mmOutMsg);
+
+ hoState_ = HAND_ST_TRG_RCV_HO_REQ;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgHoReqAck(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgHoReqAck", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ T_CNI_L3_ID newId;
+ newId.msgq_id = msgQId;
+ newId.sub_id = 0; // No sub id needed here
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgHoReqAck): [<==MM MM_EST_CNF] (hoAgId=%d,callIndex=%d,entryId=%d)\n}\n",
+ hoAgId_, callIndex, mmInMsg->entry_id);
+
+ // <Igal 1-6-00> Updated to standard IRT setup
+ if (parent->setIrt(mmInMsg->entry_id, newId) == false)
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoReqAck): setIrt API failed for (entryId=%d)\n}\n",
+ mmInMsg->entry_id);
+
+ hoEndCause_ = MC_HO_SYSTEM_FAILURE; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ // GET OID AND SAPI
+ T_CNI_RIL3_IRT_ENTRY irtEntry;
+ irtEntry.entry_id = mmInMsg->entry_id;
+
+ if ( (CNI_RIL3_IRT_Get_Entry_by_Entry_ID(&irtEntry))
+ == false )
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoReqAck): getIrt API failed for entryId=%d)\n}\n",
+ mmInMsg->entry_id);
+
+ hoEndCause_ = MC_HO_SYSTEM_FAILURE; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ // Setup the entry id, oid, and sapi
+ parent->entryId = mmInMsg->entry_id;
+ parent->oid = irtEntry.lapdm_oid;
+
+ //Populate data for encoding A-HANDOVER-ACKNOWLEDGE message
+ A_Handover_Request_Ack_t *pRequestAck = (A_Handover_Request_Ack_t*) &aifMsg.handoverRequestAck;
+
+ memset((char*) &aifMsg,0,sizeof(T_AIF_MSG));
+
+ //Mandatory IEs
+ pRequestAck->msgType = A_HANDOVER_REQUEST_ACK_TYPE;
+ pRequestAck->layer3Information.ie_present = true;
+ pRequestAck->layer3Information.elementIdentifier = 0x17; //layer3Information-IEI
+ pRequestAck->layer3Information.length = (unsigned char) mmInMsg->l3_data.handReqAck.handCmd.msgLength;
+ memcpy((char*)pRequestAck->layer3Information.layer3Info,
+ (char*)mmInMsg->l3_data.handReqAck.handCmd.buffer,
+ (int) mmInMsg->l3_data.handReqAck.handCmd.msgLength);
+
+ //Optional IEs
+ pRequestAck->chosenChannel.ie_present = true;
+ pRequestAck->chosenChannel.elementIdentifier = 0x21; //chosen channel-IEI
+ pRequestAck->chosenChannel.channelMode = 9; //speech (full/half)
+ pRequestAck->chosenChannel.channel = 4; //1-TCH full
+
+ pRequestAck->speechVersionChosen.ie_present = true;
+ pRequestAck->speechVersionChosen.elementIdentifier= 0x40;//speechVersionChosen-IEI
+ if (currSpeechCh_.version == 0)
+ pRequestAck->speechVersionChosen.speechVersionId = 0x01;
+ else if (currSpeechCh_.version == 2)
+ pRequestAck->speechVersionChosen.speechVersionId = 0x21;
+ else
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoReqAck): CC Internal error (speechVer=%d)\n\n}\n",
+ currSpeechCh_.version);
+
+ hoEndCause_ = MC_HO_SYSTEM_FAILURE; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ pRequestAck->chosenEncryptAlgorithm.ie_present = true;
+ pRequestAck->chosenEncryptAlgorithm.elementIdentifier = 0x2c;
+ if (currEncrypt_.cmd.cipherModeSetting.ciphering == CNI_RIl3_CIPHER_NO_CIPHERING)
+ {
+ pRequestAck->chosenEncryptAlgorithm.algorithmId = 0x01; //no encryption used
+ } else if (currEncrypt_.cmd.cipherModeSetting.algorithm == CNI_RIL3_CIPHER_ALGORITHM_A51)
+ {
+ pRequestAck->chosenEncryptAlgorithm.algorithmId = 0x02; //A51 used
+ } else if (currEncrypt_.cmd.cipherModeSetting.algorithm == CNI_RIL3_CIPHER_ALGORITHM_A52)
+ {
+ pRequestAck->chosenEncryptAlgorithm.algorithmId = 0x03; //A52 used
+ } else
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoReqAck): CC Internal error (ciphSetting=%d, ciphAlgo=%d)\n\n}\n",
+ currEncrypt_.cmd.cipherModeSetting.ciphering,
+ currEncrypt_.cmd.cipherModeSetting.algorithm);
+
+ hoEndCause_ = MC_HO_SYSTEM_FAILURE; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ //Encode A-MSG: HANDOVER REQUEST ACKNOWLEDGE
+ A_Result_t result;
+ NonStdRasMessagePerformHandoverAck_t requestAck;
+
+ memset( (char*) &requestAck, 0, sizeof(NonStdRasMessagePerformHandoverAck_t) );
+ if ( A_RESULT_SUCCESS != (result=
+ AIF_Encode(&aifMsg, (T_AIF_MessageUnit*)&requestAck.A_INTERFACE_MSG) ) )
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoReqAck): A-HANDOVER-REQUEST-ACKNOWLEDGE encoding failed (result=%d)\n\n}\n",
+ result);
+
+ hoEndCause_ = MC_HO_SYSTEM_FAILURE; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgHoReqAck) Received A-HANDOVER-REQ-ACK DUMP (length=%d): \n",
+ requestAck.A_INTERFACE_MSG.msglength);
+ DBG_HEXDUMP(
+ (unsigned char*)requestAck.A_INTERFACE_MSG.A_INTERFACE_DATA,
+ (int) requestAck.A_INTERFACE_MSG.msglength
+ );
+ DBG_TRACE("\n END-OF-DUMP\n}\n");
+
+ //Send PERFORM-HANDOVER-ACK (positive) to HOA
+ requestAck.reason = 0;
+ requestAck.header.origSubId = callIndex;
+ requestAck.header.destSubId = hoAgId_;
+
+ if (!VBLinkPerformHandoverAck(&requestAck))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoReqAck): VBLinkPerformHandoverAck API failed !\n",
+ result);
+ DBG_HEXDUMP(
+ (unsigned char*) &requestAck,
+ (int) (requestAck.A_INTERFACE_MSG.msglength+6)
+ );
+
+ DBG_ERROR("}\n");
+
+ hoEndCause_ = MC_HO_SYSTEM_FAILURE; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgHoReqAck): [==>HOA PERFORM_HANDOVER_ACK(p)] (hoAgId=%d,callIndex=%d,entryId=%d)\n}\n",
+ hoAgId_, callIndex, mmInMsg->entry_id);
+
+ //start the T204 timer
+ parent->sessionTimer->setTimer(5000); // CALL_HAND_TRG_T204
+ DBG_CALL_TRACE(hoAgId_, "\nMNETeiTRACE(etrg::handleTrgHoReqAck): [<==CC START TIMER T204] (hoAgId=%d, callId=%d, T204=%d msec)\n}\n",
+ hoAgId_, callIndex, (int)CALL_HAND_TRG_T204/TICKS_PER_10MS);
+
+ hoState_ = HAND_ST_TRG_SND_HO_REQ_ACK;
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgHoReqNack(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgHoReqNack", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_,"{\nMNETeiTRACE(etrg::handleTrgHoReqNack): [<==MM MM_EST_REJ] (hoAgId=%d,callIndex=%d)\n}\n",
+ hoAgId_, callIndex);
+
+ //Populate data for encoding A-HANDOVER-FAILURE message
+ memset(&aifMsg, 0, sizeof(A_Handover_Failure_t));
+
+ A_Handover_Failure_t *pFailure = (A_Handover_Failure_t*) &aifMsg.handoverFailure;
+
+ //Mandatory IEs
+ pFailure->msgType = A_HANDOVER_FAILURE_TYPE;
+ pFailure->cause.ie_present = true;
+ pFailure->cause.elementIdentifier = 0x04; //cause IEI
+ pFailure->cause.length = 1;
+ pFailure->cause.cause = 0x21; //No radio resource available
+
+ //Optional IEs
+
+ //Encode A-MSG: HANDOVER REQUEST ACKNOWLEDGE
+ A_Result_t result;
+ NonStdRasMessagePerformHandoverAck_t requestAck;
+
+ memset( (char*) &requestAck, 0, sizeof(NonStdRasMessagePerformHandoverAck_t) );
+ if ( A_RESULT_SUCCESS != (result=
+ AIF_Encode(&aifMsg, (T_AIF_MessageUnit*)&requestAck.A_INTERFACE_MSG) ) )
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoReqNack): A-HANDOVER-FAILURE encoding failed (result=%d)\n\n}\n",
+ result);
+
+ hoEndCause_ = MC_HO_SYSTEM_FAILURE; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ //Send PERFORM-HANDOVER-ACK (negative) to HOA
+ //requestAck.reason = 1;
+ requestAck.header.origSubId = callIndex;
+ requestAck.header.destSubId = hoAgId_;
+
+ if (!VBLinkPerformHandoverAck(&requestAck))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoReqNack): VBLinkPerformHandoverAck API failed !\n",
+ result);
+ DBG_HEXDUMP(
+ (unsigned char*) &requestAck,
+ (int) (requestAck.A_INTERFACE_MSG.msglength+6)
+ );
+
+ DBG_ERROR("}\n");
+
+ hoEndCause_ = MC_HO_SYSTEM_FAILURE; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etgt::handleTrgHoReqNack): [==>HOA PERFORM_HANDOVER_ACK(n)] (hoAgId=%d,callIndex=%d)\n}\n",
+ hoAgId_, callIndex);
+
+ hoEndCause_ = (HandoverCause_t)0;
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleAnchToTrgEndHandover(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleAnchToTrgEndHandover", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoaInMsg->origSubId, "{\nMNETeiTRACE(etrg::handleAnchToTrgEndHandover): [<==HOA END_HANDOVER] (hoAgId=%d,callId=%d,reason=%d)\n}\n",
+ hoaInMsg->origSubId, hoaInMsg->destSubId,
+ hoaInMsg->msgData.extEndHandover.reason);
+
+ parent->sessionTimer->cancelTimer();
+
+ parent->sessionTimer->cancelTimer();
+
+ DBG_LEAVE();
+ return(CC_RELEASE_OWN);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgMmRelInd(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgMmRelInd", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etgt::handleTrgMmRelInd): [<==MM MM_REL_IND (RSL)] (hoAgId=%d,callId=%d,entryId=%d)\n",
+ hoAgId_, callIndex, parent->entryId);
+
+ //Clean up the on-going handover
+ hoEndCause_ = MC_HO_RLS_FAILURE; //EHOcause
+ parent->setReleaseCause(CNI_RIL3_CAUSE_DESTINATION_OUT_OF_ORDER);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgHoComplt(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgHoComplt", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ //Populate data for encoding A-HANDOVER-COMPLETE message
+ memset(&aifMsg, 0, sizeof(A_Handover_Complete_t));
+
+ A_Handover_Complete_t *pComplete = (A_Handover_Complete_t*) &aifMsg.handoverComplete;
+
+ //Mandatory IEs
+ pComplete->msgType = A_HANDOVER_COMPLETE_TYPE;
+
+ //Optional IEs
+ pComplete->rrCause.ie_present = true;
+ pComplete->rrCause.elementIdentifier = 0x15; //cause IEI
+ pComplete->rrCause.rrCause = 0; //normal event
+
+ //Encode A-MSG: HANDOVER REQUEST ACKNOWLEDGE
+ A_Result_t result;
+ NonStdRasMessageHandoverSuccess_t hoSuccess;
+
+ memset( (char*) &hoSuccess, 0, sizeof(NonStdRasMessageHandoverSuccess_t) );
+ if ( A_RESULT_SUCCESS != (result=
+ AIF_Encode(&aifMsg, (T_AIF_MessageUnit*)&hoSuccess.A_INTERFACE_MSG) ) )
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoComplt): A-HANDOVER-COMPLETE encoding failed (result=%d)\n\n}\n",
+ result);
+
+ hoEndCause_ = MC_HO_SYSTEM_FAILURE; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ //Send HANDOVER-SUCCESS to HOA
+ hoSuccess.header.origSubId = callIndex;
+ hoSuccess.header.destSubId = hoAgId_;
+
+ if (!VBLinkHandoverSuccess(&hoSuccess))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoComplt): VBLinkHandoverSuccess API failed !\n",
+ result);
+ DBG_HEXDUMP(
+ (unsigned char*) &hoSuccess,
+ (int) (hoSuccess.A_INTERFACE_MSG.msglength+4)
+ );
+
+ DBG_ERROR("}\n");
+
+ hoEndCause_ = MC_HO_SYSTEM_FAILURE; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ //Stop T204 if the voice path is connected too
+ if (parent->hoCallVoiceConnected())
+ {
+ parent->sessionTimer->cancelTimer();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etgt::handleTrgHoComplt): [==>HOA HANDOVER-COMPLETE both signaling and voice] (hoAgId=%d,callId=%d,entryId=%d)\n",
+ hoAgId_, callIndex, parent->entryId);
+ DBG_CALL_TRACE(hoAgId_," : [<==CC STOP T204] (hoAgId=%d, callId=%d, T204=%d msec)\n}\n",
+ hoAgId_, callIndex, (int)CALL_HAND_TRG_T204/TICKS_PER_10MS);
+ } else
+ {
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etgt::handleTrgHoComplt): [==>HOA HANDOVER-COMPLETE signaling only] (hoAgId=%d,callId=%d,entryId=%d)\n}\n",
+ hoAgId_, callIndex, parent->entryId);
+ }
+
+ hoState_ = HAND_ST_TRG_HO_COMPLT;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgHoAccess(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgHoAccess", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etgt::handleTrgHoAccess): [<==RM HANDOVER-ACCESS] (hoAgId=%d,callId=%d,entryId=%d)\n}\n",
+ hoAgId_, callIndex, parent->entryId);
+
+ //Populate data for encoding A-HANDOVER-COMPLETE message
+ memset(&aifMsg, 0, sizeof(A_Handover_Detect_t));
+
+ A_Handover_Detect_t *pDetect = (A_Handover_Detect_t*) &aifMsg.handoverDetect;
+
+ //Mandatory IEs
+ pDetect->msgType = A_HANDOVER_DETECT_TYPE;
+
+ //Optional IEs
+
+ //Encode A-MSG: HANDOVER DETECT
+ A_Result_t result;
+ NonStdRasMessageHandoverAccess_t hoAccess;
+
+ memset( (char*) &hoAccess, 0, sizeof(NonStdRasMessageHandoverAccess_t) );
+
+ //Send HANDOVER-ACCESS to HOA
+ hoAccess.header.origSubId = callIndex;
+ hoAccess.header.destSubId = hoAgId_;
+
+ if (!VBLinkHandoverAccess(&hoAccess))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoAccess): VBLinkHandoverAccess API failed !\n",
+ result);
+ DBG_HEXDUMP(
+ (unsigned char*) &hoAccess,
+ (int) (hoAccess.A_INTERFACE_MSG.msglength+4)
+ );
+
+ DBG_ERROR("}\n");
+
+ hoEndCause_ = MC_HO_SYSTEM_FAILURE; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etgt::handleTrgHoAccess): [==>HOA HANDOVER-DETECT] (hoAgId=%d,callId=%d,entryId=%d)\n}\n",
+ hoAgId_, callIndex, parent->entryId);
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+void
+CCTargetHandoverExtHo::sendMMMsgToRemoteCC (IntraL3Msg_t *mmMsg)
+{
+ //Send Response to CM SERVICE REQUEST (either CM SERVICE ACCEPT or REJECT)
+
+ DBG_FUNC("CCTargetHandoverExtHo::sendMMMsgToCC", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::sendMMMsgToRemoteCC): CC Internal Error (hoAgId=%d,callId=%d,hoState=%d,currEvent=%d)\n}\n",
+ hoAgId_,callIndex,hoState_,currEvent);
+ //vcOutMsg.msgType = INTER_VC_CC_POST_HANDOVER_MOB_EVENT ;
+ //vcOutMsg.msgData.postHoMobEventData.intraL3Msg = *mmMsg;
+
+ // Source, Destination
+ //sendVcMsg (MODULE_CC, MODULE_MM);
+
+ DBG_LEAVE();
+}
+
+void
+CCTargetHandoverExtHo::sendMSMsgToAnchorCC(T_CNI_RIL3MD_CCMM_MSG *msInMsg)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::sendMSMsgToAnchorCC", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etgt::sendMSMsgToAnchorCC): [<==L2 MS MESSAGE] (hoAgId=%d,callId=%d,entryId=%d)\n",
+ hoAgId_, callIndex, parent->entryId);
+ DBG_HEXDUMP((unsigned char*) msInMsg->l3_data.buffer, msInMsg->l3_data.msgLength);
+ DBG_CALL_TRACE(hoAgId_, "}\n");
+
+ //Relay the MS message received to HOA
+ NonStdRasMessagePostHandoverMobEvent_t l3msg;
+
+ l3msg.header.origSubId = callIndex;
+ l3msg.header.destSubId = hoAgId_;
+
+ l3msg.LAYER3PDU.LAYER3DATA[0] = 0x01; //DTAP 1st byte of Distribution Data Unit (Discrimination)
+ l3msg.LAYER3PDU.LAYER3DATA[1] = 0x80; //DTAP 2nd byte of Distribution Data Unit (FACCH or SDCCH, SAPI0)
+ l3msg.LAYER3PDU.LAYER3DATA[2] = (unsigned char) msInMsg->l3_data.msgLength; //length of L3 Msg followed
+ memcpy((char*) &l3msg.LAYER3PDU.LAYER3DATA[3], (char*) msInMsg->l3_data.buffer, //body of L3 Msg
+ (int)msInMsg->l3_data.msgLength);
+ l3msg.LAYER3PDU.msglength = (unsigned short) 3 + msInMsg->l3_data.msgLength;
+
+ if (!VBLinkPostHandoverMobEvent(&l3msg))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::sendMSMsgToAnchorCC): VBLinkPostHandoverMobEvent API failed !\n}\n");
+ DBG_HEXDUMP((unsigned char*) &l3msg, l3msg.LAYER3PDU.msglength+2);
+
+ DBG_ERROR("}\n");
+
+ hoEndCause_ = MC_HO_SYSTEM_FAILURE; //EHOcause
+
+ // send END_HANDOVER and RELEASE-HOA to HOA then cleanup self: radio resource, hoCallLeg, context
+ // DBG_LEAVE();
+ // return (CC_RELEASE_CALL);
+
+ return;
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etgt::sendMSMsgToAnchorCC): [==>HOA MS MESSAGE] (hoAgId=%d,callId=%d,entryId=%d)\n",
+ hoAgId_, callIndex);
+ DBG_HEXDUMP((unsigned char*) &l3msg, l3msg.LAYER3PDU.msglength+2);
+ DBG_CALL_TRACE(hoAgId_, "}\n");
+
+ DBG_LEAVE();
+}
+
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgT204TimerExpiry(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgT204TimerExpiry", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etgt::handleTrgT204TimerExpiry): [<==CC T204 FIRED] (hoAgId=%d,callId=%d,entryId=%d)\n",
+ hoAgId_, callIndex, parent->entryId);
+
+ //Clean up the on-going handover
+ hoEndCause_ = MC_HO_T204_TIMEOUT; //EHOcause
+ parent->setReleaseCause(CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+}
+
+
+BOOL
+CCTargetHandoverExtHo::cleanup(BOOL force = FALSE)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::cleanup", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE((unsigned long)hoAgId_, "{\nMNETeiTRACE(etgt::cleanup): [<==CC T204 FIRED] (hoAgId=%d,callId=%d,entryId=%d)\n",
+ hoAgId_, callIndex, parent->entryId);
+
+ //Send END_HANDOVER, RELEASE_HOA to HOA
+ if (hoAgId_ != -1)
+ {
+ NonStdRasMessageEndHandover_t endHandover;
+ endHandover.header.origSubId = callIndex;
+ endHandover.header.destSubId = hoAgId_;
+ endHandover.reason = hoEndCause_;
+
+ if (!VBLinkEndHandover(&endHandover))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::cleanup): VBLinkEndHandover API failed\n}\n");
+ }
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::cleanup): [==>HOA END_HANDOVER (hoAgId=%d, callId=%d, entryId=%d)\n}\n",
+ hoAgId_, callIndex, parent->entryId);
+
+ //NonStdRasMessageReleaseHOA_t relHoa;
+ //relHoa.header.origSubId = callIndex;
+ //relHoa.header.destSubId = hoAgId_;
+
+ //if (!VBLinkReleaseHOA(&relHoa))
+ //{
+ // DBG_ERROR("{\nMNETeiERROR(etrg::cleanup): VBLinkReleaseHOA API failed\n}\n");
+ //}
+
+ //DBG_TRACE("{\nMNETeiTRACE(etrg::cleanup): [==>HOA RELEASE_HANDOVER_AGENT (hoAgId=%d, callId=%d, entryId=%d)\n}\n",
+ // hoAgId_, callIndex, parent->entryId);
+ }
+
+ initData();
+
+ DBG_LEAVE();
+ return(true);
+
+}
+
+CCTargetHandoverExtHo::CCTargetHandoverExtHo(CCSessionHandler *session,
+ int callId ,
+ MSG_Q_ID qid )
+ : CCHandover (session, callId, qid)
+{
+ voiceConnected = false;
+
+ CCHandover::initData();
+}
+
+int
+CCTargetHandoverExtHo::handleTimeoutMsg (IntraL3Msg_t *ccInMsg)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTimeoutMsg", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ currEvent = HAND_TRG_TIMER_EXPIRY;
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+}
+
+int
+CCTargetHandoverExtHo::handleRRMsg(IntraL3Msg_t *rrMsg,
+ JCCEvent_t hoEvent)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleRRMsg", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ CCHandover::handleRRMsg(rrMsg, hoEvent);
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleAnchToTrgPerfHbAck(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleAnchToTrgPerfHbAck", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ //cancel T211 timer
+ parent->sessionTimer->cancelTimer();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHbAck): [<==HOA PERFORM_HANDBACK_ACK (p)] (callId=%d, entryId=%d)\n}\n",
+ callIndex, parent->entryId);
+
+ //Decode A-interface message
+ A_Result_t result;
+ memset( (char*)&aifMsg, 0, sizeof(T_AIF_MSG));
+
+ if ( A_RESULT_SUCCESS != (result=
+ AIF_Decode((T_AIF_MessageUnit*)&(hoaInMsg->msgData.perfExtHandbackAck.A_INTERFACE_MSG), &aifMsg)) )
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleAnchToTrgPerfHbAck): A-MSG decoding err (err=%d, hoAgId=%d,callId=%d)\n",
+ result, hoAgId_,callIndex);
+ DBG_ERROR(" A-INTERFACE MESSAGE Hex Dump:\n");
+ DBG_HEXDUMP(
+ (unsigned char*)hoaInMsg->msgData.perfExtHandbackAck.A_INTERFACE_MSG.A_INTERFACE_DATA,
+ (int)hoaInMsg->msgData.perfExtHandbackAck.A_INTERFACE_MSG.msglength
+ );
+ DBG_ERROR("\n}\n");
+
+ //remember reason
+ hoEndCause_ = JC_FAILURE_A_INTERFACE_MESSAGE_DECODING_FAILED; //EHOcause
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+ }
+
+ if (aifMsg.msgType != A_HANDOVER_REQUEST_ACK_TYPE)
+ {
+ //Unexpected A-MSG received, ignore but report
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleAnchToTrgPerfHbAck): unexpected A-MSG (msgType=%d,hoState_=%d)\n}\n",
+ aifMsg.msgType, hoState_);
+
+ hoEndCause_ = JC_FAILURE_A_INTERFACE_MESSAGE_TYPE_INCOMPATIBLE;
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+ }
+
+ if (!(aifMsg.handoverRequestAck.layer3Information.ie_present))
+ {
+ //Unexpected A-MSG received, ignore but report
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleAnchToTrgPerfHbAck): A_HANDOVER_ACK without HANDOVER COMMAND (hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ hoAgId_,callIndex,hoState_);
+ hoEndCause_ = JC_FAILURE_A_HANDOVER_ACKNOWLEDGE_WITHOUT_L3_DATA;
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+ }
+
+ switch(hoState_)
+ {
+ case HAND_ST_ANCH_SND_HB_REQ:
+ //Relay message to GP-B
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_ACK;
+ vcOutMsg.msgData.perfHandbackAck.handCmd.msgLength =
+ aifMsg.handoverRequestAck.layer3Information.length;
+ memcpy(vcOutMsg.msgData.perfHandbackAck.handCmd.buffer,
+ aifMsg.handoverRequestAck.layer3Information.layer3Info,
+ aifMsg.handoverRequestAck.layer3Information.length);
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ DBG_CALL_TRACE(hoAgId_,"{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHbAck) [==>GP-B PERFORM_HANDBACK_ACK] (callId=%d,entryId=%d)\n}\n",
+ callIndex,parent->entryId);
+
+ hoState_ = HAND_ST_ANCH_RCV_HB_REQ_ACK;
+
+ break;
+
+ case HAND_ST_TRG_SND_HB_REQ:
+ //Send internal RR msg
+ rrOutMsg.l3_data.handCmd.handCmd.msgLength = aifMsg.handoverRequestAck.layer3Information.length;
+ memcpy(rrOutMsg.l3_data.handCmd.handCmd.buffer, aifMsg.handoverRequestAck.layer3Information.layer3Info,
+ aifMsg.handoverRequestAck.layer3Information.length);
+
+ sendRR(INTRA_L3_DATA, INTRA_L3_RR_HANDOVER_COMMAND, parent->entryId, &rrOutMsg);
+
+ DBG_CALL_TRACE(hoAgId_,"{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHbAck) [==>RM HANDOVER_COMMAND] (callId=%d,entryId=%d)\n}\n",
+ callIndex,parent->entryId);
+
+ // start the T204 timer
+ parent->sessionTimer->setTimer(CALL_HAND_TRG_T204);
+
+ hoState_ = HAND_ST_TRG_RCV_HB_REQ_ACK;
+
+ break;
+
+ default:
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleAnchToTrgPerfHbAck): CC Error Inproper hoState(%d) (hoAgId=%d,callId=%d\n}\n",
+ hoState_,hoAgId_,callIndex);
+
+ hoEndCause_ = JC_FAILURE_INPROPER_HANDOVER_STATE;
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+ }
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleAnchToTrgPerfHbNack(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleAnchToTrgPerfHbNack", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHbNack): [<==HOA PERFORM_HANDBACK_ACK (n)] (callId=%d, entryId=%d)\n}\n",
+ callIndex, parent->entryId);
+
+ // cancel Tsho timer
+ parent->sessionTimer->cancelTimer();
+
+ int i;
+ IntraL3HandoverRequired_t *inMsg = &handReqd;
+
+ switch (hoState_)
+ {
+ case HAND_ST_TRG_SND_HB_REQ:
+ if ( (i=getNextHoCandidate()) == (-1) )
+ {
+ DBG_TRACE("MNETeiTRACE(etrg::handleAnchToTrgPerfHbNack): no more candidate to retrytry (#ofCands=%d)\n",
+ inMsg->numCandidates);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+ } else
+ {
+ //Try next candidate
+ candGlobalCellId_t candidate;
+ candidate = inMsg->candGlobalCellId[i];
+
+ DBG_TRACE("MNETeiTRACE(etrg::handleAnchToTrgPerfHbNack): try next cand cell! %d-th of Cands(%d) candCell(%x,%x%x%x,%x%x%x,%x,%x) hoState(%d)\n",
+ i,inMsg->numCandidates,
+ candidate.candGlobalCellId.mcc[0],candidate.candGlobalCellId.mcc[1],
+ candidate.candGlobalCellId.mcc[2],
+ candidate.candGlobalCellId.mnc[0],candidate.candGlobalCellId.mnc[1],
+ candidate.candGlobalCellId.mnc[2],
+ candidate.candGlobalCellId.lac, candidate.candGlobalCellId.ci, hoState_);
+
+ if (candidate.candIsExternal)
+ {
+ //Handback from anchor GP to PLMN case
+ populateAHandoverRequest( &MY_GLOBALCELL_ID, &candidate.candGlobalCellId);
+
+ A_Result_t result;
+ NonStdRasMessagePerformHandbackRQ_t handbackRQ;
+
+ memset( (char*) &handbackRQ, 0, sizeof(NonStdRasMessagePerformHandbackRQ_t) );
+
+ if ( A_RESULT_SUCCESS != (result=
+ AIF_Encode(&aifMsg, (T_AIF_MessageUnit*)&handbackRQ.A_HANDOVER_REQUEST) ) )
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleAnchToTrgPerfHbNack): A-HANDOVER-REQUEST encoding failed (result=%d)\n\n}\n",
+ result);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+ }
+
+ //Send PERFORM-HANDBACK-REQ to HOA
+ handbackRQ.hoCause = inMsg->hoCause;
+ handbackRQ.header.origSubId = callIndex;
+ handbackRQ.header.destSubId = hoAgId_;
+ handbackRQ.globalCellID = candidate.candGlobalCellId;
+ handbackRQ.externalCell = true;
+
+ if (!VBLinkPerformHandback(&handbackRQ))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleAnchToTrgPerfHbNack): VBLinkPerformHandoverAck API failed !\n}\n");
+
+ DBG_HEXDUMP( (unsigned char*) &handbackRQ,
+ (int) (handbackRQ.A_HANDOVER_REQUEST.msglength+26)
+ );
+
+ DBG_ERROR("}\n");
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHbNack): [==>HOA PERFORM_HANDBACK_REQ](callId=%d,entryId=%d)\n}\n",
+ callIndex, parent->entryId);
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHbNack) PERFORM_HANDBACK_REQ MESSAGE DATA:\n");
+ DBG_TRACE(" : hoAgId_=%d, callId=%d\n",hoAgId_, callIndex);
+ DBG_TRACE(" : target cell(type=%d, mcc[1-3]:%x,%x,%x; mnc[1-3]:%x,%x,%x;lac=%x,ci=%x)\n",
+ handbackRQ.globalCellID.ci_disc,
+ handbackRQ.globalCellID.mcc[0],handbackRQ.globalCellID.mcc[1],handbackRQ.globalCellID.mcc[2],
+ handbackRQ.globalCellID.mnc[0],handbackRQ.globalCellID.mnc[1],handbackRQ.globalCellID.mnc[2],
+ handbackRQ.globalCellID.lac,handbackRQ.globalCellID.ci);
+
+ DBG_TRACE(" Encoded A_HANDOVER_REQ HEX DUMP:\n");
+ DBG_HEXDUMP((unsigned char*) &handbackRQ, sizeof (NonStdRasMessagePerformHandoverRQ_t) );
+ DBG_TRACE(" \n}\n");
+
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHbNack) Received A-INTERFACE-MSG DUMP (length=%d): \n",
+ handbackRQ.A_HANDOVER_REQUEST.msglength);
+ DBG_HEXDUMP(
+ (unsigned char*)handbackRQ.A_HANDOVER_REQUEST.A_INTERFACE_DATA,
+ (int)handbackRQ.A_HANDOVER_REQUEST.msglength
+ );
+ DBG_TRACE("\n END-OF-DUMP\n}\n");
+
+ parent->sessionTimer->setTimer(CALL_HAND_TRG_T211);
+
+ DBG_CALL_TRACE(hoAgId_, "\nMNETeiTRACE(etrg::handleAnchToTrgPerfHbNack): [<==CC START TIMER T211] (callId=%d, T211=%d ticks)\n}\n",
+ callIndex, (int)CALL_HAND_TRG_T211);
+
+ hoState_ = HAND_ST_TRG_SND_HB_REQ;
+
+ } else
+ {
+ //Handover from anchor GP to another GP case
+ sprintf(&(cellLocationRequest.ViperCellId[0]), "%d:%d",
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ cellLocationRequest.TxnId = callIndex;
+
+ if (false == VBLinkLocationRequest(cellLocationRequest) )
+ {
+ // Ignore the message
+ DBG_ERROR("{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHbNack): VBLinkLocationRequest failed!\n");
+ DBG_ERROR(" (hoAgId=%d callId=%d entryId=%d,lac=%d,ci=%d)\n}\n",
+ hoAgId_, callIndex, parent->entryId,
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHbNack): [==>HOA IP_ADDRESS_REQ](callId=%d,entryId=%d,lac=%d,ci=%d)\n}\n",
+ callIndex, parent->entryId,
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHbNack): [<==CC START TIMER Tvb](callId=%d,entryId=%d,lac=%d,ci=%d)\n}\n",
+ callIndex, parent->entryId,
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TVB);
+
+ hoState_ = HAND_ST_ANCH_VC_IP_ADDRESS_REQ;
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ break;
+
+ case HAND_ST_ANCH_SND_HB_REQ:
+ // Abort HB part at GP-B
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = JC_FAILURE_A_HANDOVER_FAILURE;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ DBG_CALL_TRACE(hoAgId_,"{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHbAck) [==>GP-B PERFORM_HANDBACK_NACK] (callId=%d,hoState=%d)\n}\n",
+ callIndex,hoState_);
+
+ DBG_LEAVE();
+ return(CC_RELEASE_GP_HB);
+
+ break;
+
+ default:
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleAnchToTrgPerfHbNack): CC Error Inproper hoState(%d) (hoAgId=%d,callId=%d\n}\n",
+ hoState_,hoAgId_,callIndex);
+
+ hoEndCause_ = JC_FAILURE_INPROPER_HANDOVER_STATE;
+
+ DBG_LEAVE();
+ return (JCC_NULL_EVENT);
+ }
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgT211TimerExpiry(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgT211TimerExpiry", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgT211TimerExpiry): [<==CC TIMER T211 FIRED](callId=%d,entryId=%d)\n}\n",
+ callIndex, parent->entryId);
+
+ hoEndCause_ = JC_FAILURE_T211_TIMEOUT;
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgHoReqd(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgHoReqd", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ int i;
+
+ IntraL3HandoverRequired_t *inMsg = &rrInMsg->l3_data.handReqd;
+ candGlobalCellId_t candidate;
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgHoReqd): [<==RM HANDOVER REQUIRED] (callId=%d, entryId=%d, #Cands=%d)\n}\n",
+ callIndex, parent->entryId, inMsg->numCandidates);
+
+ candidate.candIsExternal = false;
+ candidate.candIsTried = true;
+ candidate.candGlobalCellId = hoGlobalCellId_;
+
+ handReqd = *inMsg;
+
+ if (!forcedHandover)
+ {
+ if ((inMsg->numCandidates) <= 0)
+ {
+ // Ignore the message
+ DBG_ERROR ("{\nMNETeiERROR(etrg::handleTrgHoReqd): Handover Required Error (bad numCandidates = %d)\n}\n",
+ inMsg->numCandidates);
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ if ( (i=getNextHoCandidate()) == (-1) )
+ {
+ DBG_ERROR ("{\nMNETeiERROR(etrg::handleTrgHoReqd): Handover Required Error (all bad #candidates = %d)\n}\n",
+ inMsg->numCandidates);
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ candIndex_ = i;
+ candidate = inMsg->candGlobalCellId[i];
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgHoReqd): Selected %dth of Candidates(%d) (mcc:%x%x%x mnc:%x%x%x lac:%d ci:%d) (hoState %d)\n}\n",
+ i, inMsg->numCandidates,
+ candidate.candGlobalCellId.mcc[0],candidate.candGlobalCellId.mcc[1],
+ candidate.candGlobalCellId.mcc[2],
+ candidate.candGlobalCellId.mnc[0],candidate.candGlobalCellId.mnc[1],
+ candidate.candGlobalCellId.mnc[2],
+ candidate.candGlobalCellId.lac, candidate.candGlobalCellId.ci, hoState_);
+ }
+
+ if (candidate.candIsExternal)
+ {
+ //Handback from anchor GP to PLMN
+ populateAHandoverRequest(&MY_GLOBALCELL_ID, &candidate.candGlobalCellId);
+
+ A_Result_t result;
+ NonStdRasMessagePerformHandbackRQ_t handbackRQ;
+
+ memset( (char*) &handbackRQ, 0, sizeof(NonStdRasMessagePerformHandbackRQ_t) );
+
+ if ( A_RESULT_SUCCESS != (result=
+ AIF_Encode(&aifMsg, (T_AIF_MessageUnit*)&handbackRQ.A_HANDOVER_REQUEST) ) )
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoReqd): A-HANDOVER-REQUEST encoding failed (result=%d)\n\n}\n",
+ result);
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //Send PERFORM-HANDBACK-REQ to HOA
+ handbackRQ.hoCause = inMsg->hoCause;
+ handbackRQ.header.origSubId = callIndex;
+ handbackRQ.header.destSubId = hoAgId_;
+ handbackRQ.globalCellID = candidate.candGlobalCellId;
+ handbackRQ.externalCell = true;
+
+ if (!VBLinkPerformHandback(&handbackRQ))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoReqd): VBLinkPerformHandoverAck API failed !\n}\n");
+
+ DBG_HEXDUMP( (unsigned char*) &handbackRQ,
+ (int) (handbackRQ.A_HANDOVER_REQUEST.msglength+26)
+ );
+
+ DBG_ERROR("}\n");
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchHoReqd): [==>HOA PERFORM_HANDBACK_REQ](callId=%d,entryId=%d)\n}\n",
+ callIndex, parent->entryId);
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleAnchHoReqd) PERFORM_HANDBACK_REQ MESSAGE DATA:\n");
+ DBG_TRACE(" : hoAgId_=%d, callId=%d\n",hoAgId_, callIndex);
+ DBG_TRACE(" : target cell(type=%d, mcc[1-3]:%x,%x,%x; mnc[1-3]:%x,%x,%x;lac=%x,ci=%x)\n",
+ handbackRQ.globalCellID.ci_disc,
+ handbackRQ.globalCellID.mcc[0],handbackRQ.globalCellID.mcc[1],handbackRQ.globalCellID.mcc[2],
+ handbackRQ.globalCellID.mnc[0],handbackRQ.globalCellID.mnc[1],handbackRQ.globalCellID.mnc[2],
+ handbackRQ.globalCellID.lac,handbackRQ.globalCellID.ci);
+
+ DBG_TRACE(" Encoded A_HANDOVER_REQ HEX DUMP:\n");
+ DBG_HEXDUMP((unsigned char*) &handbackRQ, sizeof (NonStdRasMessagePerformHandoverRQ_t) );
+ DBG_TRACE(" \n}\n");
+
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgHoReqAck) Received A-INTERFACE-MSG DUMP (length=%d): \n",
+ handbackRQ.A_HANDOVER_REQUEST.msglength);
+ DBG_HEXDUMP(
+ (unsigned char*)handbackRQ.A_HANDOVER_REQUEST.A_INTERFACE_DATA,
+ (int)handbackRQ.A_HANDOVER_REQUEST.msglength
+ );
+ DBG_TRACE("\n END-OF-DUMP\n}\n");
+
+ parent->sessionTimer->setTimer(CALL_HAND_TRG_T211);
+ DBG_CALL_TRACE(hoAgId_, "\nMNETeiTRACE(etrg::handleTrgHoReqAck): [<==CC START TIMER T211] (callId=%d, T211=%d msec)\n}\n",
+ callIndex, (int)CALL_HAND_TRG_T211);
+
+ hoState_ = HAND_ST_TRG_SND_HB_REQ;
+
+ } else
+ {
+ //Handover from anchor GP to another GP case
+ sprintf(&(cellLocationRequest.ViperCellId[0]), "%d:%d",
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ cellLocationRequest.TxnId = callIndex;
+
+ if (false == VBLinkLocationRequest(cellLocationRequest) )
+ {
+ // Ignore the message
+ DBG_ERROR("{\nMNETeiTRACE(etrg::handleAnchHoReqd): VBLinkLocationRequest failed!\n");
+ DBG_ERROR(" (hoAgId=%d callId=%d entryId=%d,lac=%d,ci=%d)\n}\n",
+ hoAgId_, callIndex, parent->entryId,
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchHoReqd): [==>HOA IP_ADDRESS_REQ](callId=%d,entryId=%d,lac=%d,ci=%d)\n}\n",
+ callIndex, parent->entryId,
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchHoReqd): [<==CC START TIMER Tvb](callId=%d,entryId=%d,lac=%d,ci=%d)\n}\n",
+ callIndex, parent->entryId,
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TVB);
+
+
+ hoState_ = HAND_ST_ANCH_VC_IP_ADDRESS_REQ;
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgToAnchHoAccess(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgToAnchHoAccess", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchHoAccess): [<==GP-B HANDOVER_ACCESS] (callIndex=%d,hoState=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ callIndex, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ //Send up bss APDU to PLMN (anchor part)
+ NonStdRasMessagePostHandoverMobEvent_t bssApdu;
+
+ bssApdu.header.origSubId = callIndex;
+ bssApdu.header.destSubId = hoAgId_;
+
+ bssApdu.LAYER3PDU.LAYER3DATA[0] = 0x00; //BSSMAP
+ bssApdu.LAYER3PDU.LAYER3DATA[1] = 1;
+ bssApdu.LAYER3PDU.LAYER3DATA[2] = A_HANDOVER_DETECT_TYPE;
+
+ bssApdu.LAYER3PDU.msglength = 3;
+
+ if (!VBLinkPostHandoverMobEvent(&bssApdu))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgToAnchHoAccess): VBLinkPostHandoverMobEvent API failed !\n}\n");
+ DBG_HEXDUMP((unsigned char*) &bssApdu, bssApdu.LAYER3PDU.msglength+2);
+
+ DBG_ERROR("}\n");
+ } else
+ {
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etgt::handleTrgHoFail): [==>HOA A-HANDOVER-DETECT] (callId=%d,hoState=%d)\n",
+ callIndex,hoState_);
+ DBG_HEXDUMP((unsigned char*) &bssApdu, bssApdu.LAYER3PDU.msglength+2);
+ DBG_CALL_TRACE(hoAgId_, "}\n");
+ }
+
+ DBG_LEAVE();
+ return(CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleAnchHoReqNack(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleAnchHoReqNack", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_,"{\nMNETeiTRACE(etrg::handleAnchHoReqNack): [<==RR MM_EST_REJ(hoReqNack)](callId=%d,hoState=%d)\n}\n",
+ callIndex, hoState_);
+
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = rrInMsg->l3_data.handReqNack.cause;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ //
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_HB);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleAnchHoReqAck(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleAnchHoReqAck", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchHoReqAck): [<==RR MM_EST_CNF(hoReqAck)](callId=%d,hoState=%d)\n}\n",
+ callIndex, hoState_);
+
+
+ T_CNI_L3_ID newId;
+ newId.msgq_id = msgQId;
+ newId.sub_id = 0;
+
+ if (parent->setIrt (mmInMsg->entry_id, newId) == false)
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleAnchHoReqAck) CC Call Error IRT SET problem for (entryId=%d)(hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ mmInMsg->entry_id,hoAgId_,callIndex,hoState_);
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchHoReqAck): [==>GP-B PERFORM_HANDBACK_NACK](callId=%d,entryId=%d,hoState=%d)\n}\n",
+ callIndex, mmInMsg->entry_id, hoState_);
+
+ // Treat it like a Ho. Req. Nack.
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = JC_FAILURE_IRT_TABLE_SET_FAILED;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_HB);
+ }
+
+ // Setup the entry id, oid, and sapi
+ parent->entryId = mmInMsg->entry_id;
+
+ // GET OID AND SAPI
+ T_CNI_RIL3_IRT_ENTRY irtEntry;
+ irtEntry.entry_id = mmInMsg->entry_id;
+
+ if ( (CNI_RIL3_IRT_Get_Entry_by_Entry_ID(&irtEntry)) == false )
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleAnchHoReqAck) CC Call Error IRT GET problem for (entryId=%d)(hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ mmInMsg->entry_id,hoAgId_,callIndex,hoState_);
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchHoReqAck): [==>GP-B PERFORM_HANDBACK_NACK](callId=%d,entryId=%d,hoState=%d)\n}\n",
+ callIndex, mmInMsg->entry_id, hoState_);
+
+ // Treat it like a Ho. Req. Nack.
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = JC_FAILURE_IRT_TABLE_GET_FAILED;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_HB);
+ }
+
+ parent->oid = irtEntry.lapdm_oid;
+
+ // Make a simplex connection between the remote rtp channel and the rf channel
+ T_CSU_PORT_ID rfSinkPort, rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rfSinkPort.portType = CSU_GSM_PORT;
+ rtpSourcePort.portType = CSU_RTP_PORT;
+
+ rfSinkPort.portId.gsmHandler = parent->entryId;
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(parent->hoCallLeg->h323CallHandle);
+
+ if ((csuResult = csu_SimplexConnect(&rtpSourcePort, &rfSinkPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleAnchHoReqAck) CSU UNI-CONNECT failed (entryId=%d,h323Hndl=%p)(hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ mmInMsg->entry_id,parent->hoCallLeg->h323CallHandle, hoAgId_,callIndex,hoState_);
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchHoReqAck): [==>GP-B PERFORM_HANDBACK_NACK](callId=%d,entryId=%d,hoState=%d)\n}\n",
+ callIndex, mmInMsg->entry_id, hoState_);
+
+ // Treat it like a Ho. Req. Nack.
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = JC_FAILURE_CSU_UNI_CONNECT_FAILED;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_HB);
+ }
+
+ hoSimplexConnected_ = true;
+
+ //Send the Perform Ack message.
+
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_ACK;
+ vcOutMsg.msgData.perfHandbackAck.handCmd = mmInMsg->l3_data.handReqAck.handCmd;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchHoReqAck): [==>GP-B PERFORM_HANDBACK_ACK](callId=%d,entryId=%d,hoState=%d)\n}\n",
+ callIndex, mmInMsg->entry_id, hoState_);
+
+ // start the T202 timer
+ parent->sessionTimer->setTimer(CALL_HAND_TRG_T202); //ext-HO FFS-TIMER
+
+ hoState_ = HAND_ST_ANCH_SND_HB_REQ_ACK;
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleAnchHoComplt(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleAnchHoComplt", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchHoComplt): [<==RM HANDOVER_COMPLETE] (callIndex=%d,entryId=%d,hoState=%d)\n}\n",
+ callIndex, parent->entryId, hoState_);
+
+ //Send the Complete Handback message.
+ vcOutMsg.msgType = INTER_VC_CC_COMPLETE_HANDBACK;
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+
+ //Make voice connection
+ T_CSU_PORT_ID oldPort, srcPort, snkPort;
+ T_CSU_RESULT_CON csuResult;
+
+ oldPort.portType = CSU_RTP_PORT;
+ oldPort.portId.rtpHandler = hoRtpSession_;
+
+ if (hoRtpSession_ != NULL)
+ {
+ if ( (csuResult = csu_OrigTermBreakAll(&oldPort)) != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_WARNING("{\nMNETeiWARNING(etrg::handleAnchHoComplt) CSU BreakAll Error(%d) for oldPort(%d, %x)\n}\n",
+ csuResult, oldPort.portType, oldPort.portId.rtpHandler);
+
+ //Ignore this warning to allow call going along
+ }
+
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+
+ hoRtpSession_ = NULL;
+ }
+
+ srcPort.portType = CSU_RTP_PORT;
+ srcPort.portId.rtpHandler = VoipCallGetRTPHandle(parent->hoCallLeg->h323CallHandle);
+
+ snkPort.portType = CSU_GSM_PORT;
+ snkPort.portId.gsmHandler = parent->entryId;
+ if ((csuResult = csu_DuplexConnect(&srcPort, &snkPort)) != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleAnchHoComplt) CSU 2-WAY Conn Error (%d) SrcPort(%d:%p)<->SnkPort(%d:%p)\n}\n",
+ csuResult, srcPort.portType, srcPort.portId.rtpHandler, snkPort.portType, snkPort.portId.rtpHandler);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ //Empty the queues now. Do this only at the end.
+ emptyRRQueue ();
+ emptyDownlinkQueue();
+ emptyMMQueue ();
+
+ //
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_HO);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleAnchPostHoRls(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleAnchPostHoRls", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchPostHoRls): [<==GP-B POST_HANDOVER_RLS] (callIndex=%d,hoState=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ callIndex, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ // cancel any timers running
+ parent->sessionTimer->cancelTimer();
+
+ hoEndCause_ = MC_HO_RLS_FAILURE;
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgToAnchPostHoMobEvent(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgToAnchPostHoMobEvent", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPostHoMobEvent): [<==GP-B POST_HANDOVER_EVENT] (callIndex=%d,hoState=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ callIndex, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ //PostL3RecvMsLog(msInMsg->lapdm_oid, msInMsg->sapi, &msInMsg->l3_data);
+
+ switch (vcInMsg->origModuleId)
+ {
+ case MODULE_RM:
+ //Should not happen: ignore RR message but watch out for analysis when it really occurs.
+ DBG_WARNING("{\nMNETeiTRACE(etrg::handleAnchPostHoMobEvent): [<==GP-B POST_HANDOVER_EVENT (RR Message)] (callIndex=%d,hoState=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ hoAgId_, callIndex, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ break;
+
+ case MODULE_MD:
+ //Pass up to PLMN (anchor)
+ sendMSMsgToAnchorCC(&vcInMsg->msgData.postHoMobEventData.msInMsg);
+ break;
+
+ default:
+ // late event
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgToAnchPostHoMobEvent) CC Error Invalid OrigModuleId(%d) (hoAgId=%d,callId=%d,hoState=%d, reIpAddr=%x, reCallId=%d)\n}\n",
+ vcInMsg->origModuleId, hoAgId_, callIndex, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+ }
+
+ DBG_LEAVE();
+ return(CC_MESSAGE_PROCESSING_COMPLT);
+
+}
+
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgToAnchPerfHbReq(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgToAnchPerfHbReq", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHbReq): [<==GP-B PERFORM_SUBSEQUENT_HO_REQ] (callIndex=%d,hoState=%d,reIpAddr=%x,reCallId=%d cand(MCC:%x%x% MNC:%x%x%x LAC:%x CI:%x)\n}\n",
+ callIndex, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId,
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.mcc[2],
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.mcc[1],
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.mcc[0],
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.mnc[2],
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.mnc[1],
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.mnc[0],
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.lac,
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.ci);
+
+ // Use the same criteria as when triggered on the anchor side.
+ if (!parent->hoCallVoiceConnected())
+ {
+ // Need to fix the cause value for the nack.
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHbReq): HB disallowed due to improper hoCallState(%d) (hoAgId=%d,callId=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ parent->hoCallState(),hoAgId_,callIndex, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHbReq): [==>GP-B PERFORM_SUBSEQUENT_HO_REQ] (callIndex=%d,hoState=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ callIndex, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = JC_FAILURE_HANDBACK_NOT_ALLOWED;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ return(CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ if ( isEqualGlobalCellId(&(vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId), &MY_GLOBALCELL_ID) &&
+ !forcedHandmsc3 )
+ {
+ //HB->anchor GP scenario
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHbReq): [<==GP-B HANDBACK to GP-A] (callIndex=%d,hoState=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ callIndex, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ // Build MM_EST_REQ for sake of the handback <ext-HO FFS-CIPH>
+ memcpy( (unsigned char*) &(mmOutMsg.l3_data.handReq.cipherCmd),
+ (unsigned char*) &currEncrypt_, sizeof(IntraL3CipherModeCommand_t));
+ mmOutMsg.l3_data.handReq.channelType = currChannel_;
+ mmOutMsg.l3_data.handReq.qid = msgQId;
+
+ // Send internal MM msg -
+ sendMM(INTRA_L3_MM_EST_REQ, INTRA_L3_RR_HANDOVER_REQ, parent->entryId, &mmOutMsg);
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchToTrgPerfHoReq): [==>MM MM_EST_REQ] (hoAgId_=%d,callId=%d,speech%d:%d,ciph:%d:%d,Kc:%x%x%x%x)\n}\n",
+ hoAgId_, callIndex,
+ vcOutMsg.msgData.perfHandoverReq.channelType.bearerType,
+ vcOutMsg.msgData.perfHandoverReq.channelType.speechChann.version,
+ currEncrypt_.cmd.cipherModeSetting.ciphering,
+ currEncrypt_.cmd.cipherModeSetting.algorithm,
+ currEncrypt_.Kc[0],currEncrypt_.Kc[1],
+ currEncrypt_.Kc[2],currEncrypt_.Kc[3]);
+
+ parent->sessionTimer->setTimer(CALL_HAND_TRG_T202);
+
+ hoState_ = HAND_ST_ANCH_RCV_HB_REQ;
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ } else
+ {
+ VBLINK_API_CELL_LOCATION_REQUEST_MSG t_cellLocationRequest;
+
+ if (forcedHandmsc3)
+ {
+ h3GlobalCellId_ = ccHoTrgGlobalCellId;
+ h3VcIpAddress_ = ccHoTrgCellIpAddress;
+ } else
+ {
+ h3GlobalCellId_ = vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId;
+
+ }
+
+ candGlobalCellId_t candidate;
+ candidate = vcInMsg->msgData.perfHandbackReq.globalCellId;
+
+ if (candidate.candIsExternal)
+ {
+ //Handback from non-anchor GP to PLMN
+ populateAHandoverRequest(&MY_GLOBALCELL_ID, &candidate.candGlobalCellId);
+
+ A_Result_t result;
+ NonStdRasMessagePerformHandbackRQ_t handbackRQ;
+
+ memset( (char*) &handbackRQ, 0, sizeof(NonStdRasMessagePerformHandbackRQ_t) );
+
+ if ( A_RESULT_SUCCESS != (result=
+ AIF_Encode(&aifMsg, (T_AIF_MessageUnit*)&handbackRQ.A_HANDOVER_REQUEST) ) )
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgToAnchPerfHbReq): A-HANDOVER-REQUEST encoding error(%d)(hoAgId=%d,callIndex=%d)\n\n}\n",
+ result,hoAgId_,callIndex);
+
+ hoEndCause_ = JC_FAILURE_A_INTERFACE_MESSAGE_ENCODING_FAILED;
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+ }
+
+ //Send PERFORM-HANDBACK-REQ to HOA
+ handbackRQ.hoCause = vcInMsg->msgData.perfHandbackReq.hoCause;
+ handbackRQ.header.origSubId = callIndex;
+ handbackRQ.header.destSubId = hoAgId_;
+ handbackRQ.globalCellID = h3GlobalCellId_;
+ handbackRQ.externalCell = true;
+
+ if (!VBLinkPerformHandback(&handbackRQ))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgToAnchPerfHbReq): VBLinkPerformHandoverAck() failed! (hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ hoAgId_,callIndex,hoState_);
+
+ DBG_HEXDUMP( (unsigned char*) &handbackRQ,
+ (int) (handbackRQ.A_HANDOVER_REQUEST.msglength+26)
+ );
+
+ DBG_ERROR("}\n");
+
+ hoEndCause_ = JC_FAILURE_A_INTERFACE_MESSAGE_ENCODING_FAILED;
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHbReq): [==>HOA PERFORM_HANDBACK_REQ](callId=%d,entryId=%d)\n}\n",
+ callIndex, parent->entryId);
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHbReq) PERFORM_HANDBACK_REQ MESSAGE DATA:\n");
+ DBG_TRACE(" : hoAgId_=%d, callId=%d\n",hoAgId_, callIndex);
+ DBG_TRACE(" : target cell(type=%d, mcc[1-3]:%x,%x,%x; mnc[1-3]:%x,%x,%x;lac=%x,ci=%x)\n",
+ handbackRQ.globalCellID.ci_disc,
+ handbackRQ.globalCellID.mcc[0],handbackRQ.globalCellID.mcc[1],handbackRQ.globalCellID.mcc[2],
+ handbackRQ.globalCellID.mnc[0],handbackRQ.globalCellID.mnc[1],handbackRQ.globalCellID.mnc[2],
+ handbackRQ.globalCellID.lac,handbackRQ.globalCellID.ci);
+
+ DBG_TRACE(" Encoded A_HANDOVER_REQ HEX DUMP:\n");
+ DBG_HEXDUMP((unsigned char*) &handbackRQ, sizeof (NonStdRasMessagePerformHandoverRQ_t) );
+ DBG_TRACE(" \n}\n");
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHbReq) Received A-INTERFACE-MSG DUMP (length=%d): \n",
+ handbackRQ.A_HANDOVER_REQUEST.msglength);
+ DBG_HEXDUMP(
+ (unsigned char*)handbackRQ.A_HANDOVER_REQUEST.A_INTERFACE_DATA,
+ (int)handbackRQ.A_HANDOVER_REQUEST.msglength
+ );
+ DBG_TRACE("\n END-OF-DUMP\n}\n");
+
+ parent->sessionTimer->setTimer(CALL_HAND_TRG_T211);
+ hoState_ = HAND_ST_ANCH_SND_HB_REQ;
+
+ } else
+ {
+ //Handover to 3rd GP10
+ if ( (!forcedHandmsc3) || (forcedHandmsc3&&useViperBase) )
+ {
+ //H3 scenario. Go ahead to inquire IP address of mscB'
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHbReq): [<==GP-B HANDTO3rd to GP-B'] (callIndex=%d,hoState=%d,B-reIpAddr=%x,B-reCallId-B=%d,B'-LAC:%x,B'-CI:%x)\n}\n",
+ callIndex, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId,
+ h3GlobalCellId_.lac, h3GlobalCellId_.ci);
+
+ sprintf(&(t_cellLocationRequest.ViperCellId[0]), "%d:%d", h3GlobalCellId_.lac,h3GlobalCellId_.ci);
+
+ t_cellLocationRequest.TxnId = callIndex;
+
+ if (VBLinkLocationRequest(t_cellLocationRequest) == false)
+ {
+ //Ignore the message
+ DBG_ERROR("{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHbReq):VBLinkLocationRequest()failed for GP(%d:%d)(hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ h3GlobalCellId_.lac, h3GlobalCellId_.ci,hoAgId_,callIndex,hoState_);
+
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = JC_FAILURE_ANCH_VB_LINK_PROBLEM;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_HB);
+ }
+
+ // start the VB timer
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TVB);
+
+ //MSC-B' born here while MSC-B is still alive. Mark handover type and relevant state
+ hoState_ = HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ;
+
+ } else
+ {
+ //MSC-B' born here
+ hoState_ = HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ;
+
+ DBG_LEAVE();
+ return (handleVcAddressRsp());
+ }
+ }
+ }
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleVcAddressRsp(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleVcAddressRsp", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleVcAddressRsp): [<==HOA IP ADDRESS RSP] (callIndex=%d,entryId=%d,ipAddr=%x)\n}\n",
+ callIndex, parent->entryId,hoVcIpAddress_);
+
+ //Cancel Timer Tvb
+ parent->sessionTimer->cancelTimer();
+
+ switch (hoState_)
+ {
+ case HAND_ST_ANCH_VC_IP_ADDRESS_REQ:
+ //Handover from anchor GP->another GP
+ if (hoRtpSession_ != NULL)
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ break;
+
+ case HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ:
+ //Handover to 3rd GP from nonanchor GP
+ if (h3RtpSession_ != NULL)
+ ReleaseHandoverRtpChannel(h3RtpSession_);
+ break;
+
+ default:
+ DBG_ERROR("{\nMNETeiTRACE(etrg::handleVcAddressRsp): CC Internal Error (hoAgId=%d,callId=%d,entryId=%d,hoState=%d)\n",
+ hoAgId_, callIndex, parent->entryId, hoState_);
+ DBG_LEAVE();
+ return (JCC_NULL_EVENT);
+ }
+
+ HJCRTPSESSION reRtpSession;
+
+ if ((reRtpSession = AssignHandoverRtpChannel())
+ == NULL)
+ {
+ // Do not proceed with ho
+ DBG_ERROR ("{\nMNETeiTRACE(etrg::handleVcAddressRsp): AssignHandoverRtpChannel failed for reRtpSession(hoAgId=%d,callId=%d,entryId=%d,hoState=%d\n}\n",
+ hoAgId_,callIndex,parent->entryId,hoState_);
+ DBG_LEAVE();
+ return( (hoState_==HAND_ST_ANCH_VC_IP_ADDRESS_REQ) ? CC_RELEASE_GP_HO:CC_RELEASE_GP_H3);
+ }
+
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDOVER;
+ vcOutMsg.msgData.perfHandoverReq.sourceInRtpPort
+ = GetIncomingHandoverRtpPort(reRtpSession);
+ vcOutMsg.msgData.perfHandoverReq.channelType.bearerType
+ = BEARER_SPEECH;
+ vcOutMsg.msgData.perfHandoverReq.channelType.speechChann
+ = currSpeechCh_;
+ vcOutMsg.msgData.perfHandoverReq.globalCellId
+ = MY_GLOBALCELL_ID;
+
+ IntraL3CipherModeCommand_t cipherCmd;
+ //if (getExtHoCipherAlgo(&cipherCmd))
+ {
+ DBG_ERROR("{\nMNETeiTRACE(etrg::handleVcAddressRsp): getExtHoCipherAlgo() failed (hoAgId=%d,callId=%d,entryId=%d,hoState=%d)\n}\n",
+ hoAgId_,callIndex,parent->entryId,hoState_);
+ cipherCmd.cmd.cipherModeSetting.ciphering = CNI_RIl3_CIPHER_NO_CIPHERING;
+ }
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleVcAddressRsp): PerfHo (bearer %d, spchVer %d, ciphSet %d, algo %d, kc:%x,%x,%x,%x)\n}\n",
+ vcOutMsg.msgData.perfHandoverReq.channelType.bearerType,
+ vcOutMsg.msgData.perfHandoverReq.channelType.speechChann.version,
+ cipherCmd.cmd.cipherModeSetting.ciphering,
+ cipherCmd.cmd.cipherModeSetting.algorithm,
+ cipherCmd.Kc[0],cipherCmd.Kc[1],
+ cipherCmd.Kc[2],cipherCmd.Kc[3]);
+
+ memcpy( (unsigned char*) &(vcOutMsg.msgData.perfHandoverReq.cipherCmd),
+ (unsigned char*) &(cipherCmd),
+ sizeof (IntraL3CipherModeCommand_t) );
+
+
+ // Send Perform Handover to the Target ViperCell.
+ switch (hoState_)
+ {
+ case HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ:
+ // H3 case
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleVcAddressRsp): [==>GP-B' PERFORM_HANDOVER_REQ(h3)] (callIndex=%d,entryId=%d,lac=%d,ci=%d)\n}\n",
+ hoAgId_, callIndex, parent->entryId, hoGlobalCellId_.lac, hoGlobalCellId_.ci);
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleVcAddressRsp): hand3rd info (loRtpHndl=%p, loPort=%d, h3VcIpAddress=%d)\n}\n",
+ reRtpSession, vcOutMsg.msgData.perfHandoverReq.sourceInRtpPort, h3VcIpAddress_);
+
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ h3RtpSession_ = reRtpSession;
+ hoState_ = HAND_ST_ANCH_SND_H3_REQ;
+ break;
+
+ case HAND_ST_ANCH_VC_IP_ADDRESS_REQ:
+ // HO case
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleVcAddressRsp): [==>GP-B PERFORM_HANDOVER_REQ(ho)] (callIndex=%d,entryId=%d,lac=%d,ci=%d)\n}\n",
+ hoAgId_, callIndex, parent->entryId, hoGlobalCellId_.lac, hoGlobalCellId_.ci);
+
+ DBG_TRACE("{\nNETeiTRACE(etrg::handleVcAddressRsp): handover info (loRtpHndl=%p, loPort=%d, hoVcIpAddress=%d)\n}\n",
+ reRtpSession, vcOutMsg.msgData.perfHandoverReq.sourceInRtpPort, hoVcIpAddress_);
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ hoRtpSession_ = reRtpSession;
+ hoState_ = HAND_ST_ANCH_SND_HO_REQ;
+
+ break;
+ }
+
+ // start the T202 timer
+ parent->sessionTimer->setTimer(CALL_HAND_TRG_T202);
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleAnchTvbTimerExpiry(void)
+{
+ JCCEvent_t retEvent = JCC_NULL_EVENT;
+
+ DBG_FUNC("CCTargetHandoverExtHo::handleAnchTvbTimerExpiry", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchTvbTimerExpiry): [<==CC TIMER Tvb FIRED] (callIndex=%d,hoState=%d)\n}\n",
+ callIndex, hoState_);
+
+ switch(hoState_)
+ {
+ case HAND_ST_ANCH_VC_IP_ADDRESS_REQ:
+ hoState_ = HAND_ST_TRG_HO_COMPLT;
+ retEvent = CC_MESSAGE_PROCESSING_COMPLT;
+
+ break;
+
+ case HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ:
+ retEvent = CC_RELEASE_GP_HB;
+
+ break;
+
+ default:
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleAnchTvbTimerExpiry): CC Error Inproper hoState(%d) (hoAgId=%d,callId=%d)\n}\n",
+ hoState_,hoAgId_,callIndex);
+ break;
+ }
+
+ DBG_LEAVE();
+ return (retEvent);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleAnchHoFail(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleAnchHoFail", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchHoFail): [<==RR HANDOVER FAILURE](callId=%d,entryId=%d)\n}\n",
+ callIndex, parent->entryId);
+
+ //cancel T202 timer
+ parent->sessionTimer->cancelTimer();
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_REVERT_TO_OLD;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ // break connection
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = hoRtpSession_;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort)) != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleAnchHoFail) CSU BreakAll Error(%d) for rtpPort(%d:%p)\n}\n",
+ csuResult, rtpSourcePort.portType, (int)rtpSourcePort.portId.rtpHandler);
+ }
+
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_HO);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgHoFail(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgHoFail", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgHoFail): [<==RR HANDOVER FAILURE](callId=%d,entryId=%d)\n}\n",
+ callIndex, parent->entryId);
+
+ //cancel T204
+ parent->sessionTimer->cancelTimer();
+
+ //Pass an A-HANDOVER FAILURE to anchor i.e. PLMN
+
+ //Zero out message description
+ A_Handover_Failure_t *pFailure = (A_Handover_Failure_t*) &aifMsg.handoverFailure;
+ memset((char*) &aifMsg,0,sizeof(T_AIF_MSG));
+
+ //Mandatory IEs
+ pFailure->msgType = A_HANDOVER_FAILURE_TYPE;
+ pFailure->cause.ie_present = true;
+ pFailure->cause.elementIdentifier = 0x04;
+ pFailure->cause.length = 1;
+ pFailure->cause.length = (unsigned char) rrInMsg->l3_data.handFail.cause;
+
+ //No optional IEs furnished now
+
+ //Encode A-HANDOVER-FAILURE msg
+ A_Result_t result; A_INTERFACE_MSG_STRUCT_t aifData;
+ memset( (char*) &aifData, 0, sizeof(A_INTERFACE_MSG_STRUCT_t) );
+ if ( A_RESULT_SUCCESS != (result=
+ AIF_Encode(&aifMsg, (T_AIF_MessageUnit*)&aifData) ) )
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoFail): A-HANDOVER-FAILURE encoding failed (result=%d)\n\n}\n",
+ result);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+ }
+
+ //Send up bss APDU to PLMN (anchor part)
+ NonStdRasMessagePostHandoverMobEvent_t bssApdu;
+
+ bssApdu.header.origSubId = callIndex;
+ bssApdu.header.destSubId = hoAgId_;
+
+ bssApdu.LAYER3PDU.LAYER3DATA[0] = 0x00; //BSSMAP
+ bssApdu.LAYER3PDU.LAYER3DATA[1] = (unsigned char) aifData.msglength;
+ memcpy((char*)&bssApdu.LAYER3PDU.LAYER3DATA[2],(char*)aifData.A_INTERFACE_DATA,
+ aifData.msglength);
+ bssApdu.LAYER3PDU.msglength = (unsigned short) (2 + aifData.msglength);
+
+ if (!VBLinkPostHandoverMobEvent(&bssApdu))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoFail): VBLinkPostHandoverMobEvent API failed !\n}\n");
+ DBG_HEXDUMP((unsigned char*) &bssApdu, bssApdu.LAYER3PDU.msglength+2);
+
+ DBG_ERROR("}\n");
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);;
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etgt::handleTrgHoFail): [==>HOA A-HANDOVER-FAILURE] (callId=%d,entryId=%d)\n",
+ callIndex,parent->entryId);
+ DBG_HEXDUMP((unsigned char*) &bssApdu, bssApdu.LAYER3PDU.msglength+2);
+ DBG_CALL_TRACE(hoAgId_, "}\n");
+
+ //Retry next candidate if there is candidate
+ int i;
+ IntraL3HandoverRequired_t *inMsg = &handReqd;
+
+ if ( (i=getNextHoCandidate()) == (-1) )
+ {
+ DBG_TRACE("MNETeiTRACE(etrg::handleTrgHoFail): no more candidate to retrytry (#ofCands=%d)\n",
+ inMsg->numCandidates);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+
+ } else
+ {
+ candGlobalCellId_t candidate;
+ candidate = inMsg->candGlobalCellId[i];
+
+ DBG_TRACE("MNETeiTRACE(etrg::handleTrgHoFail): try next cand cell! %d-th of Cands(%d) candCell(%x,%x%x%x,%x%x%x,%x,%x) hoState(%d)\n",
+ i,inMsg->numCandidates,
+ candidate.candGlobalCellId.mcc[0],candidate.candGlobalCellId.mcc[1],
+ candidate.candGlobalCellId.mcc[2],candidate.candGlobalCellId.mnc[0],
+ candidate.candGlobalCellId.mnc[1],candidate.candGlobalCellId.mnc[2],
+ candidate.candGlobalCellId.lac, candidate.candGlobalCellId.ci,
+ hoState_);
+
+ if (candidate.candIsExternal)
+ {
+ //Handback from anchor GP to PLMN case
+ populateAHandoverRequest(&MY_GLOBALCELL_ID, &candidate.candGlobalCellId);
+
+ A_Result_t result;
+ NonStdRasMessagePerformHandbackRQ_t handbackRQ;
+
+ memset( (char*) &handbackRQ, 0, sizeof(NonStdRasMessagePerformHandbackRQ_t) );
+
+ if ( A_RESULT_SUCCESS != (result=
+ AIF_Encode(&aifMsg, (T_AIF_MessageUnit*)&handbackRQ.A_HANDOVER_REQUEST) ) )
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoFail): A-HANDOVER-REQUEST encoding failed (result=%d)\n\n}\n",
+ result);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+ }
+
+ //Send PERFORM-HANDBACK-REQ to HOA
+ handbackRQ.hoCause = inMsg->hoCause;
+ handbackRQ.header.origSubId = callIndex;
+ handbackRQ.header.destSubId = hoAgId_;
+ handbackRQ.globalCellID = candidate.candGlobalCellId;
+ handbackRQ.externalCell = true;
+
+ if (!VBLinkPerformHandback(&handbackRQ))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgHoFail): VBLinkPerformHandoverAck API failed !\n}\n");
+
+ DBG_HEXDUMP( (unsigned char*) &handbackRQ,
+ (int) (handbackRQ.A_HANDOVER_REQUEST.msglength+26)
+ );
+
+ DBG_ERROR("}\n");
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgHoFail): [==>HOA PERFORM_HANDBACK_REQ](callId=%d,entryId=%d)\n}\n",
+ callIndex, parent->entryId);
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgHoFail) PERFORM_HANDBACK_REQ MESSAGE DATA:\n");
+ DBG_TRACE(" : hoAgId_=%d, callId=%d\n",hoAgId_, callIndex);
+ DBG_TRACE(" : target cell(type=%d, mcc[1-3]:%x,%x,%x; mnc[1-3]:%x,%x,%x;lac=%x,ci=%x)\n",
+ handbackRQ.globalCellID.ci_disc,
+ handbackRQ.globalCellID.mcc[0],handbackRQ.globalCellID.mcc[1],handbackRQ.globalCellID.mcc[2],
+ handbackRQ.globalCellID.mnc[0],handbackRQ.globalCellID.mnc[1],handbackRQ.globalCellID.mnc[2],
+ handbackRQ.globalCellID.lac,handbackRQ.globalCellID.ci);
+
+ DBG_TRACE(" Encoded A_HANDOVER_REQ HEX DUMP:\n");
+ DBG_HEXDUMP((unsigned char*) &handbackRQ, sizeof (NonStdRasMessagePerformHandoverRQ_t) );
+ DBG_TRACE(" \n}\n");
+
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgHoFail) Received A-INTERFACE-MSG DUMP (length=%d): \n",
+ handbackRQ.A_HANDOVER_REQUEST.msglength);
+ DBG_HEXDUMP(
+ (unsigned char*)handbackRQ.A_HANDOVER_REQUEST.A_INTERFACE_DATA,
+ (int)handbackRQ.A_HANDOVER_REQUEST.msglength
+ );
+ DBG_TRACE("\n END-OF-DUMP\n}\n");
+
+ parent->sessionTimer->setTimer(CALL_HAND_TRG_T211);
+
+ DBG_CALL_TRACE(hoAgId_, "\nMNETeiTRACE(etrg::handleTrgHoFail): [<==CC START TIMER T211] (callId=%d, T211=%d ticks)\n}\n",
+ callIndex, (int)CALL_HAND_TRG_T211);
+
+ hoState_ = HAND_ST_TRG_SND_HB_REQ;
+
+ } else
+ {
+ //Handover from anchor GP to another GP case
+ sprintf(&(cellLocationRequest.ViperCellId[0]), "%d:%d",
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ cellLocationRequest.TxnId = callIndex;
+
+ if (false == VBLinkLocationRequest(cellLocationRequest) )
+ {
+ // Ignore the message
+ DBG_ERROR("{\nMNETeiTRACE(etrg::handleTrgHoFail): VBLinkLocationRequest failed!\n");
+ DBG_ERROR(" (hoAgId=%d callId=%d entryId=%d,lac=%d,ci=%d)\n}\n",
+ hoAgId_, callIndex, parent->entryId,
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_EH_HB);
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgHoFail): [==>HOA IP_ADDRESS_REQ](callId=%d,entryId=%d,lac=%d,ci=%d)\n}\n",
+ callIndex, parent->entryId,
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgHoFail): [<==CC START TIMER Tvb](callId=%d,entryId=%d,lac=%d,ci=%d)\n}\n",
+ callIndex, parent->entryId,
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TVB);
+
+ hoState_ = HAND_ST_ANCH_VC_IP_ADDRESS_REQ;
+ }
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleAnchToTrgCompltHb(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleAnchToTrgCompltHb", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchToTrgCompltHb): [<==HOA HANDBACK SUCCESS] (callIndex=%d, entryId=%d,hoState=%d)\n}\n",
+ callIndex, parent->entryId,hoState_);
+
+ // cancel T204 timer
+ parent->sessionTimer->cancelTimer();
+
+ if (hoState_==HAND_ST_ANCH_RCV_HB_REQ_ACK)
+ {
+ vcOutMsg.msgType = INTER_VC_CC_COMPLETE_HANDBACK;
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleAnchToTrgCompltHb): [==>GP-B HANDBACK SUCCESS] (callIndex=%d,hoState=%d)\n}\n",
+ callIndex, hoState_);
+ }
+
+ DBG_LEAVE();
+ return (CC_RELEASE_OWN);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgToAnchCompltHo(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgToAnchCompltHo", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ //cancel T202
+ parent->sessionTimer->cancelTimer();
+
+ GlobalCellId_t globalCellId, globalCellId_t;
+
+ T_CSU_PORT_ID oldPort, srcPort, snkPort;
+ T_CSU_RESULT_CON csuResult;
+
+ srcPort.portType = CSU_RTP_PORT;
+ srcPort.portId.rtpHandler = VoipCallGetRTPHandle(parent->hoCallLeg->h323CallHandle);
+
+ switch (hoState_)
+ {
+ case HAND_ST_ANCH_RCV_HO_REQ_ACK:
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchCompltHo): [<==GP-B HANDOVER_COMPLETE] (callIndex=%d,hoState=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ callIndex, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ oldPort.portType = CSU_GSM_PORT;
+ oldPort.portId.gsmHandler = parent->entryId;
+ snkPort.portType = CSU_RTP_PORT;
+ snkPort.portId.rtpHandler = hoRtpSession_;
+
+ globalCellId = hoGlobalCellId_;
+
+ break;
+
+ case HAND_ST_ANCH_RCV_H3_REQ_ACK:
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchCompltHo): [<==GP-B' HANDOVER_COMPLETE] (callIndex=%d,hoState=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ callIndex, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ oldPort.portType = CSU_RTP_PORT;
+ oldPort.portId.rtpHandler = hoRtpSession_;
+ snkPort.portType = CSU_RTP_PORT;
+ snkPort.portId.rtpHandler = h3RtpSession_;
+
+ globalCellId = h3GlobalCellId_;
+
+ break;
+
+ default:
+ DBG_ERROR("{\nMNETeiTRACE(etrg::handleTrgToAnchCompltHo) CC Inproper hoState(%d)(hoAgId=%d,callId=%d)\n}\n",
+ hoState_,hoAgId_,callIndex);
+
+ DBG_LEAVE();
+ return(JCC_NULL_EVENT);
+ }
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgToAnchCompltHo) (hoState=%d) srcPort(%d:%p) oldPort(%d:%p) snkPort(%d,%x)\n}\n",
+ hoState_,
+ srcPort.portType, srcPort.portId.rtpHandler,
+ oldPort.portType, oldPort.portId.rtpHandler,
+ snkPort.portType, snkPort.portId.rtpHandler);
+
+ if ( (csuResult = csu_OrigTermBreakAll(&oldPort)) != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_WARNING("{\nMNETeiWARNING(etrg::handleTrgToAnchCompltHo) CSU BreakAll Error(%d) for oldPort(%d, %x)\n}\n",
+ csuResult, oldPort.portType, oldPort.portId.rtpHandler);
+
+ //Ignore this warning to allow call going along
+ }
+
+ // Make duplex ho or h3 connection between src and snk rtp ports
+ if ((csuResult = csu_DuplexConnect(&snkPort, &srcPort)) != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgToAnchCompltHo) CSU 2-WAY Conn Error (%d) SrcPort(%d:%p)<->SnkPort(%d:%p)\n}\n",
+ csuResult, srcPort.portType, srcPort.portId.rtpHandler, snkPort.portType, snkPort.portId.rtpHandler);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchCompltHo): [==>CSU 2-WAY CONNECT] src(%d:%p) snk(%d:%p)] (callIndex=%d, hoState=%d, reIpAddr=%x,reCallId=%d)\n}\n",
+ srcPort.portType, srcPort.portId.rtpHandler, snkPort.portType, snkPort.portId.rtpHandler,
+ callIndex, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgToAnchCompltHo) BEFORE B'->B (hoAgId=%d,callId=%d,hoState=%d) ho(rtp=%p:%d vcCc=%x:%d vcId=%d:%d) h3(rtp=%p:%d vcCc=%x:%d vcId=%d:%d)\n}\n",
+ hoAgId_,callIndex, hoState_,
+ hoRtpSession_,otherHoIncomingRtpPort_, hoVcIpAddress_,hoVcCallIndex_, hoGlobalCellId_.lac,hoGlobalCellId_.ci,
+ h3RtpSession_,otherH3IncomingRtpPort_, h3VcIpAddress_,h3VcCallIndex_, h3GlobalCellId_.lac,h3GlobalCellId_.ci);
+
+ if (hoState_ == HAND_ST_ANCH_RCV_H3_REQ_ACK)
+ {
+ // Send the Complete Handback message to vcB
+ vcOutMsg.msgType = INTER_VC_CC_COMPLETE_HANDBACK;
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ //Release hoRtpHndle
+
+ if ( hoRtpSession_ != NULL ) ReleaseHandoverRtpChannel(hoRtpSession_);
+
+ // Update vcB'->vcB
+ hoRtpSession_ = h3RtpSession_;
+ h3RtpSession_ = NULL;
+ hoVcIpAddress_ = h3VcIpAddress_;
+ h3VcIpAddress_ = 0;
+ hoVcCallIndex_ = h3VcCallIndex_;
+ h3VcCallIndex_ = CC_MAX_CC_CALLS_DEF_VAL;
+ otherHoIncomingRtpPort_ = otherH3IncomingRtpPort_;
+ otherH3IncomingRtpPort_ = 0;
+ hoGlobalCellId_ = h3GlobalCellId_;
+ memset(&h3GlobalCellId_, 0, sizeof(GlobalCellId_t));
+
+ hoSimplexConnected_ = false;
+ h3SimplexConnected_ = false;
+ hoSrcLinkLost_ = false;
+ h3SrcLinkLost_ = false;
+ } else
+ {
+ // Release rf
+ if (parent->entryId != (T_CNI_IRT_ID) JCC_UNDEFINED )
+ {
+ // Send internal MM msg - release channel
+ sendMM(INTRA_L3_MM_REL_REQ, INTRA_L3_NULL_MSG, parent->entryId, &mmOutMsg);
+ parent->resetIrt();
+ }
+
+ parent->entryId = (T_CNI_IRT_ID) JCC_UNDEFINED;
+ parent->oid = CNI_LAPDM_NULL_OID;
+ hoSimplexConnected_ = false;
+ hoSrcLinkLost_ = false;
+ }
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgToAnchCompltHo) AFTER B'->B (hoAgId=%d,callId=%d,hoState=%d) ho(rtp=%p:%d vcCc=%x:%d vcId=%d:%d) h3(rtp=%p:%d vcCc=%x:%d vcId=%d:%d)\n}\n",
+ hoAgId_,callIndex, hoState_,
+ hoRtpSession_,otherHoIncomingRtpPort_, hoVcIpAddress_,hoVcCallIndex_, hoGlobalCellId_.lac,hoGlobalCellId_.ci,
+ h3RtpSession_,otherH3IncomingRtpPort_, h3VcIpAddress_,h3VcCallIndex_, h3GlobalCellId_.lac,h3GlobalCellId_.ci);
+
+ hoState_ = HAND_ST_ANCH_HO_COMPLT;
+
+ // empty the queues now that the handover is successful
+ // Do this only at the end.
+
+ emptyRRQueue ();
+ emptyDownlinkQueue();
+ emptyMMQueue ();
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgT202TimerExpiry(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgT202TimerExpiry", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgT202TimerExpiry): [<==CC TIMER T202 FIRED] (callIndex=%d,entryId=%d)\n}\n",
+ callIndex, parent->entryId);
+
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgToAnchPerfHoAck(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgToAnchPerfHoAck", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ //cancel T202
+ parent->sessionTimer->cancelTimer();
+
+ T_CSU_PORT_ID rtpSinkPort;
+
+ switch(hoState_)
+ {
+ case HAND_ST_ANCH_SND_H3_REQ:
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoAck): [<==GP-B' PERFORM_HANDOVER_ACK] (callIndex=%d,entryId=%d,hoState=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ callIndex, parent->entryId, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ h3VcCallIndex_ = vcInMsg->origSubId;
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoAck) hand23rd (hoAgId=%d,callId=%d,entryId=%d,h3RtpHndl=%p) (reIpAddr=%x, reCallId=%d, reRtpPort=%d)\n}\n",
+ hoAgId_, callIndex, parent->entryId, h3RtpSession_,
+ h3VcIpAddress_, h3VcCallIndex_, vcInMsg->msgData.perfHandoverAck.targetInRtpPort);
+
+ if (h3RtpSession_ == NULL)
+ {
+ DBG_WARNING("{\nMNETeiWARNING(etrg::handleTrgToAnchPerfHoAck) h3RtpHandle NULL (hoAgId=%d,callId=%d,entryId=%d, hoState=%d)(reIpAddr=%x,reCallId=%d)\n}\n",
+ hoAgId_,callIndex, parent->entryId, hoState_, h3VcIpAddress_, h3VcCallIndex_);
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_ANCH_H3_RTP_HANDLE_NULL;
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = JC_FAILURE_ANCH_H3_RTP_HANDLE_NULL;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_H3);
+ }
+
+ SetRemoteHandoverRtpPort(h3RtpSession_, h3VcIpAddress_,
+ vcInMsg->msgData.perfHandoverAck.targetInRtpPort);
+
+ rtpSinkPort.portType = CSU_RTP_PORT;
+ rtpSinkPort.portId.rtpHandler = h3RtpSession_;
+
+ break;
+
+ case HAND_ST_ANCH_SND_HO_REQ:
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoAck): [<==GP-B PERFORM_HANDOVER_ACK] (callIndex=%d,entryId=%d,hoState=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ callIndex, parent->entryId, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ hoVcCallIndex_ = vcInMsg->origSubId;
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoAck) handover (hoAgId=%d,callId=%d,entryId=%d,hoRtpHndl=%p) (reIpAddr=%x, reCallId=%d, reRtpPort=%d)\n}\n",
+ hoAgId_, callIndex, parent->entryId, hoRtpSession_,
+ hoVcIpAddress_, hoVcCallIndex_, vcInMsg->msgData.perfHandoverAck.targetInRtpPort);
+
+ if (hoRtpSession_ == NULL)
+ {
+ DBG_WARNING("{\nMNETeiWARNING(etrg::handleTrgToAnchPerfHoAck) hoRtpHandle NULL (hoAgId=%d,callId=%d,entryId=%d, hoState=%d)(reIpAddr=%x,reCallId=%d)\n}\n",
+ hoAgId_,callIndex, parent->entryId, hoState_, hoVcIpAddress_, hoVcCallIndex_);
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_ANCH_HO_RTP_HANDLE_NULL;
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_HO);
+ }
+
+ SetRemoteHandoverRtpPort(hoRtpSession_, hoVcIpAddress_,
+ vcInMsg->msgData.perfHandoverAck.targetInRtpPort);
+
+ rtpSinkPort.portType = CSU_RTP_PORT;
+ rtpSinkPort.portId.rtpHandler = hoRtpSession_;
+
+ break;
+
+ default:
+ //Deadly problem, need shoubleshooting first before running ahead !
+ DBG_ERROR ("{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoAck): CC Error Inproper hoState(%d) (hoAgId=%d,callId=%d)\n}\n",
+ hoState_,hoAgId_,callIndex);
+ DBG_LEAVE();
+ return (JCC_NULL_EVENT);
+ }
+
+ // simplex conn for ho or h3
+
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(parent->hoCallLeg->h323CallHandle);
+
+ if ((csuResult = csu_SimplexConnect(&rtpSourcePort, &rtpSinkPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERROR("{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoAck): CSU 1-Way Conn Error(%d) (hoAgId=%d,callId=%d,hoState=%d,srcRtpHndl=%p,snkRtpHndl=%p)\n}\n",
+ csuResult, hoAgId_,callIndex,hoState_,
+ (int)rtpSourcePort.portId.rtpHandler,
+ (int)rtpSinkPort.portId.rtpHandler);
+
+ if (hoState_ == HAND_ST_ANCH_SND_H3_REQ)
+ {
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDBACK;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_CSU_UNI_CONNECT_FAILED;
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_CSU_UNI_CONNECT_FAILED;
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_H3);
+ } else
+ {
+ //hoState_ == HAND_ST_ANCH_SND_HO_REQ)
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_CSU_UNI_CONNECT_FAILED;
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_HO);
+ }
+ }
+
+ // Handover or handover to 3rd Simplex Connection is made successfully
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoAck): [==>CSU 1-WAY CONNECT](callId=%d,hoState=%d,src=%d:%p<-->snk=%d:%p)\n}\n",
+ callIndex, hoState_,
+ rtpSinkPort.portType, rtpSinkPort.portId.rtpHandler,
+ rtpSourcePort.portType, rtpSourcePort.portId.rtpHandler);
+
+ switch(hoState_)
+ {
+ case HAND_ST_ANCH_SND_HO_REQ:
+ // Send internal RR msg
+ rrOutMsg.l3_data.handCmd.handCmd = vcInMsg->msgData.perfHandoverAck.handCmd;
+
+ sendRR(INTRA_L3_DATA, INTRA_L3_RR_HANDOVER_COMMAND, parent->entryId, &rrOutMsg);
+
+ hoSimplexConnected_ = true;
+ hoState_ = HAND_ST_ANCH_RCV_HO_REQ_ACK;
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoAck): [==>RM HANDOVER_COMMAND](callId=%d,hoState=%d,entryId=%d)\n}\n",
+ callIndex, hoState_,parent->entryId);
+ break;
+
+ case HAND_ST_ANCH_SND_H3_REQ:
+ //Send HB ack to MSC-B based on HO ack from MSC-B'
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_ACK;
+ vcOutMsg.msgData.perfHandbackAck.handCmd = vcInMsg->msgData.perfHandoverAck.handCmd;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ h3SimplexConnected_ = true;
+ hoState_ = HAND_ST_ANCH_RCV_H3_REQ_ACK;
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoAck): [==>GP-B PERFORM_HANDBACK_ACK](callId=%d,entryId=%d,hoState=%d)\n}\n",
+ callIndex,parent->entryId,hoState_);
+
+ break;
+ }
+
+ // start the T202 timer
+ parent->sessionTimer->setTimer(CALL_HAND_TRG_T202);
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgToAnchPerfHoNack(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgToAnchPerfHoNack", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ //cancel T202
+ parent->sessionTimer->cancelTimer();
+
+ int i;
+ IntraL3HandoverRequired_t *inMsg = &handReqd;
+
+ switch(hoState_)
+ {
+ case HAND_ST_ANCH_SND_HO_REQ:
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoNack): [<==GP-B PERFORM_HANDOVER_NACK] (callIndex=%d,entryId=%d,hoState=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ callIndex, parent->entryId, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ if ( (i=getNextHoCandidate()) != (-1) )
+ {
+ //Try next candidate
+ candGlobalCellId_t candidate;
+ candidate = inMsg->candGlobalCellId[i];
+
+ DBG_TRACE("MNETeiTRACE(etrg::handleTrgToAnchPerfHoNack): try next cand cell! %d-th of Cands(%d) candCell(%x,%x%x%x,%x%x%x,%x,%x) hoState(%d)\n}\n",
+ i,inMsg->numCandidates,
+ candidate.candGlobalCellId.mcc[0],candidate.candGlobalCellId.mcc[1],
+ candidate.candGlobalCellId.mcc[2],candidate.candGlobalCellId.mnc[0],
+ candidate.candGlobalCellId.mnc[1],candidate.candGlobalCellId.mnc[2],
+ candidate.candGlobalCellId.lac, candidate.candGlobalCellId.ci,
+ hoState_);
+
+ if (candidate.candIsExternal)
+ {
+ //Handback from anchor GP to PLMN case
+ populateAHandoverRequest(&MY_GLOBALCELL_ID, &candidate.candGlobalCellId);
+
+ A_Result_t result;
+ NonStdRasMessagePerformHandbackRQ_t handbackRQ;
+
+ memset( (char*) &handbackRQ, 0, sizeof(NonStdRasMessagePerformHandbackRQ_t) );
+
+ if ( A_RESULT_SUCCESS != (result=
+ AIF_Encode(&aifMsg, (T_AIF_MessageUnit*)&handbackRQ.A_HANDOVER_REQUEST) ) )
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgToAnchPerfHoNack): A-HANDOVER-REQUEST encoding failed (result=%d)\n\n}\n",
+ result);
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_A_INTERFACE_MESSAGE_ENCODING_FAILED;
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_HO);
+ }
+
+ //Send PERFORM-HANDBACK-REQ to HOA
+ handbackRQ.hoCause = inMsg->hoCause;
+ handbackRQ.header.origSubId = callIndex;
+ handbackRQ.header.destSubId = hoAgId_;
+ handbackRQ.globalCellID = candidate.candGlobalCellId;
+ handbackRQ.externalCell = true;
+
+ if (!VBLinkPerformHandback(&handbackRQ))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgToAnchPerfHoNack): VBLinkPerformHandoverAck API failed !\n}\n");
+
+ DBG_HEXDUMP( (unsigned char*) &handbackRQ,
+ (int) (handbackRQ.A_HANDOVER_REQUEST.msglength+26)
+ );
+
+ DBG_ERROR("}\n");
+
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_HO);
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoNack): [==>HOA PERFORM_HANDBACK_REQ](callId=%d,entryId=%d,lac=%d,ci=%d)\n}\n",
+ callIndex, parent->entryId,candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoNack) PERFORM_HANDBACK_REQ MESSAGE DATA:\n");
+ DBG_TRACE(" : hoAgId_=%d, callId=%d\n",hoAgId_, callIndex);
+ DBG_TRACE(" : target cell(type=%d, mcc[1-3]:%x,%x,%x; mnc[1-3]:%x,%x,%x;lac=%x,ci=%x)\n",
+ handbackRQ.globalCellID.ci_disc,
+ handbackRQ.globalCellID.mcc[0],handbackRQ.globalCellID.mcc[1],handbackRQ.globalCellID.mcc[2],
+ handbackRQ.globalCellID.mnc[0],handbackRQ.globalCellID.mnc[1],handbackRQ.globalCellID.mnc[2],
+ handbackRQ.globalCellID.lac,handbackRQ.globalCellID.ci);
+
+ DBG_TRACE(" Encoded A_HANDOVER_REQ HEX DUMP:\n");
+ DBG_HEXDUMP((unsigned char*) &handbackRQ, sizeof (NonStdRasMessagePerformHandoverRQ_t) );
+ DBG_TRACE(" \n}\n");
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoNack) Received A-INTERFACE-MSG DUMP (length=%d): \n",
+ handbackRQ.A_HANDOVER_REQUEST.msglength);
+ DBG_HEXDUMP(
+ (unsigned char*)handbackRQ.A_HANDOVER_REQUEST.A_INTERFACE_DATA,
+ (int)handbackRQ.A_HANDOVER_REQUEST.msglength
+ );
+ DBG_TRACE("\n END-OF-DUMP\n}\n");
+
+ parent->sessionTimer->setTimer(CALL_HAND_TRG_T211);
+
+ DBG_CALL_TRACE(hoAgId_, "\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoNack): [<==CC START TIMER T211] (callId=%d, T211=%d ticks,lac=%d,ci=%d)\n}\n",
+ callIndex, (int)CALL_HAND_TRG_T211,candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ hoState_ = HAND_ST_TRG_SND_HB_REQ;
+
+ } else
+ {
+ //Handover from anchor GP to another GP case
+ sprintf(&(cellLocationRequest.ViperCellId[0]), "%d:%d",
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ cellLocationRequest.TxnId = callIndex;
+
+ if (false == VBLinkLocationRequest(cellLocationRequest) )
+ {
+ // Ignore the message
+ DBG_ERROR("{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoNack): VBLinkLocationRequest failed!\n");
+ DBG_ERROR(" (hoAgId=%d callId=%d entryId=%d,lac=%d,ci=%d)\n}\n",
+ hoAgId_, callIndex, parent->entryId,
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_HO);
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoNack): [==>HOA IP_ADDRESS_REQ](callId=%d,entryId=%d,lac=%d,ci=%d)\n}\n",
+ callIndex, parent->entryId,
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoNack): [<==CC START TIMER Tvb](hoAgId=%d,callId=%d,entryId=%d,lac=%d,ci=%d)\n}\n",
+ hoAgId_, callIndex, parent->entryId,
+ candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TVB);
+
+ hoState_ = HAND_ST_ANCH_VC_IP_ADDRESS_REQ;
+ }
+
+ } else
+ {
+ DBG_TRACE("MNETeiTRACE(etrg::handleTrgToAnchPerfHoNack): run-out of (#ofCands=%d) (hoAgId=%d,callId=%d,entryId=%d,hoState=%d)\n",
+ inMsg->numCandidates,hoAgId_,callIndex,parent->entryId,hoState_);
+ DBG_LEAVE();
+ return (CC_RELEASE_GP_HO);
+ }
+
+ break;
+
+ case HAND_ST_ANCH_SND_H3_REQ:
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoNack): [<==GP-B' PERFORM_HANDOVER_NACK] (callIndex=%d,entryId=%d,hoState=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ callIndex, parent->entryId, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ //Abort action @ MSC-B'
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = vcInMsg->msgData.perfHandoverNack.cause;
+
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoNack): [==>GP-B' ABORT_HANDOVER] (callIndex=%d,hoState=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ callIndex, hoState_, vcInMsg->origVcAddress, vcInMsg->origSubId);
+
+ // Abort HB part at MSC-B
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = vcInMsg->msgData.perfHandoverNack.cause;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoNack): [==>GP-B ABORT_HANDBACK] (callIndex=%d,hoState=%d,reIpAddr=%x,reCallId=%d)\n}\n",
+ callIndex, hoState_, hoVcIpAddress_, hoVcCallIndex_);
+
+ DBG_LEAVE();
+ return(CC_RELEASE_GP_H3);
+
+ break;
+
+ default:
+ //Deadly problem, need shoubleshooting right away !
+ DBG_ERROR ("{\nMNETeiTRACE(etrg::handleTrgToAnchPerfHoNack): CC Inproper hoState(%d) (hoAgId=%d,callId=%d)\n}\n",
+ hoState_, hoAgId_, callIndex);
+ DBG_LEAVE();
+
+ return (JCC_NULL_EVENT);
+ }
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgToAnchAbortHb(void)
+{
+ JCCEvent_t retEvent;
+
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgToAnchAbortHb", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchAbortHb): [<==GP-B ABORT_HANDBACK](callId=%d,hoState=%d)\n}\n",
+ callIndex, hoState_);
+
+ parent->sessionTimer->cancelTimer();
+
+ if ( (hoState_ == HAND_ST_ANCH_SND_HB_REQ) || (hoState_ ==HAND_ST_ANCH_RCV_HB_REQ_ACK) )
+ retEvent = CC_RELEASE_GP_EH_HB;
+ else if ( (hoState_ == HAND_ST_ANCH_RCV_HB_REQ) || (hoState_ == HAND_ST_ANCH_SND_HB_REQ_ACK) ||
+ (hoState_ == HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ) )
+ retEvent = CC_RELEASE_GP_HB;
+
+ else if ( (hoState_ == HAND_ST_ANCH_RCV_H3_REQ_ACK) || (hoState_ == HAND_ST_ANCH_SND_H3_REQ) )
+ {
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = vcInMsg->msgData.abortHandback.cause;
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ retEvent = CC_RELEASE_GP_H3;
+ } else
+ {
+ retEvent = JCC_NULL_EVENT;
+ }
+
+ DBG_LEAVE();
+ return(retEvent);
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleTrgToAnchHbFail(void)
+{
+ JCCEvent_t retEvent = JCC_NULL_EVENT;
+
+ DBG_FUNC("CCTargetHandoverExtHo::handleTrgToAnchHbFail", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgToAnchHbFail): [<==GP-B HANDOVER FAILURE](callId=%d,hoState=%d)\n}\n",
+ callIndex, hoState_);
+
+ //Cancel T202 or T204
+ parent->sessionTimer->cancelTimer();
+ A_Handover_Failure_t *pFailure = (A_Handover_Failure_t*) &aifMsg.handoverFailure;
+
+ switch (hoState_)
+ {
+ case HAND_ST_ANCH_RCV_H3_REQ_ACK:
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_ANCH_H3_RTP_HANDLE_NULL;
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ retEvent = CC_RELEASE_GP_H3;
+
+ break;
+
+ case HAND_ST_ANCH_RCV_HB_REQ_ACK:
+ //Zero out message description
+ memset((char*) &aifMsg,0,sizeof(T_AIF_MSG));
+
+ //Mandatory IEs
+ pFailure->msgType = A_HANDOVER_FAILURE_TYPE;
+ pFailure->cause.ie_present = true;
+ pFailure->cause.elementIdentifier = 0x04;
+ pFailure->cause.length = 1;
+ pFailure->cause.length = (unsigned char) vcInMsg->msgData.abortHandback.cause;
+
+ //No optional IEs furnished now
+
+ //Encode A-HANDOVER-FAILURE msg
+ A_Result_t result; A_INTERFACE_MSG_STRUCT_t aifData;
+ memset( (char*) &aifData, 0, sizeof(A_INTERFACE_MSG_STRUCT_t) );
+ if ( A_RESULT_SUCCESS != (result=
+ AIF_Encode(&aifMsg, (T_AIF_MessageUnit*)&aifData) ) )
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgToAnchHbFail): A-HANDOVER-FAILURE encoding error(%d)(hoAgId=%d,callIndex=%d,hoState=%d)\n}\n",
+ result,hoAgId_,callIndex,hoState_);
+
+ retEvent = CC_RELEASE_EH_HB;
+ }
+
+ //Send up bss APDU to PLMN (anchor part)
+ NonStdRasMessagePostHandoverMobEvent_t bssApdu;
+
+ bssApdu.header.origSubId = callIndex;
+ bssApdu.header.destSubId = hoAgId_;
+
+ bssApdu.LAYER3PDU.LAYER3DATA[0] = 0x00; //BSSMAP
+ bssApdu.LAYER3PDU.LAYER3DATA[1] = (unsigned char) aifData.msglength;
+ memcpy((char*)&bssApdu.LAYER3PDU.LAYER3DATA[2],(char*)aifData.A_INTERFACE_DATA,
+ aifData.msglength);
+ bssApdu.LAYER3PDU.msglength = (unsigned short) (2 + aifData.msglength);
+
+ if (!VBLinkPostHandoverMobEvent(&bssApdu))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::handleTrgToAnchHbFail): VBLinkPostHandoverMobEvent() failed (hoAgId=%d,callIndex=%d,hoState=%d)\n}\n",
+ hoAgId_,callIndex,hoState_);
+ DBG_HEXDUMP((unsigned char*) &bssApdu, bssApdu.LAYER3PDU.msglength+2);
+
+ DBG_ERROR("}\n");
+
+ retEvent = CC_RELEASE_EH_HB;
+ }
+
+ DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etgt::handleTrgToAnchHbFail): [==>HOA A-HANDOVER-FAILURE] (callId=%d,entryId=%d,hoState=%d)\n",
+ callIndex,parent->entryId,hoState_);
+ DBG_HEXDUMP((unsigned char*) &bssApdu, bssApdu.LAYER3PDU.msglength+2);
+ DBG_CALL_TRACE(hoAgId_, "}\n");
+
+ retEvent = CC_RELEASE_EH_HB;
+
+ break;
+
+ default:
+ DBG_ERROR("{\nMNETeiERROR)(etrg::handleTrgToAnchHbFail):CC Error Inproper hoState(%d)(hoAgId=%d,callId=%d)\n}\n",
+ hoState_,hoAgId_,callIndex);
+ break;
+ }
+
+ DBG_LEAVE();
+ return (retEvent);
+
+}
+
+int
+CCTargetHandoverExtHo::ccReleaseCall(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::ccReleaseCall", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::ccReleaseCall): CC External Handover (CC_RELEASE_CALL event=%d)(hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ hoEndCause_,hoAgId_,callIndex,hoState_);
+
+ //Cancel whatever timer in case
+ parent->sessionTimer->cancelTimer();
+
+ //Send END_HANDOVER to HOA
+ NonStdRasMessageEndHandover_t endHandover;
+ endHandover.header.origSubId = callIndex;
+ endHandover.header.destSubId = hoAgId_;
+ endHandover.reason = hoEndCause_;
+
+ if (!VBLinkEndHandover(&endHandover))
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::smHandleEvent): VBLinkEndHandover API failed(hoAgId=%d,callId=%d,hoState=%d,cause=%d)\n}\n",
+ hoAgId_,callIndex,hoState_,hoEndCause_);
+ } else
+ {
+ DBG_TRACE("{\nMNETeiTRACE(etrg::smHandleEvent): [==>HOA END_HANDOVER cause=%d)](hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ hoEndCause_, hoAgId_, callIndex, hoState_);
+ }
+
+ //Send RELEASE_HOA to HOA
+ //NonStdRasMessageReleaseHOA_t relHoa;
+ //relHoa.header.origSubId = callIndex;
+ //relHoa.header.destSubId = hoAgId_;
+
+ //if (!VBLinkReleaseHOA(&relHoa))
+ //{
+ // DBG_ERROR("{\nMNETeiERROR(etrg::smHandleEvent): VBLinkReleaseHOA API failed\n}\n");
+ //} else
+ //{
+ // DBG_TRACE("{\nMNETeiTRACE(etrg::smHandleEvent): [==>HOA RELEASE_HANDOVER_AGENT (hoAgId=%d,callId=%d,entryId=%d)\n}\n",
+ // hoAgId_, callIndex, parent->entryId);
+ //}
+
+ hoAgId_ = -1;
+
+ DBG_LEAVE();
+ return(CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING);
+}
+
+
+int
+CCTargetHandoverExtHo::ccReleaseOwn(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::ccReleaseOwn", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::ccReleaseCall): CC External Handover (CC_RELEASE_OWN)(hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ hoAgId_,callIndex, hoState_);
+
+ //Cancel whatever timer in case
+ parent->sessionTimer->cancelTimer();
+
+ hoAgId_ = -1;
+
+ DBG_LEAVE();
+ return(CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING);
+}
+
+void
+CCTargetHandoverExtHo::ccReleaseGpHo(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::ccReleaseGpHo", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::ccReleaseGpHo): CC External Handover (CC_RELEASE_GP_HO)(hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ hoAgId_,callIndex,hoState_);
+
+ //Cancel whatever timer in case
+ parent->sessionTimer->cancelTimer();
+
+ if (hoRtpSession_ != NULL)
+ {
+ // break connection
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = hoRtpSession_;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort)) != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::ccReleaseGpHo) CC CSU OrigTerm Break All Error(%d) (hoAgId=%d,callId=%d,hoRtpSession=%x)\n",
+ csuResult,hoAgId_,callIndex, (int)hoRtpSession_);
+
+ //Skip this error but may report via OAM if it cares.
+ }
+
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+
+ hoRtpSession_ = NULL;
+ }
+
+ msMsgsQueued_ = false;
+ rrMsgsQueued_ = false;
+ hoSimplexConnected_ = false;
+ hoSrcLinkLost_ = false; //ext-HO FFS ???
+ hoVcCallIndex_ = CC_MAX_CC_CALLS_DEF_VAL;
+ hoVcIpAddress_ = 0;
+ otherHoIncomingRtpPort_ = 0;
+ memset(&hoGlobalCellId_, 0, sizeof(GlobalCellId_t));
+
+ hoState_ = HAND_ST_TRG_HO_COMPLT;
+
+ DBG_LEAVE();
+ return; //(CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+void
+CCTargetHandoverExtHo::ccReleaseGpH3(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::ccReleaseGpH3", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::ccReleaseGpH3): CC External Handover (CC_RELEASE_GP_H3)(hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ hoAgId_,callIndex, hoState_);
+
+ //Cancel whatever timer in case
+ parent->sessionTimer->cancelTimer();
+
+ if (h3RtpSession_ != NULL)
+ {
+ // break connection
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = h3RtpSession_;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort)) != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::ccReleaseGpH3) CC CSU OrigTerm Break All Error(%d) (hoAgId=%d,callId=%d,hoRtpSession=%x)\n",
+ csuResult,hoAgId_,callIndex, (int)h3RtpSession_);
+
+ //Skip this error but may report via OAM if it cares.
+ }
+
+ ReleaseHandoverRtpChannel(h3RtpSession_);
+
+ h3RtpSession_ = NULL;
+ }
+
+ msMsgsQueued_ = false;
+ rrMsgsQueued_ = false;
+
+ h3SimplexConnected_ = false;
+ h3VcCallIndex_ = CC_MAX_CC_CALLS_DEF_VAL;
+ h3VcIpAddress_ = 0;
+ otherH3IncomingRtpPort_ = 0;
+ h3SrcLinkLost_ = false; //ext-HO FFS ???
+ memset(&h3GlobalCellId_, 0, sizeof(GlobalCellId_t));
+
+ hoState_ = HAND_ST_ANCH_HO_COMPLT;
+
+ DBG_LEAVE();
+ return; //(CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+void
+CCTargetHandoverExtHo::ccReleaseGpHb(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::ccReleaseGpHb", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::ccReleaseGpHb): CC External Handover (CC_RELEASE_GP_HB)(hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ hoAgId_,callIndex, hoState_);
+
+ //Cancel whatever timer in case
+ parent->sessionTimer->cancelTimer();
+
+ if (parent->entryId != (T_CNI_IRT_ID) JCC_UNDEFINED)
+ {
+ //Break the connections with the RF Port
+ T_CSU_PORT_ID rfSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rfSourcePort.portType = CSU_GSM_PORT;
+ rfSourcePort.portId.gsmHandler = parent->entryId;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rfSourcePort)) != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERROR("CSU Error : Disconn. Failure, (Result = %d) for (entryId = %d)\n",
+ csuResult, parent->entryId);
+
+ // Can only generate OA&M log.
+ }
+
+ IntraL3Msg_t mmOutMsg;
+
+ // Send internal MM msg for release
+ sendMM(INTRA_L3_MM_REL_REQ, INTRA_L3_NULL_MSG, parent->entryId, &mmOutMsg);
+ parent->resetIrt();
+ parent->entryId = (T_CNI_IRT_ID) JCC_UNDEFINED;
+ parent->oid = CNI_LAPDM_NULL_OID;
+ }
+
+
+ hoSimplexConnected_ = false;
+ hoState_ = HAND_ST_ANCH_HO_COMPLT;
+
+ DBG_LEAVE();
+ return; //(CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+void
+CCTargetHandoverExtHo::ccReleaseEhHb(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::ccReleaseEhHb", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::ccReleaseGpHb): CC External Handover (CC_RELEASE_EH_HB)(hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ hoAgId_,callIndex, hoState_);
+
+ //Cancel whatever timer in case
+ parent->sessionTimer->cancelTimer();
+
+
+ hoState_ = HAND_ST_TRG_HO_COMPLT;
+
+ DBG_LEAVE();
+ return; //(CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+void
+CCTargetHandoverExtHo::ccReleaseGpEhHb(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::ccReleaseGpEhHb", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::ccReleaseGpEhHb): CC External Handover (CC_RELEASE_GP_EH_HB)(hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ hoAgId_,callIndex, hoState_);
+
+ //Cancel whatever timer in case
+ parent->sessionTimer->cancelTimer();
+
+ hoState_ = HAND_ST_ANCH_HO_COMPLT;
+
+ DBG_LEAVE();
+ return; //(CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+int
+CCTargetHandoverExtHo::handleVcCcMsg(InterVcMsg_t *vcCcInMsg)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleVcCcMsg", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ CCHandover::handleVcCcMsg(vcCcInMsg);
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+}
+
+void
+CCTargetHandoverExtHo::initData()
+{
+ DBG_FUNC("CCTargetHandoverExtHo::initData", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ //Cancel whatever timer in case
+ //parent->sessionTimer->cancelTimer();
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_REMOTE_END_HANDOVER;
+
+ switch (hoState_)
+ {
+ case HAND_ST_ANCH_SND_H3_REQ: case HAND_ST_ANCH_RCV_H3_REQ_ACK:
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+ case HAND_ST_ANCH_SND_HO_REQ: case HAND_ST_ANCH_RCV_HO_REQ_ACK:
+ case HAND_ST_ANCH_HO_COMPLT : case HAND_ST_ANCH_SND_HB_REQ :
+ case HAND_ST_ANCH_RCV_HB_REQ_ACK: case HAND_ST_ANCH_RCV_HB_REQ :
+ case HAND_ST_ANCH_SND_HB_REQ_ACK: case HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ:
+ sendVcMsg(MODULE_CC, MODULE_CC);
+ break;
+
+ default:
+ break;
+ }
+
+ if (hoRtpSession_ != NULL)
+ {
+ // break connection
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = hoRtpSession_;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort)) != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::initData) CC CSU OrigTerm Break All Error(%d) (hoAgId=%d,callId=%d,hoRtpSession=%x)\n",
+ csuResult,hoAgId_,callIndex, (int)hoRtpSession_);
+
+ //Skip this error but may report via OAM if it cares.
+ }
+
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ }
+
+ if (h3RtpSession_ != NULL)
+ {
+ // break connection
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = h3RtpSession_;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort)) != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::initData) CC CSU OrigTerm Break All Error(%d) (hoAgId=%d,callId=%d,hoRtpSession=%x)\n",
+ csuResult,hoAgId_,callIndex, (int)h3RtpSession_);
+
+ //Skip this error but may report via OAM if it cares.
+ }
+
+ ReleaseHandoverRtpChannel(h3RtpSession_);
+ }
+
+
+ if (parent->entryId != (T_CNI_IRT_ID) JCC_UNDEFINED)
+ {
+ //Break the connections with the RF Port
+ T_CSU_PORT_ID rfSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rfSourcePort.portType = CSU_GSM_PORT;
+ rfSourcePort.portId.gsmHandler = parent->entryId;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rfSourcePort)) != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERROR("{\nMNETeiERROR(etrg::initData) CC CSU OrigTerm Break All Error(%d) (hoAgId=%d,callId=%d,entryId=%d)\n",
+ csuResult, hoAgId_,callIndex, parent->entryId);
+
+ // Can only generate OA&M log.
+ }
+
+ // Send internal MM msg for release
+ IntraL3Msg_t mmOutMsg;
+
+ sendMM(INTRA_L3_MM_REL_REQ, INTRA_L3_NULL_MSG, parent->entryId, &mmOutMsg);
+ parent->resetIrt();
+ parent->entryId = (T_CNI_IRT_ID) JCC_UNDEFINED;
+ parent->oid = CNI_LAPDM_NULL_OID;
+ }
+
+ msMsgsQueued_ = false;
+ rrMsgsQueued_ = false;
+
+ hoSimplexConnected_ = false;
+ hoSrcLinkLost_ = false; //ext-HO FFS ???
+ hoVcCallIndex_ = CC_MAX_CC_CALLS_DEF_VAL;
+ hoVcIpAddress_ = 0;
+ otherHoIncomingRtpPort_ = 0;
+ memset(&hoGlobalCellId_, 0, sizeof(GlobalCellId_t));
+
+ h3SimplexConnected_ = false;
+ h3VcCallIndex_ = CC_MAX_CC_CALLS_DEF_VAL;
+ h3VcIpAddress_ = 0;
+ otherH3IncomingRtpPort_ = 0;
+ h3SrcLinkLost_ = false; //ext-HO FFS ???
+ memset(&h3GlobalCellId_, 0, sizeof(GlobalCellId_t));
+
+ currSpeechCh_.version = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1;
+ currChannel_.bearerType = BEARER_SPEECH;
+ currChannel_.speechChann.version= CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1;
+ hoEndCause_ = MC_HO_SUCCESS;
+ memset(&currEncrypt_, 0, sizeof(IntraL3CipherModeCommand_t));
+
+ parent->handoverSession = NULL;
+
+ hoState_ = HAND_ST_IDLE;
+
+ DBG_LEAVE();
+ return; //(CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+int
+CCTargetHandoverExtHo::handleMMMsg(IntraL3Msg_t *mmMsg,
+ JCCEvent_t hoEvent)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleMMMsg", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ CCHandover::handleMMMsg(mmMsg, hoEvent);
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+}
+
+void
+CCTargetHandoverExtHo::emptyDownlinkQueue (void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::emptyDownlinkQueue", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ short index;
+
+ // Empty second level PDU Queue first
+ // Messages will be send to the target Vipercell
+ parent->flashSapi3Queue();
+
+ if (msMsgsQueued_ > 0)
+ {
+ for(index=0; index< msMsgsQueued_; index++)
+ {
+ parent->sendL2Msg(&downlinkQueue_[index]);
+ }
+
+ msMsgsQueued_ = 0;
+ }
+
+ DBG_LEAVE();
+}
+
+
+void
+CCTargetHandoverExtHo::addToRRQueue (IntraL3Msg_t *rrMsg)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::addToRRQueue", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ if (rrMsgsQueued_)
+ {
+ // Queue is full. Do Nothing.
+ }
+ else
+ {
+ savedRRMsg_ = *rrMsg;
+ rrMsgsQueued_ = true;
+ }
+
+ DBG_LEAVE();
+}
+
+void
+CCTargetHandoverExtHo::emptyRRQueue (void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::emptyRRQueue", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ if (!rrMsgsQueued_)
+ {
+ // Queue is empty. Do Nothing.
+ }
+ else
+ {
+ parent->sendRRMsg(savedRRMsg_.primitive_type,
+ savedRRMsg_.message_type,
+ &savedRRMsg_);
+
+ rrMsgsQueued_ = false;
+ }
+
+ DBG_LEAVE();
+}
+
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleNullEvent(void)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::handleNullEvent",CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ if (vcInMsg->msgType==INTER_VC_CC_POST_HANDOVER_MOB_EVENT)
+ {
+ DBG_CALL_TRACE(hoAgId_,"{\nMNETeiTRACE(etrg::handleNullEvent):[<==GP(%x:%x) MS MESSAGE](callId=%d,hoState=%d)\n}\n",
+ vcInMsg->origVcAddress,vcInMsg->origSubId,callIndex,hoState_);
+ } else
+ {
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleNullEvent): CC Ignored Event(%d) (hoAgId=%d,callIndex=%d,hoState=%d)\n}\n",
+ currEvent,hoAgId_,callIndex,hoState_);
+ }
+ DBG_LEAVE();
+ return (JCC_NULL_EVENT);
+}
+
+void
+CCTargetHandoverExtHo::sendL2MsgToGpBCc(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ DBG_FUNC("CCAnchorHandover::sendL2MsgToGpBCc", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ vcOutMsg.msgType = INTER_VC_CC_POST_HANDOVER_DATA_EVENT;
+ vcOutMsg.msgData.postHoMobEventData.msEncodedMsg = *msEncodedMsg;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+ DBG_LEAVE();
+}
+
+JCCEvent_t
+CCTargetHandoverExtHo::handleAnchToTrgPostHoHoaEvent(void)
+{
+ DBG_FUNC ("CCTargetHandoverExtHo::handleAnchToTrgPostHoHoaEvent", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ T_CNI_LAPDM_L3MessageUnit msMsg;
+
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleAnchToTrgPostHoHoaEvent) Received POST HOA EVENT DUMP (length=%d): \n",
+ hoaInMsg->msgData.postExtHoMobEventData.LAYER3PDU.msglength);
+
+ DBG_HEXDUMP(
+ (unsigned char*)&(hoaInMsg->msgData.postExtHoMobEventData.LAYER3PDU.LAYER3DATA),
+ (int)hoaInMsg->msgData.postExtHoMobEventData.LAYER3PDU.msglength
+ );
+ DBG_TRACE("\n END-OF-DUMP\n}\n");
+
+ msMsg.msgLength = hoaInMsg->msgData.postExtHoMobEventData.LAYER3PDU.LAYER3DATA[2];
+ memcpy( (char*)msMsg.buffer,
+ (char*)&(hoaInMsg->msgData.postExtHoMobEventData.LAYER3PDU.LAYER3DATA[3]),
+ (int) msMsg.msgLength);
+
+
+ //If handing around within MNET in progress. Relay the message properly
+ switch (hoState_)
+ {
+ case HAND_ST_TRG_HO_COMPLT: case HAND_ST_TRG_SND_HB_REQ:
+ case HAND_ST_ANCH_VC_IP_ADDRESS_REQ: case HAND_ST_ANCH_SND_HO_REQ:
+ //Send MS message to GP-A
+ sendL2MsgToGpACc(&msMsg);
+ break;
+
+ case HAND_ST_ANCH_HO_COMPLT: case HAND_ST_ANCH_SND_HB_REQ:
+ case HAND_ST_ANCH_RCV_HB_REQ: case HAND_ST_ANCH_SND_H3_REQ:
+ case HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ:
+ //Send MS message to GP-B
+ sendL2MsgToGpBCc(&msMsg);
+ break;
+
+ case HAND_ST_ANCH_RCV_HO_REQ_ACK: case HAND_ST_ANCH_SND_HB_REQ_ACK:
+ case HAND_ST_ANCH_RCV_H3_REQ_ACK:
+ //Queue up MS messages since MNET handover is in progress
+ addToDownlinkQueue(&msMsg);
+ break;
+
+ case HAND_ST_TRG_RCV_HB_REQ_ACK: case HAND_ST_ANCH_RCV_HB_REQ_ACK:
+ default:
+ DBG_WARNING("{\nMNETeiTRACE(etrg::handleAnchToTrgPostHoHoaEvent): Ignore this MS message from HOA (hoAgId=%d,callId=%d,hoState=%d)\n}\n",
+ hoAgId_,callIndex,hoState_);
+ break;
+ }
+
+ DBG_LEAVE();
+ return(CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+bool
+CCTargetHandoverExtHo::sendL2MsgToGpACc (T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ DBG_FUNC ("CCTargetHandoverExtHo::sendL2MsgToGpACc", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ bool retVal = true;
+
+ //T_CNI_RIL3_PROTOCOL_DISCRIMINATOR msgPd = extractPd (msEncodedMsg);
+ //T_CNI_LAPDM_SAPI sapi = (msgPd == CNI_RIL3_PD_SMS) ? SAPI_SMS : SAPI_MAIN;
+ T_CNI_LAPDM_SAPI sapi = SAPI_MAIN;
+ // Retrieve oid for the channel according to SAPI from RR
+ T_CNI_LAPDM_OID msgOid;
+
+ //if (sapi == SAPI_MAIN || getSapi3Status())
+ {
+ // SAPI=0 message or SAPI=3 connection is already established
+ if ((msgOid = rm_GetOid (parent->entryId, sapi)) == CNI_LAPDM_NULL_OID)
+ {
+ DBG_ERROR ("{\nMNETeiTRACE(etrg::sendL2MsgToGpACc) Invalid OID received from RM (hoAgId=%d,callId=%d, hoState=%d entryId=%d sapi=%d)\n",
+ hoAgId_,callIndex, hoState_, parent->entryId, sapi);
+ retVal = false;
+ }
+
+ CNI_LAPDM_Dl_Data_Request (msgOid, sapi, msEncodedMsg);
+ PostL3SendMsLog (msgOid, sapi, msEncodedMsg);
+
+ }
+ //else
+ {
+ // Establish SAPI=3 before sending SMS messages to LAPDm
+ // sendDLMsg (L3L2_DL_EST_REQ, SAPI_SMS);
+ // Queue message till connection is established
+ //sapi3Queue_.add (msEncodedMsg );
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+void
+CCTargetHandoverExtHo::addToDownlinkQueue (T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ DBG_FUNC("CCTargetHandoverExtHo::addToDownlinkQueue", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ if (msMsgsQueued_ < MAX_HO_SRC_DOWNLINK_QUEUE_LENGTH)
+ {
+ downlinkQueue_[msMsgsQueued_] = *msEncodedMsg;
+ msMsgsQueued_++;
+ }
+
+ DBG_LEAVE();
+}
+
+
+int
+CCTargetHandoverExtHo::handleVbCcMsg (IntraL3Msg_t *vbCcInMsg)
+{
+
+ JCCEvent_t retEvent;
+
+ DBG_FUNC("CCTargetHandoverExtHo::handleVbCcMsg", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ // Copy the ip address from the message
+ UINT32 reVcIpAddress;
+ reVcIpAddress = inet_addr(&(vbCcInMsg->l3_data.ipAddressResponse.ViperCellIpAddress[0]) );
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleVbCcMsg): Received IP Addr Rsp Msg (hoAgId=%d,callId=%d,hoState=%d,ipAddr=%x,hoCell=%d:%d,h3CellId=%d:%d)\n}\n",
+ hoAgId_, callIndex,hoState_, reVcIpAddress,hoGlobalCellId_.lac,hoGlobalCellId_.ci,h3GlobalCellId_.lac,h3GlobalCellId_.ci);
+
+ if ((hoState_ != HAND_ST_ANCH_VC_IP_ADDRESS_REQ) && (hoState_ != HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ ))
+ {
+ // Do Nothing, late message
+
+ DBG_TRACE("{\nMNETeiTRACE(etrg::handleVbCcMsg): Late IP Address Response ignored (callId=%d,hoState=%d,ipAddr=%x)\n}\n",
+ hoAgId_,callIndex, hoState_,reVcIpAddress);
+
+ retEvent = ( (hoState_==HAND_ST_ANCH_VC_IP_ADDRESS_REQ) ? CC_RELEASE_GP_HO:CC_RELEASE_GP_H3);
+ }
+
+ if (reVcIpAddress == 0)
+ {
+ DBG_ERROR ("{\nMNETeiERROR(etrg::handleVbCcMsg): IP Address Failed (hoAgId=%d,callId=%d,hoState=%d)\n",
+ hoAgId_,callIndex,hoState_);
+ DBG_ERROR("\n Check if an adjacent vipercell is still up running properly\n}\n");
+
+ retEvent = ( (hoState_==HAND_ST_ANCH_VC_IP_ADDRESS_REQ) ? CC_RELEASE_GP_HO:CC_RELEASE_GP_H3);
+ } else
+ {
+ //Proceed to do handover or hand 3rd
+
+ currEvent = HC_VB_GET_VC_ADDRESS_RSP;
+ if (hoState_==HAND_ST_ANCH_VC_IP_ADDRESS_REQ) hoVcIpAddress_ = reVcIpAddress;
+ else h3VcIpAddress_ = reVcIpAddress;
+
+ DBG_LEAVE();
+ return (smHandleEvent());
+ }
+
+ DBG_LEAVE();
+ return (retEvent);
+
+}
+
diff --git a/data/mnet/GP10/Host/cc/src/CCH323Util.cpp b/data/mnet/GP10/Host/cc/src/CCH323Util.cpp
new file mode 100644
index 0000000..c2e1baa
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCH323Util.cpp
@@ -0,0 +1,413 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCH23Util.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 02-01-98
+// Description : CC (VOIP)H323 side utilities
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "CC/CCH323Util.h"
+
+#include "logging/VCLOGGING.h"
+
+#include "JCC/JCCLog.h"
+
+#include "taskLib.h"
+
+#include "CC/CallLeg.h"
+
+//ext-HO <chenj:06-06-11>
+#include "CC/HOCallLeg.h"
+
+//CDR <xxu:08-21-00> BEGIN
+#include "JCC/LUDBapi.h"
+#include "CDR/CdrVoiceCall.h"
+#include "CDR/CdrSSA.h"
+extern BtsBasicPackage ccBtsBasicPackage;
+
+void gCaptureSetupCdr( IntraL3Msg_t *h323InMsg,
+ CdrRecCauseTerm_t cdrCause,
+ T_CNI_RIL3_CAUSE_VALUE ccCause );
+
+bool
+ sendH323DisconnectMsg(
+ IntraL3Msg_t *h323InMsg,
+ CdrRecCauseTerm_t cdrCause,
+ T_CNI_RIL3_CAUSE_VALUE ccCause )
+ {
+ DBG_FUNC("sendH323DisconnectMsg", CC_LAYER);
+ DBG_ENTER();
+
+ VOIP_API_MESSAGE voipOutMsg;
+
+ bool retValue;
+
+ voipOutMsg.Magic = VOIP_API_MAGIC_VALUE;
+
+ voipOutMsg.MessageType = VOIP_API_CALL_RELEASE;
+
+ voipOutMsg.CallRelease.cause = ccCause;
+
+ DBG_TRACE("CC->H323 LOG: Sending Disconnect Msg reason(%d) h323CallHandle(%d) ludbId(%d)\n",
+ ccCause,h323InMsg->call_handle,
+ h323InMsg->entry_id);
+
+ voipOutMsg.VoipCallHandle = h323InMsg->call_handle;
+
+ voipOutMsg.LudbId = h323InMsg->entry_id;
+
+ // Eventhough the Transaction Id is not used in this case, fill in this
+ // parameter with the NULL value to make it valid.
+ voipOutMsg.TxnId = VOIP_NULL_CALL_HANDLE;
+
+ retValue = VoipApiMessageHandler(&voipOutMsg);
+
+ // Capture CDR data for all MTC landed in GP
+ gCaptureSetupCdr(h323InMsg, cdrCause, ccCause);
+
+ DBG_LEAVE();
+ return (retValue);
+ }
+ //CDR <xxu:08-21-00> END
+
+ bool
+ sendH323Msg(TwoPartyCallLeg *parent,
+ JCCEvent_t remoteEvent,
+ CCRemMsgData_t remMsgData)
+ {
+ DBG_FUNC("sendH323Msg", CC_LAYER);
+ DBG_ENTER();
+
+ VOIP_API_MESSAGE voipOutMsg;
+
+ bool retValue;
+
+ voipOutMsg.Magic = VOIP_API_MAGIC_VALUE;
+
+ voipOutMsg.TxnId = parent->callIndex;
+
+ voipOutMsg.LudbId = parent->ludbIndex();
+
+ voipOutMsg.VoipCallHandle = parent->h323CallHandle;
+
+ switch (remoteEvent)
+ {
+ case HC_REMOTE_DTMF_REQ:
+ voipOutMsg.MessageType = VOIP_API_CALL_DTMF;
+ voipOutMsg.CallDtmf.Digit = (VOIP_DTMF_DIGIT) (DTMF_DIGIT_0 + remMsgData.dtmfDigit);
+ voipOutMsg.CallDtmf.Duration = 15;
+ break;
+
+ case THC_REMOTE_TERM_ADDRESS:
+
+ voipOutMsg.MessageType = VOIP_API_CALL_SETUP;
+ voipOutMsg.CallSetup = remMsgData.setup;
+
+ // DBG_TRACE("Call Log: called party number sent to Voip:\n");
+ // DBG_TRACE("(numDigits=%d), (%d), (%d), (%d), (%d), (%d)\n",
+ // voipOutMsg.CallSetup.CalledPartyNumber.numDigits,
+ // voipOutMsg.CallSetup.CalledPartyNumber.digits[0],
+ // voipOutMsg.CallSetup.CalledPartyNumber.digits[1],
+ // voipOutMsg.CallSetup.CalledPartyNumber.digits[2],
+ // voipOutMsg.CallSetup.CalledPartyNumber.digits[3],
+ // voipOutMsg.CallSetup.CalledPartyNumber.digits[4]
+ // );
+
+ break;
+
+ case HC_REMOTE_CALL_PROGRESS:
+ voipOutMsg.MessageType = VOIP_API_CALL_PROCEEDING;
+ voipOutMsg.CallProceeding = remMsgData.callProceeding;
+ break;
+
+ case OHC_REMOTE_ALERTING:
+ voipOutMsg.MessageType = VOIP_API_CALL_ALERTING;
+ break;
+
+ case OHC_REMOTE_ANSWER:
+ voipOutMsg.MessageType = VOIP_API_CALL_ANSWER;
+ break;
+
+ case HC_REMOTE_DISCONNECT_REQ:
+ case HC_REMOTE_RELEASE_COMPLETE:
+ // To avoid sending the release a second time to H323
+
+ if (! (parent->disconnectSentToVoip))
+ {
+ parent->disconnectSentToVoip = true;
+ voipOutMsg.MessageType = VOIP_API_CALL_RELEASE;
+ voipOutMsg.CallRelease = remMsgData.callRelease;
+ JCCLog1("CC->Voip: Disconnect (reason = %d)\n",
+ voipOutMsg.CallRelease.cause);
+ DBG_TRACE("CC->Voip: Disconnect (reason = %d)\n",
+ voipOutMsg.CallRelease.cause);
+
+ // The following is needed when the Voip side starts handling
+ // Disconnect right after a setup!!
+ }
+ else
+ {
+ // Do Nothing
+ DBG_LEAVE();
+ return (true);
+ }
+ break;
+
+ //BCT <xxu:07-11-00> BEGIN
+ case OHC_REMOTE_BCT_INVOKE:
+ voipOutMsg.MessageType = VOIP_API_CALL_TRANSFER;
+ voipOutMsg.CallTransfer = remMsgData.callTransfer;
+ break;
+ //BCT <xxu:07-11-00> END
+
+ default:
+ DBG_ERROR("CC->H323 ERROR: Unexpected (Remote Event = %d) from GSM CC.\n",
+ remoteEvent);
+ DBG_LEAVE();
+ return (false);
+
+ }
+
+ DBG_TRACE("CC->H323 LOG: Sending Msg(%d) TxnId(%d) h323CallHandle(%d) ludbId(%d) reEv(%d) callLeg(%d) entryId(%d)\n",
+ voipOutMsg.MessageType,
+ voipOutMsg.TxnId,
+ voipOutMsg.VoipCallHandle,
+ voipOutMsg.LudbId,
+ remoteEvent,
+ parent->callLegNum,
+ parent->entryId() );
+
+ retValue = VoipApiMessageHandler(&voipOutMsg);
+
+ DBG_LEAVE();
+ return (retValue);
+ }
+
+ // <ext-HO <chenj:06-11-01>
+ bool
+ sendH323MsgExtHo(HOCallLeg *parent,
+ JCCEvent_t remoteEvent,
+ CCRemMsgData_t remMsgData,
+ unsigned short callLegId)
+ {
+ DBG_FUNC("sendH323Msg", CC_LAYER);
+ DBG_ENTER();
+
+ VOIP_API_MESSAGE voipOutMsg;
+
+ bool retValue;
+
+ voipOutMsg.Magic = VOIP_API_MAGIC_VALUE;
+
+ voipOutMsg.TxnId = ( (callLegId << 8) |
+ (parent->callIndex & 0xFF) );
+
+ voipOutMsg.LudbId = parent->ludbIndex();
+
+ voipOutMsg.VoipCallHandle = parent->h323CallHandle;
+
+ switch (remoteEvent)
+ {
+ case HC_REMOTE_DTMF_REQ:
+ voipOutMsg.MessageType = VOIP_API_CALL_DTMF;
+ voipOutMsg.CallDtmf.Digit = (VOIP_DTMF_DIGIT) (DTMF_DIGIT_0 + remMsgData.dtmfDigit);
+ voipOutMsg.CallDtmf.Duration = 15;
+ break;
+
+ case THC_REMOTE_TERM_ADDRESS:
+
+ voipOutMsg.MessageType = VOIP_API_CALL_SETUP;
+ voipOutMsg.CallSetup = remMsgData.setup;
+
+ break;
+
+ case HC_REMOTE_CALL_PROGRESS:
+ voipOutMsg.MessageType = VOIP_API_CALL_PROCEEDING;
+ voipOutMsg.CallProceeding = remMsgData.callProceeding;
+ break;
+
+ case OHC_REMOTE_ALERTING:
+ voipOutMsg.MessageType = VOIP_API_CALL_ALERTING;
+ break;
+
+ case OHC_REMOTE_ANSWER:
+ voipOutMsg.MessageType = VOIP_API_CALL_ANSWER;
+ break;
+
+ case HC_REMOTE_DISCONNECT_REQ:
+ case HC_REMOTE_RELEASE_COMPLETE:
+ // To avoid sending the release a second time to H323
+
+ if (! (parent->disconnectSentToVoip))
+ {
+ parent->disconnectSentToVoip = true;
+ voipOutMsg.MessageType = VOIP_API_CALL_RELEASE;
+ voipOutMsg.CallRelease = remMsgData.callRelease;
+ JCCLog1("CC->Voip: Disconnect (reason = %d)\n",
+ voipOutMsg.CallRelease.cause);
+ DBG_TRACE("CC->Voip: Disconnect (reason = %d)\n",
+ voipOutMsg.CallRelease.cause);
+
+ // The following is needed when the Voip side starts handling
+ // Disconnect right after a setup!!
+ }
+ else
+ {
+ // Do Nothing
+ DBG_LEAVE();
+ return (true);
+ }
+ break;
+
+ //BCT <xxu:07-11-00> BEGIN
+ case OHC_REMOTE_BCT_INVOKE:
+ voipOutMsg.MessageType = VOIP_API_CALL_TRANSFER;
+ voipOutMsg.CallTransfer = remMsgData.callTransfer;
+ break;
+ //BCT <xxu:07-11-00> END
+
+ default:
+ DBG_ERROR("CC->H323 ERROR: Unexpected (Remote Event = %d) from GSM CC.\n",
+ remoteEvent);
+ DBG_LEAVE();
+ return (false);
+
+ }
+
+ DBG_TRACE("CC->H323 LOG: Sending Msg(%d) TxnId(%d) h323CallHandle(%d) ludbId(%d) reEv(%d) callLeg(%d) entryId(%d)\n",
+ voipOutMsg.MessageType,
+ voipOutMsg.TxnId,
+ voipOutMsg.VoipCallHandle,
+ voipOutMsg.LudbId,
+ remoteEvent,
+ parent->callLegNum,
+ parent->entryId() );
+
+ retValue = VoipApiMessageHandler(&voipOutMsg);
+
+ DBG_LEAVE();
+ return (retValue);
+ }
+
+
+ //CDR <xxu:08-23-00> BEGIN
+ void gCaptureSetupCdr(
+ IntraL3Msg_t *h323InMsg,
+ CdrRecCauseTerm_t cdrCause,
+ T_CNI_RIL3_CAUSE_VALUE ccCause )
+ {
+ CCdrVoiceCall ccCdr;
+
+ T_SUBSC_IE_ISDN *msisdn;
+ short ludbIndex = h323InMsg->entry_id;
+
+ DBG_FUNC("msgHandlerInit", CC_LAYER);
+ DBG_ENTER();
+
+ // Capture setup cdr data
+ if (ludbGetSubscInfoExists(ludbIndex))
+ {
+ ccCdr.setServedIMSI(ludbGetMobileIdPtr(ludbIndex));
+ msisdn = ludbGetMSISDNPtr(ludbIndex);
+ msisdn->num_plan[0] = 0x11;
+ ccCdr.setServedMSISDN(msisdn);
+ //ccCdr.setServedMSISDN(ludbGetMSISDNPtr(ludbIndex));
+ }
+
+ ccCdr.seisure_NormalTermination(0);
+
+ ccCdr.setCallingPartyNumber( &h323InMsg->l3_data.voipMsg.setup.CallingPartyNumber );
+ //ccCdr.setCalledPartyNumber( &h323InMsg->l3_data.voipMsg.setup.CalledPartyNumber );
+
+ if ( ludbIsProvCW(ludbIndex) && ludbIsActiveCW(ludbIndex) &&
+ (ccCause== CNI_RIL3_CAUSE_USER_BUSY) )
+ {
+ CCdrSSA cwCdr;
+ if (ludbGetSubscInfoExists(ludbIndex))
+ {
+ cwCdr.setServedIMSI(ludbGetMobileIdPtr(ludbIndex));
+ msisdn = ludbGetMSISDNPtr(ludbIndex);
+ msisdn->num_plan[0] = 0x11;
+ cwCdr.setServedMSISDN(msisdn);
+ //cwCdr.setServedMSISDN(ludbGetMSISDNPtr(ludbIndex));
+ }
+ cwCdr.setCorrelatedEventRefNumber(ccCdr.getEventRefNumber());
+ cwCdr.generateRecord(CDR_SS_ACTION_INVOCATION, SUPP_SERV_CW, CNI_RIL3_CAUSE_USER_BUSY);
+ }
+
+ //Load up with Location area info
+ T_CNI_RIL3_IE_LOCATION_AREA_ID lai;
+ T_CNI_RIL3_IE_CELL_ID ci;
+
+ ci.ie_present = true;
+ ci.value = ((short)(ccBtsBasicPackage.bts_ci));
+
+ lai.ie_present = true;
+ lai.mcc[0] = ((char*)&(ccBtsBasicPackage.bts_mcc))[0];
+ lai.mcc[1] = ((char*)&(ccBtsBasicPackage.bts_mcc))[1];
+ lai.mcc[2] = ((char*)&(ccBtsBasicPackage.bts_mcc))[2];
+ lai.mnc[0] = ((char*)&(ccBtsBasicPackage.bts_mnc))[0];
+ lai.mnc[1] = ((char*)&(ccBtsBasicPackage.bts_mnc))[1];
+ lai.lac = ((short)(ccBtsBasicPackage.bts_lac));
+
+ DBG_TRACE("mcc(%d,%d,%d) mnc(%d,%d) lac(%d) ci(%d)\n",
+ lai.mcc[0],lai.mcc[1],lai.mcc[2],lai.mnc[0],lai.mnc[1],lai.lac,ci.value);
+
+ DBG_TRACE("MCC(%d,%d,%d) MNC(%d,%d)\n",
+ ((char*)&(ccBtsBasicPackage.bts_mcc))[0],
+ ((char*)&(ccBtsBasicPackage.bts_mcc))[1],
+ ((char*)&(ccBtsBasicPackage.bts_mcc))[2],
+ ((char*)&(ccBtsBasicPackage.bts_mnc))[0],
+ ((char*)&(ccBtsBasicPackage.bts_mnc))[1]);
+
+ ccCdr.setLocationAreaCID(&lai, &ci);
+
+ // Generate last CDR record
+ ccCdr.release(ccCause, cdrCause);
+ }
+ //CDR <xxu:08-23-00> END
+
+
+ //ext-HO <xxu:06-01-01>
+ bool
+ sendH323DisconnectMsgExtHo(VOIP_CALL_HANDLE callHandle, T_CNI_RIL3_CAUSE_VALUE ccCause)
+ {
+ DBG_FUNC("sendH323DisconnectMsgExtHo", CC_HO_LAYER);
+ DBG_ENTER();
+
+ VOIP_API_MESSAGE voipOutMsg;
+
+ bool retValue;
+
+ voipOutMsg.Magic = VOIP_API_MAGIC_VALUE;
+ voipOutMsg.MessageType = VOIP_API_CALL_RELEASE;
+
+ voipOutMsg.CallRelease.cause = ccCause;
+ voipOutMsg.VoipCallHandle = callHandle;
+
+ voipOutMsg.LudbId = -1;
+
+ voipOutMsg.TxnId = VOIP_NULL_CALL_HANDLE;
+
+ retValue = VoipApiMessageHandler(&voipOutMsg);
+
+ DBG_TRACE("{\nMNEThoTRACE(sendH323DisconnectMsgExtHo): [==>VOIP DISCONNECT HANDOVER VOICE PATH] (hoCallHandle(%x), cause(%d)\n}\n",
+ callHandle, ccCause);
+
+ DBG_LEAVE();
+ return (retValue);
+ }
diff --git a/data/mnet/GP10/Host/cc/src/CCHalfCall.cpp b/data/mnet/GP10/Host/cc/src/CCHalfCall.cpp
new file mode 100644
index 0000000..2de3bb0
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCHalfCall.cpp
@@ -0,0 +1,563 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCHalfCall.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description : CC Half call main methods
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+//
+#include "taskLib.h"
+
+#include "CC/CCHalfCall.h"
+
+#include "CC/CCMsgAnal.h"
+
+#include "jcc/JCCLog.h"
+
+#include "stdio.h"
+
+#include "CC/CCUtil.h"
+
+#include "CC/CCInt.h"
+
+#include "CC/CCH323Util.h"
+
+#include "logging/VCLOGGING.h"
+
+#include "pm/pm_class.h"
+
+#include "csunew/csu_head.h"
+
+#include "CC/CallConfig.h"
+
+#include "CC/CallLeg.h"
+
+extern bool callTrace;
+
+extern DbgOutput Dbg;
+
+inline int JCCDBG_TRACE2(char *str) { DBG_TRACE(str); return true;};
+
+// *******************************************************************
+// forward declarations.
+// *******************************************************************
+
+// !> move the following?
+// this goes inside the Call Half Class definition
+HalfCallMsgHandler_t generatedEventHandler[MAX_GENERATED_EVENTS];
+
+// this goes inside the Call Half Class definition
+HalfCallMsgHandler_t callStateHandler[MAX_CALL_STATES][MAX_CALL_EXTERNAL_EVENTS];
+
+// Channel state machine
+HalfCallMsgHandler_t channStateHandler[MAX_CHANN_STATES][MAX_CHANN_EXTERNAL_EVENTS];
+
+ CCHalfCall::CCHalfCall ()
+ {
+
+ }
+
+ CCOrigHalfCall::CCOrigHalfCall (TwoPartyCallLeg *callLeg, JCCTimer *tclTimer)
+ {
+ //PR1378 <xxu:08-16-00>
+ //UINT16 uint16TimerValue;
+ //int timerValue;
+
+ // Timer Data below is used for sending timeout to the correct task.
+ CCHalfCall::parent = callLeg;
+
+ //uint16TimerValue = (((UINT16)(parent->callLegNum)) & (0x000F)) << 8;
+ //uint16TimerValue = uint16TimerValue | (((UINT16)(parent->callIndex)) & 0x00FF);
+
+ //timerValue = (short)uint16TimerValue;
+
+ hcTimer = tclTimer;
+ //hcTimer = new JCCTimer(callTimerExpiry, timerValue);
+
+ initData();
+ }
+
+ CCTermHalfCall::CCTermHalfCall (TwoPartyCallLeg *callLeg, JCCTimer *tclTimer)
+ {
+ //PR1378 <xxu:08-16-00>
+ //UINT16 uint16TimerValue;
+ //int timerValue;
+
+ // Timer Data below is used for sending timeout to the correct task.
+ CCHalfCall::parent = callLeg;
+
+ //uint16TimerValue = (((UINT16)(parent->callLegNum)) & (0x000F)) << 8;
+ //uint16TimerValue = uint16TimerValue | (((UINT16)(parent->callIndex)) & 0x00FF);
+
+ //timerValue = (short)uint16TimerValue;
+
+ hcTimer = tclTimer;
+ //hcTimer = new JCCTimer(callTimerExpiry, timerValue);
+
+ initData();
+ }
+
+ void
+ CCOrigHalfCall::setupNewCall (T_CNI_RIL3_SI_TI newCallTi,
+ T_CNI_RIL3_CM_SERVICE_TYPE serviceRequested)
+ {
+
+ DBG_FUNC("CCOrigHalfCall::setupNewCall", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ char callTaskName[20];
+
+ sprintf(&callTaskName[0],
+ "Call-%d EntryId-%d\0",
+ parent->callIndex,
+ parent->entryId());
+
+ if (callTrace)
+ {
+ Dbg.Func(&callTaskName[0], CC_LAYER);
+ }
+
+ // set transaction Id - first message for CC
+ // The starting entity uses 0. Other side uses 1.
+ ti = (newCallTi | ORIG_OR_MASK);
+
+ // set to null state so that we can take care of abnormal cleanups.
+ callState_ = HC_ST_NULL;
+
+ // start the timer when waiting for the setup message
+ hcTimer->setTimer(CALL_MM_CONN_EST_T999);
+
+ isEmergencyCall = (serviceRequested == CNI_RIL3_CM_SERVICE_TYPE_EMERGENCY_CALL);
+ DBG_LEAVE();
+ }
+
+ void
+ CCHalfCall::cleanup(void)
+ {
+
+ DBG_FUNC("CCHalfCall::cleanup", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ currEvent = CC_MM_CONNECTION_REL;
+ smHandleFirstCallEvent();
+ DBG_LEAVE();
+ }
+
+ void
+ CCOrigHalfCall::initData(void)
+ {
+ CCHalfCall::ti = ORIG_OR_MASK; // ti = 0 from MS
+ CCHalfCall::initData();
+ }
+
+ void
+ CCTermHalfCall::initData(void)
+ {
+ // This is used in terminations as is
+ CCHalfCall::ti = parent->callLegNum;
+ CCHalfCall::initData();
+ }
+
+ void
+ CCHalfCall::initData(void)
+ {
+
+ DBG_FUNC("CCHalfCall::initData", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // cancel any timers
+ hcTimer->cancelTimer();
+
+ releaseCounter = 0;
+ callState_ = HC_ST_FREE;
+
+ //CH<xxu:11-10-99>
+ chState_ = CH_ST_IDLE;
+
+ //BCT <xxu:09-24-00>
+ if (annState_ == ANN_PLAY_ON)
+ {
+ //Stop inband annoucement
+ T_CSU_RESULT_CON csuResult;
+
+ DBG_TRACE("CC->CSU(bct): call released, stop inband alert ann(%d,%x)-->snk(%d,%x,%d)\n",
+ annSrcPort_.portType,
+ (int)annSrcPort_.portId.rtpHandler,
+ annSnkPort_.portType,
+ (int)annSnkPort_.portId.rtpHandler,
+ (int)annSnkPort_.speechVersion);
+
+ if ( (csuResult = csu_SimplexBreak(&annSrcPort_, &annSnkPort_))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_WARNING("CC->CSU(bct): call released, stop inband alert s-break failed xlst(%d) ann(%d,%x) snk(%d,%x,%d)\n",
+ csuResult,
+ annSrcPort_.portType,
+ (int)annSrcPort_.portId.rtpHandler,
+ annSnkPort_.portType,
+ (int)annSnkPort_.portId.rtpHandler,
+ (int)annSnkPort_.speechVersion);
+
+ }
+
+ }
+
+ //BCT <xxu:09-24-00>
+ annState_ = ANN_PLAY_OFF;
+
+ channState_ = RES_ST_IDLE;
+
+ currSpeechCh_.version = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1;
+
+ currEvent = JCC_NULL_EVENT;
+ msOutResult = CNI_RIL3_RESULT_SUCCESS;
+
+ // Have a standard release cause to use
+ memset(&rlsCause, 0, sizeof(T_CNI_RIL3_IE_CAUSE)); // first zap this ie
+ rlsCause.ie_present = true;
+ rlsCause.codingStandard = CNI_RIL3_GSMPLMN_CODING;
+ rlsCause.location = CNI_RIL3_LOCATION_PRIVATE_NETWORK_LOCAL_USER;
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NORMAL_UNSPECIFIED;
+ rlsCause.diagnosticsLength = 0;
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ // pre-initialized value
+ //voipReleaseCause_ = MOBILE_CAUSE_NORMAL_CALL_CLEARING;
+
+ voipReleaseCause_ = CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING;
+
+ //CAUSE<xxu:03-21-00> END
+
+ // initialize cpn
+ cpn.ie_present = false;
+
+ // Have a simple Bearer Capability to use - for speech only
+ // Allocate a full rate channel based on this.
+ memset(&bearerCap, 0, sizeof(T_CNI_RIL3_IE_BEARER_CAPABILITY)); // first zap this ie
+ bearerCap.ie_present = true;
+
+ // octet 3 after TL - only one byte needed
+ bearerCap.codingStandard = CNI_RIL3_GSM_STANDARD_CODING;
+ bearerCap.transferMode = CNI_RIL3_TRANSFER_CIRCUIT_MODE;
+ bearerCap.infoTransferCap = CNI_RIL3_INFO_TRANSFER_SPEECH;
+ // Following is used only in Mob-to-Nwk direction. It should be set to
+ // default value in the Encoding routine for the Nwk-to-Mob direction - Syang
+ bearerCap.radioChannelReq = CNI_RIL3_FULL_RATE_SUPPORT_ONLY_MS; // 01
+
+ callingPartyNum.ie_present = false;
+
+ alertingSent_ = false;
+ progressSent_ = false;
+ connectSent_ = false;
+
+ DBG_LEAVE();
+
+ if (callTrace)
+ {
+ Dbg.Func(taskName(taskIdSelf()), CC_LAYER);
+ }
+
+ isEmergencyCall = false;
+ }
+
+ void
+ CCHalfCall::printData(JCCPrintStFn fnPtr)
+ {
+ char * hcStr1Ptr = "Half Call Data: \n";
+ char hcStr2[120];
+
+ char callTaskName[22];
+
+ sprintf(&callTaskName[0],
+ "Call-%d EntryId-%d: \0",
+ parent->callIndex,
+ parent->entryId());
+
+ //BCT <xxu:08-01-00> BEGIN
+ sprintf(&hcStr2[0],
+ "ti(%d),curEv(%d),decRes(%d),encRes(%d),callSt(%d),channSt(%d),chState(%d),rlsCause(%d) annSt(%d)\n",
+ ti,
+ currEvent,
+ msDecodeResult,
+ msOutResult,
+ callState_,
+ channState_,
+ chState_,
+ rlsCause.causeValue,
+ annState_
+ );
+ //BCT <xxu:08-01-00> END
+
+ (*fnPtr)(callTaskName);
+ (*fnPtr)(hcStr1Ptr);
+ (*fnPtr)(&hcStr2[0]);
+
+ }
+
+ int
+ CCHalfCall::handleMobMsg(T_CNI_RIL3CC_MSG *msInMsg,
+ T_CNI_RIL3_RESULT decodeResult,
+ T_CNI_RIL3_CAUSE_VALUE causeValue,
+ JCCEvent_t inEvent)
+ {
+ DBG_FUNC("CCHalfCall::handleMobMsg", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ currEvent = inEvent;
+ msDecodedMsg = msInMsg;
+ msDecodeResult = decodeResult;
+ if (msDecodeResult != CNI_RIL3_RESULT_SUCCESS)
+ {
+ rlsCause.causeValue = causeValue;
+
+ //CAUSE<xxu:03-21-00> BEGIN
+ if (causeValue==CNI_RIL3_CAUSE_INVALID_MANDATORY_INFO)
+ voipReleaseCause_ = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+ else
+ voipReleaseCause_ = causeValue;
+
+ //CAUSE<xxu:03-21-00> END
+
+ }
+
+ DBG_LEAVE();
+ return (smHandleFirstCallEvent());
+ }
+
+ int
+ CCHalfCall::handleTimeoutMsg(IntraL3Msg_t *ccInMsg)
+ {
+ DBG_FUNC("CCHalfCall::handleTimeoutMsg", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // We already know that it is a timeout msg
+ //CH<xxu:11-10-99> now CH not supported during & after HO
+ if (chState_ == CH_ST_HREQ)
+ {
+ currEvent = HC_LOCAL_CHTR_EXP;
+ DBG_LEAVE();
+ return (smHandleFirstCallEvent());
+ }
+ else
+ {
+ currEvent = HC_LOCAL_PROTOCOL_TIMEOUT;
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_RECOVERY_ON_TIMER_EXPIRY;
+
+ DBG_LEAVE();
+ return (smHandleFirstCallEvent());
+ }
+ }
+
+
+ JCCEvent_t
+ CCHalfCall::handleInvalidChannEvent(void)
+ {
+ DBG_FUNC("CCHalfCall::handleInvalidChannEvent", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // let the developer/tester/fields person decide.
+ // The user of the system needs to check this out if there was other problem.
+ // Otherwise, this is just a race condition.
+ JCCLog2("RR->CC Chann Warning: Invalid/Late (event = %d) in (State = %d) \n",
+ currEvent,
+ channState_);
+ DBG_WARNING("RR->CC Chann Warning: Invalid/Late (event = %d) in (State = %d) \n",
+ currEvent,
+ channState_);
+ DBG_LEAVE();
+ return (JCC_NULL_EVENT);
+
+ }
+
+ int
+ CCHalfCall::handleRemoteEvent(IntraL3Msg_t* h323Msg, JCCEvent_t remoteEvent,
+ CCRemMsgData_t inRemMsg)
+ {
+ DBG_FUNC("CCHalfCall::handleRemoteEvent", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // copy message data
+ h323InMsg = h323Msg;
+ remMsgData = inRemMsg;
+
+ currEvent = remoteEvent;
+
+ // Just call the SM Handle Event
+ DBG_LEAVE();
+ return (smHandleFirstCallEvent());
+ }
+
+ int
+ CCHalfCall::smHandleEvent(void)
+ {
+ DBG_FUNC("CCHalfCall::smHandleEvent", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // Call Handler and loop
+ while ((currEvent != JCC_NULL_EVENT) &&
+ (currEvent != CC_MESSAGE_PROCESSING_COMPLT) &&
+ (currEvent != CC_RELEASE_CALL))
+ {
+ // sm logic here - one-to-one mapping for internal events
+ // that are generated from within.
+ // state is already factored in
+ currEvent =
+ (this->*generatedEventHandler[currEvent - CC_INTERNAL_GEN_EVENT_BASE])();
+ }
+
+ if (currEvent == CC_RELEASE_CALL)
+ {
+ int storedCause;
+
+ parent->handleReleaseCall();
+
+ // causeValue below Works because 0 is unused.
+ storedCause = (0 - rlsCause.causeValue);
+
+ initData();
+ DBG_LEAVE();
+ return(storedCause);
+ }
+
+ DBG_LEAVE();
+ return(0);
+ }
+
+ int
+ CCHalfCall::smHandleFirstCallEvent(void)
+ {
+ DBG_FUNC("CCHalfCall::smHandleFirstCallEvent", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // Come up with the correct handler that should handle the msg
+ // based on the state
+
+ #ifdef _JCC_DEBUG
+ ccEntryPrint(ccSession[parent->callIndex], JCCLog);
+ #endif
+
+ if (callTrace)
+ {
+
+ ccEntryPrint(ccSession[parent->callIndex], JCCDBG_TRACE2);
+ }
+
+ //TEST
+ //printf("CC Log FirstCallEv: callIndex(%d), callSt(%d), curEv(%d)\n", parent->callIndex, callState_, currEvent);
+
+ // For Call States:
+ if (currEvent != JCC_NULL_EVENT)
+ {
+ currEvent =
+ (this->*callStateHandler[callState_][currEvent - CC_INTERNAL_CALL_EVENT_BASE])();
+ }
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+ }
+
+ JCCEvent_t
+ CCHalfCall::handleInvalidEvent(void)
+ {
+
+ DBG_FUNC("CCHalfCall::handleInvalidEvent", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // let the developer/tester/fields person decide.
+ // The user of the system needs to check this out if there was other problem.
+ // Otherwise, this is just a race condition.
+ JCCLog2("CC Call Warning: Invalid (event = %d) in (State = %d) \n",
+ currEvent,
+ callState_);
+ DBG_WARNING("CC Call Warning: Invalid (event = %d) in (State = %d) \n",
+ currEvent,
+ callState_);
+ DBG_LEAVE();
+ return (JCC_NULL_EVENT);
+
+ }
+
+ bool
+ CCHalfCall::sendRemote(JCCEvent_t remoteEvent)
+ {
+ DBG_FUNC("CCHalfCall::sendRemote", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // Copy the disconnect reason, if it is a release message.
+ if (remoteEvent == HC_REMOTE_RELEASE_COMPLETE)
+ {
+ remMsgData.callRelease.cause = voipReleaseCause_;
+ }
+
+ // send to H323 task
+ DBG_LEAVE();
+ return (sendH323Msg(parent, remoteEvent, remMsgData));
+ }
+
+ JCCEvent_t
+ CCHalfCall::handleMobProtocolProblem(void)
+ {
+ DBG_FUNC("CCHalfCall::handleMobProtocolProblem", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_PROTOCOL_ERROR_UNSPECIFIED;
+ voipReleaseCause_ = CNI_RIL3_CAUSE_DESTINATION_OUT_OF_ORDER;
+
+ //CAUSE<xxu:03-21-00> END
+
+ DBG_LEAVE();
+ return (CC_TWO_STAGE_DISCONNECT);
+ }
+
+ int
+ CCHalfCall::handleMMMsg(IntraL3Msg_t *mmMsg,
+ JCCEvent_t inEvent)
+ {
+ DBG_FUNC("CCHalfCall::handleMMMsg", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ mmInMsg = mmMsg;
+
+ currEvent = inEvent;
+
+ DBG_LEAVE();
+ return(smHandleFirstCallEvent());
+
+ }
+
+ int
+ CCHalfCall::handleRRMsg(IntraL3Msg_t *rrMsg,
+ JCCEvent_t inEvent)
+ {
+ DBG_FUNC("CCHalfCall::handleRRMsg", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ rrInMsg = rrMsg;
+
+ currEvent = inEvent;
+
+ currEvent =
+ (this->*channStateHandler[channState_][currEvent - CC_INTERNAL_CHANN_EVENT_BASE])();
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+ }
diff --git a/data/mnet/GP10/Host/cc/src/CCHandover.cpp b/data/mnet/GP10/Host/cc/src/CCHandover.cpp
new file mode 100644
index 0000000..adb5f28
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCHandover.cpp
@@ -0,0 +1,2191 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCHandover.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-99
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+//
+#include "taskLib.h"
+
+#include "jcc/JCCUtil.h"
+
+#include "logging/VCLOGGING.h"
+
+#include "defs.h"
+#include "oam_api.h"
+#include "pm/pm_class.h"
+
+#include "CC/CCHandover.h"
+
+#include "CC/CCUtil.h"
+
+#include "CC/CCSessionHandler.h"
+
+#include "CC/hortp.h"
+
+// ext-HO <chenj:06-06-01>
+#include "jcc/JCCEHoMsg.h"
+
+//GCELL<tyu:06-01-01> BEGIN
+extern GlobalCellId_t MY_GLOBALCELL_ID;
+//GCELL<tyu:06-01-01> END
+
+//Ciphering <chenj:07-17-01>
+extern unsigned char rm_DspCiphCap;
+#define RM_DSPA52(X) (X & 2)
+#define RM_DSPA51(X) (X & 1)
+#include "jcc/LUDBApi.h"
+
+// Handover state machine
+AnchorHandoverMsgHandler_t hoSrcHandler[MAX_HO_SRC_STATES][MAX_HO_SRC_EVENTS];
+TargetHandoverMsgHandler_t hoTrgHandler[MAX_HO_TRG_STATES][MAX_HO_TRG_EVENTS];
+
+//ext-HO <xxu:06-07-01>
+ExtHoTargetHandoverMsgHandler_t extHoTrgHandler[MAX_HO_TRG_STATES+MAX_HO_SRC_STATES][MAX_HO_TRG_EVENTS+MAX_HO_SRC_EVENTS];
+// *******************************************************************
+// forward declarations.
+// *******************************************************************
+
+ CCHandover::CCHandover (CCSessionHandler *session,
+ int callId ,
+ MSG_Q_ID qid )
+ : mmQueue_(this)
+ {
+ parent = session;
+ callIndex = callId ;
+ msgQId = qid ;
+ hoRtpSession_ = NULL ;
+ }
+
+ CCAnchorHandover::CCAnchorHandover(CCSessionHandler *session,
+ int callId ,
+ MSG_Q_ID qid )
+ : CCHandover (session, callId, qid)
+ {
+ hoSimplexConnected_ = false;
+ h3SimplexConnected_ = false;
+
+ initData();
+
+ }
+
+ CCTargetHandover::CCTargetHandover(CCSessionHandler *session,
+ int callId ,
+ MSG_Q_ID qid )
+ : CCHandover (session, callId, qid)
+ {
+ voiceConnected = false;
+
+ initData();
+ }
+
+ void
+ CCHandover::initData (void)
+ {
+ DBG_FUNC ("CCHandover::initData", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ hoState_ = HAND_ST_IDLE;
+ hoVcCallIndex_ = CC_MAX_CC_CALLS_DEF_VAL;
+
+//GCELL<tyu:06-01-01> BEGIN
+ memset(&hoGlobalCellId_, 0, sizeof(GlobalCellId_t));
+//GCELL<tyu:06-01-01> END
+
+ hoVcIpAddress_ = 0;
+
+ otherHoIncomingRtpPort_ = 0;
+
+ if (hoRtpSession_ != NULL)
+ {
+ // Release the Ho RTP channel
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ hoRtpSession_ = NULL;
+ }
+
+ parent->handoverSession = NULL;
+
+ hoSrcLinkLost_ = false;
+
+ //ext-HO <xxu:05-07-01>
+ hoAgId_ = -1;
+ h3AgId_ = -1;
+ memset(&hoNumber_, 0, sizeof(T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER));
+ hoEndCause_ = MC_HO_SUCCESS;
+ memset(&currEncrypt_, 0, sizeof(IntraL3CipherModeCommand_t));
+ reqEncrypt_.ie_present = false;
+ optCurrEncrypt_.ie_present = false;
+ reqChannelType_.ie_present = false;
+ optCurrChannelType_.ie_present = false;
+ currClassmark_.ie_present = false;
+ currChannel_.bearerType = BEARER_SPEECH;
+ currChannel_.speechChann.version = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1;
+ currSpeechCh_.version = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1;
+
+ DBG_LEAVE();
+ }
+
+
+ bool
+ CCHandover::isEqualGlobalCellId (const GlobalCellId_t *gCell1,const GlobalCellId_t *gCell2)
+ {
+ if (gCell1->mcc[0] != gCell2->mcc[0] ||
+ gCell1->mcc[1] != gCell2->mcc[1] ||
+ gCell1->mcc[2] != gCell2->mcc[2] ||
+ gCell1->mnc[0] != gCell2->mnc[0] ||
+ gCell1->mnc[1] != gCell2->mnc[1] ||
+ gCell1->mnc[2] != gCell2->mnc[2] ||
+ gCell1->lac != gCell2->lac ||
+ gCell1->ci != gCell2->ci)
+ return false;
+ else
+ return true;
+ }
+
+ void CCHandover::emptyMMQueue (void)
+ {
+
+ DBG_FUNC("CCHandover::emptyMMQueue", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ mmQueue_.flash ();
+
+ DBG_LEAVE();
+ }
+
+ void
+ CCAnchorHandover::addToDownlinkQueue (T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+ {
+
+ DBG_FUNC("CCAnchorHandover::addToDownlinkQueue", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ if (msMsgsQueued_ < MAX_HO_SRC_DOWNLINK_QUEUE_LENGTH)
+ {
+ downlinkQueue_[msMsgsQueued_] = *msEncodedMsg;
+ msMsgsQueued_++;
+ }
+
+ DBG_LEAVE();
+ }
+
+
+ void
+ CCAnchorHandover::emptyDownlinkQueue (void)
+ {
+
+ DBG_FUNC("CCAnchorHandover::emptyDownlinkQueue", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ short index;
+
+ // Empty second level PDU Queue first
+ // Messages will be send to the target Vipercell
+ parent->flashSapi3Queue();
+
+ if (msMsgsQueued_ > 0)
+ {
+ for(index=0; index< msMsgsQueued_; index++)
+ {
+ parent->sendL2Msg(&downlinkQueue_[index]);
+ }
+
+ msMsgsQueued_ = 0;
+ }
+
+ DBG_LEAVE();
+ }
+
+
+ void
+ CCAnchorHandover::addToRRQueue (IntraL3Msg_t *rrMsg)
+ {
+
+ DBG_FUNC("CCAnchorHandover::addToRRQueue", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ if (rrMsgsQueued_)
+ {
+ // Queue is full. Do Nothing.
+ }
+ else
+ {
+ savedRRMsg_ = *rrMsg;
+ rrMsgsQueued_ = true;
+ }
+
+ DBG_LEAVE();
+ }
+
+ void
+ CCAnchorHandover::emptyRRQueue (void)
+ {
+
+ DBG_FUNC("CCAnchorHandover::emptyRRQueue", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ if (!rrMsgsQueued_)
+ {
+ // Queue is empty. Do Nothing.
+ }
+ else
+ {
+ parent->sendRRMsg(savedRRMsg_.primitive_type,
+ savedRRMsg_.message_type,
+ &savedRRMsg_);
+
+ rrMsgsQueued_ = false;
+ }
+
+ DBG_LEAVE();
+ }
+
+ void
+ CCTargetHandover::initData (void)
+ {
+
+ DBG_FUNC("CCTargetHandover::initData", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ if (parent->entryId != (T_CNI_IRT_ID) JCC_UNDEFINED )
+ {
+ //ext-HO <xxu:07-09-01>
+ //if (voiceConnected)
+ {
+ // Break the connections with the RF Port
+ T_CSU_PORT_ID rfSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rfSourcePort.portType = CSU_GSM_PORT;
+ rfSourcePort.portId.gsmHandler = parent->entryId;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rfSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERROR("CSU Error : Ho Disconn. Failure, (Result = %d) for (entryId = %d)\n",
+ csuResult, parent->entryId);
+
+ // Can only generate OA&M log.
+ }
+
+ voiceConnected = false;
+
+ }
+
+ sendMM(INTRA_L3_MM_REL_REQ, INTRA_L3_NULL_MSG, parent->entryId, &mmOutMsg);
+ }
+
+ CCHandover::initData();
+ DBG_LEAVE();
+
+ }
+
+ void
+ CCTargetHandover::initHandbackData()
+ {
+ DBG_FUNC("CCTargetHandover::initHandbackData", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ hoState_ = HAND_ST_TRG_HO_COMPLT;
+ DBG_LEAVE();
+ }
+
+ void
+ CCAnchorHandover::initHandbackData()
+ {
+ DBG_FUNC("CCAnchorHandover::initHandbackData", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ hoState_ = HAND_ST_ANCH_HO_COMPLT;
+
+ if (hoSimplexConnected_)
+ {
+ // Break the connections with the RF Port
+ T_CSU_PORT_ID rfSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rfSourcePort.portType = CSU_GSM_PORT;
+ rfSourcePort.portId.gsmHandler = parent->entryId;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rfSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog2("CSU Error : Disconn. Failure, (Result = %d) for (entryId = %d)\n",
+ csuResult, parent->entryId);
+ DBG_ERROR("CSU Error : Disconn. Failure, (Result = %d) for (entryId = %d)\n",
+ csuResult, parent->entryId);
+
+ // Can only generate OA&M log.
+ }
+
+ hoSimplexConnected_ = false;
+ }
+
+ //BCT <xxu:09-22-00> Begin
+ TwoPartyCallLeg *whichLeg;
+ whichLeg = parent->activeLeg();
+
+ if (whichLeg != NULL)
+ {
+ if ( whichLeg->msSide != NULL )
+ {
+ if (whichLeg->msSide->annState_ == ANN_PLAY_WAITING)
+ {
+ //Play inband ringback to transferred party for BCT
+ T_CSU_RESULT_CON csuResult;
+ whichLeg->msSide->annSrcPort_.portType = CSU_ANN_PORT;
+ whichLeg->msSide->annSrcPort_.portId.annHandler = 0;
+ whichLeg->msSide->annSnkPort_.portType = CSU_RTP_PORT;
+ whichLeg->msSide->annSnkPort_.portId.rtpHandler = hoRtpSession_;
+ whichLeg->msSide->annSnkPort_.speechVersion = whichLeg->msSide->currSpeechCh_.version;
+
+ DBG_TRACE("CC->CSU(bct): start inband alert annState(%d) ann(%d,%x) --> snk(%d,%x,%d)\n",
+ whichLeg->msSide->annState_,
+ whichLeg->msSide->annSrcPort_.portType,
+ whichLeg->msSide->annSrcPort_.portId.annHandler,
+ whichLeg->msSide->annSnkPort_.portType,
+ whichLeg->msSide->annSnkPort_.portId.rtpHandler,
+ whichLeg->msSide->annSnkPort_.speechVersion);
+
+ if ( (csuResult = csu_SimplexConnect(&whichLeg->msSide->annSrcPort_,
+ &whichLeg->msSide->annSnkPort_))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_WARNING("CC->BCT(csuSConnFailedAfterHoFailed):xlst(%d) ann(%d,%x) snk(%d,%x,%d)\n",
+ csuResult,
+ whichLeg->msSide->annSrcPort_.portType,
+ (int)whichLeg->msSide->annSrcPort_.portId.rtpHandler,
+ whichLeg->msSide->annSnkPort_.portType,
+ (int)whichLeg->msSide->annSnkPort_.portId.rtpHandler,
+ (int)whichLeg->msSide->annSnkPort_.speechVersion);
+
+ //ignore this remote alerting
+ }
+ whichLeg->msSide->annState_ = ANN_PLAY_ON;
+ }
+ }
+ }
+ //BCT <xxu:09-21-00> END
+
+ DBG_LEAVE();
+ }
+
+ int
+ CCHandover::handleMMMsg(IntraL3Msg_t *mmMsg,
+ JCCEvent_t hoEvent)
+ {
+ DBG_FUNC("CCHandover::handleMMMsg", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ mmInMsg = mmMsg;
+ currEvent = hoEvent;
+ DBG_LEAVE();
+ return(0);
+
+ }
+
+ int
+ CCAnchorHandover::handleMMMsg(IntraL3Msg_t *mmMsg,
+ JCCEvent_t hoEvent)
+ {
+ DBG_FUNC("CCAnchorHandover::handleMMMsg", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ CCHandover::handleMMMsg(mmMsg, hoEvent);
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+
+ }
+
+ int
+ CCTargetHandover::handleMMMsg(IntraL3Msg_t *mmMsg,
+ JCCEvent_t hoEvent)
+ {
+ DBG_FUNC("CCTargetHandover::handleMMMsg", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ CCHandover::handleMMMsg(mmMsg, hoEvent);
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+
+ }
+
+ int
+ CCHandover::handleRRMsg(IntraL3Msg_t *rrMsg,
+ JCCEvent_t hoEvent)
+ {
+ DBG_FUNC("CCHandover::handleRRMsg", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ rrInMsg = rrMsg;
+ currEvent = hoEvent;
+ DBG_LEAVE();
+ return(0);
+
+ }
+
+ int
+ CCAnchorHandover::handleRRMsg(IntraL3Msg_t *rrMsg,
+ JCCEvent_t hoEvent)
+ {
+ DBG_FUNC("CCAnchorHandover::handleRRMsg", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ CCHandover::handleRRMsg(rrMsg, hoEvent);
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+
+
+ }
+
+ int
+ CCTargetHandover::handleRRMsg(IntraL3Msg_t *rrMsg,
+ JCCEvent_t hoEvent)
+ {
+ DBG_FUNC("CCTargetHandover::handleRRMsg", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ CCHandover::handleRRMsg(rrMsg, hoEvent);
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+
+
+ }
+
+ JCCEvent_t
+ CCHandover::handleMMLateEstCnf(void)
+ {
+
+ DBG_FUNC("handleMMLateEstCnf", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // handle the case where a late establish confirm comes in
+ // for a handover request that was previously sent.
+ sendMM (INTRA_L3_MM_REL_REQ,
+ INTRA_L3_NULL_MSG,
+ mmInMsg->entry_id,
+ &mmOutMsg);
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ JCCEvent_t
+ CCHandover::handleInvalidEvent(void)
+ {
+
+ DBG_FUNC("CCHandover::handleInvalidEvent", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // let the developer/tester/fields person decide.
+ // The user of the system needs to check this out if there was other problem.
+ // Otherwise, this is just a race condition.
+ JCCLog2("CC Handover Warning: (Invalid event = %d) in (State = %d) \n",
+ currEvent,
+ hoState_);
+ DBG_WARNING("CC Handover Warning: (Invalid event = %d) in (State = %d) \n",
+ currEvent,
+ hoState_);
+ DBG_LEAVE();
+ return (JCC_NULL_EVENT);
+
+ }
+
+ JCCEvent_t
+ CCHandover::handleInternalEvent (JCCEvent_t handEvent)
+ {
+ DBG_FUNC("CCHandover::handleInternalEvent", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ DBG_LEAVE();
+ return(CC_RELEASE_CALL);
+
+ }
+
+ //HO<xxu:03-07-00>
+ JCCEvent_t
+ CCAnchorHandover::handleInternalEvent (JCCEvent_t handEvent)
+ {
+
+ DBG_FUNC("CCAnchorHandover::handleInternalEvent", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ JCCEvent_t returnValue = JCC_NULL_EVENT;
+
+ DBG_TRACE("CC INFO @anch-handleInternalEvent: ho(%d, %d), event %d\n",
+ hoType_, hoState_, handEvent);
+
+ // check for handover
+ switch (hoState_)
+ {
+ case HAND_ST_IDLE:
+ // No Handover activity
+ returnValue = CC_RELEASE_CALL;
+ break;
+
+ case HAND_ST_ANCH_VC_IP_ADDRESS_REQ:
+ case HAND_ST_ANCH_SND_HO_REQ:
+ // Skip event loop. cleanup handover and continue to cleanup session.
+ handleAnchDuringHoRls();
+ returnValue = CC_RELEASE_CALL;
+ break;
+
+ case HAND_ST_ANCH_RCV_HO_REQ_ACK:
+ {
+ // There is a risk that we never receive any message
+ // from Target ViperCell. Also, we haven't released
+ // the old channel and connection resources and setup the
+ // two-way connection with the new Ho RTP channel.
+
+ // Do not cancel T103 timer - timer value should be set accordingly!
+ // This will let us handle the case described above.
+ // hcTimer->cancelTimer();
+
+ hoSrcLinkLost_ = true;
+
+ // Wait for a Handover Complete from Target
+ // Do Nothing else
+ returnValue = CC_MESSAGE_PROCESSING_COMPLT;
+ break;
+ }
+
+ case HAND_ST_ANCH_HO_COMPLT:
+ case HAND_ST_ANCH_RCV_HB_REQ:
+ // Should not receive this msg. in these states.
+ // Late Message. Ignore!
+ returnValue = CC_MESSAGE_PROCESSING_COMPLT;
+ break;
+
+ case HAND_ST_ANCH_SND_HB_REQ_ACK:
+ // cancel T104 timer
+ parent->sessionTimer->cancelTimer();
+ // There is a chance for recovery.
+ handleAnchT104TimerExpiry();
+ returnValue = CC_MESSAGE_PROCESSING_COMPLT;
+ break;
+
+ default:
+ DBG_ERROR("CC Handover Error: (Invalid Anchor State = %d)(hoType %d) \n",
+ hoState_, hoType_);
+ }
+
+
+ DBG_LEAVE();
+ return(returnValue);
+ }
+
+ JCCEvent_t
+ CCTargetHandover::handleInternalEvent (JCCEvent_t handEvent)
+ {
+ DBG_FUNC("CCTargetHandover::handleInternalEvent", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ JCCEvent_t returnValue = JCC_NULL_EVENT;
+
+ // check for handover
+ switch (hoState_)
+ {
+
+ case HAND_ST_TRG_RCV_HO_REQ:
+ case HAND_ST_TRG_SND_HO_REQ_ACK:
+ case HAND_ST_TRG_HO_COMPLT:
+ case HAND_ST_TRG_SND_HB_REQ:
+ handleTrgPostHoRls();
+ returnValue = CC_RELEASE_CALL;
+ break;
+
+ case HAND_ST_TRG_RCV_HB_REQ_ACK:
+ {
+ // There is a risk that we never receive any message
+ // from Target(Anchor) ViperCell. Also, we haven't released
+ // the old channel and connection resources and setup the
+ // new connection with the new Ho RTP channel.
+
+ // Do not cancel T203 timer - timer value should be set accordingly!
+ // This will let us handle the case described above.
+ // hcTimer->cancelTimer();
+
+ hoSrcLinkLost_ = true;
+
+ // Wait for a Handover Complete from Target
+ // Do Nothing else
+ returnValue = CC_MESSAGE_PROCESSING_COMPLT;
+ break;
+ }
+
+ default:
+ DBG_ERROR("CC Handover Error: (Invalid Target State = %d) \n",
+ hoState_);
+ }
+
+ DBG_LEAVE();
+ return(returnValue);
+
+ }
+
+ int
+ CCHandover::handleTimeoutMsg (IntraL3Msg_t *ccInMsg)
+ {
+ DBG_FUNC("CCHandover::handleTimeoutMsg", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ DBG_LEAVE();
+ return(0);
+
+ }
+
+ int
+ CCAnchorHandover::handleTimeoutMsg (IntraL3Msg_t *ccInMsg)
+ {
+ DBG_FUNC("CCAnchorHandover::handleTimeoutMsg", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ currEvent = HAND_SRC_TIMER_EXPIRY;
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+
+ }
+
+ int
+ CCTargetHandover::handleTimeoutMsg (IntraL3Msg_t *ccInMsg)
+ {
+ DBG_FUNC("CCTargetHandover::handleTimeoutMsg", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ currEvent = HAND_TRG_TIMER_EXPIRY;
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+
+ }
+
+
+ int
+ CCHandover::handleVcCcMsg(InterVcMsg_t *vcCcInMsg)
+ {
+
+ DBG_FUNC("CCHandover::handleVcCcMsg", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ vcInMsg = vcCcInMsg;
+
+ switch (vcInMsg->msgType)
+ {
+ case INTER_VC_CC_PERFORM_HANDOVER:
+ currEvent = HAND_PERFORM_HO_REQ;
+ // peg
+ PM_CCMeasurement.attIncomingInterMSCHDOs.increment();
+ break;
+
+ case INTER_VC_CC_ABORT_HANDOVER:
+ currEvent = HAND_ABORT_HO;
+ break;
+
+ case INTER_VC_CC_PERFORM_HANDOVER_ACK:
+ currEvent = HAND_PERFORM_HO_ACK;
+ break;
+
+ case INTER_VC_CC_PERFORM_HANDOVER_NACK:
+ currEvent = HAND_PERFORM_HO_NACK;
+ break;
+
+ case INTER_VC_CC_COMPLETE_HANDOVER:
+ currEvent = HAND_COMPLT_HO;
+ // peg
+ PM_CCMeasurement.succOutgoingInterMSCHDOs.increment();
+ break;
+
+ case INTER_VC_CC_RLS_CALL:
+ currEvent = HAND_RLS_CALL;
+ break;
+
+ case INTER_VC_CC_POST_HANDOVER_MOB_EVENT:
+ currEvent = HAND_POSTHO_MOB_EVENT;
+ break;
+
+ // Handback Events
+
+ case INTER_VC_CC_PERFORM_HANDBACK:
+ currEvent = HAND_PERFORM_HO_REQ;
+ // peg
+ PM_CCMeasurement.attIncomingInterMSCHDOs.increment();
+ break;
+
+ case INTER_VC_CC_ABORT_HANDBACK:
+ currEvent = HAND_ABORT_HO;
+ break;
+
+ case INTER_VC_CC_PERFORM_HANDBACK_ACK:
+ currEvent = HAND_PERFORM_HO_ACK;
+ break;
+
+ case INTER_VC_CC_PERFORM_HANDBACK_NACK:
+ currEvent = HAND_PERFORM_HO_NACK;
+ break;
+
+ case INTER_VC_CC_COMPLETE_HANDBACK:
+ currEvent = HAND_COMPLT_HO;
+ // peg
+ PM_CCMeasurement.succOutgoingInterMSCHDOs.increment();
+ break;
+
+ default:
+ DBG_ERROR("CC Call Error: Unexpected (Msg Type = %d) from Vipercell.\n",
+ vcInMsg->msgType);
+ currEvent = JCC_NULL_EVENT;
+
+ }
+
+ DBG_LEAVE();
+ return(0);
+ }
+
+ int
+ CCAnchorHandover::handleVcCcMsg(InterVcMsg_t *vcCcInMsg)
+ {
+ DBG_FUNC("CCAnchorHandover::handleVcCcMsg", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ CCHandover::handleVcCcMsg(vcCcInMsg);
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+ }
+
+ int
+ CCTargetHandover::handleVcCcMsg(InterVcMsg_t *vcCcInMsg)
+ {
+ DBG_FUNC("CCTargetHandover::handleVcCcMsg", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ CCHandover::handleVcCcMsg(vcCcInMsg);
+
+ DBG_LEAVE();
+ return(smHandleEvent());
+ }
+
+ void
+ CCHandover::printData (JCCPrintStFn fnPtr)
+ {
+ char * hcStr1Ptr = "Call Handover Data : ";
+ char hcStr2[120];
+
+ sprintf(&hcStr2[0],
+ "state( %d), hoCallIndex( %d), VcMCC(%x%x%x), VcMNC(%x%x%x), VcLac(%d), VcCellId( %d), VcIpAddress( %d)\n",
+ hoState_,
+ hoVcCallIndex_,
+ hoGlobalCellId_.mcc[0],hoGlobalCellId_.mcc[1],hoGlobalCellId_.mcc[2],
+ hoGlobalCellId_.mnc[0],hoGlobalCellId_.mnc[1],hoGlobalCellId_.mnc[2],
+ hoGlobalCellId_.lac,
+ hoGlobalCellId_.ci,
+ hoVcIpAddress_
+ );
+
+ //if (hoState_ != HAND_ST_IDLE)
+ // {
+ (*fnPtr)(hcStr1Ptr);
+ (*fnPtr)(&hcStr2[0]);
+ // }
+ }
+
+ void
+ CCTargetHandover::printData (JCCPrintStFn fnPtr)
+ {
+ CCHandover::printData(fnPtr);
+
+ char * hcStr1Ptr = "Call Target Handover Data : ";
+ char hcStr2[120];
+
+ sprintf(&hcStr2[0],
+ "voiceConnected( %d)\n",
+ voiceConnected
+ );
+
+ if (hoState_ != HAND_ST_IDLE)
+ {
+ (*fnPtr)(hcStr1Ptr);
+ (*fnPtr)(&hcStr2[0]);
+ }
+ }
+
+ //HO<xxu:02-23-00> Handle H3
+ BOOL
+ CCAnchorHandover::cleanup(BOOL force = FALSE)
+ {
+ BOOL retVal;
+
+ DBG_FUNC("CCAnchorHandover::cleanup", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ if (force == FALSE)
+ {
+ // FALSE returned on canceling handover in process (incompleted)
+ // The return value is used in the CCSessionHandler::cleanup()
+ // as a condition for cleaning the call upon remote VC failure
+ retVal = (hoState_ < HAND_ST_ANCH_HO_COMPLT) ? FALSE : TRUE;
+
+ // Cleanup source
+ switch (hoType_)
+ {
+ case HO_TY_HANDMSC3:
+ //Keep ho but drop h3
+ handleAnchPostH3Rls();
+ hoState_ = HAND_ST_ANCH_HO_COMPLT;
+ hoType_ = HO_TY_HANDOVER;
+ retVal = FALSE;
+ break;
+
+ case HO_TY_HANDOVER:
+ case HO_TY_HANDBACK:
+ //Drop ho
+ handleAnchPostHoRls();
+ break;
+
+ case HO_TY_EXT_HANDOVER:
+ case HO_TY_EXT_HANDBACK:
+ case HO_TY_EXT_HANDMSC3:
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ case HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3:
+ // <ext-ho <chenj: 06-05-01>
+ handleAnchPostExtHoRls();
+ break;
+
+ default:
+ // own messup happend, trouble shooting immediately!
+ DBG_ERROR ("CC Error @anch-cleanup: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ break;
+ }
+ }
+ else
+ {
+ // <Igal: 04-10-01>
+ // Unconditional complete cleanup
+ retVal = TRUE;
+
+ // <ext-ho <chenj: 06-05-01>
+ handleAnchPostExtHoRls();
+
+ handleAnchPostHoRls();
+ handleAnchPostH3Rls();
+
+ initData();
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+ }
+
+ BOOL
+ CCTargetHandover::cleanup(BOOL force = FALSE)
+ {
+
+ DBG_FUNC("CCTargetHandover::cleanup", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // Cleanup target
+ handleTrgPostHoRls();
+
+ DBG_LEAVE();
+
+ // Always TRUE. Target session is always cleaned when a connection
+ // with the target VC and the anchor session is lost.
+ // The return value is used in the CCSessionHandler::cleanup()
+ return (TRUE);
+ }
+
+ int
+ CCHandover::smHandleEvent(void)
+ {
+
+ DBG_FUNC("CCHandover::smHandleEvent", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ DBG_LEAVE();
+ return(0);
+ }
+
+ int
+ CCAnchorHandover::smHandleEvent(void)
+ {
+ DBG_FUNC("CCAnchorHandover::smHandleEvent", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ int returnValue = 0;
+
+ if (currEvent != JCC_NULL_EVENT)
+ {
+ currEvent =
+ (this->*hoSrcHandler[hoState_][currEvent - HAND_SRC_EVENT_BASE])();
+ }
+ else
+ {
+ DBG_LEAVE();
+ return(0);
+ }
+
+ switch(currEvent)
+ {
+ case CC_RELEASE_CALL:
+ returnValue = -1; // release call
+
+ break;
+
+ case CC_RELEASE_HOCALLLEG:
+ // ext-HO <chenj:06-11-01>
+ // JOE: later, might want to pass a correct cause
+ parent->hoCallLeg->cleanup( CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING );
+
+ returnValue = 0; // do NOT release call (just the external call leg)!
+
+ break;
+
+ case CC_RELEASE_H3CALLLEG:
+ // ext-HO <chenj:06-11-01>
+ // JOE: later, might want to pass a correct cause
+ parent->h3CallLeg->cleanup( CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING );
+
+ returnValue = 0; // do NOT release call (just the external call leg)!
+
+ break;
+
+ case CC_RELEASE_ALLHOCALLLEG:
+ // EHO <chenj:06-11-01>
+ // JOE: later, might want to pass a correct cause
+ parent->hoCallLeg->cleanup( CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING );
+ parent->h3CallLeg->cleanup( CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING );
+
+ returnValue = 0; // do NOT release call (just the external call leg)!
+
+ break;
+
+ case CC_RELEASE_OWN:
+ //Return to proceed with call legs and call releases
+ returnValue = CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING;
+ break;
+
+ case CC_TWO_STAGE_DISCONNECT:
+ returnValue = -1;
+ break;
+
+ case CC_MESSAGE_PROCESSING_COMPLT:
+ case JCC_NULL_EVENT:
+ // Do Nothing
+ break;
+
+ default:
+
+ DBG_ERROR("CC Handover Internal Error: (Bad event=%d), (state=%d), (session=%d)\n",
+ currEvent,
+ hoState_,
+ callIndex);
+ }
+
+ DBG_LEAVE();
+ return(returnValue);
+ }
+
+ int
+ CCTargetHandover::smHandleEvent(void)
+ {
+ DBG_FUNC("CCTargetHandover::smHandleEvent", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ int returnValue = 0;
+
+ if (currEvent != JCC_NULL_EVENT)
+ {
+ currEvent =
+ (this->*hoTrgHandler[hoState_][currEvent - HAND_SRC_EVENT_BASE])();
+ }
+ else
+ {
+ DBG_LEAVE();
+ return(0);
+ }
+
+
+ switch(currEvent)
+ {
+ case CC_RELEASE_CALL:
+ returnValue = -1;
+ break;
+
+ case CC_MESSAGE_PROCESSING_COMPLT:
+ case JCC_NULL_EVENT:
+ // Do Nothing
+ break;
+
+ default:
+
+ DBG_ERROR("CC Handover Internal Error: (Bad event=%d), (state=%d), (session=%d)\n",
+ currEvent,
+ hoState_,
+ callIndex);
+ }
+
+ DBG_LEAVE();
+ return(returnValue);
+ }
+
+ void
+ CCTargetHandover::sendRRMsgToAnchorCC(IntraL3Msg_t *rrMsg)
+ {
+
+ DBG_FUNC("CCTargetHandover::sendRRMsgToAnchorCC", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // Do Nothing
+ vcOutMsg.msgType = INTER_VC_CC_POST_HANDOVER_MOB_EVENT;
+ vcOutMsg.msgData.postHoMobEventData.intraL3Msg = *rrMsg;
+ sendVcMsg(MODULE_RM, MODULE_CC);
+ DBG_LEAVE();
+ }
+
+ void
+ CCTargetHandover::sendMSMsgToAnchorCC(T_CNI_RIL3MD_CCMM_MSG *msInMsg)
+ {
+ DBG_FUNC("CCTargetHandover::sendMSMsgToAnchorCC", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ vcOutMsg.msgType = INTER_VC_CC_POST_HANDOVER_MOB_EVENT;
+ vcOutMsg.msgData.postHoMobEventData.msInMsg = *msInMsg;
+ sendVcMsg(MODULE_MD, MODULE_CC);
+ DBG_LEAVE();
+ }
+
+
+ void CCTargetHandover::sendMMMsgToRemoteCC (IntraL3Msg_t *mmMsg)
+ {
+ /* Forward CM SERVICE REQUEST to the anchor CC (CM Session) */
+
+ DBG_FUNC("CCTargetHandover::sendMMMsgToCC", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ vcOutMsg.msgType = INTER_VC_CC_POST_HANDOVER_MOB_EVENT ;
+ vcOutMsg.msgData.postHoMobEventData.intraL3Msg = *mmMsg;
+
+ // Source, Destination
+ sendVcMsg (MODULE_MM, MODULE_CC);
+
+ DBG_LEAVE();
+ }
+
+
+ void
+ CCAnchorHandover::sendL2MsgToTargetCC(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+ {
+ DBG_FUNC("CCAnchorHandover::sendL2MsgToTargetCC", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ vcOutMsg.msgType = INTER_VC_CC_POST_HANDOVER_DATA_EVENT;
+ vcOutMsg.msgData.postHoMobEventData.msEncodedMsg = *msEncodedMsg;
+
+ // Igal: PDU has to be intercepted by the CM Session on the target side
+ sendVcMsg(MODULE_CC, MODULE_CC);
+ DBG_LEAVE();
+ }
+
+
+ void
+ CCAnchorHandover::sendRRMsgToTargetCC(IntraL3Msg_t *rrMsg)
+ {
+ DBG_FUNC("CCAnchorHandover::sendRRMsgToTargetCC", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ vcOutMsg.msgType = INTER_VC_CC_POST_HANDOVER_DATA_EVENT; //INTER_VC_CC_POST_HANDOVER_MOB_EVENT;
+ vcOutMsg.msgData.postHoMobEventData.intraL3Msg = *rrMsg;
+ sendVcMsg(MODULE_CC, MODULE_RM);
+ DBG_LEAVE();
+ }
+
+
+ void CCAnchorHandover::sendMMMsgToRemoteCC (IntraL3Msg_t *mmMsg)
+ {
+ /* Send Response to CM SERVICE REQUEST (either CM SERVICE ACCEPT or REJECT)
+ to the target MM */
+
+ DBG_FUNC("CCAnchorHandover::sendMMMsgToCC", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ vcOutMsg.msgType = INTER_VC_CC_POST_HANDOVER_MOB_EVENT ;
+ vcOutMsg.msgData.postHoMobEventData.intraL3Msg = *mmMsg;
+
+ // Source, Destination
+ sendVcMsg (MODULE_CC, MODULE_MM);
+
+ DBG_LEAVE();
+ }
+
+
+ T_CSU_PORT_ID
+ CCAnchorHandover::mobileCsuPort(void)
+ {
+ DBG_FUNC("CCAnchorHandover::mobileCsuPort", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ T_CSU_PORT_ID rtpSourcePort;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+
+ if (hoState_ == HAND_ST_ANCH_EHO_COMPLT) // External handover
+ {
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(parent->hoCallLeg->h323CallHandle);
+ }
+ else
+ {
+ rtpSourcePort.portId.rtpHandler = hoRtpSession_;
+ }
+
+ return(rtpSourcePort);
+
+ DBG_LEAVE();
+ }
+
+
+ //HO<xxu:01-31-00> give type of going handover
+ JCCEvent_t
+ CCHandover::handleNullEvent(void)
+ {
+
+ DBG_FUNC("handleNullEvent", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("CC Info: hoType '%d', hoState '%d'\n", hoType_, hoState_);
+ // Do Nothing.
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+
+ //HO<xxu:01-31-00> init h3
+ void
+ CCAnchorHandover::initHandmsc3Data(void)
+ {
+ DBG_FUNC("CCAnchorHandover::initHandmsc3Data", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ if (h3SimplexConnected_)
+ {
+ // Break connections with the RF Port
+ T_CSU_PORT_ID dstRtpPort;
+ T_CSU_RESULT_CON csuResult;
+
+ dstRtpPort.portType = CSU_RTP_PORT;
+ dstRtpPort.portId.rtpHandler = h3RtpSession_;
+
+ if ((csuResult = csu_OrigTermBreakAll(&dstRtpPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog3("CSU Error : Disconn. Failure, (hoType|hoState: %x) (Result = %d)(rtpHndler %x) \n",
+ (hoType_<<8|hoState_), csuResult, (int) h3RtpSession_);
+ DBG_ERROR("CSU Error : Disconn. Failure, (hoType %d;hoState_ %d)(Result = %d)(rtpHndler %x) \n",
+ hoType_, hoState_, csuResult, h3RtpSession_);
+
+ // Can only generate OA&M log.
+ }
+ }
+
+ if (h3RtpSession_ != NULL)
+ {
+ // Release the H3 RTP channel
+ ReleaseHandoverRtpChannel(h3RtpSession_);
+ }
+
+ msMsgsQueued_ = 0;
+ rrMsgsQueued_ = false;
+
+ h3SimplexConnected_ = false;
+ h3VcCallIndex_ = CC_MAX_CC_CALLS_DEF_VAL;
+//GCELL<tyu:06-01-01> BEGIN
+ memset(&h3GlobalCellId_, 0, sizeof(GlobalCellId_t));
+//GCELL<tyu:06-01-01> END
+ h3VcIpAddress_ = 0;
+ otherH3IncomingRtpPort_ = 0;
+ h3RtpSession_ = NULL;
+
+ h3SrcLinkLost_ = false;
+ hoType_ = HO_TY_HANDOVER;
+ hoState_ = HAND_ST_ANCH_HO_COMPLT;
+
+ //BCT <xxu:09-22-00> Begin
+ TwoPartyCallLeg *whichLeg;
+ whichLeg = parent->activeLeg();
+
+ if (whichLeg != NULL)
+ {
+ if ( whichLeg->msSide != NULL )
+ {
+ if (whichLeg->msSide->annState_ == ANN_PLAY_WAITING)
+ {
+ //Play inband ringback to transferred party for BCT
+ T_CSU_RESULT_CON csuResult;
+ whichLeg->msSide->annSrcPort_.portType = CSU_ANN_PORT;
+ whichLeg->msSide->annSrcPort_.portId.annHandler = 0;
+ whichLeg->msSide->annSnkPort_.portType = CSU_RTP_PORT;
+ whichLeg->msSide->annSnkPort_.portId.rtpHandler = hoRtpSession_;
+ whichLeg->msSide->annSnkPort_.speechVersion = whichLeg->msSide->currSpeechCh_.version;
+
+
+ DBG_TRACE("CC->CSU(bct): start inband alert annState(%d) ann(%d,%x) --> snk(%d,%x,%d)\n",
+ whichLeg->msSide->annState_,
+ whichLeg->msSide->annSrcPort_.portType,
+ whichLeg->msSide->annSrcPort_.portId.annHandler,
+ whichLeg->msSide->annSnkPort_.portType,
+ whichLeg->msSide->annSnkPort_.portId.rtpHandler,
+ whichLeg->msSide->annSnkPort_.speechVersion);
+
+ if ( (csuResult = csu_SimplexConnect( &whichLeg->msSide->annSrcPort_,
+ &whichLeg->msSide->annSnkPort_))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_WARNING("CC->BCT(csuSConnFailedAfterHoFailed):xlst(%d) ann(%d,%x) snk(%d,%x,%d)\n",
+ csuResult,
+ whichLeg->msSide->annSrcPort_.portType,
+ (int)whichLeg->msSide->annSrcPort_.portId.rtpHandler,
+ whichLeg->msSide->annSnkPort_.portType,
+ (int)whichLeg->msSide->annSnkPort_.portId.rtpHandler,
+ (int)whichLeg->msSide->annSnkPort_.speechVersion);
+
+ //ignore this remote alerting
+ }
+ whichLeg->msSide->annState_ = ANN_PLAY_ON;
+ }
+ }
+ }
+ //BCT <xxu:09-21-00> END
+
+
+ //RETRY<xxu:04-24-00> BEGIN
+ hoRetry_ = 0;
+ //RETRY<xxu:04-24-00> END
+
+ DBG_LEAVE();
+ }
+
+
+ //HO<xxu:01-31-00> init ho
+ void
+ CCAnchorHandover::initData (void)
+ {
+
+ DBG_FUNC("CCAnchorHandover::initData", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ msMsgsQueued_ = 0;
+
+ rrMsgsQueued_ = false;
+
+ if (hoSimplexConnected_)
+ {
+ // break connection
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = hoRtpSession_;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog2("CSU Error : Ho Disconn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)hoRtpSession_);
+ DBG_ERROR("CSU Error : Ho Disconn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)hoRtpSession_);
+
+ // Can only generate OA&M log.
+ }
+
+ hoSimplexConnected_ = false;
+ }
+
+
+ if (h3SimplexConnected_)
+ {
+ // Break connections with the RF Port
+ T_CSU_PORT_ID dstRtpPort;
+ T_CSU_RESULT_CON csuResult;
+
+ dstRtpPort.portType = CSU_RTP_PORT;
+ dstRtpPort.portId.rtpHandler = h3RtpSession_;
+
+ if ((csuResult = csu_OrigTermBreakAll(&dstRtpPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog3("CSU Error : Disconn. Failure, (hoType|hoState: %x) (Result = %d)(rtpHndler %x) \n",
+ (hoType_<<8|hoState_), csuResult, (int) h3RtpSession_);
+ DBG_ERROR("CSU Error : Disconn. Failure, (hoType %d;hoState_ %d)(Result = %d)(rtpHndler %x) \n",
+ hoType_, hoState_, csuResult, h3RtpSession_);
+
+ // Can only generate OA&M log.
+ }
+ }
+
+ if (h3RtpSession_ != NULL)
+ {
+ // Release the H3 RTP channel
+ ReleaseHandoverRtpChannel(h3RtpSession_);
+ }
+
+ msMsgsQueued_ = 0;
+ rrMsgsQueued_ = false;
+
+ h3SimplexConnected_ = false;
+ h3VcCallIndex_ = CC_MAX_CC_CALLS_DEF_VAL;
+//GCELL<tyu:06-01-01> BEGIN
+ memset(&h3GlobalCellId_, 0, sizeof(GlobalCellId_t));
+//GCELL<tyu:06-01-01> END
+ h3VcIpAddress_ = 0;
+ otherH3IncomingRtpPort_ = 0;
+ h3RtpSession_ = NULL;
+
+ h3SrcLinkLost_ = false;
+
+ // ext-HO <chenj:06-29-01>
+ memset(&targetMscNumber_, 0, sizeof(T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER));
+
+ //BCT <xxu:09-22-00> Begin
+ TwoPartyCallLeg *whichLeg;
+ whichLeg = parent->activeLeg();
+
+ if (whichLeg != NULL)
+ {
+ if ( whichLeg->msSide != NULL )
+ {
+ if (whichLeg->msSide->annState_ == ANN_PLAY_WAITING)
+ {
+ //Play inband ringback to transferred party for BCT
+ T_CSU_RESULT_CON csuResult;
+ whichLeg->msSide->annSrcPort_.portType = CSU_ANN_PORT;
+ whichLeg->msSide->annSrcPort_.portId.annHandler = 0;
+ whichLeg->msSide->annSnkPort_.portType = CSU_GSM_PORT;
+ whichLeg->msSide->annSnkPort_.portId.gsmHandler = parent->entryId;
+ whichLeg->msSide->annSnkPort_.speechVersion = whichLeg->msSide->currSpeechCh_.version;
+
+
+ DBG_TRACE("CC->CSU(bct): start inband alert annState(%d) ann(%d,%x) --> snk(%d,%x,%d)\n",
+ whichLeg->msSide->annState_,
+ whichLeg->msSide->annSrcPort_.portType,
+ whichLeg->msSide->annSrcPort_.portId.annHandler,
+ whichLeg->msSide->annSnkPort_.portType,
+ whichLeg->msSide->annSnkPort_.portId.rtpHandler,
+ whichLeg->msSide->annSnkPort_.speechVersion);
+
+ if ( (csuResult = csu_SimplexConnect(&whichLeg->msSide->annSrcPort_,
+ &whichLeg->msSide->annSnkPort_))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_WARNING("CC->BCT(csuSConnFailedAfterHoFailed):xlst(%d) ann(%d,%x) snk(%d,%x,%d)\n",
+ csuResult,
+ whichLeg->msSide->annSrcPort_.portType,
+ (int)whichLeg->msSide->annSrcPort_.portId.rtpHandler,
+ whichLeg->msSide->annSnkPort_.portType,
+ (int)whichLeg->msSide->annSnkPort_.portId.rtpHandler,
+ (int)whichLeg->msSide->annSnkPort_.speechVersion);
+
+ //ignore this remote alerting
+ }
+ whichLeg->msSide->annState_ = ANN_PLAY_ON;
+ }
+ }
+ }
+ //BCT <xxu:09-21-00> END
+
+ CCHandover::initData();
+
+ //HO<xxu: 01-27-00>
+ hoType_ = (HandoverTypes_t) 0;
+
+ //RETRY<xxu:04-24-00> BEGIN
+ hoRetry_ = 0;
+ //RETRY<xxu:04-24-00> END
+
+ DBG_LEAVE();
+ }
+
+ //HO<xxu:01-28-00> need handle both h3 and ho
+ int
+ CCAnchorHandover::handleVbCcMsg(IntraL3Msg_t *vbCcInMsg)
+ {
+ UINT32 reVcIpAddress;
+ bool location_rejected = false;
+
+ DBG_FUNC("CCAnchorHandover::handleVbCcMsg", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("CC->Handover Info: CCAnchorHandover::handleVbCcMsg (hoType %d, hoState %d)\n",
+ hoType_, hoState_);
+
+ if (hoState_ != HAND_ST_ANCH_VC_IP_ADDRESS_REQ &&
+ hoState_ != HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ )
+ {
+ // Do Nothing
+ // Late Message
+ DBG_LEAVE();
+ return 0;
+ }
+
+ // PR CSCdv18197 <chenj:08-27-01>
+ // A string "0" instead of NULL for rejected case
+ if ((vbCcInMsg->l3_data.ipAddressResponse.ViperCellIpAddress[0] == '0') &&
+ (vbCcInMsg->l3_data.ipAddressResponse.ViperCellIpAddress[0] == '\n'))
+ {
+ location_rejected = true;
+ }
+ else
+ {
+ // Copy the ip address from the message
+ reVcIpAddress =
+ inet_addr(&(vbCcInMsg->l3_data.ipAddressResponse.ViperCellIpAddress[0]) );
+
+ if (reVcIpAddress == 0)
+ {
+ location_rejected = true;
+ }
+
+ switch(hoType_)
+ {
+ case HO_TY_HANDOVER:
+ hoVcIpAddress_ = reVcIpAddress;
+
+ break;
+
+ case HO_TY_HANDMSC3:
+ h3VcIpAddress_ = reVcIpAddress;
+
+ break;
+
+ default:
+ //Deadly error, can't go further. Troubleshooting needed !
+ JCCLog2 ("CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_ERROR ("CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ location_rejected = true;
+ return (0);
+ }
+ }
+
+ if (location_rejected)
+ {
+ // Do Nothing
+ JCCLog2 ("VOIP->CC Error: Ip Address failed (hoType %d, hoState %d)\n",
+ hoType_, hoState_);
+ JCCLog("Check if an adjacent vipercell is down, but radio is powered on.\n");
+ DBG_ERROR ("VOIP->CC Error: Ip Address failed (hoType %d, hoState %d)\n",
+ hoType_, hoState_);
+ DBG_ERROR("Check if an adjacent vipercell is down, but radio is powered on.\n");
+
+ // Give up this ho or h3 effort wait for next Handover Required message.
+ if (hoType_==HO_TY_HANDOVER)
+ initData();
+ else
+ initHandmsc3Data();
+ }else
+ {
+ JCCLog3 ("VOIP->CC Log: (hoType %d, hoState %d) (Ip Address = %d) returned.\n",
+ hoType_, hoState_,
+ reVcIpAddress);
+ DBG_TRACE ("VOIP->CC Log: (hoType %d, hoState %d) (Ip Address = %d) returned.\n",
+ hoType_, hoState_,
+ reVcIpAddress);
+
+ // VC IP Address Request was sent out.
+ currEvent = HC_VB_GET_VC_ADDRESS_RSP;
+
+ DBG_LEAVE();
+ return (smHandleEvent());
+ }
+
+ DBG_LEAVE();
+ return(0);
+ }
+
+ //RETRY<xxu:04-25-00> BEGIN
+ int
+ CCHandover::getNextHoCandidate(void)
+ {
+ int i;
+ IntraL3HandoverRequired_t *inMsg = &handReqd;
+
+ DBG_FUNC("CCHandover::getNextHoCandidate", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // Assume all the candidates are already sorted in terms of perference
+ // Make sure a candidate to try is a valid one
+ for (i=0;i<inMsg->numCandidates;i++)
+ {
+ // xxuTbdHo: multiple VBs ie networkId
+
+ DBG_TRACE("TRACE-getNextHoCandidate: Cand MCC %x%x%x MNC %x%x%x Lac %d Ci %d IsExtern %d IsTried %d\n",
+ inMsg->candGlobalCellId[i].candGlobalCellId.mcc[0], inMsg->candGlobalCellId[i].candGlobalCellId.mcc[1], inMsg->candGlobalCellId[i].candGlobalCellId.mcc[2],
+ inMsg->candGlobalCellId[i].candGlobalCellId.mnc[0], inMsg->candGlobalCellId[i].candGlobalCellId.mnc[1], inMsg->candGlobalCellId[i].candGlobalCellId.mnc[2],
+ inMsg->candGlobalCellId[i].candGlobalCellId.lac, inMsg->candGlobalCellId[i].candGlobalCellId.ci, inMsg->candGlobalCellId[i].candIsExternal,
+ inMsg->candGlobalCellId[i].candIsTried);
+
+ if ((isEqualGlobalCellId(&(inMsg->candGlobalCellId[i].candGlobalCellId), &MY_GLOBALCELL_ID) == false) &&
+ (inMsg->candGlobalCellId[i].candIsTried == FALSE))
+ {
+ inMsg->candGlobalCellId[i].candIsTried = true;
+ // Found an untried candidate that is not myself, so break out of for loop.
+ break;
+ }
+ else
+ {
+ DBG_WARNING("RR->CC Alert: %th of (numCandidates %d) in handReqd msg is self\n",
+ i, inMsg->numCandidates);
+ }
+ }
+
+ if (i>=inMsg->numCandidates)
+ {
+ DBG_ERROR ("RR->CC Error: look for next candidate, all of (numCandidates = %d) are bad \n",
+ inMsg->numCandidates);
+ DBG_LEAVE();
+ return (-1);
+ }
+
+ DBG_LEAVE();
+ return (i);
+ }
+ //RETRY<xxu:04-25-00> END
+
+
+//ext-HO <xxu:05-22-01>
+int
+CCHandover::handleHoaCcMsg(InterHoaVcMsg_t *hoaCcInMsg)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(ho::handleHoaCcMsg): entering......\n}\n");
+
+ hoaInMsg = hoaCcInMsg;
+
+ switch (hoaInMsg->msgType)
+ {
+ case INTER_EHO_PERFORM_HANDOVER_REQUEST:
+ currEvent = HAND_PERFORM_HO_REQ;
+ break;
+
+ case INTER_EHO_PERFORM_HANDOVER_ACK:
+ if (hoaCcInMsg->msgData.perfExtHandoverAck.reason)
+ currEvent = HAND_PERFORM_HO_NACK;
+ else
+ currEvent = HAND_PERFORM_HO_ACK;
+
+ break;
+
+ case INTER_EHO_END_HANDOVER:
+ currEvent = HAND_END_HO;
+ break;
+
+ case INTER_EHO_HANDOVER_ACCESS:
+ currEvent = HAND_HO_ACCESS;
+ break;
+
+ case INTER_EHO_HANDOVER_SUCCESS:
+ currEvent = HAND_COMPLT_HO;
+ break;
+
+ case INTER_EHO_HANDOVER_MOB_EVENT:
+ // <tyy:6-29-01> POSTMOB
+ // Check DTAP 1st byte of Distribution Data Unit (Discrimination)
+ if (hoaInMsg->msgData.postExtHoMobEventData.LAYER3PDU.LAYER3DATA[0] & 0x01 == 1)
+ {
+ if (parent->handoverSession == parent->targetHandoverSessionExtHo)
+ currEvent = HAND_POSTHO_HOA_EVENT;
+ else
+ currEvent = HAND_POSTHO_MOB_EVENT;
+ }
+ else { // If it's a BSSMAP message instead then check for detect or failure
+ if (hoaInMsg->msgData.postExtHoMobEventData.LAYER3PDU.LAYER3DATA[2] == A_HANDOVER_DETECT_TYPE)
+ currEvent = HAND_HO_ACCESS;
+ else if (hoaInMsg->msgData.postExtHoMobEventData.LAYER3PDU.LAYER3DATA[2] == A_HANDOVER_FAILURE_TYPE)
+ currEvent = HAND_SRC_HO_FAIL;
+ else
+ {
+ DBG_ERRORho("{\nMNEThoWARNING(ho::handleHoaCcMsg): Unexpected (A-Int MsgType %d) in MOB Event from HOA\n}\n",
+ hoaInMsg->msgData.postExtHoMobEventData.LAYER3PDU.LAYER3DATA[2]);
+ currEvent = JCC_NULL_EVENT;
+ }
+ }
+ break;
+
+ case INTER_EHO_PERFORM_HANDBACK_REQUEST:
+ currEvent = HAND_PERFORM_HO_REQ;
+ break;
+
+ case INTER_EHO_PERFORM_HANDBACK_ACK:
+ if (hoaCcInMsg->msgData.perfExtHandbackAck.reason)
+ currEvent = HAND_PERFORM_HO_NACK;
+ else
+ currEvent = HAND_PERFORM_HO_ACK;
+ break;
+
+ case INTER_EHO_COMPLETE_HANDBACK:
+ currEvent = HAND_COMPLT_HO;
+
+ default:
+ DBG_ERRORho("{\nMNEThoWARNING(ho::handleHoaCcMsg): Unexpected (msgType = %d) from HOA\n}\n",
+ hoaInMsg->msgType);
+ currEvent = JCC_NULL_EVENT;
+
+ }
+
+ if (currEvent != JCC_NULL_EVENT)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(ho::handleHoaCcMsg): received a HOA msg (msgType=%d, event=%d, callId=%d)\n}\n",
+ hoaInMsg->msgType, currEvent, callIndex);
+ }
+
+ return(0);
+}
+
+
+// ----------------------- External Handover Methods -------------------------------
+
+ void
+ CCHandover::classmarkFill( T_AIF_MSG *aifMsg )
+ {
+ DBG_FUNC("CCHandover::classmarkFill", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ aifMsg->handoverRequest.classmarkInformation1.elementIdentifier = A_CLASSMARK_INFORMATION1_TYPE;
+ aifMsg->handoverRequest.classmarkInformation1.ie_present = false;
+
+ aifMsg->handoverRequest.classmarkInformation2.elementIdentifier = A_CLASSMARK_INFORMATION2_TYPE;
+ aifMsg->handoverRequest.classmarkInformation2.ie_present = true;
+ aifMsg->handoverRequest.classmarkInformation2.length = 3;
+
+ if (parent->handoverSession == parent->anchorHandoverSession)
+ { // External handover SERVING
+ if (parent->classmark2Info.ie_present)
+ {
+ unsigned char *pclass = (unsigned char *)&aifMsg->handoverRequest.classmarkInformation2.classmark[0];
+
+ if (parent->classmark2Info.revLevel == CNI_RIL3_REV_LEVEL_PHASE2)
+ pclass[0] |= 0x20;
+ if (parent->classmark2Info.esInd == CNI_RIL3_EARLY_CLASSMARK_SENDING_IMPLEMENTED)
+ pclass[0] |= 0x10;
+ if (parent->classmark2Info.a51 == CNI_RIL3_A51_NOT_AVAILABLE)
+ pclass[0] |= 0x08;
+
+ pclass[0] |= parent->classmark2Info.rfPowerCap;
+
+ if (parent->classmark2Info.psCap == CNI_RIL3_PS_CAPABILITY_PRESENT)
+ pclass[1] |= 0x40;
+ if (parent->classmark2Info.ssScreening == CNI_RIL3_SS_SCREENING_PHASE2)
+ pclass[1] |= 0x10;
+ if (parent->classmark2Info.smCap == CNI_RIL3_SM_MT_PTP_SUPPORTED)
+ pclass[1] |= 0x08;
+ if (parent->classmark2Info.vbsReception == CNI_RIL3_VBS_NOTIFICATION_WANTED)
+ pclass[1] |= 0x04;
+ if (parent->classmark2Info.vgcsReception == CNI_RIL3_VGCS_NOTIFICATION_WANTED)
+ pclass[1] |= 0x02;
+ if (parent->classmark2Info.fcFreqCap == CNI_RIL3_GSM_EXTENTION_BAND_G1_SUPPORTED)
+ pclass[1] |= 0x01;
+ if (parent->classmark2Info.classmark3 == CNI_RIL3_CLASSMARK3_INFO_AVAILABLE)
+ pclass[2] |= 0x80;
+ if (parent->classmark2Info.cmsp == CNI_RIL3_NETWORK_INITIATED_MO_SUPPORTED)
+ pclass[2] |= 0x04;
+ if (parent->classmark2Info.a53 == CNI_RIL3_A53_AVAILABLE)
+ pclass[2] |= 0x02;
+ if (parent->classmark2Info.a52 == CNI_RIL3_A52_AVAILABLE)
+ pclass[2] |= 0x01;
+ }
+ else
+ {
+ DBG_ERROR("Error@classmarkFill: Classmark2Info ie NOT present. Filling with default values.\n");
+ // Classmark 2 Default values (see 04.08 section 10.5.1.6 Mobile Station Classmark 6)
+ // - Revision = phase 2 MS
+ // - "Controlled Early classmark sending" option is NOT implemented in the MS
+ // - Encryption algorithm A5/1 AVAILABLE
+ // - PCS 1900 CLASS 3
+ // - Pseudo-synchronization capability NOT present
+ // - Suplementary Service screening indicator = 0
+ // - SM capability SUPPORTED
+ // - VBS, VGCS, CM3, LCS VA, SoLSA, CMSP, A5/3 all NOT supported
+ // - Frequency capability = 0
+ // - A5/2 algorithm SUPPORTED
+
+ aifMsg->handoverRequest.classmarkInformation2.classmark[0] = 0x22;
+ aifMsg->handoverRequest.classmarkInformation2.classmark[1] = 0x08;
+ aifMsg->handoverRequest.classmarkInformation2.classmark[2] = 0x01;
+ }
+ }
+ else
+ { // External handover TARGET
+ aifMsg->handoverRequest.classmarkInformation2 = currClassmark_;
+ }
+
+ aifMsg->handoverRequest.classmarkInformation3.elementIdentifier = A_CLASSMARK_INFORMATION3_TYPE;
+ aifMsg->handoverRequest.classmarkInformation3.ie_present = false;
+
+ DBG_LEAVE();
+ }
+
+ void
+ CCHandover::channelTypeFill( T_AIF_MSG *aifMsg )
+ {
+ int i;
+ int version_count = 0;
+ TwoPartyCallLeg *whichLeg;
+ T_CNI_RIL3_SPEECH_VERSION version;
+
+ aifMsg->handoverRequest.channelType.elementIdentifier = A_CHANNEL_TYPE_TYPE;
+ aifMsg->handoverRequest.channelType.ie_present = true;
+
+ aifMsg->handoverRequest.channelType.speechDataIndicator = 1; // Speech
+ aifMsg->handoverRequest.channelType.channelRateAndType = 8; // Full rate TCH channel Bm
+
+ if (parent->handoverSession == parent->anchorHandoverSession)
+ { // External handover SERVING
+ whichLeg = parent->activeLeg();
+
+ for (i=0; i<3; i++)
+ {
+ if (whichLeg->msSide->bearCap1speechVersionInd_[i].fieldPresent)
+ {
+ version = whichLeg->msSide->bearCap1speechVersionInd_[i].version;
+
+ if (version == CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1) {
+ aifMsg->handoverRequest.channelType.permittedIndicator[version_count] = 0x01; // NOTE: This is actually GSM VERSION 1 in 08.08 spec (full rate FR)
+ version_count ++;
+ } else if (version == CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_2) {
+ aifMsg->handoverRequest.channelType.permittedIndicator[version_count] = 0x21; // NOTE: This is actually GSM VERSION 3 in 08.08 spec (full rate AMR)
+ version_count ++;
+ } else if (version == CNI_RIL3_GSM_HALF_RATE_SPEECH_VERSION_1) {
+ aifMsg->handoverRequest.channelType.permittedIndicator[version_count] = 0x05; // NOTE: This is actually GSM VERSION 3 in 08.08 spec (full rate AMR)
+ version_count ++;
+ } else
+ {
+ DBG_ERRORho("CCHandover::channelTypeFill -- Version content error (version=%d)\n", version);
+ }
+ }
+ }
+ }
+ else
+ { // External handover TARGET
+ if (currSpeechCh_.version = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1)
+ {
+ aifMsg->handoverRequest.channelType.permittedIndicator[0] = 0x01;
+ }
+ else if (currSpeechCh_.version = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_2)
+ {
+ aifMsg->handoverRequest.channelType.permittedIndicator[0] = 0x21;
+ }
+ else if (currSpeechCh_.version = CNI_RIL3_GSM_HALF_RATE_SPEECH_VERSION_1)
+ {
+ aifMsg->handoverRequest.channelType.permittedIndicator[0] = 0x05;
+ }
+ else
+ {
+ DBG_ERRORho("CCHandover::channelTypeFill -- Version content error (version=%d)\n", version);
+ }
+ version_count = 1;
+ }
+
+ switch (version_count)
+ {
+ case 1:
+ aifMsg->handoverRequest.channelType.length = 3;
+ break;
+
+ case 2:
+ aifMsg->handoverRequest.channelType.length = 4;
+ aifMsg->handoverRequest.channelType.permittedIndicator[0] |= 0x80; // Set extension bit 8
+ break;
+
+ case 3:
+ aifMsg->handoverRequest.channelType.length = 5;
+ aifMsg->handoverRequest.channelType.permittedIndicator[0] |= 0x80; // Set extension bit 8
+ aifMsg->handoverRequest.channelType.permittedIndicator[1] |= 0x80; // Set extension bit 8
+ break;
+
+ case 0:
+ default:
+ DBG_ERRORho("CCHandover::channelTypeFill -- Content error (i=%d)\n", i);
+ aifMsg->handoverRequest.channelType.length = 3;
+ aifMsg->handoverRequest.channelType.permittedIndicator[0] = 0x21;
+ }
+ }
+
+ void
+ CCHandover::currentChannelTypeFill( T_AIF_MSG *aifMsg )
+ {
+ aifMsg->handoverRequest.currentChannelType1.elementIdentifier = A_CURRENT_CHANNEL_TYPE1_TYPE;
+ aifMsg->handoverRequest.currentChannelType1.ie_present = true;
+ aifMsg->handoverRequest.currentChannelType1.channelMode = 1; // Speech
+ aifMsg->handoverRequest.currentChannelType1.channel = 8; // Full rate TCH channel Bm
+ }
+
+ unsigned char
+ CCHandover::findGpCipheringCapability(void)
+ {
+ DBG_FUNC("CCHandover::findGpCipheringCapability", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ unsigned char ciphCap=0;
+
+ if (RM_DSPA51(rm_DspCiphCap)) ciphCap |= 0x02;
+ if (RM_DSPA52(rm_DspCiphCap)) ciphCap |= 0x04;
+
+ if (ciphCap)
+ ciphCap &= 0xFE;
+ else
+ ciphCap = 1; // No Encryption
+
+ DBG_TRACE("INFO@findGpCipheringCapability (ciphCap=0x%x)\n",ciphCap);
+ DBG_LEAVE();
+ return(ciphCap);
+ }
+
+ void
+ CCHandover::encryptionInformationFill( T_AIF_MSG *aifMsg )
+ {
+ IntraL3CipherModeCommand_t cipherCmd;
+
+ if (parent->handoverSession == parent->anchorHandoverSession)
+ { // External handover SERVING
+ if (ludbGetCipherAlgo(parent->ludbIndex, &cipherCmd))
+ {
+ DBG_ERRORho (" WARNING: ludbGetCipherAlgo() failed, (ludbIndex = %d)\n",
+ parent->ludbIndex);
+ cipherCmd.cmd.cipherModeSetting.ie_present = true;
+ cipherCmd.cmd.cipherModeSetting.ciphering = CNI_RIl3_CIPHER_NO_CIPHERING;
+ }
+ }
+ else
+ { // External handover TARGET
+ cipherCmd = currEncrypt_;
+ }
+
+ aifMsg->handoverRequest.encryptionInformation.elementIdentifier = A_ENCRYPTION_INFORMATION_TYPE;
+ if (cipherCmd.cmd.cipherModeSetting.ie_present)
+ {
+ aifMsg->handoverRequest.encryptionInformation.ie_present = true;
+ aifMsg->handoverRequest.encryptionInformation.length = 9;
+ if (cipherCmd.cmd.cipherModeSetting.ciphering == CNI_RIl3_CIPHER_NO_CIPHERING)
+ {
+ aifMsg->handoverRequest.encryptionInformation.permittedAlgorithm = 1; // No encryption
+ }
+ else
+ {
+ aifMsg->handoverRequest.encryptionInformation.permittedAlgorithm = findGpCipheringCapability();
+ }
+
+ memcpy( (unsigned char*)aifMsg->handoverRequest.encryptionInformation.key,
+ (unsigned char*)cipherCmd.Kc, CIPHER_KC_LEN);
+ }
+ else
+ {
+ aifMsg->handoverRequest.encryptionInformation.ie_present = true;
+ aifMsg->handoverRequest.encryptionInformation.permittedAlgorithm = 1; // No Ciphering
+ aifMsg->handoverRequest.encryptionInformation.length = 9;
+ };
+ }
+
+ void
+ CCHandover::currentEncryptionAlgorithmFill( T_AIF_MSG *aifMsg )
+ {
+ IntraL3CipherModeCommand_t cipherCmd;
+
+ if (parent->handoverSession == parent->anchorHandoverSession)
+ { // External handover SERVING
+ if (ludbGetCipherAlgo(parent->ludbIndex, &cipherCmd))
+ {
+ DBG_ERRORho (" WARNING: ludbGetCipherAlgo() failed, (ludbIndex = %d)\n",
+ parent->ludbIndex);
+ cipherCmd.cmd.cipherModeSetting.ie_present = true;
+ cipherCmd.cmd.cipherModeSetting.ciphering = CNI_RIl3_CIPHER_NO_CIPHERING;
+ }
+ }
+ else
+ { // External handover TARGET
+ cipherCmd = currEncrypt_;
+ }
+
+ aifMsg->handoverRequest.chosenEncryptAlgorithmServing.elementIdentifier = A_CHOSEN_ENCRYPTION_ALGORITHM_TYPE;
+ if (cipherCmd.cmd.cipherModeSetting.ie_present)
+ {
+ aifMsg->handoverRequest.chosenEncryptAlgorithmServing.ie_present = true;
+ if (cipherCmd.cmd.cipherModeSetting.ciphering == CNI_RIl3_CIPHER_NO_CIPHERING)
+ {
+ aifMsg->handoverRequest.chosenEncryptAlgorithmServing.algorithmId = 1; // No encryption
+ }
+ else
+ {
+ switch (cipherCmd.cmd.cipherModeSetting.algorithm)
+ {
+ case CNI_RIL3_CIPHER_ALGORITHM_A51:
+ {
+ aifMsg->handoverRequest.chosenEncryptAlgorithmServing.algorithmId = 0x02; // GSM A5/1
+ break;
+ }
+
+ case CNI_RIL3_CIPHER_ALGORITHM_A52:
+ {
+ aifMsg->handoverRequest.chosenEncryptAlgorithmServing.algorithmId = 0x03; // GSM A5/2
+ break;
+ }
+
+ case CNI_RIL3_CIPHER_ALGORITHM_A53:
+ {
+ aifMsg->handoverRequest.chosenEncryptAlgorithmServing.algorithmId = 0x04; // GSM A5/3
+ break;
+ }
+
+ case CNI_RIL3_CIPHER_ALGORITHM_A54:
+ {
+ aifMsg->handoverRequest.chosenEncryptAlgorithmServing.algorithmId = 0x05; // GSM A5/4
+ break;
+ }
+
+ case CNI_RIL3_CIPHER_ALGORITHM_A55:
+ {
+ aifMsg->handoverRequest.chosenEncryptAlgorithmServing.algorithmId = 0x06; // GSM A5/5
+ break;
+ }
+
+ case CNI_RIL3_CIPHER_ALGORITHM_A56:
+ {
+ aifMsg->handoverRequest.chosenEncryptAlgorithmServing.algorithmId = 0x07; // GSM A5/6
+ break;
+ }
+
+ case CNI_RIL3_CIPHER_ALGORITHM_A57:
+ {
+ aifMsg->handoverRequest.chosenEncryptAlgorithmServing.algorithmId = 0x08; // GSM A5/7
+ break;
+ }
+ }
+
+ aifMsg->handoverRequest.chosenEncryptAlgorithmServing.algorithmId = findGpCipheringCapability();
+ }
+ }
+ else
+ {
+ aifMsg->handoverRequest.chosenEncryptAlgorithmServing.ie_present = true;
+ aifMsg->handoverRequest.chosenEncryptAlgorithmServing.algorithmId = 1; // No Ciphering
+ };
+ }
+
+ void
+ CCHandover::populateAHandoverRequest(GlobalCellId_t *serving_cell, GlobalCellId_t *target_cell)
+ {
+ memset( (char*)&aifMsg, 0, sizeof(T_AIF_MSG));
+ aifMsg.header.msgType = A_HANDOVER_REQUEST_TYPE;
+
+ // Mandatory A-interface parameters
+ channelTypeFill( &aifMsg );
+ encryptionInformationFill( &aifMsg );
+ classmarkFill( &aifMsg );
+
+ aifMsg.handoverRequest.cellIdentifierTarget.elementIdentifier = A_CELL_IDENTIFIER_TYPE;
+ aifMsg.handoverRequest.cellIdentifierTarget.ie_present = true;
+ aifMsg.handoverRequest.cellIdentifierTarget.length = 8;
+ aifMsg.handoverRequest.cellIdentifierTarget.cellIdDescriminator = 0; // The whole Cell Global Id is used
+ memcpy ((unsigned char *) aifMsg.handoverRequest.cellIdentifierTarget.mcc,
+ (char *) target_cell->mcc,
+ NUM_MCC_DIGITS);
+ memcpy ((unsigned char *) aifMsg.handoverRequest.cellIdentifierTarget.mnc,
+ (char *) target_cell->mnc,
+ NUM_MNC_DIGITS);
+ aifMsg.handoverRequest.cellIdentifierTarget.lac = target_cell->lac;
+ aifMsg.handoverRequest.cellIdentifierTarget.ci = target_cell->ci;
+
+
+ aifMsg.handoverRequest.cellIdentifierServing.elementIdentifier = A_CELL_IDENTIFIER_TYPE;
+ aifMsg.handoverRequest.cellIdentifierServing.ie_present = true;
+ aifMsg.handoverRequest.cellIdentifierServing.length = 8;
+ aifMsg.handoverRequest.cellIdentifierServing.cellIdDescriminator = 0; // The whole Cell Global Id is used
+ memcpy ((unsigned char *) aifMsg.handoverRequest.cellIdentifierServing.mcc,
+ (char *) serving_cell->mcc,
+ NUM_MCC_DIGITS);
+ memcpy ((unsigned char *) aifMsg.handoverRequest.cellIdentifierServing.mnc,
+ (char *) serving_cell->mnc,
+ NUM_MNC_DIGITS);
+ aifMsg.handoverRequest.cellIdentifierServing.lac = serving_cell->lac;
+ aifMsg.handoverRequest.cellIdentifierServing.ci = serving_cell->ci;
+
+ // Optional A-interface parameters
+ currentChannelTypeFill( &aifMsg );
+ currentEncryptionAlgorithmFill( &aifMsg );
+
+
+ DBG_TRACEho(" AIFMSG PRE-AIF PROCESSING MESSAGE DATA: A_HANDOVER_REQUEST_TYPE\n");
+ DBG_TRACEho(" {\n");
+ DBG_TRACEho(" - channelType\n");
+ DBG_TRACEho(" - speechDataIndicator=%d\n",
+ aifMsg.handoverRequest.channelType.speechDataIndicator);
+ DBG_TRACEho(" - channelRateAndType=%d\n",
+ aifMsg.handoverRequest.channelType.channelRateAndType);
+ DBG_TRACEho(" - permittedIndicator[0-7]=%x,%x,%x,%x,%x,%x,%x,%x\n",
+ aifMsg.handoverRequest.channelType.permittedIndicator[0],
+ aifMsg.handoverRequest.channelType.permittedIndicator[1],
+ aifMsg.handoverRequest.channelType.permittedIndicator[2],
+ aifMsg.handoverRequest.channelType.permittedIndicator[3],
+ aifMsg.handoverRequest.channelType.permittedIndicator[4],
+ aifMsg.handoverRequest.channelType.permittedIndicator[5],
+ aifMsg.handoverRequest.channelType.permittedIndicator[6],
+ aifMsg.handoverRequest.channelType.permittedIndicator[7]);
+ DBG_TRACEho(" - encryptionInformation (ie_present=%d)\n",
+ aifMsg.handoverRequest.encryptionInformation.ie_present);
+ DBG_TRACEho(" - permittedAlgorithm=%d\n",
+ aifMsg.handoverRequest.encryptionInformation.permittedAlgorithm);
+ DBG_TRACEho(" - ciphData (ciphKey[1-8]: %x,%x,%x,%x,%x,%x,%x,%x)\n",
+ aifMsg.handoverRequest.encryptionInformation.key[0],
+ aifMsg.handoverRequest.encryptionInformation.key[1],
+ aifMsg.handoverRequest.encryptionInformation.key[2],
+ aifMsg.handoverRequest.encryptionInformation.key[3],
+ aifMsg.handoverRequest.encryptionInformation.key[4],
+ aifMsg.handoverRequest.encryptionInformation.key[5],
+ aifMsg.handoverRequest.encryptionInformation.key[6],
+ aifMsg.handoverRequest.encryptionInformation.key[7]);
+ DBG_TRACEho(" - classmarkInformation2\n");
+ DBG_TRACEho(" - classmark[0-2]: %x,%x,%x\n",
+ aifMsg.handoverRequest.classmarkInformation2.classmark[0],
+ aifMsg.handoverRequest.classmarkInformation2.classmark[1],
+ aifMsg.handoverRequest.classmarkInformation2.classmark[2]);
+ DBG_TRACEho(" - cellIdentifierTarget\n");
+ DBG_TRACEho(" - cellIdDescriminator=%d\n",
+ aifMsg.handoverRequest.cellIdentifierTarget.cellIdDescriminator);
+ DBG_TRACEho(" - cellIdentifierTarget.mcc[0-2]: %x%x%x\n",
+ aifMsg.handoverRequest.cellIdentifierTarget.mcc[0],
+ aifMsg.handoverRequest.cellIdentifierTarget.mcc[1],
+ aifMsg.handoverRequest.cellIdentifierTarget.mcc[2]);
+ DBG_TRACEho(" - cellIdentifierTarget.mnc[0-2]: %x%x%x\n",
+ aifMsg.handoverRequest.cellIdentifierTarget.mnc[0],
+ aifMsg.handoverRequest.cellIdentifierTarget.mnc[1],
+ aifMsg.handoverRequest.cellIdentifierTarget.mnc[2]);
+ DBG_TRACEho(" - lac=%d\n",
+ aifMsg.handoverRequest.cellIdentifierTarget.lac);
+ DBG_TRACEho(" - ci=%d\n",
+ aifMsg.handoverRequest.cellIdentifierTarget.ci);
+ DBG_TRACEho(" - cellIdentifierServing\n");
+ DBG_TRACEho(" - cellIdDescriminator=%d\n",
+ aifMsg.handoverRequest.cellIdentifierServing.cellIdDescriminator);
+ DBG_TRACEho(" - cellIdentifierServing.mcc[0-2]: %x%x%x\n",
+ aifMsg.handoverRequest.cellIdentifierServing.mcc[0],
+ aifMsg.handoverRequest.cellIdentifierServing.mcc[1],
+ aifMsg.handoverRequest.cellIdentifierServing.mcc[2]);
+ DBG_TRACEho(" - cellIdentifierServing.mnc[0-2]: %x%x%x\n",
+ aifMsg.handoverRequest.cellIdentifierServing.mnc[0],
+ aifMsg.handoverRequest.cellIdentifierServing.mnc[1],
+ aifMsg.handoverRequest.cellIdentifierServing.mnc[2]);
+ DBG_TRACEho(" - lac=%d\n",
+ aifMsg.handoverRequest.cellIdentifierServing.lac);
+ DBG_TRACEho(" - ci=%d\n",
+ aifMsg.handoverRequest.cellIdentifierServing.ci);
+ DBG_TRACEho(" - currentChannelType1\n");
+ DBG_TRACEho(" - channelMode=%d\n",
+ aifMsg.handoverRequest.currentChannelType1.channelMode);
+ DBG_TRACEho(" - channel=%d\n",
+ aifMsg.handoverRequest.currentChannelType1.channel);
+
+ DBG_TRACEho("\n aifMsg hexdump: ");
+ DBG_HEXDUMPho((unsigned char*) &aifMsg, sizeof (T_AIF_MSG) );
+ DBG_TRACEho("\n }\n");
+ }
+
+ int
+ CCHandover::selectEncryption(void)
+ {
+ DBG_FUNC("CCHandover::selectEncryption", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ int ret_val = -1;
+
+ if (optCurrEncrypt_.ie_present)
+ {
+ switch (optCurrEncrypt_.algorithmId)
+ {
+ case 0x01: // No encryption
+ ret_val = -1;
+ break;
+
+ case 0x02: // A51 algorithm
+ if RM_DSPA51(rm_DspCiphCap)
+ ret_val = CNI_RIL3_CIPHER_ALGORITHM_A51;
+ else
+ ret_val = -1;
+ break;
+
+ case 0x03: // A52 algorithm
+ if RM_DSPA52(rm_DspCiphCap)
+ ret_val = CNI_RIL3_CIPHER_ALGORITHM_A52;
+ else
+ ret_val = -1;
+ break;
+
+ default:
+ ret_val = -1;
+ }
+ }
+ else
+ {
+ ret_val = -1; // No encryption
+ }
+
+ DBG_TRACE("INFO@selectEncryption (ret_val=%d)\n",ret_val);
+ DBG_LEAVE();
+ return (ret_val);
+ }
+
+ int
+ CCHandover::selectChannelType(void)
+ {
+ DBG_FUNC("CCHandover::selectChannelType", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ int ret_val = -1;
+ int i;
+
+ for (i=0;i<8;i++)
+ {
+ if ((aifMsg.handoverRequest.channelType.permittedIndicator[i] & 0x7F) == 0x21)
+ {
+ ret_val = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_2;
+ break;
+ }
+
+ if ((aifMsg.handoverRequest.channelType.permittedIndicator[i] & 0x7F) == 0x01)
+ {
+ ret_val = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1;
+ // Don't break -- want to search through entire list for Version 2 preference
+ }
+
+ if ((aifMsg.handoverRequest.channelType.permittedIndicator[i] & 0x7F) == 0x05)
+ {
+ ret_val = CNI_RIL3_GSM_HALF_RATE_SPEECH_VERSION_1;
+ // Don't break -- want to search through entire list for Version 2 preference
+ }
+ }
+
+ DBG_TRACE("INFO@selectChannelType (ret_val=%d)\n",ret_val);
+ DBG_LEAVE();
+ return (ret_val);
+ }
+
+
diff --git a/data/mnet/GP10/Host/cc/src/CCHndUtil.cpp b/data/mnet/GP10/Host/cc/src/CCHndUtil.cpp
new file mode 100644
index 0000000..60ba22d
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCHndUtil.cpp
@@ -0,0 +1,168 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCHndUtil.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 05-01-99
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "CC/CCHalfCall.h"
+
+#include "CC/CCInt.h"
+
+#include "logging/VCLOGGING.h"
+
+#include "jcc/JCCLog.h"
+
+#include "defs.h"
+#include "oam_api.h"
+
+//GCELL<tyu:06-01-01> BEGIN
+extern GlobalCellId_t MY_GLOBALCELL_ID;
+//GCELL<tyu:06-01-01> END
+
+#include "pm/pm_class.h"
+
+#include "csunew/csu_head.h"
+
+#include "CC/hortp.h"
+
+#include "CC/CCHandover.h"
+
+
+void
+CCHandover::sendVcMsg(JcModuleId_t origModule,
+ JcModuleId_t destModule)
+{
+ DBG_FUNC("CCHandover::sendVcMsg", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ vcOutMsg.origModuleId = origModule;
+ vcOutMsg.origSubId = callIndex;
+//GCELL<tyu:06-01-01> BEGIN
+ vcOutMsg.origVcId.cellId = MY_GLOBALCELL_ID.ci;
+ vcOutMsg.origVcId.networkId = MY_GLOBALCELL_ID.lac;
+//GCELL<tyu:06-01-01> END
+ // lac setting
+ vcOutMsg.origVcAddress = MY_VIPERCELL_IP_ADDRESS;
+
+//GCELL<tyu:06-01-01> BEGIN
+ vcOutMsg.destVcId.cellId = hoGlobalCellId_.ci;
+ vcOutMsg.destVcId.networkId = hoGlobalCellId_.lac;
+//GCELL<tyu:06-01-01> END
+ vcOutMsg.destVcAddress = hoVcIpAddress_;
+ vcOutMsg.destModuleId = destModule;
+ vcOutMsg.destSubId = hoVcCallIndex_;
+
+ // send the message.
+ if (! JcMsgSendToVipercell(&vcOutMsg) )
+ {
+ JCCLog1("CC Call Ho Error : sendVcMsg (dest Vipercell Address = %d) error\n ",
+ vcOutMsg.destVcAddress);
+ DBG_ERROR("CC Call Ho Error : sendVcMsg (dest Vipercell Address = %d) error\n ",
+ vcOutMsg.destVcAddress);
+ }
+ else
+ {
+ // peg here when we are successful
+ switch (vcOutMsg.msgType)
+ {
+ case INTER_VC_CC_PERFORM_HANDOVER:
+ case INTER_VC_CC_PERFORM_HANDBACK:
+ PM_CCMeasurement.attOutgoingInterMSCHDOs.increment();
+ break;
+
+ case INTER_VC_CC_COMPLETE_HANDOVER:
+ case INTER_VC_CC_COMPLETE_HANDBACK:
+ PM_CCMeasurement.succIncomingInterMSCHDOs.increment();
+ break;
+
+ default:
+ break;
+ }
+
+
+ JCCLog2("CC Call Ho Log: Sent Message to (VC# = %d) with (ip address = %d)\n",
+ vcOutMsg.destVcId.cellId,
+ vcOutMsg.destVcAddress);
+
+ DBG_TRACE("CC Call Ho Log: Sent Message to (VC# = %d) with (ip address = %d)\n",
+ vcOutMsg.destVcId.cellId,
+ vcOutMsg.destVcAddress);
+ }
+ DBG_LEAVE();
+}
+
+
+//HO<xxu:01-24-00>used to send message to MSC-B'
+void
+CCHandover::sendVcMsgH3(JcModuleId_t origModule,
+ JcModuleId_t destModule)
+{
+ DBG_FUNC("CCHandover::sendVcMsgH3", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ vcOutMsg.origModuleId = origModule;
+ vcOutMsg.origSubId = callIndex;
+//GCELL<tyu:06-01-01> BEGIN
+ vcOutMsg.origVcId.cellId = MY_GLOBALCELL_ID.ci;
+ vcOutMsg.origVcId.networkId = MY_GLOBALCELL_ID.lac;
+//GCELL<tyu:06-01-01> END
+ vcOutMsg.origVcAddress = MY_VIPERCELL_IP_ADDRESS;
+
+//GCELL<tyu:06-01-01> BEGIN
+ vcOutMsg.destVcId.cellId = h3GlobalCellId_.ci;
+ vcOutMsg.destVcId.networkId = h3GlobalCellId_.lac;
+//GCELL<tyu:06-01-01> END
+ vcOutMsg.destVcAddress = h3VcIpAddress_;
+ vcOutMsg.destModuleId = destModule;
+ vcOutMsg.destSubId = h3VcCallIndex_;
+
+ // send the message.
+ if (! JcMsgSendToVipercell(&vcOutMsg) )
+ {
+ JCCLog1("CC Error(JCC) : sendVcMsgH3 (dest Vipercell Address = %d) error\n ",
+ vcOutMsg.destVcAddress);
+ DBG_ERROR("CC Error(JCC) : sendVcMsgH3 (dest Vipercell Address = %d) error\n ",
+ vcOutMsg.destVcAddress);
+ }
+ else
+ {
+ // peg here when we are successful
+ switch (vcOutMsg.msgType)
+ {
+ case INTER_VC_CC_PERFORM_HANDOVER:
+ case INTER_VC_CC_PERFORM_HANDBACK:
+ PM_CCMeasurement.attOutgoingInterMSCHDOs.increment();
+ break;
+
+ default:
+ break;
+ }
+
+ JCCLog2("CC Call Log (JCC): Sent Message to (VC# = %d) with (ip address = %d)\n",
+ vcOutMsg.destVcId.cellId,
+ vcOutMsg.destVcAddress);
+
+ DBG_TRACE("CC Call Log (JCC): Sent Message to (VC# = %d) with (ip address = %d)\n",
+ vcOutMsg.destVcId.cellId,
+ vcOutMsg.destVcAddress);
+ }
+ DBG_LEAVE();
+}
+
+
diff --git a/data/mnet/GP10/Host/cc/src/CCHoSrcHnd.cpp b/data/mnet/GP10/Host/cc/src/CCHoSrcHnd.cpp
new file mode 100644
index 0000000..2d7a77d
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCHoSrcHnd.cpp
@@ -0,0 +1,2922 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCHoSrcHnd.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 05-01-99
+// Description : Source Vipercell Handover Event handlers
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+
+//
+
+#include "CC/CCHandover.h"
+
+#include "CC/CCSessionHandler.h"
+
+#include "CC/CCUtil.h"
+
+#include "CC/CallConfig.h"
+#include "CC/CCInt.h"
+#include "CC/CCH323Util.h"
+
+#include "jcc/JCCLog.h"
+#include "logging/VCLOGGING.h"
+
+#include "stdio.h"
+
+// Temporarily use csu_head instead of csu_intf
+#include "csunew/csu_head.h"
+
+#include "CC/hortp.h"
+
+#include "lapdm/cni_debug.h"
+
+#include "logging/VCLOGGING.h"
+
+#include "strLib.h"
+
+#include "string.h"
+
+#include "pm/pm_class.h"
+
+#include "voip/vblink.h"
+
+//ext-HO <chenj:05-29-01>
+#include "voip/exchangeho.h"
+#include "CC/A_Handover_Request_Msg.h"
+
+//CDR <xxu:08-22-00> BEGIN
+#include "CDR/CdrVoiceCall.h"
+extern BtsBasicPackage ccBtsBasicPackage;
+extern AdjacentCellPackage ccAdjacentCellPackage;
+
+//CDR <xxu:08-22-00> END
+
+//GCELL<tyu:06-01-01> BEGIN
+extern GlobalCellId_t MY_GLOBALCELL_ID;
+const GlobalCellId_t OTHER_GLOBALCELL_ID_DEF_VAL = {0, {'0','0','0'}, {'0','0','0'}, 1, 1};
+
+GlobalCellId_t ccHoTrgGlobalCellId = OTHER_GLOBALCELL_ID_DEF_VAL;
+//GCELL<tyu:06-01-01> END
+
+
+bool forcedHandover = false;
+
+bool useViperBase = false;
+
+bool forcedHandmsc3 = false;
+
+UINT32 ccHoTrgCellIpAddress = inet_addr(GetViperCellIpAddress());
+
+// *******************************************************************
+// forward declarations.
+// *******************************************************************
+
+ //CIPH<xxu:02-10-00>
+ int ludbGetCipherAlgo(short ludbIndex, IntraL3CipherModeCommand_t *cipherCmd);
+
+ void
+ forcedHandoverOn (void)
+ {
+ forcedHandover = true;
+ }
+
+ void
+ forcedHandoverOff (void)
+ {
+ forcedHandover = false;
+ }
+
+ void
+ forcedHandmsc3On (void)
+ {
+ forcedHandmsc3 = true;
+ }
+
+ void
+ forcedHandmsc3Off (void)
+ {
+ forcedHandmsc3 = false;
+ }
+
+ void
+ useViperBaseOn (void)
+ {
+ useViperBase = true;
+ }
+
+ void
+ useViperBaseOff (void)
+ {
+ useViperBase = false;
+ }
+
+//GCELL<tyu:06-01-01> BEGIN
+ void
+ setTargetCellId(short newVal)
+ {
+ ccHoTrgGlobalCellId.ci = newVal;
+ }
+
+ void
+ setTargetGlobalCellId(char mcc0, char mcc1, char mcc2, char mnc0, char mnc1, char mnc2, short lac, short ci)
+ {
+ ccHoTrgGlobalCellId.ci_disc = 0; // Whole Cell Id
+ ccHoTrgGlobalCellId.mcc[0] = mcc0;
+ ccHoTrgGlobalCellId.mcc[1] = mcc1;
+ ccHoTrgGlobalCellId.mcc[2] = mcc2;
+ ccHoTrgGlobalCellId.mnc[0] = mnc0;
+ ccHoTrgGlobalCellId.mnc[1] = mnc1;
+ ccHoTrgGlobalCellId.mnc[2] = mnc2;
+ ccHoTrgGlobalCellId.lac = lac;
+ ccHoTrgGlobalCellId.ci = ci;
+ }
+//GCELL<tyu:06-01-01> END
+
+ void
+ setTargetIpAddress(char *trgIpAddress)
+ {
+ ccHoTrgCellIpAddress = inet_addr(trgIpAddress);
+ }
+
+ //HO<xxu:02-15-00> add test code for H3
+ JCCEvent_t
+ CCAnchorHandover::handleAnchHoReqd(void)
+ {
+ int i;
+
+ DBG_FUNC("CCAnchorHandover::handleAnchHoReqd", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // get handover vipercell id
+
+ //RETRY<xxu:04-21-00> BEGIN
+ //VBLINK_API_CELL_LOCATION_REQUEST_MSG cellLocationRequest;
+ //RETRY<xxu:04-21-00> END
+
+ IntraL3HandoverRequired_t *inMsg = &rrInMsg->l3_data.handReqd;
+
+ //initData();
+
+//GCELL<tyu:06-01-01> BEGIN
+ hoGlobalCellId_ = ccHoTrgGlobalCellId;
+//GCELL<tyu:06-01-01> END
+
+ hoVcIpAddress_ = ccHoTrgCellIpAddress;
+
+ //RETRY<xxu:04-24-00> BEGIN
+ hoNextCandidate_ = false;
+ //RETRY<xxu:04-24-00> END
+
+ handReqd = *inMsg;
+
+ if (!forcedHandover)
+ {
+ if ( (i=getNextHoCandidate()) == (-1) )
+ {
+ // Ignore the message
+ JCCLog1 ("RR->CC Error: Handover Required, bad (numCandidates = %d)\n",
+ inMsg->numCandidates);
+ DBG_ERROR ("RR->CC Error: Handover Required, bad (numCandidates = %d)\n",
+ inMsg->numCandidates);
+ //initData();
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //GCELL<tyu:06-01-01> BEGIN
+ hoGlobalCellId_ = inMsg->candGlobalCellId[i].candGlobalCellId;
+
+ DBG_TRACE("CC HO Info @anch-HoReqd: #ofCand %d, candVcId(%d,%x%x%x,%x%x%x,%d,%d) ho(type %d, state %d)\n",
+ inMsg->numCandidates, i,
+ hoGlobalCellId_.mcc[0],hoGlobalCellId_.mcc[1],hoGlobalCellId_.mcc[2],
+ hoGlobalCellId_.mnc[0],hoGlobalCellId_.mnc[1],hoGlobalCellId_.mnc[2],
+ hoGlobalCellId_.lac, hoGlobalCellId_.ci,
+ hoType_, hoState_);
+
+
+ // ext-HO <chenj: 05-29-01>
+ if (!inMsg->candGlobalCellId[i].candIsExternal)
+ { // Candidate is internal to MNET
+
+ hoType_ = HO_TY_HANDOVER;
+
+ sprintf(&(cellLocationRequest.ViperCellId[0]), "%d:%d", hoGlobalCellId_.lac,hoGlobalCellId_.ci);
+
+ cellLocationRequest.TxnId = callIndex;
+
+ if (VBLinkLocationRequest(cellLocationRequest)
+ == false)
+ {
+ // Ignore the message
+ DBG_ERROR ("CC->VB Link Error: Failed on Cell Location Request Message\n");
+
+ initData();
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ hoState_ = HAND_ST_ANCH_VC_IP_ADDRESS_REQ;
+
+ } else { // Candidate is external to MNET
+ JCCEvent_t event_result;
+
+ hoType_ = HO_TY_EXT_HANDOVER;
+
+ // Send Perform HO to external PLMN
+ event_result = ExtPerformHO();
+ if ( event_result != CC_MESSAGE_PROCESSING_COMPLT )
+ {
+ DBG_LEAVE();
+ return event_result;
+ }
+ }
+
+ //RETRY<xxu:04-21-00> BEGIN
+ // start the VB timer
+
+ hoRetry_ = 1;
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_THO);
+ //RETRY<xxu:04-21-00> END
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ }
+
+ else
+ {
+ if (useViperBase)
+ {
+ // ext-HO <chenj: 05-29-01>
+ if (!inMsg->candGlobalCellId[i].candIsExternal)
+ { // Candidate is internal to MNET
+ hoType_ = HO_TY_HANDOVER;
+
+ sprintf(&(cellLocationRequest.ViperCellId[0]), "%d:%d", hoGlobalCellId_.lac,hoGlobalCellId_.ci);
+
+ cellLocationRequest.TxnId = callIndex;
+
+ if (VBLinkLocationRequest(cellLocationRequest)
+ == false)
+ {
+ // Ignore the message
+ DBG_ERROR ("CC->VB Link Error: Failed on Cell Location Request Message\n");
+
+ initData();
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ DBG_TRACE("CC->VB Link Info: viperCellId[0] '%s', lac '%d', cellId '%d', callIndex '%d'\n",
+ (&cellLocationRequest.ViperCellId[0]),
+ hoGlobalCellId_.lac,
+ hoGlobalCellId_.ci,
+ cellLocationRequest.TxnId);
+
+ hoState_ = HAND_ST_ANCH_VC_IP_ADDRESS_REQ;
+
+ } else { // Candidate is external to MNET
+ JCCEvent_t event_result;
+
+ hoType_ = HO_TY_EXT_HANDOVER;
+
+ // Send Perform HO to external PLMN
+ event_result = ExtPerformHO();
+ if ( event_result != CC_MESSAGE_PROCESSING_COMPLT )
+ {
+ DBG_LEAVE();
+ return event_result;
+ }
+ }
+
+ //RETRY<xxu:04-21-00> BEGIN
+ hoRetry_ = 1;
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_THO);
+ //RETRY<xxu:04-21-00> END
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ }
+ else
+ {
+ hoType_ = HO_TY_HANDOVER;
+ hoState_ = HAND_ST_ANCH_VC_IP_ADDRESS_REQ;
+ DBG_LEAVE();
+ return (handleVcAddressRsp());
+ }
+ }
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchHoFail(void)
+ {
+ IntraL3HandoverRequired_t *inMsg = &handReqd;
+
+ DBG_FUNC("CCAnchorHandover::handleAnchHoFail", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // cancel T103 timer
+ parent->sessionTimer->cancelTimer();
+
+ // Send Abort Handover to the Target ViperCell.
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_REVERT_TO_OLD;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ if (hoSimplexConnected_)
+ {
+ // break connection
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = hoRtpSession_;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog2("CSU Error : Ho Disconn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Ho Disconn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+
+ hoSimplexConnected_ = false;
+ }
+
+ //RETRY<xxu:04-24-00> BEGIN
+ // retry next candidate
+ int i;
+ if ( (i=getNextHoCandidate()) != (-1) )
+ {
+ //Try next candidate
+ hoNextCandidate_ = true;
+ candIndex_ = i;
+
+ //GCELL<tyu:06-01-01> BEGIN
+ hoGlobalCellId_ = inMsg->candGlobalCellId[i].candGlobalCellId;
+
+ DBG_TRACE("CC HO Info @handleAnchHoFail(ho): #ofCand %d, candVcId(%d,%x%x%x,%x%x%x,%d,%d) ho(type %d, state %d)\n",
+ inMsg->numCandidates, i,
+ hoGlobalCellId_.mcc[0],hoGlobalCellId_.mcc[1],hoGlobalCellId_.mcc[2],
+ hoGlobalCellId_.mnc[0],hoGlobalCellId_.mnc[1],hoGlobalCellId_.mnc[2],
+ hoGlobalCellId_.lac, hoGlobalCellId_.ci,
+ hoType_, hoState_);
+
+ sprintf(&(cellLocationRequest.ViperCellId[0]), "%d:%d", hoGlobalCellId_.lac,hoGlobalCellId_.ci);
+ //GCELL<tyu:06-01-01> END
+
+ cellLocationRequest.TxnId = callIndex;
+
+ if (VBLinkLocationRequest(cellLocationRequest)
+ == false)
+ {
+ // Ignore the message
+ DBG_ERROR ("CC->VB Link Error: Failed on Cell Location Request Message\n");
+
+ initData();
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ // start the VB timer
+ hoRetry_ = 0;
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TVB);
+
+ hoState_ = HAND_ST_ANCH_VC_IP_ADDRESS_REQ;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ } else
+ //RETRY<xxu:04-25-00> END
+
+ {
+ //RETRY<xxu:04-25-00> BEGIN
+ //GCELL<tyu:06-01-01> END
+ DBG_TRACE("CC HO Info@handleAnchHoFail(ho): #ofCand %d, lastCandVcId(%d,%x%x%x,%x%x%x,%d,%d) ho(type %d, state %d)\n",
+ inMsg->numCandidates, candIndex_,
+ hoGlobalCellId_.mcc[0],hoGlobalCellId_.mcc[1],hoGlobalCellId_.mcc[2],
+ hoGlobalCellId_.mnc[0],hoGlobalCellId_.mnc[1],hoGlobalCellId_.mnc[2],
+ hoGlobalCellId_.lac, hoGlobalCellId_.ci,
+ hoType_, hoState_);
+ //GCELL<tyu:06-01-01> END
+ //RETRY<xxu:04-25-00> END
+
+ // Release the Ho RTP channel
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ hoRtpSession_ = NULL;
+
+ initData();
+
+ // empty the queues now that the handover failed
+ emptyRRQueue ();
+ emptyDownlinkQueue();
+ emptyMMQueue ();
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchDuringHoRls(void)
+ {
+ DBG_FUNC("CCAnchorHandover::handleAnchDuringHoRls", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // cancel any timers running
+ parent->sessionTimer->cancelTimer();
+
+ if (hoState_ != HAND_ST_ANCH_VC_IP_ADDRESS_REQ)
+ {
+ // Send Abort Handover to the Target ViperCell.
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_BASE;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ }
+
+ if (hoSimplexConnected_)
+ {
+ // break connection
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = hoRtpSession_;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+
+ JCCLog2("CSU Error : Ho Disconn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Ho Disconn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+
+ hoSimplexConnected_ = false;
+
+ }
+
+ // Release the Ho RTP channel
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ hoRtpSession_ = NULL;
+
+ initData();
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ }
+
+
+ // utility for Mobile and Connection Resource cleanup
+ void
+ CCAnchorHandover::releaseMobAndConnRes(void)
+ {
+ DBG_FUNC("CCAnchorHandover::releaseMobAndConnRes", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ if (parent->entryId != (T_CNI_IRT_ID) JCC_UNDEFINED )
+ {
+ if (hoSimplexConnected_)
+ {
+ // Break the connections with the RF Port
+ T_CSU_PORT_ID rfSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rfSourcePort.portType = CSU_GSM_PORT;
+ rfSourcePort.portId.gsmHandler = parent->entryId;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rfSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog2("CSU Error : Ho Disconn. Failure, (Result = %d) for (entryId = %d)\n",
+ csuResult,
+ parent->entryId);
+ DBG_ERROR("CSU Error : Ho Disconn. Failure, (Result = %d) for (entryId = %d)\n",
+ csuResult,
+ parent->entryId);
+
+ // Can only generate OA&M log.
+ }
+
+ hoSimplexConnected_ = false;
+
+ }
+ }
+
+ releaseMobRes();
+ DBG_LEAVE();
+ }
+
+ // utility for cleanup
+ void
+ CCAnchorHandover::releaseMobRes(void)
+ {
+ DBG_FUNC("CCAnchorHandover::releaseMobRes", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ if (parent->entryId != (T_CNI_IRT_ID) JCC_UNDEFINED )
+ {
+ // Send internal MM msg - release channel
+ sendMM(INTRA_L3_MM_REL_REQ, INTRA_L3_NULL_MSG, parent->entryId, &mmOutMsg);
+
+ // <Igal 1-6-00> Updated to standard IRT reset
+ parent->resetIrt();
+ }
+
+ parent->entryId = (T_CNI_IRT_ID) JCC_UNDEFINED;
+ parent->oid = CNI_LAPDM_NULL_OID;
+ DBG_LEAVE();
+ }
+
+ //HO<xxu:02-17-00> handle both ho and h3 cases
+ JCCEvent_t
+ CCAnchorHandover::handleTrgToAnchCompltHo(void)
+ {
+ DBG_FUNC("CCAnchorHandover::handleTrgToAnchCompltHo", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // cancel T103 timer
+ parent->sessionTimer->cancelTimer();
+
+ TwoPartyCallLeg *whichLeg;
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((whichLeg = parent->activeLeg()) == NULL)
+ {
+ // internal error condition
+ // should not have ended up in signaling only mode.
+ // abort handover and session
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ //CDR <xxu:08-22-00>
+ //GCELL<tyu:06-01-01> END
+ GlobalCellId_t globalCellId, globalCellId_t;
+
+ T_CSU_PORT_ID oldPort, srcPort, snkPort;
+ T_CSU_RESULT_CON csuResult;
+
+ srcPort.portType = CSU_RTP_PORT;
+ srcPort.portId.rtpHandler = VoipCallGetRTPHandle(whichLeg->h323CallHandle);
+
+ switch (hoType_)
+ {
+ case HO_TY_HANDOVER:
+ oldPort.portType = CSU_GSM_PORT;
+ oldPort.portId.gsmHandler = parent->entryId;
+ snkPort.portType = CSU_RTP_PORT;
+ snkPort.portId.rtpHandler = hoRtpSession_;
+ //GCELL<tyu:06-01-01> END
+ globalCellId = hoGlobalCellId_;
+
+ break;
+
+ case HO_TY_HANDMSC3:
+ oldPort.portType = CSU_RTP_PORT;
+ oldPort.portId.rtpHandler = hoRtpSession_;
+ snkPort.portType = CSU_RTP_PORT;
+ snkPort.portId.rtpHandler = h3RtpSession_;
+ //GCELL<tyu:06-01-01> END
+ globalCellId = h3GlobalCellId_;
+
+ break;
+
+ default:
+ // Own messup happened. Need immediate attendance thus don't go further.
+ // Also release any resource engaged.
+
+ JCCLog2("CC Error internal messed up: (hoType = %d) (hoState = %d)\n",
+ hoType_, hoState_);
+ DBG_ERROR("CC Error internal messed up: (hoType = %d) (hoState = %d)\n",
+ hoType_, hoState_);
+
+ releaseMobRes();
+ handleAnchPostH3Rls();
+
+ DBG_LEAVE();
+ return(handleAnchPostHoRls());
+ }
+
+ //CDR <xxu:08-22-00> BEGIN
+ T_CNI_RIL3_IE_LOCATION_AREA_ID lai;
+ T_CNI_RIL3_IE_CELL_ID ci;
+
+ for (int i=0; i<16; i++)
+ {
+ int mccInteger, mncInteger;
+
+ mccInteger = ((unsigned int)(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_mcc));
+ //GCELL<tyu:06-01-01> BEGIN
+ globalCellId_t.mcc[0] = ((char*)&(mccInteger))[0];
+ globalCellId_t.mcc[1] = ((char*)&(mccInteger))[1];
+ globalCellId_t.mcc[2] = ((char*)&(mccInteger))[2];
+
+ mncInteger = ((unsigned int)(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_mnc));
+ globalCellId_t.mnc[0] = ((char*)&(mncInteger))[0];
+ globalCellId_t.mnc[1] = ((char*)&(mncInteger))[1];
+ globalCellId_t.mnc[2] = ((char*)&(mncInteger))[2];
+
+ globalCellId_t.lac = ((unsigned short)(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_lac));;
+ globalCellId_t.ci = ((unsigned short)(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_ci));;
+
+ if (isEqualGlobalCellId(&globalCellId, &globalCellId_t))
+ break;
+ //GCELL<tyu:06-01-01> END
+ }
+
+ if (i>=16)
+ //GCELL<tyu:06-01-01>
+ DBG_WARNING("CC WARNING (ho-cdr): (hoType = %d) (hoState = %d), vc(%d,%d)\n",
+ hoType_, hoState_, globalCellId.lac, globalCellId.ci);
+ else
+ {
+ lai.ie_present = true;
+ lai.mcc[0] = ((unsigned char*)&(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_mcc))[0];
+ lai.mcc[1] = ((unsigned char*)&(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_mcc))[1];
+ lai.mcc[2] = ((unsigned char*)&(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_mcc))[2];
+ lai.mnc[0] = ((unsigned char*)&(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_mnc))[0];
+ lai.mnc[1] = ((unsigned char*)&(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_mnc))[1];
+ lai.lac = ((short)((((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_lac)));
+
+ ci.ie_present = true;
+ ci.value = ((short)((((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_ci)));
+
+ if ( (parent->callLeg1->msSide != NULL) &&
+ (parent->callLeg1->msSide->callState_ == HC_ST_ACTIVE) )
+ parent->callLeg1->ccCdr.handover(&lai, &ci);
+ if ( (parent->callLeg2->msSide != NULL) &&
+ (parent->callLeg2->msSide->callState_ == HC_ST_ACTIVE) )
+ parent->callLeg2->ccCdr.handover(&lai, &ci);
+ }
+
+ //CDR <xxu:08-22-00> END
+
+ DBG_TRACE("CC->@anch:handleTrgToAnchCompltHo: voConn %d, ho(%d,%d) src(%d,%x) old(%d,%x) snk(%d,%x)\n",
+ whichLeg->voiceConnected,
+ hoType_, hoState_,
+ srcPort.portType, srcPort.portId.rtpHandler,
+ oldPort.portType, oldPort.portId.rtpHandler,
+ snkPort.portType, snkPort.portId.rtpHandler );
+
+ if (whichLeg->voiceConnected)
+ {
+ // Break old connections
+
+ if ( (csuResult = csu_OrigTermBreakAll(&oldPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog3("CSU Error : Break old conn failure, (Result = %d) for oldPort(%d, %x)\n",
+ csuResult,
+ oldPort.portType,
+ (int) oldPort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Break old conn failure, (Result = %d) for oldPort(%d, %x)\n",
+ csuResult,
+ oldPort.portType,
+ oldPort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+
+ // Allow going along since ho is complete already
+
+ whichLeg->voiceConnected = false;
+
+ // Make duplex ho or h3 connection between src and snk rtp ports
+
+ if ((csuResult = csu_DuplexConnect(&snkPort, &srcPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog3("CSU Error : Make conn failure, (Result = %d) for (snk %p, src %p)\n",
+ csuResult,
+ (int)snkPort.portId.rtpHandler, (int)srcPort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Make conn failure, (Result = %d) for (snk %p, src %p)\n",
+ csuResult,
+ snkPort.portId.rtpHandler, srcPort.portId.rtpHandler);
+
+ // Treat this as internal messup, thus don't go further either !
+ //
+
+ if (hoType_ == HO_TY_HANDOVER)
+ {
+ // ho: Cleanup!
+ releaseMobRes();
+
+ DBG_LEAVE();
+ return(handleAnchPostHoRls());
+
+ } else
+ {
+ // h3: Cleanup!
+ handleAnchPostH3Rls();
+
+ DBG_LEAVE();
+ return(handleAnchPostHoRls());
+ }
+ }
+
+ //
+ whichLeg->voiceConnected = true;
+
+ } else
+ {
+ // break the simplex connection setup earlier.
+
+ if ((csuResult = csu_OrigTermBreakAll(&srcPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+
+ JCCLog2("CSU Error : Break src conn failure, (Result = %d) for vpPortHndl %p)\n",
+ csuResult,
+ (int)srcPort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Break src conn failure, (Result = %d) for vpPortHndl %p)\n",
+ csuResult,
+ srcPort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+ }
+
+ //GCELL<tyu:06-01-01> BEGIN
+ DBG_TRACE("CC->@anch:handleTrgToAnchCompltHo bf. B'->B: hoType %d, ho(rtp %p, vcIp %x vcId %d, callId %d, rePort %d)\n",
+ hoType_,
+ hoRtpSession_,
+ hoVcIpAddress_,
+ hoGlobalCellId_.ci,
+ hoVcCallIndex_,
+ otherHoIncomingRtpPort_);
+
+ DBG_TRACE("CC->@anch:handleTrgToAnchCompltHo bf. B'->B: hoType %d, h3(rtp %p, vcIp %x vcId %d, callId %d, rePort %d)\n",
+ hoType_,
+ h3RtpSession_,
+ h3VcIpAddress_,
+ h3GlobalCellId_.ci,
+ h3VcCallIndex_,
+ otherH3IncomingRtpPort_);
+ //GCELL<tyu:06-01-01> END
+
+ // h3: update MSC-B' as MSC-B
+
+ if (hoType_ == HO_TY_HANDMSC3)
+ {
+ // Send the Complete Handback message to vcB
+
+ vcOutMsg.msgType = INTER_VC_CC_COMPLETE_HANDBACK;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ // Release old tgt rtpHndle
+
+ if ( hoRtpSession_ != NULL )
+ {
+ if ( (csuResult = csu_OrigTermBreakAll(&oldPort))
+ != CSU_RESULT_CON_SUCCESS )
+ {
+ // This failure may not be a real failure, thus only treating it as INFO type
+
+ JCCLog2("CSU INFO : Break old conn failure, (Result = %d) for oldRtpHndl %p)\n",
+ csuResult,
+ (int)oldPort.portId.rtpHandler);
+ DBG_TRACE("CSU INFO : Break old conn failure, (Result = %d) for oldRtptHndl %p)\n",
+ csuResult,
+ oldPort.portId.rtpHandler);
+ }
+
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ }
+
+ // Update vcB'->vcB
+
+ hoRtpSession_ = h3RtpSession_;
+ h3RtpSession_ = NULL;
+ hoVcIpAddress_ = h3VcIpAddress_;
+ h3VcIpAddress_ = 0;
+ hoVcCallIndex_ = h3VcCallIndex_;
+ h3VcCallIndex_ = CC_MAX_CC_CALLS_DEF_VAL;
+ otherHoIncomingRtpPort_ = otherH3IncomingRtpPort_;
+ otherH3IncomingRtpPort_ = 0;
+ //GCELL<tyu:06-01-01> BEGIN
+ hoGlobalCellId_ = h3GlobalCellId_;
+ memset(&h3GlobalCellId_, 0, sizeof(GlobalCellId_t));
+ //GCELL<tyu:06-01-01> END
+ hoSimplexConnected_ = false;
+ h3SimplexConnected_ = false;
+ hoSrcLinkLost_ = false;
+ h3SrcLinkLost_ = false;
+
+ } else
+ {
+ // Release rf
+ releaseMobRes();
+
+ hoSimplexConnected_ = false;
+ hoSrcLinkLost_ = false;
+ }
+
+ //GCELL<tyu:06-01-01> BEGIN
+ DBG_TRACE("CC->@anch:handleTrgToAnchCompltHo af. B'->B: hoType %d, ho(rtp %p, vcIp %x vcId %d, callId %d, rePort %d)\n",
+ hoType_,
+ hoRtpSession_,
+ hoVcIpAddress_,
+ hoGlobalCellId_.ci,
+ hoVcCallIndex_,
+ otherHoIncomingRtpPort_);
+
+
+ DBG_TRACE("CC->@anch:handleTrgToAnchCompltHo af. B'->B: hoType_ %d, h3(rtp %p, vcIp %x vcId %d, callId %d, rePort %d)\n",
+ hoType_,
+ h3RtpSession_,
+ h3VcIpAddress_,
+ h3GlobalCellId_.ci,
+ h3VcCallIndex_,
+ otherH3IncomingRtpPort_);
+ //GCELL<tyu:06-01-01> END
+
+ hoType_ = HO_TY_HANDOVER;
+ hoState_ = HAND_ST_ANCH_HO_COMPLT;
+
+ //BCT <xxu:09-22-00> Begin
+ if ( whichLeg->msSide != NULL )
+ {
+ if (whichLeg->msSide->annState_ == ANN_PLAY_WAITING)
+ {
+ //Play inband ringback to transferred party for BCT
+ T_CSU_RESULT_CON csuResult;
+ whichLeg->msSide->annSrcPort_.portType = CSU_ANN_PORT;
+ whichLeg->msSide->annSrcPort_.portId.annHandler = 0;
+ whichLeg->msSide->annSnkPort_.portType = CSU_RTP_PORT;
+ whichLeg->msSide->annSnkPort_.portId.rtpHandler = hoRtpSession_;
+ whichLeg->msSide->annSnkPort_.speechVersion = whichLeg->msSide->currSpeechCh_.version;
+
+ DBG_TRACE("CC->CSU(bct): start inband alert annState(%d) ann(%d,%x) --> snk(%d,%x,%d)\n",
+ whichLeg->msSide->annState_,
+ whichLeg->msSide->annSrcPort_.portType,
+ whichLeg->msSide->annSrcPort_.portId.annHandler,
+ whichLeg->msSide->annSnkPort_.portType,
+ whichLeg->msSide->annSnkPort_.portId.rtpHandler,
+ whichLeg->msSide->annSnkPort_.speechVersion);
+
+ if ( (csuResult = csu_SimplexConnect( &whichLeg->msSide->annSrcPort_,
+ &whichLeg->msSide->annSnkPort_) )
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_WARNING("CC->BCT(csuSConnFailedAfterHo):xlst(%d) ann(%d,%x) snk(%d,%x,%d)\n",
+ csuResult,
+ whichLeg->msSide->annSrcPort_.portType,
+ (int)whichLeg->msSide->annSrcPort_.portId.rtpHandler,
+ whichLeg->msSide->annSnkPort_.portType,
+ (int)whichLeg->msSide->annSnkPort_.portId.rtpHandler,
+ (int)whichLeg->msSide->annSnkPort_.speechVersion);
+
+ //ignore this remote alerting
+ }
+ whichLeg->msSide->annState_ = ANN_PLAY_ON;
+ }
+
+ }
+ //BCT <xxu:09-21-00> END
+
+ // empty the queues now that the handover is successful
+ // Do this only at the end.
+
+ emptyRRQueue ();
+ emptyDownlinkQueue();
+ emptyMMQueue ();
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchT104TimerExpiry(void)
+ {
+ DBG_FUNC("CCAnchorHandover::handleAnchT104TimerExpiry", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // Send Handback Nack to the Target ViperCell.
+ // Ack was already sent! Is that Ok?
+
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = JC_FAILURE_T104_TIMEOUT;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ releaseMobAndConnRes();
+
+ initHandbackData();
+
+ // empty the queues now that the handover failed
+ emptyRRQueue ();
+ emptyDownlinkQueue();
+ emptyMMQueue ();
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchHoReqAck(void)
+ {
+ DBG_FUNC("CCAnchorHandover::handleAnchHoReqAck", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ TwoPartyCallLeg *whichLeg;
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((whichLeg = parent->activeLeg()) == NULL)
+ {
+ // signaling activity (CISS, SMS Point to Point, etc)
+ // abort handover
+ DBG_LEAVE();
+ return (handleAnchHoReqNack());
+ }
+
+ T_CNI_L3_ID newId;
+ newId.msgq_id = msgQId;
+ newId.sub_id = 0; // No sub id needed here
+
+
+ // <Igal 1-6-00> Updated to standard IRT setup
+ if (parent->setIrt (mmInMsg->entry_id, newId) == false)
+ {
+ // Treat it like a Ho. Req. Nack.
+ releaseMobAndConnRes();
+ DBG_LEAVE();
+ return (handleAnchHoReqNack());
+ }
+
+ // Setup the entry id, oid, and sapi
+ parent->entryId = mmInMsg->entry_id;
+
+ // GET OID AND SAPI
+ T_CNI_RIL3_IRT_ENTRY irtEntry;
+ irtEntry.entry_id = mmInMsg->entry_id;
+
+ if ( (CNI_RIL3_IRT_Get_Entry_by_Entry_ID(&irtEntry))
+ == false )
+ {
+ JCCLog1("CC Call Error : IRT Table problem for (entry id = %d)\n ", mmInMsg->entry_id);
+ DBG_ERROR("CC Call Error : IRT Table problem for (entry id = %d)\n ", mmInMsg->entry_id);
+
+ releaseMobAndConnRes();
+ DBG_LEAVE();
+ return (handleAnchHoReqNack());
+ }
+
+ parent->oid = irtEntry.lapdm_oid;
+
+ // Make a simplex connection between the remote rtp channel and the rf channel
+ T_CSU_PORT_ID rfSinkPort, rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rfSinkPort.portType = CSU_GSM_PORT;
+ rtpSourcePort.portType = CSU_RTP_PORT;
+
+ rfSinkPort.portId.gsmHandler = parent->entryId;
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(whichLeg->h323CallHandle);
+
+ if ((csuResult = csu_SimplexConnect(&rtpSourcePort, &rfSinkPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog3("CSU Error : Ho Simplex Conn. Failure, (Result = %d) for (rtp port = %x) and (entryId = %d)\n",
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler,
+ parent->entryId);
+ DBG_ERROR("CSU Error : Ho Simplex Conn. Failure, (Result = %d) for (rtp port = %x) and (entryId = %d)\n",
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler,
+ parent->entryId);
+
+ releaseMobAndConnRes();
+ DBG_LEAVE();
+ return (handleAnchHoReqNack());
+ }
+
+ hoSimplexConnected_ = true;
+
+ // Send the Perform Ack message.
+
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_ACK;
+ vcOutMsg.msgData.perfHandbackAck.handCmd = mmInMsg->l3_data.handReqAck.handCmd;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ // start the T104 timer
+ parent->sessionTimer->setTimer(CALL_HAND_TRG_T104);
+
+ hoState_ = HAND_ST_ANCH_SND_HB_REQ_ACK;
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchHoReqNack(void)
+ {
+ DBG_FUNC("CCAnchorHandover::handleAnchHoReqNack", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // Send the Perform Nack message.
+
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = rrInMsg->l3_data.handReqNack.cause;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ initHandbackData();
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchHoComplt(void)
+ {
+ DBG_FUNC("CCAnchorHandover::handleAnchHoComplt", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // cancel T104 timer
+ parent->sessionTimer->cancelTimer();
+
+ TwoPartyCallLeg *whichLeg;
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((whichLeg = parent->activeLeg()) == NULL)
+ {
+ // internal error condition
+ // should not have ended up in signaling only mode.
+ // abort handover and session
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ //CDR <xxu:08-22-00> BEGIN
+ T_CNI_RIL3_IE_LOCATION_AREA_ID lai;
+ T_CNI_RIL3_IE_CELL_ID ci;
+
+ ci.ie_present = true;
+ ci.value = ((short)(ccBtsBasicPackage.bts_ci));
+
+ lai.ie_present = true;
+ lai.mcc[0] = ((unsigned char*)&(ccBtsBasicPackage.bts_mcc))[0];
+ lai.mcc[1] = ((unsigned char*)&(ccBtsBasicPackage.bts_mcc))[1];
+ lai.mcc[2] = ((unsigned char*)&(ccBtsBasicPackage.bts_mcc))[2];
+ lai.mnc[0] = ((unsigned char*)&(ccBtsBasicPackage.bts_mnc))[0];
+ lai.mnc[1] = ((unsigned char*)&(ccBtsBasicPackage.bts_mnc))[1];
+ lai.lac = ((short)(ccBtsBasicPackage.bts_lac));
+
+ if ( (parent->callLeg1->msSide != NULL) &&
+ (parent->callLeg1->msSide->callState_ == HC_ST_ACTIVE) )
+ parent->callLeg1->ccCdr.handover(&lai, &ci);
+ if ( (parent->callLeg2->msSide != NULL) &&
+ (parent->callLeg2->msSide->callState_ == HC_ST_ACTIVE) )
+ parent->callLeg2->ccCdr.handover(&lai, &ci);
+ //CDR <xxu:08-22-00> END
+
+ // Send the Complete Handback message.
+ vcOutMsg.msgType = INTER_VC_CC_COMPLETE_HANDBACK;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ if (whichLeg->voiceConnected)
+ {
+ // Call is not held at this point for some reason.
+
+ // First take down the earlier connection
+
+ // Break the connections with the RTP Port
+ T_CSU_PORT_ID hoRtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ hoRtpSourcePort.portType = CSU_RTP_PORT;
+ hoRtpSourcePort.portId.rtpHandler = hoRtpSession_;
+
+ if ((csuResult = csu_OrigTermBreakAll(&hoRtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+
+ JCCLog2("CSU Error : Ho Disconn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)hoRtpSourcePort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Ho Disconn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)hoRtpSourcePort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+
+ // Don't continue
+
+ hoSimplexConnected_ = false;
+
+ // Release the Ho RTP channel
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ hoRtpSession_ = NULL;
+
+ initData();
+
+ DBG_LEAVE();
+ return(CC_TWO_STAGE_DISCONNECT);
+ }
+
+ // voice is broken
+ whichLeg->voiceConnected = false;
+
+ // Complete the connection
+ // Make a simplex connection between the remote rtp channel and the rf channel
+ T_CSU_PORT_ID rfSinkPort, rtpSourcePort;
+
+ rfSinkPort.portType = CSU_GSM_PORT;
+ rtpSourcePort.portType = CSU_RTP_PORT;
+
+ rfSinkPort.portId.gsmHandler = parent->entryId;
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(whichLeg->h323CallHandle);
+
+ if ((csuResult = csu_DuplexConnect(&rfSinkPort, &rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+
+ JCCLog3("CSU Error : Ho Duplex Conn. Failure, (Result = %d) for (rtp port = %x) and (entryId = %d)\n",
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler,
+ parent->entryId);
+ DBG_ERROR("CSU Error : Ho Duplex Conn. Failure, (Result = %d) for (rtp port = %x) and (entryId = %d)\n",
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler,
+ parent->entryId);
+
+ // Skip event loop.
+ // No recovery is possible
+ DBG_LEAVE();
+ return(CC_TWO_STAGE_DISCONNECT);
+
+ }
+ whichLeg->voiceConnected = true;
+
+ }
+
+ else
+ {
+ // break the simplex connection that was setup earlier.
+ // Break the connections with the RF Port
+ T_CSU_PORT_ID rfSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rfSourcePort.portType = CSU_GSM_PORT;
+ rfSourcePort.portId.gsmHandler = parent->entryId;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rfSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog2("CSU Error : Ho Disconn. Failure, (Result = %d) for (entryId = %d)\n",
+ csuResult,
+ parent->entryId);
+ DBG_ERROR("CSU Error : Ho Disconn. Failure, (Result = %d) for (entryId = %d)\n",
+ csuResult,
+ parent->entryId);
+
+ // Can only generate OA&M log.
+ }
+
+ }
+
+ hoSimplexConnected_ = false;
+
+ // Release the Ho RTP channel
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ hoRtpSession_ = NULL;
+
+ initData();
+
+ //BCT <xxu:09-22-00> Begin
+ if ( (whichLeg->msSide != NULL) &&
+ (whichLeg->msSide->annState_ == ANN_PLAY_WAITING) )
+ {
+ //Play inband ringback to transferred party for BCT
+ T_CSU_RESULT_CON csuResult;
+ whichLeg->msSide->annSrcPort_.portType = CSU_ANN_PORT;
+ whichLeg->msSide->annSrcPort_.portId.annHandler = 0;
+ whichLeg->msSide->annSnkPort_.portType = CSU_GSM_PORT;
+ whichLeg->msSide->annSnkPort_.portId.gsmHandler = parent->entryId;
+ whichLeg->msSide->annSnkPort_.speechVersion = whichLeg->msSide->currSpeechCh_.version;
+
+ DBG_TRACE("CC->CSU(bct): start inband alert annState(%d) ann(%d,%x) --> snk(%d,%x,%d)\n",
+ whichLeg->msSide->annState_,
+ whichLeg->msSide->annSrcPort_.portType,
+ whichLeg->msSide->annSrcPort_.portId.annHandler,
+ whichLeg->msSide->annSnkPort_.portType,
+ whichLeg->msSide->annSnkPort_.portId.rtpHandler,
+ whichLeg->msSide->annSnkPort_.speechVersion);
+
+ if ( (csuResult = csu_SimplexConnect(&whichLeg->msSide->annSrcPort_,
+ &whichLeg->msSide->annSnkPort_))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_WARNING("CC->BCT(csuSConnFailedAfterHb):xlst(%d) ann(%d,%x) snk(%d,%x,%d)\n",
+ csuResult,
+ whichLeg->msSide->annSrcPort_.portType,
+ (int)whichLeg->msSide->annSrcPort_.portId.rtpHandler,
+ whichLeg->msSide->annSnkPort_.portType,
+ (int)whichLeg->msSide->annSnkPort_.portId.rtpHandler,
+ (int)whichLeg->msSide->annSnkPort_.speechVersion);
+
+ //ignore this remote alerting
+ }
+ whichLeg->msSide->annState_ = ANN_PLAY_ON;
+
+ }
+ //BCT <xxu:09-22-00> END
+
+
+ // empty the queues now that the handover is successful
+ // Do this only at the end.
+ emptyRRQueue ();
+ emptyDownlinkQueue();
+ emptyMMQueue ();
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //HO<xxu:01-24-00> Handle both H3 and HO
+ JCCEvent_t
+ CCAnchorHandover::handleVcAddressRsp(void)
+ {
+ DBG_FUNC("CCAnchorHandover::handleVcAddressRsp", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ TwoPartyCallLeg *whichLeg;
+
+ parent->sessionTimer->cancelTimer();
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((whichLeg = parent->activeLeg()) == NULL)
+ {
+ // Either ho or h3: only h3 needs to abort mscB here
+ // signaling activity (CISS, SMS Point to Point, etc)
+ // cleanup mscA and abort handover junk @ target cell
+
+ switch (hoState_)
+ {
+ case HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ:
+ //H3
+ DBG_TRACE("vcA<-VB: got vcB' IP Addr Rsp but no active leg thus aborting mscB\n");
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_CALL_ALREADY_DROPPED;
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ //Cleanup h3
+ initHandmsc3Data();
+
+ //clear ho
+ initData();
+
+ break;
+
+ case HAND_ST_ANCH_VC_IP_ADDRESS_REQ:
+ //HO
+ DBG_TRACE("vcA<-VB: got vcB IP Addr Rsp but no active leg HO case\n");
+
+ //clear ho
+ initData();
+
+ break;
+
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ DBG_TRACE("vcA<-VB: got vcB IP Addr Rsp but no active leg HO case. (hoType:%d, hoState:%d)\n",
+ hoType_, hoState_);
+
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendEndHandover();
+ initData();
+
+ break;
+
+ default:
+ JCCLog2 ("CC Error: messeup hoType %d, hoState %d\n", hoType_, hoState_);
+ DBG_ERROR ("CC Error: messeup hoType %d, hoState %d\n", hoType_, hoState_);
+
+ //Internal messup bu cleanup is still better while trouble shooting it!
+ initHandmsc3Data();
+
+ //clear ho
+ initData();
+
+ break;
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ // Got active leg, assign a new Ho RTP channel
+ HJCRTPSESSION reRtpSession;
+
+ //RETRY<xxu:04-24-00> BEGIN
+ if (hoNextCandidate_)
+ {
+ if (hoType_ == HO_TY_HANDOVER)
+ reRtpSession = hoRtpSession_;
+ else if ( (hoType_ == HO_TY_HANDMSC3) ||
+ (hoType_ == HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR) )
+ reRtpSession = h3RtpSession_;
+ else
+ {
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //PR1521 <xxu:09-12-00>
+ // Release the Ho RTP channel
+ if (reRtpSession != NULL)
+ ReleaseHandoverRtpChannel(reRtpSession);
+ else
+ DBG_WARNING("CC Ho(retry): ho(%d,%d), last rtpHandle is NULL (%p)\n",
+ hoType_, hoState_, reRtpSession);
+ }
+
+ //RETRY<xxu:04-24-00> END
+ {
+ if ((reRtpSession = AssignHandoverRtpChannel())
+ == NULL)
+ {
+ // Do not proceed with ho or h3
+ JCCLog2 ("CC Error: rtp channel assignment failed (hoType %d, hoState %d)\n",
+ hoType_, hoState_);
+ DBG_ERROR ("CC Error: rtp channel assignment failed (hoType %d, hoState %d)\n",
+ hoType_, hoState_);
+
+ switch (hoState_)
+ {
+ case HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ:
+ // Give up the h3 effort but maintain the current ho
+ initHandmsc3Data();
+ break;
+
+ case HAND_ST_ANCH_VC_IP_ADDRESS_REQ:
+ // Change the state back to no handover
+ initData();
+ break;
+
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendHandbackNack();
+ initExtHandmsc3Data();
+ break;
+
+ default:
+ //Deadly error! Troubleshooting needed!
+ JCCLog2 ("CC Error: messed up hoState '%d'. (hoType %d)\n",
+ hoState_, hoType_);
+ DBG_ERROR ("CC Error: messed up hoState '%d'. (hoType %d)\n",
+ hoState_, hoType_);
+ break;
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+ }
+
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDOVER;
+ vcOutMsg.msgData.perfHandoverReq.sourceInRtpPort
+ = GetIncomingHandoverRtpPort(reRtpSession);
+ vcOutMsg.msgData.perfHandoverReq.channelType.bearerType
+ = BEARER_SPEECH;
+ vcOutMsg.msgData.perfHandoverReq.channelType.speechChann
+ = parent->currSpeechCh();
+ vcOutMsg.msgData.perfHandoverReq.globalCellId
+ = MY_GLOBALCELL_ID;
+
+ //CIPH<xxu:02-10-00>Begin
+
+ IntraL3CipherModeCommand_t cipherCmd;
+ if (ludbGetCipherAlgo(parent->ludbIndex, &cipherCmd))
+ {
+ //handling error return
+ JCCLog1 ("CC->Handover Error: ludbGetCipherAlgo() failed, (ludbIndex = %d)\n",
+ parent->ludbIndex);
+ DBG_ERROR ("CC->Handover Error: ludbGetCipherAlgo() failed, (ludbIndex = %d)\n",
+ parent->ludbIndex);
+ cipherCmd.cmd.cipherModeSetting.ciphering = CNI_RIl3_CIPHER_NO_CIPHERING;
+ }
+
+ DBG_TRACE("CC->@anch:PerfHo(a2t): ludbIndex = %d, bearer %d, spchVer %d, ciphSet %d, algo %d, kc(%x,%x)\n",
+ parent->ludbIndex,
+ vcOutMsg.msgData.perfHandoverReq.channelType.bearerType,
+ vcOutMsg.msgData.perfHandoverReq.channelType.speechChann.version,
+ cipherCmd.cmd.cipherModeSetting.ciphering,
+ cipherCmd.cmd.cipherModeSetting.algorithm,
+ cipherCmd.Kc[0],cipherCmd.Kc[1],
+ cipherCmd.Kc[0],cipherCmd.Kc[2]);
+
+ memcpy( (unsigned char*) &(vcOutMsg.msgData.perfHandoverReq.cipherCmd),
+ (unsigned char*) &(cipherCmd),
+ sizeof (IntraL3CipherModeCommand_t) );
+
+ //CIPH<xxu:02-10-00>End
+
+
+ // Send Perform Handover to the Target ViperCell.
+ switch (hoState_)
+ {
+ case HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ:
+ // H3 case
+
+ DBG_TRACE("CC->@anch:handleVcAddressRsp: loRtpHndl %p, loPort %d, h3VcIpAddress %d\n",
+ reRtpSession, vcOutMsg.msgData.perfHandoverReq.sourceInRtpPort, h3VcIpAddress_);
+
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ h3RtpSession_ = reRtpSession;
+ hoState_ = HAND_ST_ANCH_SND_H3_REQ;
+ break;
+
+ case HAND_ST_ANCH_VC_IP_ADDRESS_REQ:
+ // HO case
+
+ DBG_TRACE("CC->@anch:handleVcAddressRsp: loRtpHndl %p, loPort %d, hoVcIpAddress %d\n",
+ reRtpSession, vcOutMsg.msgData.perfHandoverReq.sourceInRtpPort, hoVcIpAddress_);
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ hoRtpSession_ = reRtpSession;
+ hoState_ = HAND_ST_ANCH_SND_HO_REQ;
+ break;
+
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ DBG_TRACE("CC->@anch:handleVcAddressRsp: loRtpHndl %p, loPort %d, hoVcIpAddress %d\n",
+ reRtpSession, vcOutMsg.msgData.perfHandoverReq.sourceInRtpPort, hoVcIpAddress_);
+
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ h3RtpSession_ = reRtpSession;
+ hoState_ = HAND_ST_ANCH_EHO_SND_H3_REQ;
+ break;
+ }
+
+ // start the Tho timer
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_THO);
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+
+ //HO<xxu:01-31-00> extend to handle both HO & H3
+ JCCEvent_t
+ CCAnchorHandover::handleTrgToAnchPerfHoNack(void)
+ {
+ int i;
+ IntraL3HandoverRequired_t *inMsg = &handReqd;
+
+ DBG_FUNC("CCAnchorHandover::handleTrgToAnchPerfHoNack", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // cancel Tho timer
+ parent->sessionTimer->cancelTimer();
+
+ // Only retry next candidate if available in this case
+ switch(hoType_)
+ {
+ case HO_TY_HANDOVER:
+ //RETRY<xxu:04-24-00> BEGIN retry next candidate
+ if ( (i=getNextHoCandidate()) != (-1) )
+ {
+ //Try next candidate
+ hoNextCandidate_ = true;
+ candIndex_ = i;
+
+ //GCELL<tyu:06-01-01> BEGIN
+ hoGlobalCellId_ = inMsg->candGlobalCellId[i].candGlobalCellId;
+
+ DBG_TRACE("CC HO Info @handleTrgToAnchPerfHoNack(ho): #ofCand %d, candVcId(%d,%x%x%x,%x%x%x,%d,%d) ho(type %d, state %d)\n",
+ inMsg->numCandidates, i,
+ hoGlobalCellId_.mcc[0],hoGlobalCellId_.mcc[1],hoGlobalCellId_.mcc[2],
+ hoGlobalCellId_.mnc[0],hoGlobalCellId_.mnc[1],hoGlobalCellId_.mnc[2],
+ hoGlobalCellId_.lac, hoGlobalCellId_.ci,
+ hoType_, hoState_);
+
+ sprintf(&(cellLocationRequest.ViperCellId[0]), "%d:%d", hoGlobalCellId_.lac,hoGlobalCellId_.ci);
+ //GCELL<tyu:06-01-01> END
+
+ cellLocationRequest.TxnId = callIndex;
+
+ if (VBLinkLocationRequest(cellLocationRequest)
+ == false)
+ {
+ // Ignore the message
+ DBG_ERROR ("CC->VB Link Error: Failed on Cell Location Request Message\n");
+
+ initData();
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ // start the VB timer
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TVB);
+
+ hoState_ = HAND_ST_ANCH_VC_IP_ADDRESS_REQ;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ } else
+ //RETRY<xxu:04-24-00> END
+
+ {
+ // ho failed
+ if (hoSrcLinkLost_)
+ {
+ // peg
+ PM_CCMeasurement.unsuccExternHDOsWithLossOfConnectionPerMSC.increment();
+
+ initData();
+ DBG_LEAVE();
+ return(CC_RELEASE_CALL);
+ } else
+ {
+ initData();
+ }
+ }
+ break;
+
+ case HO_TY_HANDMSC3:
+ //Abort action @ MSC-B'
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_ANCH_V3_FAILED;
+
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ // Abort HB part at MSC-B
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = JC_FAILURE_ANCH_V3_FAILED;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ initHandmsc3Data();
+
+ break;
+
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ //Abort action @ MSC-B'
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_ANCH_V3_FAILED;
+
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ // Abort HB part at MSC-B
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = JC_FAILURE_ANCH_V3_FAILED;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ initHandmsc3Data();
+
+ break;
+
+ default:
+ //Deadly problem, need shoubleshooting first before running ahead !
+ JCCLog2 ("CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_ERROR ("CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ // empty the queues now that the handover failed
+ emptyRRQueue ();
+ emptyDownlinkQueue();
+ emptyMMQueue ();
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //HO<xxu:01-28-00> handle both h3 and ho casse!
+ JCCEvent_t
+ CCAnchorHandover::handleTrgToAnchPerfHoAck(void)
+ {
+ DBG_FUNC("CCAnchorHandover::handleTrgToAnchPerfHoAck", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // cancel Tho timer
+ parent->sessionTimer->cancelTimer();
+
+ TwoPartyCallLeg *whichLeg;
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((whichLeg = parent->activeLeg()) == NULL)
+ {
+ // signaling activity (CISS, SMS Point to Point, etc)
+ // abort handover
+ JCCLog2 ("CC Trace: no active leg (hoType %d, hoState %d)\n", hoType_, hoState_);
+ DBG_TRACE ("CC Trace: no active leg (hoType %d, hoState %d)\n", hoType_, hoState_);
+ DBG_LEAVE();
+ return (handleAnchAbortWiCos(JC_FAILURE_CALL_ALREADY_DROPPED));
+ }
+
+ T_CSU_PORT_ID rtpSinkPort;
+ bool need_simplex_connection;
+
+ switch(hoType_)
+ {
+ case HO_TY_HANDMSC3:
+ DBG_TRACE("CC->@anch(h3):handleTrgToAnchPerfHoAck: loRtpHndl %p, reVcIpAddr %x, rePort %d\n",
+ h3RtpSession_,
+ h3VcIpAddress_,
+ vcInMsg->msgData.perfHandoverAck.targetInRtpPort);
+
+ h3VcCallIndex_ = vcInMsg->origSubId;
+
+ if (h3RtpSession_ == NULL)
+ {
+ DBG_WARNING("CC->@anch(h3):handleTrgToAnchPerfHoAck: ho(%d,%d) null-RtpHandle(%p)\n",
+ hoType_, hoState_, h3RtpSession_);
+ DBG_LEAVE();
+ return (handleAnchAbortWiCos(JC_FAILURE_ANCH_HO_DISALOWED));
+ }
+
+ SetRemoteHandoverRtpPort(h3RtpSession_,
+ h3VcIpAddress_,
+ vcInMsg->msgData.perfHandoverAck.targetInRtpPort);
+
+ rtpSinkPort.portType = CSU_RTP_PORT;
+ rtpSinkPort.portId.rtpHandler = h3RtpSession_;
+
+ DBG_TRACE("CC->@anch(h3):handleTrgToAnchPerfHoAck: (hoType %d, hoState_ %d)\n",
+ hoType_, hoState_);
+
+ need_simplex_connection = true;
+
+ break;
+
+ case HO_TY_HANDOVER:
+ hoVcCallIndex_ = vcInMsg->origSubId;
+
+ //PR1521 <xxu:09-12-00>
+ DBG_TRACE("CC->@anch(ho):handleTrgToAnchPerfHoAck: loRtpHndl %p, reVcIpAddr %x, rePort %d callIndex %d\n",
+ hoRtpSession_,
+ hoVcIpAddress_,
+ vcInMsg->msgData.perfHandoverAck.targetInRtpPort,
+ hoVcCallIndex_);
+
+ if (hoRtpSession_ == NULL)
+ {
+ DBG_WARNING("CC->@anch(ho):handleTrgToAnchPerfHoAck: ho(%d,%d) null-RtpHandle(%p)\n",
+ hoType_, hoState_, hoRtpSession_);
+ DBG_LEAVE();
+ return (handleAnchAbortWiCos(JC_FAILURE_ANCH_HO_DISALOWED));
+ }
+
+ SetRemoteHandoverRtpPort(hoRtpSession_,
+ hoVcIpAddress_,
+ vcInMsg->msgData.perfHandoverAck.targetInRtpPort);
+
+ rtpSinkPort.portType = CSU_RTP_PORT;
+ rtpSinkPort.portId.rtpHandler = hoRtpSession_;
+
+ need_simplex_connection = true;
+
+ break;
+
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ DBG_TRACE("CC->@anch(h3):handleTrgToAnchPerfHoAck: loRtpHndl %p, reVcIpAddr %x, rePort %d\n",
+ h3RtpSession_,
+ h3VcIpAddress_,
+ vcInMsg->msgData.perfHandoverAck.targetInRtpPort);
+
+ h3VcCallIndex_ = vcInMsg->origSubId;
+
+ if (h3RtpSession_ == NULL)
+ {
+ DBG_WARNING("CC->@anch(h3):handleTrgToAnchPerfHoAck: ho(%d,%d) null-RtpHandle(%p)\n",
+ hoType_, hoState_, h3RtpSession_);
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendEndHandover();
+ initData();
+
+ DBG_LEAVE();
+ return (CC_RELEASE_HOCALLLEG);
+ }
+
+ SetRemoteHandoverRtpPort(h3RtpSession_,
+ h3VcIpAddress_,
+ vcInMsg->msgData.perfHandoverAck.targetInRtpPort);
+
+ rtpSinkPort.portType = CSU_RTP_PORT;
+ rtpSinkPort.portId.rtpHandler = h3RtpSession_;
+
+ DBG_TRACE("CC->@anch(h3):handleTrgToAnchPerfHoAck: (hoType %d, hoState_ %d)\n",
+ hoType_, hoState_);
+
+ need_simplex_connection = false;
+
+ break;
+
+ default:
+ //Deadly problem, need shoubleshooting first before running ahead !
+ JCCLog2 ("CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_ERROR ("CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+
+ if (need_simplex_connection)
+ {
+ // simplex conn for ho or h3
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(whichLeg->h323CallHandle);
+
+ DBG_TRACE("CC->@anch PerfHock(t2a): (hoType %d,hoState %d) (vpRtpHndl %p->reRtpHndl %p)\n",
+ hoType_, hoState_, rtpSourcePort.portId.rtpHandler, rtpSinkPort.portId.rtpHandler);
+
+ if ((csuResult = csu_SimplexConnect(&rtpSourcePort, &rtpSinkPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog2("CSU Error : Ho or h3 Simplex Conn. Failure, (hoType %d, hoState %)\n",
+ hoType_, hoState_);
+ JCCLog3("CSU Error : Ho or h3 Simplex Conn. Failure, (Result = %d) for (rtpPort %x --> rtpPort %x)\n",
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler,
+ (int)rtpSinkPort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Ho or h3 Simplex Conn. Failure, (hoType %d, hoState %) (Result = %d) for (rtpPort %x --> rtpPort %x)\n",
+ hoType_,hoState_,
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler,
+ (int)rtpSinkPort.portId.rtpHandler);
+
+ // Treating like a Handover Failure will behave as required.
+ // Skip event loop.
+ DBG_LEAVE();
+ return (handleAnchAbortWiCos(JC_FAILURE_CSU_SIMPLEX_CONNETION));
+ }
+ }
+
+ switch(hoType_)
+ {
+ case HO_TY_HANDOVER:
+ // Send internal RR msg
+ rrOutMsg.l3_data.handCmd.handCmd = vcInMsg->msgData.perfHandoverAck.handCmd;
+
+ // Dump the handover Command msg.
+ // CNI_DumpHex(&rrOutMsg.l3_data.handCmd.handCmd.buffer[0], 30);
+
+ sendRR(INTRA_L3_DATA, INTRA_L3_RR_HANDOVER_COMMAND, parent->entryId, &rrOutMsg);
+
+ hoSimplexConnected_ = true;
+ hoState_ = HAND_ST_ANCH_RCV_HO_REQ_ACK;
+
+ break;
+
+ case HO_TY_HANDMSC3:
+ //Send HB ack to MSC-B based on HO ack from MSC-B'
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_ACK;
+ vcOutMsg.msgData.perfHandbackAck.handCmd = vcInMsg->msgData.perfHandoverAck.handCmd;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ h3SimplexConnected_ = true;
+ hoState_ = HAND_ST_ANCH_RCV_H3_REQ_ACK;
+
+ break;
+
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+
+ // Send HANDBACK ACK to external MSC which originated the PERFORM HANDBACK
+ sendHandbackAck();
+
+ hoState_ = HAND_ST_ANCH_EHO_RCV_H3_REQ_ACK;
+
+ break;
+
+
+ //default: no other case check needed again!
+
+ }
+
+ // start the T103 timer
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_T103);
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //HO<xxu:01-24-00> handle both HB and H3 cases!
+ JCCEvent_t
+ CCAnchorHandover::handleTrgToAnchPerfHbReq(void)
+ {
+ JCCEvent_t event_result;
+
+ DBG_FUNC("CCAnchorHandover::handleTrgToAnchPerfHbReq", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // Use the same criteria as when triggered on the anchor side.
+ if (!parent->isHandoverAllowed())
+ {
+ // Need to fix the cause value for the nack.
+ DBG_ERROR("vcA->vcB: HB or H3 failed on handover disallowed at vcA\n");
+ return(handleAnchHoReqNackWiCos(JC_FAILURE_ANCH_HO_DISALOWED));
+ }
+
+ //HO<xxu:01-24-00> Handle both HB and H3 scenarioes
+ //xxuHoTbd: need to check networkId to handle multiple VBs!
+
+ //GCELL<tyu:06-01-01> BEGIN
+ DBG_TRACE("CC HO Info @anch-PerfHbReq: Mcc(%x%x%x), Mnc(%x%x%x), candVcId(%d,%d), ho(type %d, state %d)\n",
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.mcc[0],
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.mcc[1],
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.mcc[2],
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.mnc[0],
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.mnc[1],
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.mnc[2],
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.lac,
+ vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId.ci,
+ hoType_, hoState_);
+
+
+ if (vcInMsg->msgData.perfHandbackReq.globalCellId.candIsExternal)
+ {
+ event_result = do_MNET_Handback_To_External_PLMN_scenario();
+ }
+ else
+ {
+ if ( isEqualGlobalCellId(&(vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId), &MY_GLOBALCELL_ID)
+ && !forcedHandmsc3 )
+ {
+ event_result = do_MNET_Handback_scenario();
+ }
+ else
+ {
+ event_result = do_MNET_Handback_To_Third_MNET_scenario();
+ }
+ }
+
+ DBG_LEAVE();
+ return(event_result);
+ }
+
+
+ //HO<xxu:01-31-00> extend to both HB and H3
+ JCCEvent_t
+ CCAnchorHandover::handleTrgToAnchAbortHb(void)
+ {
+ DBG_FUNC("CCAnchorHandover::handleTrgToAnchAbortHb", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("CC Info: (hoType '%d', hoState %d') aborted by MSC-B\n",
+ hoType_, hoState_);
+
+ // cancel T104 (hb) or T103 (h3)
+ parent->sessionTimer->cancelTimer();
+
+ switch (hoType_)
+ {
+ case HO_TY_HANDBACK:
+ // Cleanup hb at anch
+
+ releaseMobAndConnRes();
+ initHandbackData();
+
+ break;
+
+ case HO_TY_HANDMSC3:
+ // Abort HO part at MSC-B'
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.perfHandbackNack.cause = JC_FAILURE_REVERT_TO_OLD;
+
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ initHandmsc3Data();
+
+ break;
+
+ default:
+ //Deadly problem, need shoubleshooting first before running ahead !
+ JCCLog2 ("CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_ERROR ("CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ // empty the queues now that the handover failed
+ emptyRRQueue ();
+ emptyDownlinkQueue();
+ emptyMMQueue ();
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //HO<xxu:01-28-00> handle both h3 and ho cases!
+ JCCEvent_t
+ CCAnchorHandover::handleAnchThoTimerExpiry(void)
+ {
+ int i;
+ IntraL3HandoverRequired_t *inMsg = &handReqd;
+
+ DBG_FUNC("CCAnchorHandover::handleAnchThoTimerExpiry", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ //Retry next candidate if there is, otherwise give up handover effort
+
+ switch (hoType_)
+ {
+ case HO_TY_HANDOVER:
+ //RETRY<xxu:04-21-00> BEGIN, not retry to the same cell assumed
+ //if retry to the same cell needed, getNextHoCandidate could be
+ //modified to support this in the future.
+ if ( (i=getNextHoCandidate()) != (-1) )
+ {
+ //Try next candidate
+ hoNextCandidate_ = true;
+ candIndex_ = i;
+
+ //GCELL<tyu:06-01-01> BEGIN
+ hoGlobalCellId_ = inMsg->candGlobalCellId[i].candGlobalCellId;
+
+ DBG_TRACE("CC HO Info @handleAnchThoTimerExpiry(ho): #ofCand %d, candVcId(%d,%x%x%x,%x%x%x,%d,%d) ho(type %d, state %d)\n",
+ inMsg->numCandidates, i,
+ hoGlobalCellId_.mcc[0],hoGlobalCellId_.mcc[1],hoGlobalCellId_.mcc[2],
+ hoGlobalCellId_.mnc[0],hoGlobalCellId_.mnc[1],hoGlobalCellId_.mnc[2],
+ hoGlobalCellId_.lac, hoGlobalCellId_.ci,
+ hoType_, hoState_);
+
+ sprintf(&(cellLocationRequest.ViperCellId[0]), "%d:%d", hoGlobalCellId_.lac,hoGlobalCellId_.ci);
+ //GCELL<tyu:06-01-01> END
+
+ cellLocationRequest.TxnId = callIndex;
+
+ if (VBLinkLocationRequest(cellLocationRequest)
+ == false)
+ {
+ // Ignore the message
+ DBG_ERROR ("CC->VB Link Error: Failed on Cell Location Request Message\n");
+
+ //Release the Ho data @ MSC-A
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ hoRtpSession_ = NULL;
+
+ initData();
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ // start the VB timer
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TVB);
+
+ hoState_ = HAND_ST_ANCH_VC_IP_ADDRESS_REQ;
+
+ //RETRY<xxu:04-21-00> END
+ } else
+ {
+ //Abort action @ MSC-B
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ //Release the Ho data @ MSC-A
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ hoRtpSession_ = NULL;
+ initData();
+ hoType_ = (HandoverTypes_t )0;
+ }
+
+ break;
+
+ case HO_TY_HANDMSC3:
+ //Abort action @ MSC-B'
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_THO_TIMEOUT;
+
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ //Release the H3 data @ MSC-A
+ initHandmsc3Data();
+
+ //Abort HB from MSC-B to MSC-A
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = JC_FAILURE_THO_TIMEOUT;
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ break;
+
+ default:
+ //Deadly problem, release call and troubleshoot asap!
+ JCCLog1("CC Error: messed up hoType_ '%d'\n", hoType_);
+ DBG_ERROR("CC Error: messed up hoType_ '%d'\n", hoType_);
+ DBG_LEAVE();
+ return(CC_RELEASE_CALL);
+ break;
+ }
+
+ // Treating like a Handover Failure will behave as required.
+ // Skip event loop.
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //HO<xxu:01-31-00> extend to handle ho and h3
+ JCCEvent_t
+ CCAnchorHandover::handleAnchT103TimerExpiry(void)
+ {
+ DBG_FUNC("CCAnchorHandover::handleAnchT103TimerExpiry", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // May consider to retry the same candidate later but right now just send
+ // Abort Handover to the Target ViperCell: MSC-B (ho); MSC-B' (h3) etc.
+
+ DBG_TRACE("CC Info: T103 expiry during (hoType %d, hoState)\n", hoType_, hoState_);
+
+ switch(hoType_)
+ {
+ case HO_TY_HANDOVER:
+ // Abort ho
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_T103_TIMEOUT;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+ initData();
+
+ return(CC_RELEASE_CALL);
+
+ break;
+
+ case HO_TY_HANDMSC3:
+ // Abort h3 at MSC-B'
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_T103_TIMEOUT;
+
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ // Abort hb at MSC-B
+
+ vcOutMsg.msgData.perfHandbackNack.cause = JC_FAILURE_T103_TIMEOUT;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ initHandmsc3Data();
+ initData();
+
+ return(CC_RELEASE_CALL);
+
+ break;
+
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_TVB_TIMEOUT;
+
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ //Send HANDBACK Nack to MSC which triggered PERFORM HANDBACK
+ hoEndCause_ = MC_HO_T204_TIMEOUT;
+ sendEndHandover();
+ initData();
+
+ DBG_LEAVE();
+ return (CC_RELEASE_HOCALLLEG);
+
+ default:
+ //Deadly problem, need shoubleshooting first before running ahead !
+ JCCLog2 ("CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_ERROR ("CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ // empty the queues now that the handover failed
+ emptyRRQueue ();
+ emptyDownlinkQueue();
+ emptyMMQueue ();
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //HO<xxu:02-23-00> handle h3 release
+ JCCEvent_t
+ CCAnchorHandover::handleAnchPostH3Rls(void)
+ {
+
+ DBG_FUNC("CCAnchorHandover::handleAnchPostH3Rls", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ switch(hoType_)
+ {
+ case HO_TY_HANDOVER:
+ case HO_TY_HANDBACK:
+ case HO_TY_HANDMSC3:
+
+ // cancel any timers running
+ parent->sessionTimer->cancelTimer();
+
+ // Send Abort Handover to new Target ViperCell.
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_BASE;
+
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ //Cleanup of MSC-A to MSC-B' part
+
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = h3RtpSession_;
+
+ if (h3RtpSession_ != NULL)
+ {
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog3("CSU Error @anch-PostH3Rls : break h3RtpHandle Failure, (hoType:%d) (Result:%d) (h3Port:%x)\n",
+ hoType_,
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler);
+ DBG_ERROR("CSU Error @anch-PostH3Rls : break h3RtpHandle Failure, (hoType:%d) (Result:%d) (h3Port:%x)\n",
+ hoType_,
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+
+ // Release the H3 RTP channel
+
+ ReleaseHandoverRtpChannel(h3RtpSession_);
+ } else
+ {
+ JCCLog2("CSU Warning @anch-PostH3Rls : h3RtpHandle is NULL (hoType:%d, hoState %d)\n",
+ hoType_, hoState_);
+ DBG_WARNING("CSU Warning @anch-PostH3Rls : h3RtpHandle is NULL (hoType:%d, hoState %d)\n",
+ hoType_, hoState_);
+ }
+
+
+ h3SimplexConnected_ = false;
+ h3RtpSession_ = NULL;
+
+ initHandmsc3Data();
+
+ default:
+ {
+ DBG_TRACE ("CC Info @anch-handleAnchPostH3Rls: doing nothing (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_LEAVE();
+ return(CC_MESSAGE_PROCESSING_COMPLT);
+ }
+ }
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ //HO<xxu:02-01-00>
+ JCCEvent_t
+ CCAnchorHandover::handleAnchPostHoRls(void)
+ {
+
+ DBG_FUNC("CCAnchorHandover::handleAnchPostHoRls", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // cancel any timers running
+ parent->sessionTimer->cancelTimer();
+
+ switch(hoType_)
+ {
+ case HO_TY_HANDOVER:
+ // Send Abort Handover to the Target ViperCell and release call
+
+ DBG_TRACE("CC HO INFO @anch-postHoRls: got RLS during HO (hoType %d) (hoState %d)\n",
+ hoType_, hoState_);
+
+ cleanHoCallWiCause(INTER_VC_CC_ABORT_HANDOVER, JC_FAILURE_OTGT_CALL_RLS);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+
+ break;
+
+ case HO_TY_HANDBACK:
+
+ // Send Abort Handback to the Anchor ViperCell and release call
+
+ DBG_TRACE("CC HO INFO @anch-postHoRls: got RLS during HB (hoType %d) (hoState %d)\n",
+ hoType_, hoState_);
+
+ cleanHoCallWiCause(INTER_VC_CC_ABORT_HANDOVER, JC_FAILURE_OTGT_CALL_RLS);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+
+ break;
+
+ case HO_TY_HANDMSC3:
+ // Process in terms of where H3 is progressing now
+
+ switch(hoState_)
+ {
+ case HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ:
+ // Just give up H3 effort and release call
+
+ initHandmsc3Data();
+ cleanHoCallWiCause(INTER_VC_CC_ABORT_HANDOVER,JC_FAILURE_OTGT_CALL_RLS);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+
+ break;
+
+ case HAND_ST_ANCH_SND_H3_REQ:
+ // Proceed in terms of where RLS is from old or new tgt cell
+
+ //GCELL<tyu:06-01-01>
+ if (vcInMsg->origVcId.cellId == h3GlobalCellId_.ci && vcInMsg->origVcId.networkId == h3GlobalCellId_.lac)
+ {
+ // Give up H3 effort but maintain current HO
+
+ cleanH3CallWiCause(INTER_VC_CC_ABORT_HANDOVER,JC_FAILURE_NTGT_CALL_RLS);
+ cleanHoCallWiCause(INTER_VC_CC_PERFORM_HANDBACK_NACK,JC_FAILURE_NTGT_CALL_RLS);
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ //GCELL<tyu:06-01-01>
+ } else if (vcInMsg->origVcId.cellId == hoGlobalCellId_.ci && vcInMsg->origVcId.networkId == hoGlobalCellId_.lac)
+ {
+ // Release this call and cleanup call environment
+
+ // Abort both the H3 effort and current HO, release call
+ cleanH3CallWiCause(INTER_VC_CC_ABORT_HANDOVER,JC_FAILURE_NTGT_CALL_RLS);
+ cleanHoCallWiCause(INTER_VC_CC_ABORT_HANDOVER,JC_FAILURE_NTGT_CALL_RLS);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+
+ } else
+ {
+ // Log this wrong landed message and release call for trouble shoot
+
+ //GCELL<tyu:06-01-01>
+ DBG_ERROR ("CC Error @anch-postHoRls: messup ho(%d, %d) cellId(rx %d, ho %d, h3 %d)\n",
+ hoType_, hoState_,
+ vcInMsg->origVcId.cellId,
+ hoGlobalCellId_.ci, h3GlobalCellId_.ci);
+
+ // Abort both the H3 effort and current HO, release call
+ cleanH3CallWiCause(INTER_VC_CC_ABORT_HANDOVER,JC_FAILURE_NTGT_CALL_RLS);
+ cleanHoCallWiCause(INTER_VC_CC_ABORT_HANDOVER,JC_FAILURE_NTGT_CALL_RLS);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+
+ }
+
+ break;
+
+ case HAND_ST_ANCH_RCV_H3_REQ_ACK:
+ // Simply abort both H3 and HO now, also release call. Improve later!
+ cleanH3CallWiCause(INTER_VC_CC_ABORT_HANDOVER,JC_FAILURE_NTGT_CALL_RLS);
+ cleanHoCallWiCause(INTER_VC_CC_ABORT_HANDOVER,JC_FAILURE_NTGT_CALL_RLS);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+
+ break;
+
+ default:
+ // Ignore this H3 effort but maintain the cur HO
+ JCCLog3 ("CC Error @anch-postHoRls: messed up (hoType: %d) (hoState: %d) (cellId: %d\n",
+ hoType_, hoState_, vcInMsg->origVcId.cellId);
+ DBG_ERROR ("CC Error @anch-postHoRls: messed up (hoType: %d) (hoState: %d) (cellId: %d\n",
+ hoType_, hoState_, vcInMsg->origVcId.cellId);
+
+ // Abort both the H3 effort and current HO, release call
+ cleanH3CallWiCause(INTER_VC_CC_ABORT_HANDOVER,JC_FAILURE_NTGT_CALL_RLS);
+ cleanHoCallWiCause(INTER_VC_CC_ABORT_HANDOVER,JC_FAILURE_NTGT_CALL_RLS);
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ break;
+
+ default:
+ DBG_TRACE ("CC Info @anch-postHoRls: doing nothing (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ }
+
+ }
+
+ //HO<xxu:02-01-00> extend to cover H3 case
+ JCCEvent_t
+ CCAnchorHandover::handleAnchPostHoMobEvent(void)
+ {
+
+ DBG_FUNC("CCAnchorHandover::handleAnchPostHoMobEvent", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ switch (vcInMsg->origModuleId)
+ {
+ case MODULE_RM:
+ // Need to call the handler in the session
+ parent->handleRRMsg(&vcInMsg->msgData.postHoMobEventData.intraL3Msg);
+ break;
+
+ case MODULE_MD:
+ // Need to call the handler in the session
+ parent->handleMobMsg(&vcInMsg->msgData.postHoMobEventData.msInMsg);
+ break;
+
+ default:
+ // late event
+ DBG_ERROR("EXT VC->CC Error: Unexpected event from (module id=%d)\n",
+ vcInMsg->origModuleId);
+
+ }
+
+ DBG_LEAVE();
+ return(CC_MESSAGE_PROCESSING_COMPLT);
+
+ }
+
+ //HO<xxu:01-27-00> sendback HoReqNack with failure cause
+ JCCEvent_t
+ CCAnchorHandover::handleAnchHoReqNackWiCos(JcFailureCause_t cause)
+ {
+ DBG_FUNC("CCAnchorHandover::handleAnchHoReqNackWiCos", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("CC hb or h3 failed (cause: %d)\n", cause);
+
+ // Send the Perform Nack message.
+
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_NACK;
+ vcOutMsg.msgData.perfHandbackNack.cause = cause;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ switch (hoType_)
+ {
+ case HO_TY_HANDMSC3:
+ case HO_TY_EXT_HANDMSC3:
+ case HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3:
+ initHandmsc3Data();
+
+ case HO_TY_HANDBACK:
+ case HO_TY_EXT_HANDBACK:
+ initHandbackData();
+ break;
+ default:
+ JCCLog2 ("CC Error: call dropped or messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_ERROR ("CC Error: call dropped or messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ break;
+ }
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //HO<xxu:01-28-00> Abort ho or h3 with a specific cause given
+ JCCEvent_t
+ CCAnchorHandover::handleAnchAbortWiCos(JcFailureCause_t cause)
+ {
+ DBG_FUNC("CCAnchorHandover::handleAnchAbortWiCos", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // Assume no retry is needed based on candidate list
+
+ // Send Abort Handover to the Target ViperCell.
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = cause;
+
+ switch(hoType_)
+ {
+
+ case HO_TY_HANDMSC3:
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ // Release the H3 RTP channel
+ ReleaseHandoverRtpChannel(h3RtpSession_);
+ h3RtpSession_ = NULL;
+ initHandmsc3Data();
+
+ case HO_TY_HANDOVER:
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ // Release the Ho RTP channel
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ hoRtpSession_ = NULL;
+ initData();
+
+ break;
+
+ default:
+ JCCLog2 ("CC Error: call dropped or messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_ERROR ("CC Error: call dropped or messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ break;
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //HO<xxu:02-06-00>
+ JCCEvent_t
+ CCAnchorHandover::cleanHoCallWiCause(InterVcMsgType_t msg, JcFailureCause_t cause)
+ {
+ DBG_FUNC("CCAnchorHandover::cleanHoCallWiCause", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // Send Abort Handover to the Target ViperCell.
+
+ vcOutMsg.msgType = msg;
+ vcOutMsg.msgData.abortHandover.cause = cause;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ // break connection
+ if (msg==INTER_VC_CC_ABORT_HANDOVER)
+ {
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = hoRtpSession_;
+
+ if (hoRtpSession_ != NULL)
+ {
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog3("CSU Error @anch-cleanHoCallWiCause : break hoRtpHandle Failure, (hoType:%d) (Result:%d) (hoPort:%x)\n",
+ hoType_,
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler);
+ DBG_ERROR("CSU Error @anch-cleanHoCallWiCause : break hoRtpHandle Failure, (hoType:%d) (Result:%d) (hoPort:%x)\n",
+ hoType_,
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+
+ // Release the Ho RTP channel
+
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+
+ } else
+ {
+ JCCLog2("CSU Warning @anch-cleanHoCallWiCause : hoRtpHandle is NULL (hoType:%d, hoState %d)\n",
+ hoType_, hoState_);
+ DBG_WARNING("CSU Warning @anch-cleanHoCallWiCause : hoRtpHandle is NULL (hoType:%d, hoState %d)\n",
+ hoType_, hoState_);
+ }
+
+ hoSimplexConnected_ = false;
+ hoRtpSession_ = NULL;
+
+ initData();
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ }
+
+ //HO<xxu:02-06-00>
+ JCCEvent_t
+ CCAnchorHandover::cleanH3CallWiCause(InterVcMsgType_t msg, JcFailureCause_t cause)
+ {
+ DBG_FUNC("CCAnchorHandover::cleanH3CallWiCause", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ // Send Abort Handover to the Target ViperCell.
+
+ vcOutMsg.msgType = msg;
+ vcOutMsg.msgData.abortHandover.cause = cause;
+
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ // break connection
+ if (msg==INTER_VC_CC_ABORT_HANDOVER)
+ {
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = h3RtpSession_;
+
+ if (hoRtpSession_ != NULL)
+ {
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog3("CSU Error @anch-cleanH3CallWiCause : break h3RtpHandle Failure, (hoType:%d) (Result:%d) (hoPort:%x)\n",
+ hoType_,
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler);
+ DBG_ERROR("CSU Error @anch-cleanH3CallWiCause : break h3RtpHandle Failure, (hoType:%d) (Result:%d) (hoPort:%x)\n",
+ hoType_,
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+
+ // Release the Ho RTP channel
+
+ ReleaseHandoverRtpChannel(h3RtpSession_);
+
+ } else
+ {
+ JCCLog2("CSU Warning @anch-cleanH3CallWiCause : h3RtpHandle is NULL (hoType:%d, hoState %d)\n",
+ hoType_, hoState_);
+ DBG_WARNING("CSU Warning @anch-cleanH3CallWiCause : h3RtpHandle is NULL (hoType:%d, hoState %d)\n",
+ hoType_, hoState_);
+ }
+
+ h3SimplexConnected_ = false;
+ h3RtpSession_ = NULL;
+
+ initHandmsc3Data();
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ }
+
+ //HO<xxu:05-01-00> handle to btw anchor and VB
+ JCCEvent_t
+ CCAnchorHandover::handleAnchTvbTimerExpiry(void)
+ {
+ DBG_FUNC("CCAnchorHandover::handleAnchTvbTimerExpiry", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ switch (hoType_)
+ {
+ case HO_TY_HANDOVER:
+ //handover failed at the stage of target IP address resolution
+
+ DBG_ERROR ("CC->VB Link Timeout: Failed on Tvb expiry (hoSt %d, hoTyp %d)\n",
+ hoState_, hoType_);
+ initData();
+ DBG_LEAVE();
+
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ break;
+
+ case HO_TY_HANDMSC3:
+ //Handmsc3 failed at the stage of target IP-address resolution
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_TVB_TIMEOUT;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ //Cleanup h3
+ initHandmsc3Data();
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ break;
+
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ //Handmsc3 (to MNET) failed at the state of target IP-address resolution
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_TVB_TIMEOUT;
+
+ sendVcMsgH3(MODULE_CC, MODULE_CC);
+
+ //Send HANDBACK Nack to MSC which triggered PERFORM HANDBACK
+ hoEndCause_ = MC_HO_T204_TIMEOUT;
+ sendHandbackNack();
+ initExtHandbackData();
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ default:
+ //Deadly problem, release call and troubleshoot asap!
+ DBG_ERROR("CC Ho Error: messed up at (hoSt %d, hoTyp %d, rc %d)\n",
+ hoState_, hoType_, hoRetry_);
+
+ return(CC_RELEASE_CALL);
+ break;
+ }
+
+ // Treating like a Handover Failure will behave as required.
+ // Skip event loop.
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ }
+
+ // ext-HO <chenj:05-29-01>
+ int
+ CCAnchorHandover::handleHoaCcMsg(InterHoaVcMsg_t *hoaCcInMsg)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleHoaCcMsg): entering......\n}\n");
+
+ CCHandover::handleHoaCcMsg(hoaCcInMsg); // Set currEvent according to msg received
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleHoaCcMsg): leaving.\n}\n");
+ return (smHandleEvent());
+ }
+
+ // ext-HO <chenj:06-29-01>
+ JCCEvent_t
+ CCAnchorHandover::do_MNET_Handback_scenario(void)
+ {
+ DBG_FUNC("CCAnchorHandover::do_MNET_Handback_scenario", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ initHandbackData();
+
+ DBG_TRACE("vcB->vcA: hb is requested (hoType:%d, hoState:%d)\n",
+ hoType_, hoState_);
+
+ // Build a message for MM for Handover Req.
+ // Fill the data for MM message
+ mmOutMsg.l3_data.handReq.channelType.bearerType = BEARER_SPEECH;
+ mmOutMsg.l3_data.handReq.channelType.speechChann = parent->currSpeechCh();
+
+ //CIPH<xxu:02-10-00>Begin
+
+ IntraL3CipherModeCommand_t cipherCmd;
+ if (ludbGetCipherAlgo(parent->ludbIndex, &cipherCmd))
+ {
+ //handling error return
+ JCCLog1 ("CC->Handover Error: ludbGetCipherAlgo() failed, (ludbIndex = %d)\n",
+ parent->ludbIndex);
+ DBG_ERROR ("CC->Handover Error: ludbGetCipherAlgo() failed, (ludbIndex = %d)\n",
+ parent->ludbIndex);
+ cipherCmd.cmd.cipherModeSetting.ciphering = CNI_RIl3_CIPHER_NO_CIPHERING;
+ }
+
+ DBG_TRACE("CC->@anch:PerfHb(a2r): ludbIndex %d, bearer %d, spchVer %d, ciphSet %d, algo %d, kc(%x,%x)\n",
+ parent->ludbIndex,
+ vcOutMsg.msgData.perfHandoverReq.channelType.bearerType,
+ vcOutMsg.msgData.perfHandoverReq.channelType.speechChann.version,
+ cipherCmd.cmd.cipherModeSetting.ciphering,
+ cipherCmd.cmd.cipherModeSetting.algorithm,
+ cipherCmd.Kc[0],cipherCmd.Kc[1],
+ cipherCmd.Kc[0],cipherCmd.Kc[2]);
+
+ memcpy( (unsigned char*) &(mmOutMsg.l3_data.handReq.cipherCmd),
+ (unsigned char*) &(cipherCmd),
+ sizeof (IntraL3CipherModeCommand_t) );
+
+ //CIPH<xxu:02-10-00>End
+
+ mmOutMsg.l3_data.handReq.qid = msgQId;
+
+ // Send internal MM msg -
+ sendMM(INTRA_L3_MM_EST_REQ, INTRA_L3_RR_HANDOVER_REQ, parent->entryId, &mmOutMsg);
+
+ // Mark handover type and relevant state
+ hoType_ = HO_TY_HANDBACK;
+ hoState_ = HAND_ST_ANCH_RCV_HB_REQ;
+ DBG_LEAVE();
+ }
+
+ // ext-HO <chenj:06-29-01>
+ JCCEvent_t
+ CCAnchorHandover::do_MNET_Handback_To_Third_MNET_scenario(void)
+ {
+ VBLINK_API_CELL_LOCATION_REQUEST_MSG t_cellLocationRequest;
+
+ DBG_FUNC("CCAnchorHandover::do_MNET_Handback_To_Third_MNET_scenario", CC_HANDOVER_LAYER);
+ DBG_ENTER();
+
+ initHandmsc3Data();
+
+ if (forcedHandmsc3)
+ {
+ //GCELL<tyu:06-01-01>
+ h3GlobalCellId_ = ccHoTrgGlobalCellId;
+ h3VcIpAddress_ = ccHoTrgCellIpAddress;
+
+ } else
+ //GCELL<tyu:06-01-01>
+ h3GlobalCellId_ = vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId;
+
+ if ( (!forcedHandmsc3) || (forcedHandmsc3&&useViperBase) )
+ {
+ //H3 scenario. Go ahead to inquire IP address of mscB', later check
+ //if the mscB' is known or not.
+
+ //GCELL<tyu:06-01-01> BEGIN
+ DBG_TRACE("vcB->vcA: h3 is requested (hoType %d; hoState %d) (mcc %x%x%x, mnc %x%x%x, lac %d; ci %d)\n",
+ hoType_, hoState_, h3GlobalCellId_.mcc[0],h3GlobalCellId_.mcc[1],h3GlobalCellId_.mcc[2],
+ h3GlobalCellId_.mnc[0],h3GlobalCellId_.mnc[1],h3GlobalCellId_.mnc[2],h3GlobalCellId_.lac, h3GlobalCellId_.ci);
+
+ sprintf(&(t_cellLocationRequest.ViperCellId[0]), "%d:%d", h3GlobalCellId_.lac,h3GlobalCellId_.ci);
+ //GCELL<tyu:06-01-01> END
+
+ t_cellLocationRequest.TxnId = callIndex;
+
+ if (VBLinkLocationRequest(t_cellLocationRequest)
+ == false)
+ {
+ // Ignore the message
+ DBG_ERROR ("vcA->VB Link Error: h3 failed on calling VBLinkLocationRequest()(%d,%d)\n",
+ hoType_, hoState_);
+ DBG_LEAVE();
+ return (handleAnchHoReqNackWiCos(JC_FAILURE_ANCH_VB_LINK_PROBLEM));
+ }
+
+ //RETRY<xxu:04-21-00> BEGIN
+ // start the VB timer
+ hoRetry_ = 0;
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TVB);
+ //RETRY<xxu:04-21-00> END
+
+ //MSC-B' born here while MSC-B is still alive. Mark handover type and relevant state
+ //GCELL<tyu:06-01-01>
+ h3GlobalCellId_ = vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId;
+ hoType_ = HO_TY_HANDMSC3;
+ hoState_ = HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ;
+
+ } else
+ {
+ //MSC-B' born here while MSC-B is still alive. Mark handover type and relevant state
+ hoType_ = HO_TY_HANDMSC3;
+ hoState_ = HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ;
+
+ DBG_LEAVE();
+ return (handleVcAddressRsp());
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ // ext-HO <chenj:06-29-01>
+ JCCEvent_t
+ CCAnchorHandover::do_MNET_Handback_To_External_PLMN_scenario(void)
+ {
+ A_Result_t A_result;
+ NonStdRasMessagePerformHandoverRQ_t Msg;
+ T_AIF_MessageUnit a_msg;
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::do_MNET_Handback_To_External_PLMN_scenario): entering......\n}\n");
+ initHandmsc3Data();
+
+ DBG_TRACEho(" Handback to External THIRD PLMN is requested (hoType:%d, hoState:%d)\n",
+ hoType_, hoState_);
+
+ h3GlobalCellId_ = vcInMsg->msgData.perfHandbackReq.globalCellId.candGlobalCellId;
+
+ // Set aifMsg's HANDOVER REQUEST A INTERFACE values
+ // JOE: Inter-GP10 handback currently does not give SERVING CELL ID...
+ // the code needs to be enhanced to pass back this value.
+ // For now, use MY_GLOBALCELL_ID as the serving_cell id.
+ populateAHandoverRequest( &MY_GLOBALCELL_ID, &h3GlobalCellId_);
+
+ if ((A_result = AIF_Encode( &aifMsg, &a_msg )) != A_RESULT_SUCCESS)
+ {
+ // Couldn't encode Perform Handover A-Interface msg.
+ DBG_ERRORho (" A Interface encoding Error: Perform Handver Request. Result (%d)\n",
+ (int) A_result);
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::do_MNET_Handback_To_External_PLMN_scenario): leaving.\n}\n");
+ return (handleAnchHoReqNackWiCos(JC_FAILURE_A_INTERFACE_MESSAGE_ENCODING_FAILED));
+ }
+
+ memset( (char*)&Msg, 0, sizeof(NonStdRasMessagePerformHandoverRQ_t));
+
+ Msg.A_HANDOVER_REQUEST.msglength = a_msg.msgLength;
+ memcpy(Msg.A_HANDOVER_REQUEST.A_INTERFACE_DATA,
+ (unsigned char*)a_msg.buffer, MAX_A_INTERFACE_LEN);
+
+ Msg.header.origSubId = callIndex;
+ // Note: need to put -1 as hoAgId since this requires GMC to create a new HOA
+ Msg.header.destSubId = -1; // NULL (unknown hoAgId - GMC will assign)
+ Msg.globalCellID = h3GlobalCellId_;
+ Msg.hoCause = vcInMsg->msgData.perfHandbackReq.hoCause;
+ Msg.hoNumberReqd = true; // Always TRUE
+ Msg.handoverNumber.ie_present = false; // NULL (unknown handoverNumber - GMC will assign)
+ Msg.mscNumber.ie_present = false; // NULL (unknown mscNumber - GMC will find out)
+
+ DBG_TRACEho(" MESSAGE DATA:\n");
+ DBG_TRACEho(" : hoAgId_=%d, callId=%d\n",hoAgId_, callIndex);
+ DBG_TRACEho(" : h3GlobalCellId_ (type=%d, mcc[1-3]:%x,%x,%x; mnc[1-3]:%x,%x,%x;lac=%x,ci=%x)\n",
+ h3GlobalCellId_.ci_disc,hoGlobalCellId_.mcc[0],h3GlobalCellId_.mcc[1],h3GlobalCellId_.mcc[2],
+ h3GlobalCellId_.mnc[0],h3GlobalCellId_.mnc[1],h3GlobalCellId_.mnc[2],h3GlobalCellId_.lac,hoGlobalCellId_.ci);
+ DBG_TRACEho(" : hoCause=SET TO 0 FOR NOW\n");
+
+
+ DBG_TRACEho(" a_msg.buffer POST-AIF PROCESSING MESSAGE DATA: A_HANDOVER_REQUEST_TYPE\n");
+ DBG_TRACEho(" {\n");
+ DBG_TRACEho(" \na_msg.buffer hexdump: ");
+ DBG_HEXDUMPho((unsigned char*) a_msg.buffer, a_msg.msgLength);
+ DBG_TRACEho("\n }\n");
+
+
+ DBG_TRACEho(" MSG POST-AIF PROCESSING MESSAGE DATA: A_HANDOVER_REQUEST_TYPE\n");
+ DBG_TRACEho(" {\n");
+ DBG_TRACEho(" \nMsg hexdump: ");
+ DBG_HEXDUMPho((unsigned char*) &Msg, sizeof (NonStdRasMessagePerformHandoverRQ_t) );
+ DBG_TRACEho("\n }\n");
+
+
+ if (VBLinkPerformHandoverRequest(&Msg)
+ == false)
+ {
+ // Ignore the message
+ DBG_ERRORho (" CC->VB Link ERROR: Failed on Perform Handver Request Message\n}\n");
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::do_Handover_To_Third_PLMN_scenario): leaving.\n}\n");
+ return (handleAnchHoReqNackWiCos(JC_FAILURE_ANCH_VB_LINK_PROBLEM));
+ }
+
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TVB);
+
+ hoType_ = HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3;
+ hoState_ = HAND_ST_ANCH_PERF_EHO_H3_REQ;
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::do_MNET_Handback_To_External_PLMN_scenario): leaving.\n}\n");
+ }
+
diff --git a/data/mnet/GP10/Host/cc/src/CCHoSrcHndExt.cpp b/data/mnet/GP10/Host/cc/src/CCHoSrcHndExt.cpp
new file mode 100644
index 0000000..d6ca196
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCHoSrcHndExt.cpp
@@ -0,0 +1,2350 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCHoSrcHndExt.cpp
+// Author(s) : Joe Chen
+// Create Date : 05-30-01
+// Description : External Handover Event handlers for Anchor Session
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+
+#include "CC/CCHandover.h"
+
+#include "CC/CCSessionHandler.h"
+
+#include "CC/CCUtil.h"
+
+#include "CC/CallConfig.h"
+#include "CC/CCInt.h"
+#include "CC/CCH323Util.h"
+
+#include "jcc/JCCLog.h"
+#include "logging/VCLOGGING.h"
+
+#include "stdio.h"
+
+// Temporarily use csu_head instead of csu_intf
+#include "csunew/csu_head.h"
+
+#include "CC/hortp.h"
+
+#include "lapdm/cni_debug.h"
+
+#include "logging/VCLOGGING.h"
+
+#include "strLib.h"
+
+#include "string.h"
+
+#include "pm/pm_class.h"
+
+#include "voip/vblink.h"
+
+#include "voip/exchangeho.h"
+#include "CC/A_Handover_Request_Msg.h"
+#include "CC/A_Handover_Request_Ack_Msg.h"
+#include "jcc/LUDBApi.h"
+
+#include "ril3/ril3md.h"
+
+//CDR <xxu:08-22-00> BEGIN
+#include "CDR/CdrVoiceCall.h"
+
+#include "CC/A_Handover_Common.h"
+
+extern bool forcedHandover;
+extern bool useViperBase;
+extern bool forcedHandmsc3;
+extern GlobalCellId_t MY_GLOBALCELL_ID;
+extern GlobalCellId_t ccHoTrgGlobalCellId;
+extern UINT32 ccHoTrgCellIpAddress;
+extern BtsBasicPackage ccBtsBasicPackage;
+
+// Logging scripts
+extern void ViperLogSetModuleFilters(int module_id,short severity_level);
+extern void ccDataPrint();
+extern void mmDataPrint();
+extern void irtDataPrint();
+extern void csu_ShowAllSrcTable();
+extern void intg_ShowRmChans();
+extern void VoipShowAllCalls();
+extern void handoverRtpDataPrint();
+
+
+// *******************************************************************
+// Testing scripts
+// *******************************************************************
+
+void
+hologs()
+{
+ ViperLogSetModuleFilters( 0, 0x1ff); // CC Layer
+ ViperLogSetModuleFilters( 1, 0x1ff); // CC Session
+ ViperLogSetModuleFilters( 2, 0x1ff); // CC CallLeg
+ ViperLogSetModuleFilters( 4, 0x1ff); // CC HalfCall
+ ViperLogSetModuleFilters( 5, 0x1ff); // CC Handover
+ ViperLogSetModuleFilters( 7, 0x1ff); // CC EI
+ ViperLogSetModuleFilters( 8, 0x1ff); // CC EO
+ ViperLogSetModuleFilters( 9, 0x1ff); // CC HO
+ ViperLogSetModuleFilters( 10, 0x1ff); // CC ETRG
+ ViperLogSetModuleFilters( 75, 0x1ff); // H323
+ ViperLogSetModuleFilters( 76, 0x1ff); // H323 Protocol
+ ViperLogSetModuleFilters( 80, 0x1ff); // VBLINK
+ ViperLogSetModuleFilters(225, 0x1ff); // RM Layer
+}
+
+void
+hologsoff()
+{
+ ViperLogSetModuleFilters( 1000, 0); // Turn off logging
+}
+
+void
+showalltxt()
+{
+ ccDataPrint();
+// mmDataPrint();
+// irtDataPrint();
+ csu_ShowAllSrcTable();
+// intg_ShowRmChans();
+// VoipShowAllCalls();
+ handoverRtpDataPrint();
+}
+
+
+// *******************************************************************
+// External Handover functions.
+// *******************************************************************
+
+ JCCEvent_t
+ CCAnchorHandover::ExtPerformHO(void)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::ExtPerformHO): entering......\n}\n");
+
+ TwoPartyCallLeg *whichLeg;
+ NonStdRasMessagePerformHandoverRQ_t Msg;
+ T_AIF_MessageUnit a_msg;
+ A_Result_t A_result;
+
+
+ DBG_TRACEho(" Got an external handover candidate!\n");
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((whichLeg = parent->activeLeg()) == NULL)
+ {
+ // abort handover
+ DBG_TRACEho(" WARNING: No active leg (hoType %d, hoState %d)\n}\n", hoType_, hoState_);
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::ExtPerformHO): leaving.\n}\n");
+ return (JCC_NULL_EVENT);
+ }
+
+ // Set aifMsg's HANDOVER REQUEST A INTERFACE values
+ populateAHandoverRequest( &MY_GLOBALCELL_ID, &hoGlobalCellId_ );
+
+ if ((A_result = AIF_Encode( &aifMsg, &a_msg )) != A_RESULT_SUCCESS)
+ {
+ // Couldn't encode Perform Handover A-Interface msg.
+ DBG_ERRORho (" A Interface encoding Error: Perform Handver Request. Result (%d)\n",
+ (int) A_result);
+ initData();
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::ExtPerformHO): leaving.\n}\n");
+ return (JCC_NULL_EVENT);
+ }
+
+ memset( (char*)&Msg, 0, sizeof(NonStdRasMessagePerformHandoverRQ_t));
+
+ Msg.A_HANDOVER_REQUEST.msglength = a_msg.msgLength;
+ memcpy(Msg.A_HANDOVER_REQUEST.A_INTERFACE_DATA,
+ (unsigned char*)a_msg.buffer, MAX_A_INTERFACE_LEN);
+
+ Msg.header.origSubId = callIndex;
+ Msg.header.destSubId = -1; // NULL (unknown hoAgId - GMC will assign)
+ Msg.globalCellID = hoGlobalCellId_;
+ Msg.hoCause = rrInMsg->l3_data.handReqd.hoCause;
+ Msg.hoNumberReqd = true; // Always TRUE
+ Msg.handoverNumber.ie_present = false; // NULL (unknown handoverNumber - GMC will assign)
+ Msg.mscNumber.ie_present = false; // NULL (unknown mscNumber - GMC will find out)
+
+ DBG_TRACEho(" MESSAGE DATA:\n");
+ DBG_TRACEho(" : hoAgId_=%d, callId=%d\n",hoAgId_, callIndex);
+ DBG_TRACEho(" : hoGlobalCellId_ (type=%d, mcc[1-3]:%x,%x,%x; mnc[1-3]:%x,%x,%x;lac=%x,ci=%x)\n",
+ hoGlobalCellId_.ci_disc,hoGlobalCellId_.mcc[0],hoGlobalCellId_.mcc[1],hoGlobalCellId_.mcc[2],
+ hoGlobalCellId_.mnc[0],hoGlobalCellId_.mnc[1],hoGlobalCellId_.mnc[2],hoGlobalCellId_.lac,hoGlobalCellId_.ci);
+ DBG_TRACEho(" : hoCause=%d\n",rrInMsg->l3_data.handReqd.hoCause);
+
+
+ DBG_TRACEho(" a_msg.buffer POST-AIF PROCESSING MESSAGE DATA: A_HANDOVER_REQUEST_TYPE\n");
+ DBG_TRACEho(" {\n");
+ DBG_TRACEho(" \na_msg.buffer hexdump: ");
+ DBG_HEXDUMPho((unsigned char*) a_msg.buffer, a_msg.msgLength);
+ DBG_TRACEho("\n }\n");
+
+
+ DBG_TRACEho(" MSG POST-AIF PROCESSING MESSAGE DATA: A_HANDOVER_REQUEST_TYPE\n");
+ DBG_TRACEho(" {\n");
+ DBG_TRACEho(" \nMsg hexdump: ");
+ DBG_HEXDUMPho((unsigned char*) &Msg, sizeof (NonStdRasMessagePerformHandoverRQ_t) );
+ DBG_TRACEho("\n }\n");
+
+
+ if (VBLinkPerformHandoverRequest(&Msg)
+ == false)
+ {
+ // Ignore the message
+ DBG_ERRORho (" CC->VB Link ERROR: Failed on Perform Handver Request Message\n}\n");
+
+ initData();
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::ExtPerformHO): leaving.\n}\n");
+ return (JCC_NULL_EVENT);
+ }
+
+ hoState_ = HAND_ST_ANCH_PERF_EHO_REQ;
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::ExtPerformHO): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::handleExtPerformHOAck(void)
+ {
+ A_Result_t aif_result;
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): entering......\n}\n");
+
+ // cancel timer
+ parent->sessionTimer->cancelTimer();
+
+ // save HO agent ID for later transactions
+ switch( hoType_ )
+ {
+ case HO_TY_EXT_HANDOVER:
+ {
+ hoAgId_ = hoaInMsg->origSubId;
+ break;
+ }
+
+ case HO_TY_EXT_HANDMSC3:
+ case HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3:
+ {
+ h3AgId_ = hoaInMsg->origSubId;
+ break;
+ }
+
+ default:
+ {
+ //Deadly problem, need trouble shooting first before running ahead !
+ DBG_ERRORho (" CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ initData();
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_CALL);
+ }
+ };
+
+ TwoPartyCallLeg *whichLeg;
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((whichLeg = parent->activeLeg()) == NULL)
+ {
+ DBG_TRACEho(" No active leg (hoType %d, hoState %d)\n}\n", hoType_, hoState_);
+
+ hoEndCause_ = MC_HO_SUCCESS; // Normal takedown
+ sendEndHandover();
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_ALLHOCALLLEG);
+ }
+
+ //Decode A-interface message
+ memset( (char*)&aifMsg, 0, sizeof(T_AIF_MSG));
+
+ aif_result = AIF_Decode((T_AIF_MessageUnit*)&(hoaInMsg->msgData.perfExtHandoverAck.A_INTERFACE_MSG),
+ &aifMsg);
+ if ( aif_result != A_RESULT_SUCCESS)
+ {
+ DBG_ERRORho("{\n A-MSG decoding ERROR (err=%d, hoAgId_=%d)\nA-MSG:\n",
+ aif_result, hoAgId_);
+ DBG_HEXDUMPho(
+ (unsigned char*)&hoaInMsg->msgData.perfExtHandoverAck.A_INTERFACE_MSG.A_INTERFACE_DATA,
+ (int)hoaInMsg->msgData.perfExtHandoverAck.A_INTERFACE_MSG.msglength
+ );
+ DBG_ERRORho("\n}\n");
+
+ hoEndCause_ = MC_HO_UNEXPECTED_DATA_VALUE;
+ sendEndHandover();
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_ALLHOCALLLEG);
+ }
+
+ if (aifMsg.msgType != A_HANDOVER_REQUEST_ACK_TYPE)
+ {
+ //Unexpected A-MSG received
+ DBG_ERRORho(" UNEXPECTED A-MSG (msgType=%d,hoState_=%d)\n",
+ aifMsg.msgType, hoState_);
+
+ hoEndCause_ = MC_HO_UNEXPECTED_DATA_VALUE;
+ sendEndHandover();
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_ALLHOCALLLEG);
+ }
+
+ hoNumber_ = hoaInMsg->msgData.perfExtHandoverAck.handoverNumber;
+
+ //Received PERFORM HANDOVER REQUEST ACK message
+ DBG_TRACEho(" Received PERFORM_HANDOVER_ACK from HOA (hoType_=%d, hoAgId_=%d, callIndex=%d)\n",
+ hoType_, hoAgId_, callIndex);
+
+ switch( hoType_ )
+ {
+ case HO_TY_EXT_HANDOVER:
+ {
+ // Ready HOCallLeg and send SETUP to VoIP (PLMN) to handover number
+ if (!parent->setupOrigExtHo())
+ {
+ // SETUP to VoIP subsystem failed
+ DBG_ERRORho(" ERROR in SETUP to VoIP system failed. Handover number (ie_present=%d),(numberType=%d),(plan=%d),(numDigits=%d)\n}\n",
+ hoNumber_.ie_present, hoNumber_.numberType, hoNumber_.numberingPlan, hoNumber_.numDigits);
+ DBG_ERRORho(" : handover number digits (%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x)\n}\n",
+ hoNumber_.digits[0],hoNumber_.digits[1],hoNumber_.digits[2], hoNumber_.digits[3],hoNumber_.digits[4],
+ hoNumber_.digits[5],hoNumber_.digits[6],hoNumber_.digits[7],hoNumber_.digits[8],hoNumber_.digits[9],hoNumber_.digits[10]);
+
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendEndHandover();
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+ }
+
+ // Send internal RR msg
+ rrOutMsg.l3_data.handCmd.handCmd.msgLength = (unsigned short) aifMsg.handoverRequestAck.layer3Information.length;
+ memcpy( (unsigned char*) rrOutMsg.l3_data.handCmd.handCmd.buffer,
+ (unsigned char*) aifMsg.handoverRequestAck.layer3Information.layer3Info,
+ aifMsg.handoverRequestAck.layer3Information.length );
+
+ DBG_TRACEho(" Sending RR INTRA_L3_RR_HANDOVER_COMMAND.\n");
+ DBG_TRACEho(" rrOutMsg.l3_data.handCmd.handCmd hexdump: ");
+ DBG_TRACEho("\n ");
+ DBG_HEXDUMPho((unsigned char*) &rrOutMsg.l3_data.handCmd.handCmd, rrOutMsg.l3_data.handCmd.handCmd.msgLength + 2);
+
+ sendRR(INTRA_L3_DATA, INTRA_L3_RR_HANDOVER_COMMAND, parent->entryId, &rrOutMsg);
+
+ hoState_ = HAND_ST_ANCH_RCV_EHO_REQ_ACK;
+
+ break;
+ }
+
+ case HO_TY_EXT_HANDMSC3:
+ {
+ // Ready H3CallLeg and send SETUP to VoIP (PLMN) to handover number
+ if (!parent->setupOrigExtHo3())
+ {
+ // SETUP to VoIP subsystem failed
+ DBG_ERRORho(" ERROR in SETUP to VoIP system failed. Handover number (ie_present=%d),(numberType=%d),(plan=%d),(numDigits=%d)\n}\n",
+ hoNumber_.ie_present, hoNumber_.numberType, hoNumber_.numberingPlan, hoNumber_.numDigits);
+ DBG_ERRORho(" : handover number digits (%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x)\n}\n",
+ hoNumber_.digits[0],hoNumber_.digits[1],hoNumber_.digits[2], hoNumber_.digits[3],hoNumber_.digits[4],
+ hoNumber_.digits[5],hoNumber_.digits[6],hoNumber_.digits[7],hoNumber_.digits[8],hoNumber_.digits[9],hoNumber_.digits[10]);
+
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendEndHandover();
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_ALLHOCALLLEG);
+ }
+
+ // Send Handback ACK to the MSC which originated the Perform Handover.
+ sendHandbackAck();
+
+ hoState_ = HAND_ST_ANCH_RCV_EHO_H3_REQ_ACK;
+
+ break;
+ }
+
+ case HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3:
+ {
+ // Ready H3CallLeg and send SETUP to VoIP (PLMN) to handover number
+ if (!parent->setupOrigExtHo3())
+ {
+ // SETUP to VoIP subsystem failed
+ DBG_ERRORho(" ERROR in SETUP to VoIP system failed. Handover number (ie_present=%d),(numberType=%d),(plan=%d),(numDigits=%d)\n}\n",
+ hoNumber_.ie_present, hoNumber_.numberType, hoNumber_.numberingPlan, hoNumber_.numDigits);
+ DBG_ERRORho(" : handover number digits (%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x)\n}\n",
+ hoNumber_.digits[0],hoNumber_.digits[1],hoNumber_.digits[2], hoNumber_.digits[3],hoNumber_.digits[4],
+ hoNumber_.digits[5],hoNumber_.digits[6],hoNumber_.digits[7],hoNumber_.digits[8],hoNumber_.digits[9],hoNumber_.digits[10]);
+
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendEndHandover();
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_H3CALLLEG);
+ }
+
+ // Send Handback ACK to the MNET GP10 which originated the Perform Handover.
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK_ACK;
+
+ vcOutMsg.msgData.perfHandbackAck.handCmd.msgLength = (unsigned short) aifMsg.handoverRequestAck.layer3Information.length;
+ memcpy((char*)vcOutMsg.msgData.perfHandbackAck.handCmd.buffer,
+ (char*)aifMsg.handoverRequestAck.layer3Information.layer3Info,
+ (int) aifMsg.handoverRequestAck.layer3Information.length);
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ hoState_ = HAND_ST_ANCH_RCV_EHO_H3_REQ_ACK;
+
+ break;
+ }
+
+ default:
+ {
+ //Deadly problem, need trouble shooting first before running ahead !
+ DBG_ERRORho (" CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+ }
+ };
+
+ // start the T103 timer
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_T103);
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::handleExtPerformHONack(void)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHONack): entering......\n}\n");
+
+ DBG_TRACEho(" Received Perform Handover NACK instead of ACK (hoType=%d, reason=%d, hoAgId_=%d)\n}\n",
+ hoType_, hoaInMsg->msgData.perfExtHandoverAck.reason, hoAgId_);
+
+ // cancel timer
+ parent->sessionTimer->cancelTimer();
+
+ switch( hoType_ )
+ {
+ case HO_TY_EXT_HANDOVER:
+ {
+ // set hoAgId_ to -1 since Handover NACK should have ended the HOA session.
+ hoAgId_ = -1;
+ initData();
+ break;
+ }
+
+ case HO_TY_EXT_HANDMSC3:
+ {
+ // set h3AgId_ to -1 since Handover NACK should have ended the HOA session.
+ h3AgId_ = -1;
+ sendHandbackNack();
+ initExtHandmsc3Data();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHONack): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ case HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3:
+ {
+ // set h3AgId_ to -1 since Handover NACK should have ended the HOA session.
+ h3AgId_ = -1;
+ initHandmsc3Data(); // Put hoState_ back to HAND_ST_ANCH_HO_COMPLT
+ return (handleAnchHoReqNackWiCos(JC_FAILURE_TARGETn_PERFORM_HANDOVER_REQ_NACK));
+ }
+
+ default:
+ {
+ //Deadly problem, need trouble shooting first before running ahead !
+ DBG_ERRORho (" CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+
+ hoEndCause_ = MC_HO_SYSTEM_FAILURE;
+ sendEndHandover();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_CALL);
+ }
+ };
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHONack): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::handleTrgToAnchEndHandover(void)
+ {
+ JCCEvent_t return_val = CC_MESSAGE_PROCESSING_COMPLT;
+ JcSubId_t fromHoAgId = hoaInMsg->origSubId;
+ bool late_endhandover = FALSE;
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleTrgToAnchEndHandover): entering......\n}\n");
+
+ DBG_TRACEho(" Received END HANDOVER. Info:\n");
+ DBG_TRACEho(" (hoType '%d', hoState '%d', origSubId '%d', destSubId '%d', reason '%d')\n",
+ hoType_, hoState_,
+ hoaInMsg->origSubId,
+ hoaInMsg->destSubId,
+ hoaInMsg->msgData.extEndHandover.reason);
+
+ // Check for late END HANDOVER messages
+ // One time this happens is on completion of handover to thirds
+ // the old HOA sends an END HANDOVER when old callleg is released.
+ if ( (hoAgId_ != fromHoAgId) &&
+ (h3AgId_ != fromHoAgId) )
+ {
+ // When PERFORM handover is being sent and PERFORM ACK has
+ // not been received, then hoAgId_ or h3AgId_ has not been assigned
+ // yet, so don't mark it as a late endhandover!
+ if ( ( hoState_ != HAND_ST_ANCH_PERF_EHO_REQ ) &&
+ ( hoState_ != HAND_ST_ANCH_PERF_EHO_H3_REQ ) &&
+ ( hoState_ != HAND_ST_ANCH_EHO_SND_H3_REQ) )
+ {
+ late_endhandover = TRUE;
+ }
+ }
+
+ if ( late_endhandover )
+ {
+ // This is a LATE END HANDOVER message. Discard..
+ DBG_TRACEho(" Late HOA END HANDOVER message received. (hoAgId_=%d, h3AgId_=%d, hoaInMsg->origSubId=%d)\n",
+ hoAgId_, h3AgId_, hoaInMsg->origSubId);
+ return_val = CC_MESSAGE_PROCESSING_COMPLT;
+ }
+ else
+ {
+ switch (hoType_)
+ {
+ case HO_TY_EXT_HANDOVER:
+ {
+ parent->sessionTimer->cancelTimer();
+ // set hoAgId_ to -1 since END HANDOVER received should have ended the HOA session.
+ hoAgId_ = -1;
+ initData();
+ return_val = CC_RELEASE_HOCALLLEG;
+ break;
+ }
+
+ case HO_TY_EXT_HANDBACK:
+ {
+ parent->sessionTimer->cancelTimer();
+ releaseMobAndConnRes();
+ // set hoAgId_ to -1 since END HANDOVER received should have ended the HOA session.
+ hoAgId_ = -1;
+ initData();
+ return_val = CC_RELEASE_HOCALLLEG;
+ break;
+ }
+
+ case HO_TY_EXT_HANDMSC3:
+ case HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3:
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ {
+ if (hoAgId_ == fromHoAgId)
+ {
+ // Received END HANDOVER from 1st HO call leg.
+ hoAgId_ = -1;
+
+ // Send End Handover to THIRD MSC if required
+ if (h3AgId_ != -1)
+ {
+ sendEndHandover();
+ }
+ initData();
+ return_val = CC_RELEASE_HOCALLLEG;
+ }
+ else
+ {
+ // Received END HANDOVER from 2nd HO call leg.
+ h3AgId_ = -1;
+
+ if (hoType_ == HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3)
+ {
+ initHandmsc3Data(); // Reset values (internal handover)
+ }
+ else
+ {
+ initExtHandmsc3Data(); // Reset values (external handover)
+ }
+
+ return_val = CC_RELEASE_H3CALLLEG;
+ }
+ break;
+ }
+
+ default:
+ {
+ //Deadly problem, need shoubleshooting first before running ahead !
+ DBG_ERRORho (" CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ initData();
+ return_val = CC_RELEASE_ALLHOCALLLEG;
+ }
+ }
+
+ emptyRRQueue ();
+ emptyDownlinkQueue();
+ emptyMMQueue ();
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleTrgToAnchEndHandover): leaving.\n}\n");
+
+ return (return_val);
+ }
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchPostExtHoRls(void)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoRls): entering......\n}\n");
+
+ // Send End Handover to the Target and release call
+ DBG_TRACEho(" CC HO INFO @anch-handleAnchPostExtHoRls: got RLS during HO (hoType %d) (hoState %d)\n",
+ hoType_, hoState_);
+
+ // cancel any timers running
+ parent->sessionTimer->cancelTimer();
+
+ switch(hoType_)
+ {
+ case HO_TY_EXT_HANDOVER:
+ case HO_TY_EXT_HANDBACK:
+ {
+ hoEndCause_ = MC_HO_SUCCESS;
+ sendEndHandover();
+
+ // JOE: need to map right cause value
+ parent->hoCallLeg->cleanup(CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING);
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoRls): leaving.\n}\n");
+ return (CC_RELEASE_CALL);
+
+ break;
+ }
+
+ case HO_TY_EXT_HANDMSC3:
+ {
+ hoEndCause_ = MC_HO_SUCCESS;
+ sendEndHandover();
+
+ // JOE: need to map right cause value
+ parent->hoCallLeg->cleanup(CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING);
+ parent->h3CallLeg->cleanup(CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING);
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoRls): leaving.\n}\n");
+ return (CC_RELEASE_CALL);
+
+ break;
+ }
+
+
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ {
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDOVER;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_REMOTE_END_HANDOVER;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ hoEndCause_ = MC_HO_SUCCESS;
+ sendEndHandover();
+
+ parent->hoCallLeg->cleanup(CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING);
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoRls): leaving.\n}\n");
+ return (CC_RELEASE_CALL);
+
+ break;
+ }
+
+ case HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3:
+ {
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDBACK;
+ vcOutMsg.msgData.abortHandover.cause = JC_FAILURE_REMOTE_END_HANDOVER;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ hoEndCause_ = MC_HO_SUCCESS;
+ sendEndHandover();
+
+ parent->h3CallLeg->cleanup(CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING);
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoRls): leaving.\n}\n");
+ return (CC_RELEASE_CALL);
+
+ break;
+ }
+
+ default:
+ {
+ DBG_ERRORho(" CC Error @anch-handleAnchPostExtHoRls: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ break;
+ }
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoRls): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::cleanExtHoCallWiCause(InterEHOMsgType_t msg, JcFailureCause_t cause)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::cleanExtHoCallWiCause): entering......\n}\n");
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::cleanExtHoCallWiCause): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+ }
+
+ void
+ CCAnchorHandover::sendL2MsgToTargetPLMN(T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::sendL2MsgToTargetPLMN): entering......\n}\n");
+
+ //Relay the MS message received to HOA
+ NonStdRasMessagePostHandoverMobEvent_t relaymsg;
+
+ memset( (char*)&relaymsg, 0, sizeof(NonStdRasMessagePostHandoverMobEvent_t));
+
+ relaymsg.header.origSubId = callIndex;
+ relaymsg.header.destSubId = hoAgId_;
+
+ relaymsg.LAYER3PDU.LAYER3DATA[0] = 0x01; //DTAP 1st byte of Distribution Data Unit (Discrimination)
+ relaymsg.LAYER3PDU.LAYER3DATA[1] = 0x80; //DTAP 2nd byte of Distribution Data Unit (FACCH or SDCCH, SAPI0)
+
+ relaymsg.LAYER3PDU.LAYER3DATA[2] = (unsigned char) msEncodedMsg->msgLength; //length of L3 Msg followed
+
+ relaymsg.LAYER3PDU.msglength= (unsigned short) msEncodedMsg->msgLength + 3;
+
+ memcpy((char*) &(relaymsg.LAYER3PDU.LAYER3DATA[3]),
+ (char*) msEncodedMsg->buffer, //body of L3 Msg
+ (int) relaymsg.LAYER3PDU.msglength);
+
+ DBG_TRACEho(" POST MOB EVENT [==>HOA MS MESSAGE] (hoAgId=%d,callId=%d, msEncodedMsg->msgLength=%d)\n",
+ hoAgId_, callIndex, msEncodedMsg->msgLength);
+ DBG_TRACEho(" {");
+ DBG_HEXDUMPho((unsigned char*) &(relaymsg.LAYER3PDU.LAYER3DATA[0]), relaymsg.LAYER3PDU.msglength + 20 );
+ DBG_TRACEho("}\n");
+
+ if (!VBLinkPostHandoverMobEvent(&relaymsg))
+ {
+ DBG_ERRORho("{\nMNEThoERROR(CCAnchorHandover::sendRRMsgToTargetPLMN): VBLinkPostHandoverMobEvent API failed !\n}\n");
+ DBG_HEXDUMPho((unsigned char*) &relaymsg, relaymsg.LAYER3PDU.msglength + 3);
+ DBG_TRACEho("}\n");
+
+ hoEndCause_ = MC_HO_SYSTEM_FAILURE; //EHOcause
+
+ return;
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::sendL2MsgToTargetCC): leaving.\n}\n");
+ }
+
+ void
+ CCAnchorHandover::sendRRMsgToTargetPLMN(IntraL3Msg_t *rrMsg)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::sendRRMsgToTargetPLMN): entering......\n}\n");
+
+ DBG_TRACEho(" MNET does NOT forward RR Msgs to target PLMN! rrMsg message_type (%d)\n",
+ (int) rrMsg->message_type );
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::sendRRMsgToTargetPLMN): leaving.\n}\n");
+ }
+
+ void
+ CCAnchorHandover::sendMMMsgToRemotePLMN (IntraL3Msg_t *mmMsg)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::sendMMMsgToRemotePLMN): entering......\n}\n");
+
+ DBG_TRACEho(" MNET does NOT forward MM Msgs to target PLMN! mmMsg message_type (%d)\n",
+ (int) mmMsg->message_type );
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::sendMMMsgToRemotePLMN): leaving.\n}\n");
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchExtHoTimerExpiry(void)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoTimerExpiry): entering......\n}\n");
+
+ DBG_ERRORho(" CC Timeout: External Handover expiry (hoSt %d, hoTyp %d)\n",
+ hoState_, hoType_);
+
+ switch (hoType_)
+ {
+ case HO_TY_EXT_HANDOVER:
+ {
+ hoEndCause_ = MC_HO_T204_TIMEOUT;
+ sendEndHandover();
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoTimerExpiry): leaving.\n}\n");
+ return ( CC_RELEASE_HOCALLLEG );
+ }
+
+ case HO_TY_EXT_HANDBACK:
+ {
+ releaseMobAndConnRes();
+ hoEndCause_ = MC_HO_T204_TIMEOUT;
+ sendHandbackNack();
+ initExtHandbackData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoTimerExpiry): leaving.\n}\n");
+ return ( CC_MESSAGE_PROCESSING_COMPLT );
+ }
+
+ case HO_TY_EXT_HANDMSC3:
+ {
+ hoEndCause_ = MC_HO_T204_TIMEOUT;
+ sendHandbackNack();
+ initExtHandmsc3Data();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoTimerExpiry): leaving.\n}\n");
+ return ( CC_MESSAGE_PROCESSING_COMPLT );
+ }
+
+ case HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3:
+ {
+ hoEndCause_ = MC_HO_T204_TIMEOUT;
+ sendEndHandover();
+ initHandmsc3Data(); // Set state back to HAND_ST_ANCH_HO_COMPLT
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoTimerExpiry): leaving.\n}\n");
+ return ( CC_RELEASE_H3CALLLEG );
+ }
+
+ default:
+ {
+ //Deadly problem, release call and troubleshoot asap!
+ DBG_ERRORho(" CC Ho Error: messed up at (hoSt %d, hoTyp %d, rc %d)\n",
+ hoState_, hoType_, hoRetry_);
+ initData();
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoTimerExpiry): leaving.\n}\n");
+ return(CC_RELEASE_ALLHOCALLLEG);
+ }
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoTimerExpiry): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchPostExtHoMobEvent(void)
+ {
+ TwoPartyCallLeg *whichLeg;
+ short discrimination_val;
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoMobEvent): entering......\n}\n");
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((whichLeg = parent->activeLeg()) == NULL)
+ {
+ // abort handover
+ DBG_TRACEho(" No active leg (hoType %d, hoState %d)\n", hoType_, hoState_);
+
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendEndHandover();
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoMobEvent): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+ }
+
+ discrimination_val = hoaInMsg->msgData.postExtHoMobEventData.LAYER3PDU.LAYER3DATA[0] & 0x1;
+
+ switch (discrimination_val)
+ {
+ case 0: // For BSSMAP msgs
+ {
+ DBG_TRACEho(" Received BSSMAP msg. Doing nothing.\n");
+ break;
+ }
+
+ case 1: // For DTAP msgs
+ {
+ T_CNI_RIL3MD_CCMM_MSG msMsg;
+
+ msMsg.module_id = MODULE_MD;
+ msMsg.entry_id = parent->entryId;
+ msMsg.lapdm_oid = parent->oid;
+// msMsg.l3_id
+// msMsg.sapi
+ msMsg.primitive_type = L23PT_DL_DATA_IND;
+
+ msMsg.l3_data.msgLength = hoaInMsg->msgData.postExtHoMobEventData.LAYER3PDU.LAYER3DATA[2];
+ if (msMsg.l3_data.msgLength <= CNI_LAPDM_MAX_L3MSG_LENGTH)
+ {
+ memcpy( msMsg.l3_data.buffer,
+ &(hoaInMsg->msgData.postExtHoMobEventData.LAYER3PDU.LAYER3DATA[3]),
+ msMsg.l3_data.msgLength );
+
+ DBG_TRACEho(" Handling the following Mobile Event.\n");
+ DBG_TRACEho(" - module_id (%d) \n", msMsg.module_id);
+ DBG_TRACEho(" - entry_id (%d) \n", msMsg.entry_id);
+ DBG_TRACEho(" - lapdm_oid (%d) \n", msMsg.lapdm_oid);
+ DBG_TRACEho(" - primitive_type (%d) \n", msMsg.primitive_type);
+ DBG_TRACEho(" - l3_id: unknown\n");
+ DBG_TRACEho(" - sapi: unknown\n");
+
+ DBG_TRACEho(" - l3_data HEXDUMP:\n" );
+ DBG_HEXDUMPho((unsigned char*) msMsg.l3_data.buffer, msMsg.l3_data.msgLength );
+ DBG_TRACEho("\n");
+
+ parent->handleMobMsg(&msMsg);
+ }
+ else
+ {
+ DBG_ERRORho(" Layer3 PDU TOO LONG (msgLength %d)\n", msMsg.l3_data.msgLength);
+ }
+
+ break;
+ }
+
+ default:
+ {
+ DBG_ERRORho(" UNKNOWN discrimation value (discrimination_val %d)\n", discrimination_val);
+ }
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoMobEvent): leaving.\n}\n");
+ return(CC_MESSAGE_PROCESSING_COMPLT);
+
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchExtHoReqAck(void)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoReqAck): entering......\n}\n");
+
+ // cancel timer
+ parent->sessionTimer->cancelTimer();
+
+ TwoPartyCallLeg *whichLeg;
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((whichLeg = parent->activeLeg()) == NULL)
+ {
+ DBG_TRACEho(" No active leg (hoType %d, hoState %d)\n}\n", hoType_, hoState_);
+
+ releaseMobAndConnRes();
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendEndHandover();
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoReqAck): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+ }
+
+ T_CNI_L3_ID newId;
+ newId.msgq_id = msgQId;
+ newId.sub_id = 0; // No sub id needed here
+
+ if (parent->setIrt (mmInMsg->entry_id, newId) == false)
+ {
+ DBG_ERRORho(" Error: Not able to setIrt\n");
+
+ releaseMobAndConnRes();
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendHandbackNack();
+ initExtHandbackData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoReqAck): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ // Setup the entry id, oid, and sapi
+ parent->entryId = mmInMsg->entry_id;
+
+ // GET OID AND SAPI
+ T_CNI_RIL3_IRT_ENTRY irtEntry;
+ irtEntry.entry_id = mmInMsg->entry_id;
+
+ if ( (CNI_RIL3_IRT_Get_Entry_by_Entry_ID(&irtEntry))
+ == false )
+ {
+ DBG_ERRORho(" CC Call Error : IRT Table problem for (entry id = %d)\n ",
+ mmInMsg->entry_id);
+
+ releaseMobAndConnRes();
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendHandbackNack();
+ initExtHandbackData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoReqAck): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ parent->oid = irtEntry.lapdm_oid;
+
+ // Send the Perform Ack message.
+
+ sendHandbackAck();
+
+ // start the T104 timer
+ parent->sessionTimer->setTimer(CALL_HAND_TRG_T104);
+
+ DBG_TRACEho(" [<==CC START TIMER T104] (hoAgId=%d, callId=%d, T104=%d)\n",
+ hoAgId_, callIndex, (int)CALL_HAND_TRG_T104);
+
+ hoState_ = HAND_ST_ANCH_SND_EHB_REQ_ACK;
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoReqAck): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+
+
+ JCCEvent_t
+ CCAnchorHandover::sendHandbackAck(void)
+ {
+ SpeechChann_t currSpeechCh;
+ int choosenEncryption;
+ T_AIF_MSG temp_aifMsg = aifMsg; // copy for ext handover to third MSC purpose
+ //Populate data for encoding A-HANDOVER-ACKNOWLEDGE message
+ A_Handover_Request_Ack_t *pRequestAck = (A_Handover_Request_Ack_t*) &aifMsg.handoverRequestAck;
+
+ //Mandatory IEs
+ pRequestAck->msgType = A_HANDOVER_REQUEST_ACK_TYPE;
+ pRequestAck->layer3Information.ie_present = true;
+ pRequestAck->layer3Information.elementIdentifier = A_LAYER3_INFORMATION_TYPE;
+
+ switch( hoType_ )
+ {
+ case HO_TY_EXT_HANDBACK:
+ {
+ pRequestAck->layer3Information.length = (unsigned char) mmInMsg->l3_data.handReqAck.handCmd.msgLength;
+ memcpy((char*)pRequestAck->layer3Information.layer3Info,
+ (char*)mmInMsg->l3_data.handReqAck.handCmd.buffer,
+ (int) mmInMsg->l3_data.handReqAck.handCmd.msgLength);
+ break;
+ }
+
+ case HO_TY_EXT_HANDMSC3:
+ {
+ pRequestAck->layer3Information.length = (unsigned char) temp_aifMsg.handoverRequestAck.layer3Information.length;
+ memcpy((char*)pRequestAck->layer3Information.layer3Info,
+ (char*)temp_aifMsg.handoverRequestAck.layer3Information.layer3Info,
+ (int) temp_aifMsg.handoverRequestAck.layer3Information.length);
+ break;
+ }
+
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ {
+ pRequestAck->layer3Information.length = (unsigned char) vcInMsg->msgData.perfHandoverAck.handCmd.msgLength;
+ memcpy((char*)pRequestAck->layer3Information.layer3Info,
+ (char*)vcInMsg->msgData.perfHandoverAck.handCmd.buffer,
+ (int) vcInMsg->msgData.perfHandoverAck.handCmd.msgLength);
+ break;
+ }
+
+ default:
+ {
+ //Deadly problem, need trouble shooting first before running ahead !
+ DBG_ERRORho (" CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ initData();
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+ }
+ };
+
+ //Optional IEs
+ pRequestAck->chosenChannel.ie_present = true;
+ pRequestAck->chosenChannel.elementIdentifier = A_CHOSEN_CHANNEL_TYPE;
+ pRequestAck->chosenChannel.channelMode = 9; //speech (full/half)
+ pRequestAck->chosenChannel.channel = 4; //Eight TCH full
+
+ pRequestAck->speechVersionChosen.ie_present = true;
+ pRequestAck->speechVersionChosen.elementIdentifier= A_SPEECH_VERSION_TYPE;
+ currSpeechCh = parent->currSpeechCh();
+ if (currSpeechCh.version == CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1)
+ pRequestAck->speechVersionChosen.speechVersionId = 0x01;
+ else if (currSpeechCh.version == CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_2)
+ pRequestAck->speechVersionChosen.speechVersionId = 0x21;
+ else if (currSpeechCh.version == CNI_RIL3_GSM_HALF_RATE_SPEECH_VERSION_1)
+ pRequestAck->speechVersionChosen.speechVersionId = 0x05;
+ else
+ {
+ DBG_ERRORho(" CC Internal error (speechVer=%d)\n",
+ currSpeechCh_.version);
+
+ releaseMobAndConnRes();
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendHandbackNack();
+ initExtHandbackData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::sendHandbackAck): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ choosenEncryption = selectEncryption();
+
+ pRequestAck->chosenEncryptAlgorithm.ie_present = true;
+ pRequestAck->chosenEncryptAlgorithm.elementIdentifier = A_CHOSEN_ENCRYPTION_ALGORITHM_TYPE;
+ if (choosenEncryption == -1)
+ {
+ pRequestAck->chosenEncryptAlgorithm.algorithmId = 0x01; //no encryption used
+ } else if (choosenEncryption == CNI_RIL3_CIPHER_ALGORITHM_A51)
+ {
+ pRequestAck->chosenEncryptAlgorithm.algorithmId = 0x02; //A51 used
+ } else if (choosenEncryption == CNI_RIL3_CIPHER_ALGORITHM_A52)
+ {
+ pRequestAck->chosenEncryptAlgorithm.algorithmId = 0x03; //A52 used
+ } else
+ {
+ DBG_ERRORho(" CC Internal error (choosenEncryption=%d)\n",
+ choosenEncryption);
+
+ releaseMobAndConnRes();
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendHandbackNack();
+ initExtHandbackData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::sendHandbackAck): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //Encode A-MSG: HANDOVER REQUEST ACKNOWLEDGE
+ A_Result_t result;
+ NonStdRasMessagePerformHandbackAck_t requestAck;
+
+ memset( (char*) &requestAck, 0, sizeof(NonStdRasMessagePerformHandbackAck_t) );
+ if ( A_RESULT_SUCCESS != (result=
+ AIF_Encode(&aifMsg, (T_AIF_MessageUnit*)&requestAck.A_INTERFACE_MSG) ) )
+ {
+ DBG_ERRORho(" A-HANDOVER-REQUEST-ACKNOWLEDGE encoding failed (result=%d)\n",
+ result);
+
+ releaseMobAndConnRes();
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendHandbackNack();
+ initExtHandbackData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::sendHandbackAck): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //Send PERFORM-HANDOVER-ACK (positive) to HOA
+ //requestAck.reason = 0;
+ requestAck.header.origSubId = callIndex;
+ requestAck.header.destSubId = hoAgId_;
+ requestAck.reason = MC_HO_SUCCESS;
+
+ if (!VBLinkPerformHandbackAck(&requestAck))
+ {
+ DBG_ERRORho(" VBLinkPerformHandbackAck API failed !\n",
+ result);
+ DBG_HEXDUMPho( (unsigned char*) &requestAck,
+ (int) (requestAck.A_INTERFACE_MSG.msglength+6));
+ DBG_ERRORho("}\n");
+
+ releaseMobAndConnRes();
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendHandbackNack();
+ initExtHandbackData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::sendHandbackAck): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ DBG_TRACEho(" [==>HOA PERFORM_HANDBACK_ACK(p)] (hoAgId=%d,callIndex=%d,entryId=%d)\n}\n",
+ hoAgId_, callIndex, mmInMsg->entry_id);
+ }
+
+ JCCEvent_t
+ CCAnchorHandover::sendHandbackNack(void)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::sendHandbackNack): entering......\n}\n");
+
+ //Send HANDBACK_NACK (which is really a HANDBACK ACK with a reason code other than SUCCESS)
+ NonStdRasMessagePerformHandbackAck_t handbackAck;
+
+ memset( (char*)&handbackAck, 0, sizeof(NonStdRasMessagePerformHandbackAck_t));
+ // Note: handbackAck's A_INTERFACE_MSG will be all zeros for a NACK.
+ handbackAck.header.origSubId = callIndex;
+ handbackAck.header.destSubId = hoAgId_;
+ handbackAck.reason = hoEndCause_;
+
+ if (!VBLinkPerformHandbackAck(&handbackAck))
+ {
+ DBG_ERRORho(" VBLinkPerformHandbackAck API FAILED\n");
+ } else
+ {
+ DBG_TRACEho(" Sent to HOA HANDBACK NACK (hoAgId=%d,callId=%d,entryId=%d,reason=%d)\n",
+ hoAgId_, callIndex, parent->entryId, hoEndCause_);
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::sendHandbackNack): leaving.\n}\n");
+
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchExtHOT104TimerExpiry(void)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHOT104TimerExpiry): entering......\n}\n");
+
+ releaseMobAndConnRes();
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendEndHandover();
+ initData();
+
+ // JOE: check 03.09 spec as to whether should release entire call (take it all down) or send END HANDOVER
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHOT104TimerExpiry): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchExtHoComplt(void)
+ {
+ TwoPartyCallLeg *whichLeg;
+ bool sig_and_voice_complete = false;
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoComplt): entering......\n}\n");
+
+ switch( hoType_ )
+ {
+ case HO_TY_EXT_HANDOVER:
+ {
+ // cancel T103 timer only if VoIP CONNECT was received.
+ if (parent->hoCallLeg->voiceConnected)
+ {
+ parent->sessionTimer->cancelTimer();
+
+ DBG_TRACEho(" [==>HOA HANDOVER-COMPLETE both signaling and voice] (hoType=%d, hoAgId=%d,callId=%d,entryId=%d)\n",
+ hoType_, hoAgId_, callIndex, parent->entryId);
+
+ sig_and_voice_complete = true;
+ }
+ else
+ {
+ DBG_TRACEho(" [==>HOA HANDOVER-COMPLETE signaling only] (hoType=%d, hoAgId=%d,callId=%d,entryId=%d)\n",
+ hoType_, hoAgId_, callIndex, parent->entryId);
+
+ sig_and_voice_complete = false;
+ }
+
+ break;
+ }
+
+ case HO_TY_EXT_HANDBACK:
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ {
+ // cancel T103 timer always
+ parent->sessionTimer->cancelTimer();
+
+ DBG_TRACEho(" [==>HOA HANDBACK-COMPLETE] (hoAgId=%d,callId=%d,entryId=%d)\n",
+ hoAgId_, callIndex, parent->entryId);
+
+ sig_and_voice_complete = true;
+ break;
+ }
+
+ case HO_TY_EXT_HANDMSC3:
+ case HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3:
+ {
+ // cancel T103 timer only if VoIP CONNECT was received.
+ if (parent->h3CallLeg->voiceConnected)
+ {
+ parent->sessionTimer->cancelTimer();
+
+ DBG_TRACEho(" [==>HOA HANDOVER-COMPLETE both signaling and voice] (hoType=%d, hoAgId=%d, h3AgId=%d, callId=%d,entryId=%d)\n",
+ hoType_, hoAgId_, h3AgId_, callIndex, parent->entryId);
+
+ sig_and_voice_complete = true;
+ }
+ else
+ {
+ DBG_TRACEho(" [==>HOA HANDOVER-COMPLETE signaling only] (hoType=%d, hoAgId=%d, h3AgId=%d, callId=%d, entryId=%d)\n",
+ hoType_, hoAgId_, h3AgId_, callIndex, parent->entryId);
+
+ sig_and_voice_complete = false;
+ }
+
+ break;
+ }
+
+ default:
+ {
+ //Deadly problem, need trouble shooting first before running ahead !
+ DBG_ERRORho (" CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ initData();
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_ALLHOCALLLEG);
+ }
+ }
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((whichLeg = parent->activeLeg()) == NULL)
+ {
+ DBG_TRACEho(" No active leg (hoType %d, hoState %d)\n}\n", hoType_, hoState_);
+
+ releaseMobAndConnRes();
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendEndHandover();
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_ALLHOCALLLEG);
+ }
+
+ //Do CDR
+ T_CNI_RIL3_IE_LOCATION_AREA_ID lai;
+ T_CNI_RIL3_IE_CELL_ID ci;
+
+ switch( hoType_ )
+ {
+ case HO_TY_EXT_HANDOVER:
+ {
+ ci.ie_present = true;
+ ci.value = ((short)(hoGlobalCellId_.ci));
+ lai.ie_present = true;
+ lai.mcc[0] = ((unsigned char*)&(hoGlobalCellId_.mcc))[0];
+ lai.mcc[1] = ((unsigned char*)&(hoGlobalCellId_.mcc))[1];
+ lai.mcc[2] = ((unsigned char*)&(hoGlobalCellId_.mcc))[2];
+ lai.mnc[0] = ((unsigned char*)&(hoGlobalCellId_.mnc))[0];
+ lai.mnc[1] = ((unsigned char*)&(hoGlobalCellId_.mnc))[1];
+ lai.mnc[2] = ((unsigned char*)&(hoGlobalCellId_.mnc))[2];
+ lai.lac = ((short)(hoGlobalCellId_.lac));
+ break;
+ }
+
+ case HO_TY_EXT_HANDBACK:
+ {
+ ci.ie_present = true;
+ ci.value = ((short)(ccBtsBasicPackage.bts_ci));
+ lai.ie_present = true;
+ lai.mcc[0] = ((unsigned char*)&(ccBtsBasicPackage.bts_mcc))[0];
+ lai.mcc[1] = ((unsigned char*)&(ccBtsBasicPackage.bts_mcc))[1];
+ lai.mcc[2] = ((unsigned char*)&(ccBtsBasicPackage.bts_mcc))[2];
+ lai.mnc[0] = ((unsigned char*)&(ccBtsBasicPackage.bts_mnc))[0];
+ lai.mnc[1] = ((unsigned char*)&(ccBtsBasicPackage.bts_mnc))[1];
+ lai.mnc[2] = ((unsigned char*)&(ccBtsBasicPackage.bts_mnc))[2];
+ lai.lac = ((short)(ccBtsBasicPackage.bts_lac));
+ break;
+ }
+
+ case HO_TY_EXT_HANDMSC3:
+ case HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3:
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ {
+ ci.ie_present = true;
+ ci.value = ((short)(h3GlobalCellId_.ci));
+ lai.ie_present = true;
+ lai.mcc[0] = ((unsigned char*)&(h3GlobalCellId_.mcc))[0];
+ lai.mcc[1] = ((unsigned char*)&(h3GlobalCellId_.mcc))[1];
+ lai.mcc[2] = ((unsigned char*)&(h3GlobalCellId_.mcc))[2];
+ lai.mnc[0] = ((unsigned char*)&(h3GlobalCellId_.mnc))[0];
+ lai.mnc[1] = ((unsigned char*)&(h3GlobalCellId_.mnc))[1];
+ lai.mnc[2] = ((unsigned char*)&(h3GlobalCellId_.mnc))[2];
+ lai.lac = ((short)(h3GlobalCellId_.lac));
+ break;
+ }
+
+ default:
+ {
+ //Deadly problem, need trouble shooting first before running ahead !
+ DBG_ERRORho (" CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ initData();
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_ALLHOCALLLEG);
+ }
+ };
+
+ if ( (parent->callLeg1->msSide != NULL) &&
+ (parent->callLeg1->msSide->callState_ == HC_ST_ACTIVE) )
+ parent->callLeg1->ccCdr.handover(&lai, &ci);
+ if ( (parent->callLeg2->msSide != NULL) &&
+ (parent->callLeg2->msSide->callState_ == HC_ST_ACTIVE) )
+ parent->callLeg2->ccCdr.handover(&lai, &ci);
+ //CDR END
+
+ // Relay HANDOVER SUCCESS
+ switch( hoType_ )
+ {
+ case HO_TY_EXT_HANDOVER:
+ {
+ // Release rf and RTP connections
+ hoSimplexConnected_ = true; // JOE: so GSM RTP connections will be
+ // released in releaseMobAndConnRes()
+ releaseMobAndConnRes();
+
+ hoSimplexConnected_ = false;
+ hoSrcLinkLost_ = false;
+
+ break;
+ }
+
+ case HO_TY_EXT_HANDBACK:
+ case HO_TY_EXT_HANDMSC3:
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ {
+ // Send HANDOVER SUCCESS to PLMN
+ // Populate data for encoding A-HANDOVER-COMPLETE message
+ memset(&aifMsg, 0, sizeof(A_Handover_Complete_t));
+
+ A_Handover_Complete_t *pComplete = (A_Handover_Complete_t*) &aifMsg.handoverComplete;
+
+ //Mandatory IEs
+ pComplete->msgType = A_HANDOVER_COMPLETE_TYPE;
+
+ //Optional IEs
+ pComplete->rrCause.ie_present = true;
+ pComplete->rrCause.elementIdentifier = A_RR_CAUSE_TYPE;
+ pComplete->rrCause.rrCause = 0; //normal event
+
+ //Encode A-MSG: HANDOVER REQUEST ACKNOWLEDGE
+ A_Result_t result;
+ NonStdRasMessageHandoverSuccess_t hoSuccess;
+
+ memset( (char*) &hoSuccess, 0, sizeof(NonStdRasMessageHandoverSuccess_t) );
+ if ( A_RESULT_SUCCESS != (result=
+ AIF_Encode(&aifMsg, (T_AIF_MessageUnit*)&hoSuccess.A_INTERFACE_MSG) ) )
+ {
+ DBG_ERRORho(" A-HANDOVER-COMPLETE encoding FAILED (result=%d)\n",
+ result);
+
+ // Really caught in a bad place. Mobile has already handed back and
+ // an internal error occured. So, just continue on and hope for the best!
+ DBG_TRACEho(" Continue processing HANDOVER SUCCESS anyways.\n");
+ }
+
+ // Send HANDOVER-SUCCESS to HOA
+ hoSuccess.header.origSubId = callIndex;
+ hoSuccess.header.destSubId = hoAgId_;
+
+ if (!VBLinkHandoverSuccess(&hoSuccess))
+ {
+ DBG_ERRORho(" VBLinkHandoverSuccess API failed!\n");
+ DBG_HEXDUMPho( (unsigned char*) &hoSuccess,
+ (int) (hoSuccess.A_INTERFACE_MSG.msglength+4));
+ DBG_ERRORho("}\n");
+
+ // Really caught in a bad place. Mobile has already handed back and
+ // an internal error occured. So, just continue on and hope for the best!
+ DBG_TRACEho(" Continue processing HANDOVER SUCCESS anyways.\n");
+ }
+
+ break;
+ }
+
+ case HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3:
+ {
+ // Non-anchor MNET GP10 to external PLMN handback
+ // Send HANDOVER SUCCESS (Complete Handback) to MNET GP10
+
+ vcOutMsg.msgType = INTER_VC_CC_COMPLETE_HANDBACK;
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ break;
+ }
+
+ default:
+ {
+ //Deadly problem, need trouble shooting first before running ahead !
+ DBG_ERRORho (" CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ initData();
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_ALLHOCALLLEG);
+ }
+ };
+
+
+ if (whichLeg->voiceConnected)
+ {
+ // Call is not held at this point for some reason.
+
+ // First take down the earlier connection
+
+ // Break the connections with the RTP Port
+ T_CSU_PORT_ID hoRtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ switch( hoType_ )
+ {
+ case HO_TY_EXT_HANDOVER:
+ {
+ // do nothing (no connections to break)
+ hoRtpSourcePort.portType = CSU_NIL_PORT;
+ break;
+ }
+
+ case HO_TY_EXT_HANDBACK:
+ case HO_TY_EXT_HANDMSC3:
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ {
+ hoRtpSourcePort.portType = CSU_RTP_PORT;
+ hoRtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(parent->hoCallLeg->h323CallHandle);
+ break;
+ }
+
+ case HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3:
+ {
+ hoRtpSourcePort.portType = CSU_RTP_PORT;
+ hoRtpSourcePort.portId.rtpHandler = hoRtpSession_;
+ break;
+ }
+
+ default:
+ {
+ //Deadly problem, need trouble shooting first before running ahead !
+ DBG_ERRORho (" CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ initData();
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_ALLHOCALLLEG);
+ }
+ };
+
+ if (hoRtpSourcePort.portType != CSU_NIL_PORT)
+ {
+ if ((csuResult = csu_OrigTermBreakAll(&hoRtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERRORho(" CSU Error : Ho Disconn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)hoRtpSourcePort.portId.rtpHandler);
+
+ // Release the Ho RTP channel
+ ReleaseHandoverRtpChannel(hoRtpSourcePort.portId.rtpHandler);
+ parent->hoCallLeg->h323CallHandle = VOIP_NULL_CALL_HANDLE;
+
+ // Really caught in a bad place. Mobile has already handed back and
+ // an internal error occured. So, just continue on and hope for the best!
+ DBG_TRACEho(" Continue processing HANDOVER SUCCESS anyways.\n");
+ }
+
+ // voice is broken
+ whichLeg->voiceConnected = false;
+ }
+
+ // Complete the connection
+ // Make a duplex connection between the remote rtp channel and the rf channel
+ T_CSU_PORT_ID rfSinkPort, rtpSourcePort;
+
+ switch( hoType_ )
+ {
+ case HO_TY_EXT_HANDOVER:
+ {
+ rfSinkPort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portType = CSU_RTP_PORT;
+
+ rfSinkPort.portId.rtpHandler = VoipCallGetRTPHandle(whichLeg->h323CallHandle);
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(parent->hoCallLeg->h323CallHandle);
+ break;
+ }
+
+ case HO_TY_EXT_HANDBACK:
+ {
+ rfSinkPort.portType = CSU_GSM_PORT;
+ rtpSourcePort.portType = CSU_RTP_PORT;
+
+ rfSinkPort.portId.gsmHandler = parent->entryId;
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(whichLeg->h323CallHandle);
+ break;
+ }
+
+ case HO_TY_EXT_HANDMSC3:
+ case HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3:
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ {
+ rfSinkPort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portType = CSU_RTP_PORT;
+
+ rfSinkPort.portId.rtpHandler = VoipCallGetRTPHandle(whichLeg->h323CallHandle);
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(parent->h3CallLeg->h323CallHandle);
+ break;
+ }
+
+ default:
+ {
+ //Deadly problem, need trouble shooting first before running ahead !
+ DBG_ERRORho (" CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ initData();
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+ }
+ };
+
+
+ if ((csuResult = csu_DuplexConnect(&rfSinkPort, &rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+
+ DBG_ERRORho("CSU Error : Ho Duplex Conn. Failure, (Result = %d) for (rtp port = %x) and (entryId = %d)\n",
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler,
+ parent->entryId);
+
+ // Really caught in a bad place. Mobile has already handed back and
+ // an internal error occured. So, just continue on and hope for the best!
+ DBG_TRACEho(" Continue processing HANDOVER SUCCESS anyways.\n");
+
+ }
+ whichLeg->voiceConnected = true;
+
+ }
+
+ // empty the queues now that the handover is successful
+ // Do this only at the end.
+ emptyRRQueue ();
+ emptyDownlinkQueue();
+ emptyMMQueue ();
+
+ switch( hoType_ )
+ {
+ case HO_TY_EXT_HANDOVER:
+ {
+ hoState_ = HAND_ST_ANCH_EHO_COMPLT;
+ break;
+ }
+ case HO_TY_EXT_HANDBACK:
+ {
+ // Send DISCONNECT (RELEASE COMPLETE) to VoIP (PLMN)
+ parent->hoCallLeg->disconnectOrigExtHo();
+
+ initData();
+ break;
+ }
+
+ case HO_TY_EXT_HANDMSC3:
+ {
+ // Send DISCONNECT (RELEASE COMPLETE) to VoIP (PLMN)
+ parent->hoCallLeg->disconnectOrigExtHo();
+
+ // Need to swap HO with H3 data only if signalling AND voice are completed
+ if (sig_and_voice_complete)
+ {
+ swapH3Data();
+ hoType_ = HO_TY_EXT_HANDOVER;
+ }
+
+ // Note: if signalling and voice is NOT completed, leave hoType_ as
+ // it is (don't reset it to HO_TY_EXT_HANDOVER) since when
+ // voice gets completed, the hoType will signify if swapH3Data is needed.
+
+ hoState_ = HAND_ST_ANCH_EHO_COMPLT;
+ break;
+ }
+
+ case HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3:
+ {
+ // Release Inter-GP10 RTP ports.
+ if ( hoRtpSession_ != NULL )
+ {
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ }
+
+ // Need to swap HO with H3 data only if signalling AND voice are completed
+ if (sig_and_voice_complete)
+ {
+ swapH3Data();
+ hoType_ = HO_TY_EXT_HANDOVER;
+ }
+
+ // Note: if signalling and voice is NOT completed, leave hoType_ as
+ // it is (don't reset it to HO_TY_EXT_HANDOVER) since when
+ // voice gets completed, the hoType will signify if swapH3Data is needed.
+
+ hoState_ = HAND_ST_ANCH_EHO_COMPLT;
+ break;
+ }
+
+ case HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR:
+ {
+ // clear up external handover data
+ hoAgId_ = -1;
+ h3AgId_ = -1;
+
+ // JOE: clear everything to make it look like a normal GP10 to GP10 handover took place.
+ hoType_ = HO_TY_HANDOVER;
+ hoState_ = HAND_ST_ANCH_HO_COMPLT; // Leave in state after normal inter-GP10 handover
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoComplt): leaving.\n}\n");
+ return (CC_RELEASE_ALLHOCALLLEG);
+ }
+
+ default:
+ {
+ //Deadly problem, need trouble shooting first before running ahead !
+ DBG_ERRORho (" CC Error: messed up (hoType: %d) (hoState: %d)\n",
+ hoType_, hoState_);
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_RELEASE_ALLHOCALLLEG);
+ }
+ };
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoComplt): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+
+ void
+ CCAnchorHandover::swapH3Data(void)
+ {
+ HOCallLeg * tempCallLeg;
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::swapH3Data): entering......\n}\n");
+
+ DBG_TRACEho(" Swapping the following handover data.\n");
+ DBG_TRACEho(" - hoAgId_ (%d) with h3AgId_ (%d)\n", hoAgId_, h3AgId_);
+ DBG_TRACEho(" - hoCallLeg (%d) with h3CallLeg (%d)\n", parent->hoCallLeg, parent->h3CallLeg);
+
+ hoAgId_ = h3AgId_;
+ h3AgId_ = -1;
+
+ tempCallLeg = parent->hoCallLeg;
+ parent->hoCallLeg = parent->h3CallLeg;
+ parent->h3CallLeg = tempCallLeg;
+ // parent->h3CallLeg->initData(); //JOE: some sort of cleanup for h3CallLeg should be done
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::swapH3Data): leaving.\n}\n");
+ }
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchExtHoFail(void)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoFail): entering......\n}\n");
+
+ DBG_TRACEho(" [<==RR HANDOVER FAILURE](callId=%d,entryId=%d)\n",
+ callIndex, parent->entryId);
+
+ //cancel T204
+ parent->sessionTimer->cancelTimer();
+
+ //Send EndHandover to Target (as opposed to HANDOVER FAILURE) specified by 03.09
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendEndHandover();
+ hoAgId_ = -1; // since EndHandover was sent.
+
+
+ //Retry next candidate if there is candidate
+ int i;
+ IntraL3HandoverRequired_t *inMsg = &handReqd;
+
+ if ( (i=getNextHoCandidate()) == (-1) )
+ {
+ DBG_TRACEho(" No more candidate to retry (#ofCands=%d)\n",
+ inMsg->numCandidates);
+
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoFail): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+ } else
+ {
+ candGlobalCellId_t candidate;
+ candidate = inMsg->candGlobalCellId[i];
+
+ DBG_TRACEho(" Trying next cand cell! %d-th of Cands(%d) candCell(%x,%x%x%x,%x%x%x,%x,%x) hoType(%d) hoState(%d)\n",
+ i,inMsg->numCandidates,
+ candidate.candGlobalCellId.mcc[0],candidate.candGlobalCellId.mcc[1],candidate.candGlobalCellId.mcc[2],
+ candidate.candGlobalCellId.mnc[0],candidate.candGlobalCellId.mnc[1],candidate.candGlobalCellId.mnc[2],
+ candidate.candGlobalCellId.lac, candidate.candGlobalCellId.ci,
+ hoType_, hoState_);
+
+ if (candidate.candIsExternal)
+ {
+ A_Result_t A_result;
+ T_AIF_MessageUnit a_msg;
+
+ NonStdRasMessagePerformHandoverRQ_t Msg;
+
+ //External handover from anchor GP to PLMN case
+ populateAHandoverRequest( &MY_GLOBALCELL_ID, &candidate.candGlobalCellId );
+
+ if ((A_result = AIF_Encode( &aifMsg, &a_msg )) != A_RESULT_SUCCESS)
+ {
+ // Couldn't encode Perform Handover A-Interface msg.
+ DBG_ERRORho (" A Interface encoding Error: Perform Handover Request. Result (%d)\n",
+ (int) A_result);
+ initData();
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoFail): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+ }
+
+ memset( (char*)&Msg, 0, sizeof(NonStdRasMessagePerformHandoverRQ_t));
+
+ Msg.A_HANDOVER_REQUEST.msglength = a_msg.msgLength;
+ memcpy(Msg.A_HANDOVER_REQUEST.A_INTERFACE_DATA,
+ (unsigned char*)a_msg.buffer, MAX_A_INTERFACE_LEN);
+
+ Msg.header.origSubId = callIndex;
+ // Note: destSubId (hoAgId) needs to be -1 to make GMC assign a NEW HOA.
+ Msg.header.destSubId = -1; // NULL (unknown hoAgId - GMC will assign)
+ Msg.globalCellID = hoGlobalCellId_;
+ Msg.hoCause = rrInMsg->l3_data.handReqd.hoCause;
+ Msg.hoNumberReqd = true; // Always TRUE
+ Msg.handoverNumber.ie_present = false; // NULL (unknown handoverNumber - GMC will assign)
+ Msg.mscNumber.ie_present = false; // NULL (unknown mscNumber - GMC will find out)
+
+ DBG_TRACEho(" MESSAGE DATA:\n");
+ DBG_TRACEho(" : hoAgId_=%d, callId=%d\n",hoAgId_, callIndex);
+ DBG_TRACEho(" : hoGlobalCellId_ (type=%d, mcc[1-3]:%x,%x,%x; mnc[1-3]:%x,%x,%x;lac=%x,ci=%x)\n",
+ hoGlobalCellId_.ci_disc,hoGlobalCellId_.mcc[0],hoGlobalCellId_.mcc[1],hoGlobalCellId_.mcc[2],
+ hoGlobalCellId_.mnc[0],hoGlobalCellId_.mnc[1],hoGlobalCellId_.mnc[2],hoGlobalCellId_.lac,hoGlobalCellId_.ci);
+ DBG_TRACEho(" : hoCause=%d\n",rrInMsg->l3_data.handReqd.hoCause);
+
+
+ DBG_TRACEho(" a_msg.buffer POST-AIF PROCESSING MESSAGE DATA: A_HANDOVER_REQUEST_TYPE\n");
+ DBG_TRACEho(" {\n");
+ DBG_TRACEho(" \na_msg.buffer hexdump: ");
+ DBG_HEXDUMPho((unsigned char*) a_msg.buffer, a_msg.msgLength);
+ DBG_TRACEho("\n }\n");
+
+
+ DBG_TRACEho(" MSG POST-AIF PROCESSING MESSAGE DATA: A_HANDOVER_REQUEST_TYPE\n");
+ DBG_TRACEho(" {\n");
+ DBG_TRACEho(" \nMsg hexdump: ");
+ DBG_HEXDUMPho((unsigned char*) &Msg, sizeof (NonStdRasMessagePerformHandoverRQ_t) );
+ DBG_TRACEho("\n }\n");
+
+ if (VBLinkPerformHandoverRequest(&Msg)
+ == false)
+ {
+ // Ignore the message
+ DBG_ERRORho (" CC->VB Link ERROR: Failed on Perform Handver Request Message\n}\n");
+
+ initData();
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::ExtPerformHO): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+ }
+
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_THO);
+ hoState_ = HAND_ST_ANCH_PERF_EHO_REQ;
+
+ } else
+ {
+
+ // JOE: Do handover to this scenerio later!
+
+ DBG_TRACEho(" S/W not ready yet for handover retry to VIPERCELL!\n");
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoFail): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+
+// //Handover from anchor GP to another GP case
+// sprintf(&(cellLocationRequest.ViperCellId[0]), "%d:%d",
+// candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+//
+// cellLocationRequest.TxnId = callIndex;
+//
+// if (false == VBLinkLocationRequest(cellLocationRequest) )
+// {
+// // Ignore the message
+// DBG_ERROR("{\nMNETeiTRACE(etrg::handleTrgHoFail): VBLinkLocationRequest failed!\n");
+// DBG_ERROR(" (hoAgId=%d callId=%d entryId=%d,lac=%d,ci=%d)\n}\n",
+// hoAgId_, callIndex, parent->entryId,
+// candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+// DBG_LEAVE();
+// return (CC_RELEASE_EH_HB);
+// }
+
+// DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgHoFail): [==>HOA IP_ADDRESS_REQ](callId=%d,entryId=%d,lac=%d,ci=%d)\n}\n",
+// callIndex, parent->entryId,
+// candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+//
+// DBG_CALL_TRACE(hoAgId_, "{\nMNETeiTRACE(etrg::handleTrgHoFail): [<==CC START TIMER Tvb](callId=%d,entryId=%d,lac=%d,ci=%d)\n}\n",
+// callIndex, parent->entryId,
+// candidate.candGlobalCellId.lac,candidate.candGlobalCellId.ci);
+//
+// parent->sessionTimer->setTimer(CALL_HAND_SRC_TVB)
+//
+// hoState_ = HAND_ST_ANCH_VC_IP_ADDRESS_REQ
+ }
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHoFail): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchExtHandbackFail(void)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHandbackFail): entering......\n}\n");
+
+ DBG_TRACEho(" [<==RR HANDBACK FAILURE](callId=%d,entryId=%d)\n",
+ callIndex, parent->entryId);
+
+ // cancel T204
+ parent->sessionTimer->cancelTimer();
+
+ // JOE ----- What are we supposed to do on HANDBACK FAILURES?? ------
+ releaseMobAndConnRes();
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendEndHandover();
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchExtHandbackFail): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::handleAnchPostExtHoHandbackEvent(void)
+ {
+ A_Result_t aif_result;
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoHandbackEvent): entering......\n}\n");
+
+ TwoPartyCallLeg *whichLeg;
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((whichLeg = parent->activeLeg()) == NULL)
+ {
+ DBG_TRACEho(" No active leg (hoType %d, hoState %d)\n}\n", hoType_, hoState_);
+
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendEndHandover();
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoHandbackEvent): leaving.\n}\n");
+ return (CC_RELEASE_HOCALLLEG);
+ }
+
+ //Decode A-interface message
+ memset( (char*)&aifMsg, 0, sizeof(T_AIF_MSG));
+
+ aif_result = AIF_Decode((T_AIF_MessageUnit*)&(hoaInMsg->msgData.perfExtHandbackReq.A_HANDOVER_REQUEST),
+ &aifMsg);
+ if ( aif_result != A_RESULT_SUCCESS)
+ {
+ DBG_ERRORho("{\n A-MSG decoding ERROR (err=%d, hoAgId_=%d)\nA-MSG:\n",
+ aif_result, hoAgId_);
+ DBG_HEXDUMPho(
+ (unsigned char*)&hoaInMsg->msgData.perfExtHandbackReq.A_HANDOVER_REQUEST.A_INTERFACE_DATA,
+ (int)hoaInMsg->msgData.perfExtHandbackReq.A_HANDOVER_REQUEST.msglength
+ );
+ DBG_ERRORho("\n}\n");
+
+ hoEndCause_ = MC_HO_UNEXPECTED_DATA_VALUE;
+ sendHandbackNack();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoHandbackEvent): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ if (aifMsg.msgType != A_HANDOVER_REQUEST_TYPE)
+ {
+ //Unexpected A-MSG received
+ DBG_ERRORho(" UNEXPECTED A-MSG (msgType=%d,hoState_=%d)\n",
+ aifMsg.msgType, hoState_);
+
+ hoEndCause_ = MC_HO_UNEXPECTED_DATA_VALUE;
+ sendHandbackNack();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleExtPerformHOAck): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //Received PERFORM HANDOVER REQUEST ACK message
+ DBG_TRACEho(" Received PERFORM_HANDBACK REQUEST from HOA (hoAgId_=%d, callIndex=%d)\n",
+ hoAgId_, callIndex);
+
+ // Use the same criteria as when triggered on the anchor side.
+ if (!parent->isHandoverAllowed())
+ {
+ // Need to fix the cause value for the nack.
+ DBG_ERRORho(" External HB or H3 failed on handover disallowed.\n");
+
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendHandbackNack();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoHandbackEvent): leaving.\n}\n");
+ return(CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ // Store target MSC number for Perform Handover to THIRD MSC number
+ // so HOA will be able to address MAP message.
+ targetMscNumber_ = hoaInMsg->msgData.perfExtHandbackReq.mscNumber;
+
+ // Store requested encryption and channel type info for negotiation
+ reqEncrypt_ = aifMsg.handoverRequest.encryptionInformation;
+ optCurrEncrypt_ = aifMsg.handoverRequest.chosenEncryptAlgorithmServing;
+ reqChannelType_ = aifMsg.handoverRequest.channelType;
+ optCurrChannelType_ = aifMsg.handoverRequest.currentChannelType1;
+
+ DBG_TRACEho(" CC External HO Info @anch-PerfHbReq: Mcc(%x%x%x), Mnc(%x%x%x), lac(%d), ci(%d), state %d)\n",
+ hoaInMsg->msgData.perfExtHandbackReq.globalCellID.mcc[0],
+ hoaInMsg->msgData.perfExtHandbackReq.globalCellID.mcc[1],
+ hoaInMsg->msgData.perfExtHandbackReq.globalCellID.mcc[2],
+ hoaInMsg->msgData.perfExtHandbackReq.globalCellID.mnc[0],
+ hoaInMsg->msgData.perfExtHandbackReq.globalCellID.mnc[1],
+ hoaInMsg->msgData.perfExtHandbackReq.globalCellID.mnc[2],
+ hoaInMsg->msgData.perfExtHandbackReq.globalCellID.lac,
+ hoaInMsg->msgData.perfExtHandbackReq.globalCellID.ci,
+ hoState_);
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoHandbackEvent): leaving.\n}\n");
+
+ if (hoaInMsg->msgData.perfExtHandbackReq.externalCell)
+ {
+ return(do_Handover_To_Third_PLMN_scenario());
+ }
+ else
+ {
+ if ( isEqualGlobalCellId(&(hoaInMsg->msgData.perfExtHandbackReq.globalCellID), &MY_GLOBALCELL_ID) )
+ {
+ return(do_Handback_scenario());
+ }
+ else
+ {
+ return(do_Handback_To_Third_MNET_scenario());
+ }
+ }
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::do_Handover_To_Third_PLMN_scenario(void)
+ {
+ A_Result_t A_result;
+ NonStdRasMessagePerformHandoverRQ_t Msg;
+ T_AIF_MessageUnit a_msg;
+ GlobalCellId_t serving_cell;
+ T_AIF_MSG temp_aifMsg = aifMsg; // copy for ext handover to third MSC purpose
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::do_Handover_To_Third_PLMN_scenario): entering......\n}\n");
+
+ initExtHandmsc3Data();
+
+ DBG_TRACEho(" External HANDBACK to THIRD PLMN is requested (hoType:%d, hoState:%d)\n",
+ hoType_, hoState_);
+
+ h3GlobalCellId_ = hoaInMsg->msgData.perfExtHandbackReq.globalCellID;
+
+ // Set aifMsg's HANDOVER REQUEST A INTERFACE values
+ serving_cell.ci_disc = 0;
+ memcpy( (char *)serving_cell.mcc,
+ (char *)aifMsg.handoverRequest.cellIdentifierServing.mcc,
+ NUM_MCC_DIGITS );
+ memcpy( (char *)serving_cell.mnc,
+ (char *)aifMsg.handoverRequest.cellIdentifierServing.mnc,
+ NUM_MNC_DIGITS );
+ serving_cell.lac = aifMsg.handoverRequest.cellIdentifierServing.lac;
+ serving_cell.ci = aifMsg.handoverRequest.cellIdentifierServing.ci;
+
+ populateAHandoverRequest( &serving_cell, &h3GlobalCellId_);
+
+ if ((A_result = AIF_Encode( &aifMsg, &a_msg )) != A_RESULT_SUCCESS)
+ {
+ // Couldn't encode Perform Handover A-Interface msg.
+ DBG_ERRORho (" A Interface encoding Error: Perform Handver Request. Result (%d)\n",
+ (int) A_result);
+
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendHandbackNack();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::do_Handover_To_Third_PLMN_scenario): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ memset( (char*)&Msg, 0, sizeof(NonStdRasMessagePerformHandoverRQ_t));
+
+ Msg.A_HANDOVER_REQUEST.msglength = a_msg.msgLength;
+ memcpy(Msg.A_HANDOVER_REQUEST.A_INTERFACE_DATA,
+ (unsigned char*)a_msg.buffer, MAX_A_INTERFACE_LEN);
+
+ Msg.header.origSubId = callIndex;
+ // Note: need to put -1 as hoAgId since this requires GMC to create a new HOA
+ Msg.header.destSubId = -1; // NULL (unknown hoAgId - GMC will assign)
+ Msg.globalCellID = h3GlobalCellId_;
+ Msg.hoCause = 0; // JOE: Do this cause later (extract from A-interface msg)
+ Msg.hoNumberReqd = true; // Always TRUE
+ Msg.handoverNumber.ie_present = false; // NULL (unknown handoverNumber - GMC will assign)
+ Msg.mscNumber.ie_present = true;
+ Msg.mscNumber = targetMscNumber_; // Send MSC number which was received on HANDBACK
+
+ DBG_TRACEho(" MESSAGE DATA:\n");
+ DBG_TRACEho(" : hoAgId_=%d, h3AgId_=%d, callId=%d\n",hoAgId_, h3AgId_, callIndex);
+ DBG_TRACEho(" : h3GlobalCellId_ (type=%d, mcc[1-3]:%x,%x,%x; mnc[1-3]:%x,%x,%x;lac=%x,ci=%x)\n",
+ h3GlobalCellId_.ci_disc,hoGlobalCellId_.mcc[0],h3GlobalCellId_.mcc[1],h3GlobalCellId_.mcc[2],
+ h3GlobalCellId_.mnc[0],h3GlobalCellId_.mnc[1],h3GlobalCellId_.mnc[2],h3GlobalCellId_.lac,hoGlobalCellId_.ci);
+ DBG_TRACEho(" : hoCause=SET TO 0 FOR NOW\n");
+ DBG_TRACEho(" : targetMscNumber_ (present=%d,numberType=%d,numberingPlan=%d,numDigits=%d)\n",
+ targetMscNumber_.ie_present,targetMscNumber_.numberType,targetMscNumber_.numberingPlan,targetMscNumber_.numDigits);
+ DBG_TRACEho(" (digits[1-10]:%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x)\n",
+ targetMscNumber_.digits[0],targetMscNumber_.digits[1],targetMscNumber_.digits[2],
+ targetMscNumber_.digits[3],targetMscNumber_.digits[4],targetMscNumber_.digits[5],
+ targetMscNumber_.digits[6],targetMscNumber_.digits[7],targetMscNumber_.digits[8],
+ targetMscNumber_.digits[9],targetMscNumber_.digits[10]);
+
+
+ DBG_TRACEho(" a_msg.buffer POST-AIF PROCESSING MESSAGE DATA: A_HANDOVER_REQUEST_TYPE\n");
+ DBG_TRACEho(" {\n");
+ DBG_TRACEho(" \na_msg.buffer hexdump: ");
+ DBG_HEXDUMPho((unsigned char*) a_msg.buffer, a_msg.msgLength);
+ DBG_TRACEho("\n }\n");
+
+
+ DBG_TRACEho(" MSG POST-AIF PROCESSING MESSAGE DATA: A_HANDOVER_REQUEST_TYPE\n");
+ DBG_TRACEho(" {\n");
+ DBG_TRACEho(" \nMsg hexdump: ");
+ DBG_HEXDUMPho((unsigned char*) &Msg, sizeof (NonStdRasMessagePerformHandoverRQ_t) );
+ DBG_TRACEho("\n }\n");
+
+
+ if (VBLinkPerformHandoverRequest(&Msg)
+ == false)
+ {
+ // Ignore the message
+ DBG_ERRORho (" CC->VB Link ERROR: Failed on Perform Handver Request Message\n}\n");
+
+ hoEndCause_ = MC_HO_SUBHO_FAILURE; // JOE: May not be best error cause.
+ sendHandbackNack();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::do_Handover_To_Third_PLMN_scenario): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TVB);
+
+ hoType_ = HO_TY_EXT_HANDMSC3;
+ hoState_ = HAND_ST_ANCH_PERF_EHO_H3_REQ;
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::do_Handover_To_Third_PLMN_scenario): leaving.\n}\n");
+ }
+
+
+ JCCEvent_t
+ CCAnchorHandover::do_Handback_scenario(void)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::do_Handback_scenario): entering......\n}\n");
+ // External Handback scenario
+ initExtHandbackData();
+
+ DBG_TRACEho(" External HANDBACK is requested (hoState:%d)\n",
+ hoState_);
+
+ // Build a message for MM for Handover Req.
+ // Fill the data for MM message
+ mmOutMsg.l3_data.handReq.channelType.bearerType = BEARER_SPEECH;
+ // Since this is a handback, the anchor's current speech version is
+ // preferred. If the current speech version is not supported, more has
+ // to be done in terms of changing the gateway's speech mode on the fly.
+ mmOutMsg.l3_data.handReq.channelType.speechChann = parent->currSpeechCh();
+
+ IntraL3CipherModeCommand_t cipherCmd;
+ if (ludbGetCipherAlgo(parent->ludbIndex, &cipherCmd))
+ {
+ //handling error return
+ DBG_ERRORho(" CC->Handover Error: ludbGetCipherAlgo() failed, (ludbIndex = %d)\n",
+ parent->ludbIndex);
+ cipherCmd.cmd.cipherModeSetting.ciphering = CNI_RIl3_CIPHER_NO_CIPHERING;
+ }
+
+ DBG_TRACEho(" CC->@anch:PerfHb(a2r): ludbIndex %d, bearer %d, permittedIndicator[0-7] %x,%x,%x,%x,%x,%x,%x,%x, ciphSet %d, algo %d, kc(%x,%x)\n",
+ parent->ludbIndex,
+ aifMsg.handoverRequest.channelType.speechDataIndicator,
+ aifMsg.handoverRequest.channelType.permittedIndicator[0],
+ aifMsg.handoverRequest.channelType.permittedIndicator[1],
+ aifMsg.handoverRequest.channelType.permittedIndicator[2],
+ aifMsg.handoverRequest.channelType.permittedIndicator[3],
+ aifMsg.handoverRequest.channelType.permittedIndicator[4],
+ aifMsg.handoverRequest.channelType.permittedIndicator[5],
+ aifMsg.handoverRequest.channelType.permittedIndicator[6],
+ aifMsg.handoverRequest.channelType.permittedIndicator[7],
+ cipherCmd.cmd.cipherModeSetting.ciphering,
+ cipherCmd.cmd.cipherModeSetting.algorithm,
+ cipherCmd.Kc[0],cipherCmd.Kc[1],
+ cipherCmd.Kc[0],cipherCmd.Kc[2]);
+
+ memcpy( (unsigned char*) &(mmOutMsg.l3_data.handReq.cipherCmd),
+ (unsigned char*) &(cipherCmd),
+ sizeof (IntraL3CipherModeCommand_t) );
+
+ mmOutMsg.l3_data.handReq.qid = msgQId;
+
+ // Send internal MM msg -
+ sendMM(INTRA_L3_MM_EST_REQ, INTRA_L3_RR_HANDOVER_REQ, parent->entryId, &mmOutMsg);
+
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TVB);
+ hoType_ = HO_TY_EXT_HANDBACK;
+ hoState_ = HAND_ST_ANCH_RCV_EHO_HB_REQ;
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::do_Handback_scenario): leaving.\n}\n");
+ }
+
+
+
+ JCCEvent_t
+ CCAnchorHandover::do_Handback_To_Third_MNET_scenario(void)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::do_Handback_To_Third_MNET_scenario): entering......\n}\n");
+ // External handback to third (but target is within MNET) scenario
+ initExtHandmsc3Data();
+
+ h3GlobalCellId_ = hoaInMsg->msgData.perfExtHandbackReq.globalCellID;
+
+ DBG_TRACEho(" External HANDBACK to THIRD within MNET is requested (hoType:%d, hoState:%d) (mcc %x%x%x, mnc %x%x%x, lac %d; ci %d)\n",
+ hoType_, hoState_,
+ h3GlobalCellId_.mcc[0],h3GlobalCellId_.mcc[1],h3GlobalCellId_.mcc[2],
+ h3GlobalCellId_.mnc[0],h3GlobalCellId_.mnc[1],h3GlobalCellId_.mnc[2],
+ h3GlobalCellId_.lac, h3GlobalCellId_.ci);
+
+ VBLINK_API_CELL_LOCATION_REQUEST_MSG t_cellLocationRequest;
+
+ //H3 scenario. Go ahead to inquire IP address of mscB', later check
+ //if the mscB' is known or not.
+
+ sprintf(&(t_cellLocationRequest.ViperCellId[0]), "%d:%d", h3GlobalCellId_.lac,h3GlobalCellId_.ci);
+
+ t_cellLocationRequest.TxnId = callIndex;
+
+ if (VBLinkLocationRequest(t_cellLocationRequest)
+ == false)
+ {
+ // Ignore the message
+ DBG_ERRORho(" VB Link Error: h3 failed on calling VBLinkLocationRequest()(%d,%d)\n",
+ hoType_, hoState_);
+
+ hoEndCause_ = MC_HO_SUBHO_FAILURE;
+ sendHandbackNack();
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::handleAnchPostExtHoHandbackEvent): leaving.\n}\n");
+ return(CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TVB);
+ hoType_ = HO_TY_EXT_HANDBACK_TO_MNET_NONANCHOR;
+ hoState_ = HAND_ST_ANCH_EHO_H3_VC_IP_ADDRESS_REQ;
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::do_Handback_To_Third_MNET_scenario): leaving.\n}\n");
+ }
+
+
+ void
+ CCAnchorHandover::sendEndHandover(void)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(ho::sendEndHandover): entering......\n}\n");
+
+ if (hoAgId_ != -1)
+ {
+ //Send END_HANDOVER to HOA
+ NonStdRasMessageEndHandover_t endHandover;
+
+ memset( (char*)&endHandover, 0, sizeof(NonStdRasMessageEndHandover_t));
+ endHandover.header.origSubId = callIndex;
+ endHandover.header.destSubId = hoAgId_;
+ endHandover.reason = hoEndCause_;
+
+ if (!VBLinkEndHandover(&endHandover))
+ {
+ DBG_ERRORho(" VBLinkEndHandover API FAILED\n");
+ } else
+ {
+ DBG_TRACEho(" Sent to HOA END_HANDOVER (hoAgId=%d,callId=%d,entryId=%d)\n",
+ hoAgId_, callIndex, parent->entryId);
+ }
+ }
+
+ if (h3AgId_ != -1)
+ {
+ //Send END_HANDOVER to HOA
+ NonStdRasMessageEndHandover_t endHandover;
+
+ memset( (char*)&endHandover, 0, sizeof(NonStdRasMessageEndHandover_t));
+ endHandover.header.origSubId = callIndex;
+ endHandover.header.destSubId = h3AgId_;
+ endHandover.reason = hoEndCause_;
+
+ if (!VBLinkEndHandover(&endHandover))
+ {
+ DBG_ERRORho(" VBLinkEndHandover API FAILED\n");
+ } else
+ {
+ DBG_TRACEho(" Sent to HOA END_HANDOVER (h3AgId=%d,callId=%d,entryId=%d)\n",
+ h3AgId_, callIndex, parent->entryId);
+ }
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(ho::sendEndHandover): leaving.\n}\n");
+ }
+
+ void
+ CCAnchorHandover::initExtHandbackData(void)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::initExtHandbackData): entering......\n}\n");
+
+ hoState_ = HAND_ST_ANCH_EHO_COMPLT;
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::initExtHandbackData): leaving.\n}\n");
+ }
+
+
+ void
+ CCAnchorHandover::initExtHandmsc3Data(void)
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::initExtHandmsc3Data): entering......\n}\n");
+
+ if (h3SimplexConnected_)
+ {
+ // Break connections with the RF Port
+ T_CSU_PORT_ID dstRtpPort;
+ T_CSU_RESULT_CON csuResult;
+
+ dstRtpPort.portType = CSU_RTP_PORT;
+ dstRtpPort.portId.rtpHandler = h3RtpSession_;
+
+ if ((csuResult = csu_OrigTermBreakAll(&dstRtpPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERRORho(" CSU Error : Disconn. Failure, (hoType %d;hoState_ %d)(Result = %d)(rtpHndler %x) \n",
+ hoType_, hoState_, csuResult, h3RtpSession_);
+
+ // Can only generate OA&M log.
+ }
+ }
+
+ if (h3RtpSession_ != NULL)
+ {
+ // Release the H3 RTP channel
+ ReleaseHandoverRtpChannel(h3RtpSession_);
+ }
+
+ msMsgsQueued_ = 0;
+ rrMsgsQueued_ = false;
+
+ h3SimplexConnected_ = false;
+ h3VcCallIndex_ = CC_MAX_CC_CALLS_DEF_VAL;
+ memset(&h3GlobalCellId_, 0, sizeof(GlobalCellId_t));
+ h3VcIpAddress_ = 0;
+ otherH3IncomingRtpPort_ = 0;
+ h3RtpSession_ = NULL;
+
+ h3SrcLinkLost_ = false;
+ hoType_ = HO_TY_EXT_HANDOVER;
+ hoState_ = HAND_ST_ANCH_EHO_COMPLT;
+
+ DBG_TRACEho("{\nMNEThoTRACE(CCAnchorHandover::initExtHandmsc3Data): leaving.\n}\n");
+ } \ No newline at end of file
diff --git a/data/mnet/GP10/Host/cc/src/CCHoTrgHnd.cpp b/data/mnet/GP10/Host/cc/src/CCHoTrgHnd.cpp
new file mode 100644
index 0000000..96665c5
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCHoTrgHnd.cpp
@@ -0,0 +1,704 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCHoTrgHnd.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 05-01-99
+// Description : Target Vipercell Handover Event handlers
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+//
+
+#include "CC/CCHandover.h"
+
+#include "CC/CCSessionHandler.h"
+
+#include "CC/CCUtil.h"
+
+#include "CC/CallConfig.h"
+
+#include "jcc/JCCLog.h"
+#include "logging/VCLOGGING.h"
+
+#include "stdio.h"
+
+// Temporarily use csu_head instead of csu_intf
+#include "csunew/csu_head.h"
+
+#include "CC/hortp.h"
+
+#include "lapdm/cni_debug.h"
+
+#include "pm/pm_class.h"
+
+#ifdef _SOFT_MOB
+extern T_CNI_LAPDM_OID softMobLapdmOid[];
+#endif
+
+extern MSG_Q_ID ccMsgQId;
+extern INT32 forcedHandover;
+
+//GCELL<tyu:06-01-01>
+extern GlobalCellId_t MY_GLOBALCELL_ID;
+
+//Ciphering <chenj:07-17-01>
+extern unsigned char rm_DspCiphCap;
+#define RM_DSPA52(X) (X & 2)
+#define RM_DSPA51(X) (X & 1)
+
+// *******************************************************************
+// forward declarations.
+// *******************************************************************
+
+JCCEvent_t
+CCTargetHandover::handleTrgHoReqAck(void)
+{
+
+ DBG_FUNC("CCTargetHandover::handleTrgHoReqAck", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ T_CNI_L3_ID newId;
+ newId.msgq_id = msgQId;
+ newId.sub_id = 0; // No sub id needed here
+
+ // <Igal 1-6-00> Updated to standard IRT setup
+ if (parent->setIrt(mmInMsg->entry_id, newId) == false)
+ {
+ sendMM (INTRA_L3_MM_REL_REQ, INTRA_L3_NULL_MSG, parent->entryId, &mmOutMsg);
+
+ DBG_LEAVE();
+ return (handleTrgHoReqNack());
+ }
+
+ // Setup the entry id, oid, and sapi
+ parent->entryId = mmInMsg->entry_id;
+
+ // GET OID AND SAPI
+ T_CNI_RIL3_IRT_ENTRY irtEntry;
+ irtEntry.entry_id = mmInMsg->entry_id;
+
+ if ( (CNI_RIL3_IRT_Get_Entry_by_Entry_ID(&irtEntry))
+ == false )
+ {
+ JCCLog1("CC Call Error : IRT Table problem for (entry id = %d)\n ", mmInMsg->entry_id);
+ DBG_ERROR("CC Call Error : IRT Table problem for (entry id = %d)\n ", mmInMsg->entry_id);
+
+ sendMM(INTRA_L3_MM_REL_REQ, INTRA_L3_NULL_MSG, parent->entryId, &mmOutMsg);
+ DBG_LEAVE();
+ return (handleTrgHoReqNack());
+ }
+
+ parent->oid = irtEntry.lapdm_oid;
+
+ // Assign a new Ho RTP channel
+ if ((hoRtpSession_ = AssignHandoverRtpChannel())
+ == NULL)
+ {
+ // Do not proceed with handover
+ JCCLog ("CC->Handover RTP Pool Error: assignment fail\n");
+ DBG_ERROR ("CC->Handover RTP Pool Error: assignment fail\n");
+ sendMM(INTRA_L3_MM_REL_REQ, INTRA_L3_NULL_MSG, parent->entryId, &mmOutMsg);
+ DBG_LEAVE();
+ return (handleTrgHoReqNack());
+ }
+
+ // Setup the remote RTP Port
+ SetRemoteHandoverRtpPort(hoRtpSession_,
+ hoVcIpAddress_,
+ otherHoIncomingRtpPort_);
+
+ DBG_TRACE("CC HO tgt-handleTrgHoReqAck Info: loRtpHndl %p, reVcIpAddr %x, rePort %d\n",
+ hoRtpSession_, hoVcIpAddress_, otherHoIncomingRtpPort_);
+
+ // Make a connection between the rtp channel and the rf channel
+ T_CSU_PORT_ID rfSourcePort, rtpSinkPort;
+ T_CSU_RESULT_CON csuResult;
+
+ rfSourcePort.portType = CSU_GSM_PORT;
+ rtpSinkPort.portType = CSU_RTP_PORT;
+
+ rfSourcePort.portId.gsmHandler = parent->entryId;
+ rtpSinkPort.portId.rtpHandler = hoRtpSession_;
+
+ if ((csuResult = csu_DuplexConnect(&rfSourcePort, &rtpSinkPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog3("CSU Error : Ho Duplex Conn. Failure, (Result = %d) for (rtp port = %x) and (entryId = %d)\n",
+ csuResult,
+ (int)rtpSinkPort.portId.rtpHandler,
+ parent->entryId);
+ DBG_ERROR("CSU Error : Ho Duplex Conn. Failure, (Result = %d) for (rtp port = %x) and (entryId = %d)\n",
+ csuResult,
+ (int)rtpSinkPort.portId.rtpHandler,
+ parent->entryId);
+ sendMM(INTRA_L3_MM_REL_REQ, INTRA_L3_NULL_MSG, parent->entryId, &mmOutMsg);
+ DBG_LEAVE();
+ return (handleTrgHoReqNack());
+
+ }
+
+ voiceConnected = true;
+
+ // Send the Perform Ack message.
+
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDOVER_ACK;
+ vcOutMsg.msgData.perfHandoverAck.targetInRtpPort
+ = GetIncomingHandoverRtpPort(hoRtpSession_);
+ vcOutMsg.msgData.perfHandoverAck.handCmd = mmInMsg->l3_data.handReqAck.handCmd;
+
+ // Dump the handover Command msg.
+ // CNI_DumpHex(&vcOutMsg.msgData.perfHandoverAck.handCmd.buffer[0], 30);
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ // start the T204 timer
+ parent->sessionTimer->setTimer(CALL_HAND_TRG_T204);
+
+ hoState_ = HAND_ST_TRG_SND_HO_REQ_ACK;
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandover::handleTrgHoReqNack(void)
+{
+
+ DBG_FUNC("CCTargetHandover::handleTrgHoReqNack", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // Send the Perform Nack message.
+
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDOVER_NACK;
+ vcOutMsg.msgData.perfHandoverNack.cause = rrInMsg->l3_data.handReqNack.cause;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ initData();
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ //
+}
+
+JCCEvent_t
+CCTargetHandover::handleTrgHoComplt(void)
+{
+
+ DBG_FUNC("CCTargetHandover::handleTrgHoComplt", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // cancel T204 timer
+ parent->sessionTimer->cancelTimer();
+
+ // Send the Complete Handover message.
+
+ vcOutMsg.msgType = INTER_VC_CC_COMPLETE_HANDOVER;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ hoState_ = HAND_ST_TRG_HO_COMPLT;
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandover::handleTrgT204TimerExpiry(void)
+{
+ DBG_FUNC("CCTargetHandover::handleTrgT204TimerExpiry", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // Send Handover Nack to the Source ViperCell.
+ // Ack was already sent! Is that Ok?
+
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDOVER_NACK;
+ vcOutMsg.msgData.perfHandoverNack.cause = JC_FAILURE_T204_TIMEOUT;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ if (voiceConnected)
+ {
+ // break connection
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = hoRtpSession_;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog2("CSU Error : Ho Disconn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Ho Disconn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+
+ voiceConnected = false;
+ }
+
+ // Release the Ho RTP channel
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ hoRtpSession_ = NULL;
+
+ initData();
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+}
+
+JCCEvent_t
+CCTargetHandover::handleTrgPostHoRls(void)
+{
+ DBG_FUNC("CCTargetHandover::handleTrgPostHoRls", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ vcOutMsg.msgType = INTER_VC_CC_RLS_CALL;
+ vcOutMsg.msgData.rlsCall.cause = JC_FAILURE_BASE;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ DBG_LEAVE();
+ return (handleAnchToTrgAbortHo());
+}
+
+JCCEvent_t
+CCTargetHandover::handleAnchToTrgPerfHoReq(void)
+{
+
+ DBG_FUNC("CCTargetHandover::handleAnchToTrgPerfHoReq", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // Copy the Anchor information.
+ hoVcIpAddress_ = vcInMsg->origVcAddress;
+ hoVcCallIndex_ = vcInMsg->origSubId;
+
+//GCELL<tyu:06-01-01> BEGIN
+ hoGlobalCellId_ = vcInMsg->msgData.perfHandoverReq.globalCellId;
+//GCELL<tyu:06-01-01> END
+
+ otherHoIncomingRtpPort_ = vcInMsg->msgData.perfHandoverReq.sourceInRtpPort;
+
+ // Build a message for MM for Handover Req.
+ // Fill the data for MM message
+ currSpeechCh_ = vcInMsg->msgData.perfHandoverReq.channelType.speechChann;
+ mmOutMsg.l3_data.handReq.channelType = vcInMsg->msgData.perfHandoverReq.channelType;
+ mmOutMsg.l3_data.handReq.qid = msgQId;
+
+ //CIPH<xxu:02-10-00> begin
+
+ memcpy( (unsigned char*) &(mmOutMsg.l3_data.handReq.cipherCmd),
+ (unsigned char*) &(vcInMsg->msgData.perfHandoverReq.cipherCmd),
+ sizeof (IntraL3CipherModeCommand_t) );
+
+ // Make sure ciphering algorithm is supported on target GP10
+ if (mmOutMsg.l3_data.handReq.cipherCmd.cmd.cipherModeSetting.ciphering ==
+ CNI_RIl3_CIPHER_START_CIPHERING)
+ {
+ switch (mmOutMsg.l3_data.handReq.cipherCmd.cmd.cipherModeSetting.algorithm)
+ {
+ case CNI_RIL3_CIPHER_ALGORITHM_A51:
+ if (!RM_DSPA51(rm_DspCiphCap) )
+ { // Algorithm not supported, turn off ciphering
+
+ DBG_TRACE("handleAnchToTrgPerfHoReq TURNING CIPHERING OFF: previous algorithm %d\n",
+ mmOutMsg.l3_data.handReq.cipherCmd.cmd.cipherModeSetting.ciphering);
+
+ mmOutMsg.l3_data.handReq.cipherCmd.cmd.cipherModeSetting.ciphering =
+ CNI_RIl3_CIPHER_NO_CIPHERING;
+ }
+ break;
+
+ case CNI_RIL3_CIPHER_ALGORITHM_A52:
+ if ( !RM_DSPA52(rm_DspCiphCap) )
+ { // Algorithm not supported, turn off ciphering
+ DBG_TRACE("handleAnchToTrgPerfHoReq TURNING CIPHERING OFF: previous algorithm %d\n",
+ mmOutMsg.l3_data.handReq.cipherCmd.cmd.cipherModeSetting.ciphering);
+
+ mmOutMsg.l3_data.handReq.cipherCmd.cmd.cipherModeSetting.ciphering =
+ CNI_RIl3_CIPHER_NO_CIPHERING;
+ }
+ break;
+
+ default:
+ DBG_TRACE("handleAnchToTrgPerfHoReq TURNING CIPHERING OFF: previous algorithm %d\n",
+ mmOutMsg.l3_data.handReq.cipherCmd.cmd.cipherModeSetting.ciphering);
+
+ mmOutMsg.l3_data.handReq.cipherCmd.cmd.cipherModeSetting.ciphering =
+ CNI_RIl3_CIPHER_NO_CIPHERING;
+ }
+ }
+
+ IntraL3CipherModeCommand_t *p;
+ p = (IntraL3CipherModeCommand_t *) &(vcInMsg->msgData.perfHandoverReq.cipherCmd);
+
+
+ DBG_TRACE("CC->@tgt:HoReq(t2r): ludbIndex = %d, bearer %d, spchVer %d, ciphSet %d, algo %d, kc(%x,%x)\n",
+ parent->ludbIndex,
+ vcOutMsg.msgData.perfHandoverReq.channelType.bearerType,
+ vcOutMsg.msgData.perfHandoverReq.channelType.speechChann.version,
+ p->cmd.cipherModeSetting.ciphering,
+ p->cmd.cipherModeSetting.algorithm,
+ p->Kc[0], p->Kc[1]);
+
+ //CIPH<xxu:02-10-00> End
+
+ DBG_TRACE("CC->@tgt:HoReq(t2r): callId %d, callQid(%p, %p), ccMsgQId %p\n",
+ callIndex, msgQId,
+ ccSession[callIndex].msgQId,
+ ccMsgQId);
+
+ // Send internal MM msg -
+ sendMM(INTRA_L3_MM_EST_REQ, INTRA_L3_RR_HANDOVER_REQ, parent->entryId, &mmOutMsg);
+
+ hoState_ = HAND_ST_TRG_RCV_HO_REQ;
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandover::handleAnchToTrgAbortHo(void)
+{
+ DBG_FUNC("CCTargetHandover::handleAnchToTrgAbortHo", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // cancel T204 timer
+ parent->sessionTimer->cancelTimer();
+
+ if (voiceConnected)
+ {
+ // break connection
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = hoRtpSession_;
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+
+ JCCLog2("CSU Error : Ho Disconn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Ho Disconn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)rtpSourcePort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+
+ voiceConnected = false;
+
+ }
+
+ // Release the Ho RTP channel
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ hoRtpSession_ = NULL;
+
+ initData();
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+
+}
+
+
+JCCEvent_t
+CCTargetHandover::handleAnchToTrgPerfHbAck(void)
+{
+ DBG_FUNC("CCTargetHandover::handleAnchToTrgPerfHbAck", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // cancel Tsho timer
+ parent->sessionTimer->cancelTimer();
+
+ // Send internal RR msg
+ rrOutMsg.l3_data.handCmd.handCmd = vcInMsg->msgData.perfHandbackAck.handCmd;
+
+#ifdef _SOFT_MOB
+ if (!(parent->oid < softMobLapdmOid[0]))
+ {
+ printf("Soft Mob Log: Hand Cmd. sent, Send Hand Cmd. Complete now\n");
+ }
+ else
+#endif
+ {
+ sendRR(INTRA_L3_DATA, INTRA_L3_RR_HANDOVER_COMMAND, parent->entryId, &rrOutMsg);
+ }
+
+ // start the T203 timer
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_T203);
+
+ hoState_ = HAND_ST_TRG_RCV_HB_REQ_ACK;
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+//RETRY<xxu:04-27-00>
+JCCEvent_t
+CCTargetHandover::handleAnchToTrgPerfHbNack(void)
+{
+ DBG_FUNC("CCTargetHandover::handleAnchToTrgPerfHbNack", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // cancel Tsho timer
+ parent->sessionTimer->cancelTimer();
+
+ //RETRY<xxu:04-25-00> BEGIN
+ //Retry next candidate if there is another left
+ int i;
+ IntraL3HandoverRequired_t *inMsg = &handReqd;
+
+ if ( (i=getNextHoCandidate()) != (-1) )
+ {
+ //Try next candidate
+ //GCELL<tyu:06-01-01> BEGIN
+ candGlobalCellId_t candidate;
+
+ hoNextCandidate_ = true;
+ candIndex_ = i;
+
+ candidate = inMsg->candGlobalCellId[i];
+ //GCELL<tyu:06-01-01> END
+
+ DBG_TRACE("Next Candidate (trg::handleTrgHoReqd): Selected %d-th of Candidates(%d) (isExt=%d, isTried=%d, mcc:%x%x%x mnc:%x%x%x lac:%d ci:%d) (hoState %d)\n",
+ i, inMsg->numCandidates,
+ candidate.candIsExternal, candidate.candIsTried,
+ candidate.candGlobalCellId.mcc[0],candidate.candGlobalCellId.mcc[1],candidate.candGlobalCellId.mcc[2],
+ candidate.candGlobalCellId.mnc[0],candidate.candGlobalCellId.mnc[1],candidate.candGlobalCellId.mnc[2],
+ candidate.candGlobalCellId.lac, candidate.candGlobalCellId.ci, hoType_, hoState_);
+
+ // Send Perform Handback to the Anchor ViperCell.
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK;
+ vcOutMsg.msgData.perfHandbackReq.channelType.bearerType = BEARER_SPEECH;
+ vcOutMsg.msgData.perfHandbackReq.channelType.speechChann = currSpeechCh_;
+ //GCELL<tyu:06-01-01> END
+ vcOutMsg.msgData.perfHandbackReq.globalCellId = candidate;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ // start the Tsho timer
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TSHO);
+
+ hoState_ = HAND_ST_TRG_SND_HB_REQ;
+
+ } else
+ {
+ initHandbackData();
+
+ if (hoSrcLinkLost_)
+ {
+ // peg
+ PM_CCMeasurement.unsuccExternHDOsWithLossOfConnectionPerMSC.increment();
+
+ vcOutMsg.msgType = INTER_VC_CC_RLS_CALL;
+ vcOutMsg.msgData.rlsCall.cause = JC_FAILURE_BASE;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+ DBG_LEAVE();
+ return (handleAnchToTrgAbortHo());
+ }
+ }
+
+ //
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandover::handleAnchToTrgCompltHb(void)
+{
+ DBG_FUNC("CCTargetHandover::handleAnchToTrgCompltHb", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // cancel T203 timer
+ parent->sessionTimer->cancelTimer();
+
+ // Release the Ho RTP channel
+ ReleaseHandoverRtpChannel(hoRtpSession_);
+ hoRtpSession_ = NULL;
+
+ initData();
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+}
+
+JCCEvent_t
+CCTargetHandover::handleTrgTshoTimerExpiry(void)
+{
+ DBG_FUNC("CCTargetHandover::handleTrgTshoTimerExpiry", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // Assume no retry is needed based on candidate list
+
+ // Send Abort Handback to the Anchor ViperCell.
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDBACK;
+ vcOutMsg.msgData.abortHandback.cause = JC_FAILURE_TSHO_TIMEOUT;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ initHandbackData();
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCTargetHandover::handleTrgT203TimerExpiry(void)
+{
+ DBG_FUNC("CCTargetHandover::handleTrgT203TimerExpiry", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // Assume no retry is needed based on candidate list
+
+ // Send Abort Handback to the Anchor ViperCell.
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDBACK;
+ vcOutMsg.msgData.abortHandback.cause = JC_FAILURE_T203_TIMEOUT;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ //ext-HO <xxu:07-09-01>
+ //initHandbackData();
+ initData();
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+}
+
+JCCEvent_t
+CCTargetHandover::handleTrgHoFail(void)
+{
+ DBG_FUNC("CCTargetHandover::handleTrgHoFail", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // cancel T203 timer
+ parent->sessionTimer->cancelTimer();
+
+ // Assume no retry is needed based on candidate list
+
+ // Send Abort Handback to the Anchor ViperCell.
+
+ vcOutMsg.msgType = INTER_VC_CC_ABORT_HANDBACK;
+
+ //ext-HO <xxu:06-28-01>
+ vcOutMsg.msgData.abortHandback.cause = rrInMsg->l3_data.handFail.cause;
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ initHandbackData();
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+
+//HO<xxu:02-01-00> extend to cover H3
+JCCEvent_t
+CCTargetHandover::handleTrgHoReqd(void)
+{
+ int i;
+
+ DBG_FUNC("CCTargetHandover::handleTrgHoReqd", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ IntraL3HandoverRequired_t *inMsg = &rrInMsg->l3_data.handReqd;
+ //GCELL<tyu:06-01-01> END
+ candGlobalCellId_t candidate;
+
+ DBG_TRACE("CC Info: Received Handover Required (numCandidates = %d)\n",
+ inMsg->numCandidates);
+
+ //Assume go back to anchor. If not update candidate to MSC-B' (3rd party cell)
+ //GCELL<tyu:06-01-01> END
+ candidate.candIsExternal = false;
+ candidate.candIsTried = true;
+ candidate.candGlobalCellId = hoGlobalCellId_;
+
+ handReqd = *inMsg;
+
+ if (!forcedHandover)
+ {
+ if ((inMsg->numCandidates) <= 0)
+ {
+ // Ignore the message
+ DBG_ERROR ("RR->CC Error (trg::handleTrgHoReqd): Handover Required, bad (numCandidates = %d)\n",
+ inMsg->numCandidates);
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ // Make sure a candidate to try is a valid one
+ if ( (i=getNextHoCandidate()) == (-1) )
+ {
+ DBG_ERROR ("RR->CC (trg::handleTrgHoReqd): Handover Required Error (all bad #candidates = %d)\n",
+ inMsg->numCandidates);
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ candIndex_ = i;
+ candidate = inMsg->candGlobalCellId[i];
+
+ DBG_TRACE("RR->CC (trg::handleTrgHoReqd): Selected %d-th of Candidates(%d) (isExt=%d, isTried=%d, mcc:%x%x%x mnc:%x%x%x lac:%d ci:%d) (hoState %d)\n}\n",
+ i, inMsg->numCandidates,
+ candidate.candIsExternal, candidate.candIsTried,
+ candidate.candGlobalCellId.mcc[0],candidate.candGlobalCellId.mcc[1],
+ candidate.candGlobalCellId.mcc[2],
+ candidate.candGlobalCellId.mnc[0],candidate.candGlobalCellId.mnc[1],
+ candidate.candGlobalCellId.mnc[2],
+ candidate.candGlobalCellId.lac, candidate.candGlobalCellId.ci, hoState_);
+
+ // Save candidate list for future retry
+ handReqd = *inMsg;
+ candIndex_ = i;
+ //GCELL<tyu:06-01-01> END
+
+ }
+
+ // Send Perform Handback to the Anchor ViperCell.
+ vcOutMsg.msgType = INTER_VC_CC_PERFORM_HANDBACK;
+ vcOutMsg.msgData.perfHandbackReq.channelType.bearerType = BEARER_SPEECH;
+ vcOutMsg.msgData.perfHandbackReq.channelType.speechChann = currSpeechCh_;
+ vcOutMsg.msgData.perfHandbackReq.globalCellId = candidate;
+ //GCELL<tyu:06-01-01> END
+
+ sendVcMsg(MODULE_CC, MODULE_CC);
+
+ // start the Tsho timer
+ parent->sessionTimer->setTimer(CALL_HAND_SRC_TSHO);
+
+ hoState_ = HAND_ST_TRG_SND_HB_REQ;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
diff --git a/data/mnet/GP10/Host/cc/src/CCMobExtHnd.cpp b/data/mnet/GP10/Host/cc/src/CCMobExtHnd.cpp
new file mode 100644
index 0000000..e24429c
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCMobExtHnd.cpp
@@ -0,0 +1,1422 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCMobExtHnd.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description : CC Mobile side External Event Handlers.
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "JCC/JCCLog.h"
+#include "logging/VCLOGGING.h"
+
+#include "stdio.h"
+
+#include "sysLib.h"
+
+//CH<xxu:11-11-99>
+#include "csunew/csu_head.h"
+
+//
+#include "CC/CCHalfCall.h"
+#include "CC/CallConfig.h"
+
+#include "CC/CallLeg.h"
+#include "CC/CCSessionHandler.h"
+
+#include "jcc/LUDBInstance.h"
+#include "JCC/LUDBapi.h"
+
+// included MD and IRT headers for messages from MS
+#include "ril3/ril3md.h"
+
+#include "rm/rm_head.h"
+extern u8 rm_EntryIdToTrxSlot(T_CNI_IRT_ID entryId, u16 *gsmHandler);
+extern bool callTrace;
+
+const int CALL_CFNRY_TIMER = 300; // 5 seconds
+const int CALL_WAITING_T3_TIMER = 1800; // 30 seconds
+
+//BCT <xxu:08-11-00> BEGIN
+extern int CALL_BCT_NUMBER_TVB;
+//BCT <xxu:08-11-00> END
+
+
+// *******************************************************************
+// forward declarations.
+// *******************************************************************
+
+// Current State is THC_ST_CALL_CONFIRMED
+
+JCCEvent_t
+CCHalfCall::handleMobNoReply(void)
+{
+ DBG_FUNC("CCHalfCall::handleMobNoReply", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ //skip event loop
+ //voipReleaseCause_ = MOBILE_CAUSE_USER_ALERTING_NO_ANSWER;
+ voipReleaseCause_ = CNI_RIL3_CAUSE_USER_ALERTING_NO_ANSWER;
+
+ //CAUSE<xxu:03-21-00> END
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_USER_ALERTING_NO_ANSWER;
+
+ // print out the trx, timeslot for better debugging
+ UINT16 gsmHandler;
+ UINT8 trx, slot;
+ T_SUBSC_IE_ISDN* isdnPtr;
+
+ if (rm_EntryIdToTrxSlot(parent->entryId(),
+ &gsmHandler) ==
+ RM_TRUE)
+ {
+
+ trx = (UINT8)(gsmHandler>>8);
+ slot = (UINT8)(gsmHandler);
+
+ if (callTrace)
+ {
+ DBG_WARNING("CC Log: User No Reply on (TRX=%d),(Slot=%d),(entryId=%d)\n",
+ trx, slot, parent->entryId());
+ if ((isdnPtr = ludbGetMSISDNPtr(parent->ludbIndex())) != NULL)
+ {
+ DBG_WARNING("CC Log: MS (DN=%s)\n",
+ isdnPtr->digits);
+ }
+ }
+ else
+ {
+ DBG_TRACE("CC Log: User No Reply on (TRX=%d),(Slot=%d),(entryId=%d)\n",
+ trx, slot, parent->entryId());
+ if ((isdnPtr = ludbGetMSISDNPtr(parent->ludbIndex())) != NULL)
+ {
+ DBG_TRACE("CC Log: MS (DN=%s)\n",
+ isdnPtr->digits);
+ }
+ }
+ }
+
+ //CAUSE<xxu:04-06-00> BEGING
+
+ // Always do sendRemote at the end of the handler.
+ // Now send the internal Rel Complt message to the other H.323 half call -
+ if (sendRemote(HC_REMOTE_RELEASE_COMPLETE) == false)
+ // failed commn. with the remote side - treat as a release complete
+ // from the remote side and cleanup - skip event loop.
+ {
+ DBG_LEAVE();
+ return (handleMobRemoteAbnormalRelCom());
+ }
+
+ voipReleaseCause_ = CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING;
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING;
+
+ //CAUSE<xxu:04-06-00> END
+
+ DBG_LEAVE();
+ return(handleDisconnectReq());
+}
+
+JCCEvent_t
+CCHalfCall::handleMobAlerting(void)
+{
+ int timerForCFNRy;
+
+ DBG_FUNC("CCHalfCall::handleMobAlerting", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // cancel call confirmed timer
+ hcTimer->cancelTimer();
+
+ callState_ = THC_ST_ALERTING;
+
+ if (ludbIsProvCFNRY(parent->ludbIndex()) &&
+ ludbIsActiveCFNRY(parent->ludbIndex()))
+ {
+ if ((timerForCFNRy = ludbGetTimerCFNRY(parent->ludbIndex()))
+ >= 5)
+ {
+ timerForCFNRy = timerForCFNRy * (sysClkRateGet());
+ }
+ else
+ {
+ timerForCFNRy = CALL_CFNRY_TIMER;
+ }
+
+ hcTimer->setTimer(timerForCFNRy);
+ }
+ else if (parent->waitingCallLeg)
+ {
+ hcTimer->setTimer(CALL_WAITING_T3_TIMER);
+ }
+ else
+ {
+ hcTimer->setTimer(CALL_ALERTING_T301);
+ }
+
+ // Always do sendRemote at the end of the handler.
+ // Now send the internal Alerting message to the other H.323 half call -
+ if (sendRemote(OHC_REMOTE_ALERTING) == false)
+ // failed commn. with the remote side - treat as a release complete
+ // from the remote side and cleanup -
+ // one stage release - skip event loop.
+ {
+ DBG_LEAVE();
+ return (handleMobRemoteAbnormalRelCom());
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleMobCallProgress(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleMobCallProgress", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ int i;
+
+ // cancel setup timer
+ hcTimer->cancelTimer();
+
+ // declare a pointer to the call confirmed portion of the message
+ T_CNI_RIL3CC_MSG_CALL_CONFIRMED *callConf = &(msDecodedMsg->callConfirmed);
+
+ // !< handle user busy cause value. - Network should know this already,
+ // - The MS maybe talking to a different network??
+
+ // !! handle BC info elements as per 7.01
+
+ // !< Call Control capabilities can be ignored for now
+
+ callState_ = THC_ST_CALL_CONFIRMED;
+
+ hcTimer->setTimer(CALL_CALL_CONFIRMED_T310);
+
+ //PR1508 FR only case
+ DBG_TRACE("RIL3->CC code(Ms)(MTC): 1st(%d,%d) 2nd(%d,%d) 3rd(%d,%d)\n",
+ callConf->bearCap1.speechVersionInd[0].fieldPresent,
+ callConf->bearCap1.speechVersionInd[0].version,
+ callConf->bearCap1.speechVersionInd[1].fieldPresent,
+ callConf->bearCap1.speechVersionInd[1].version,
+ callConf->bearCap1.speechVersionInd[2].fieldPresent,
+ callConf->bearCap1.speechVersionInd[2].version);
+
+ if (!(callConf->bearCap1.ie_present))
+ {
+ callConf->bearCap1.ie_present = true;
+ callConf->bearCap1.speechVersionInd[0].fieldPresent = true;
+ callConf->bearCap1.speechVersionInd[0].version = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1;
+ callConf->bearCap1.speechVersionInd[1].fieldPresent = false;
+ callConf->bearCap1.speechVersionInd[2].fieldPresent = false;
+ }
+
+ // setup remote data struct
+ for (i=0; i < 3; i++)
+ {
+ remMsgData.callProceeding.bearerCap.speechVersionInd[i] =
+ callConf->bearCap1.speechVersionInd[i];
+ }
+
+
+ if ( !( callConf->bearCap1.speechVersionInd[0].fieldPresent ||
+ callConf->bearCap1.speechVersionInd[1].fieldPresent ||
+ callConf->bearCap1.speechVersionInd[2].fieldPresent ) )
+
+ {
+ remMsgData.callProceeding.bearerCap.speechVersionInd[0].fieldPresent = 1;
+ remMsgData.callProceeding.bearerCap.speechVersionInd[0].version = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1;
+ }
+
+ DBG_TRACE("RIL3->CC code(Voip)(MTC): 1st(%d,%d) 2nd(%d,%d) 3rd(%d,%d)\n",
+ remMsgData.callProceeding.bearerCap.speechVersionInd[0].fieldPresent,
+ remMsgData.callProceeding.bearerCap.speechVersionInd[0].version,
+ remMsgData.callProceeding.bearerCap.speechVersionInd[1].fieldPresent,
+ remMsgData.callProceeding.bearerCap.speechVersionInd[1].version,
+ remMsgData.callProceeding.bearerCap.speechVersionInd[2].fieldPresent,
+ remMsgData.callProceeding.bearerCap.speechVersionInd[2].version);
+
+ bearCap1speechVersionInd_[0] = remMsgData.callProceeding.bearerCap.speechVersionInd[0];
+ bearCap1speechVersionInd_[1] = remMsgData.callProceeding.bearerCap.speechVersionInd[1];
+ bearCap1speechVersionInd_[2] = remMsgData.callProceeding.bearerCap.speechVersionInd[2];
+
+ // Always do sendRemote at the end of the handler.
+ // Now send setup to the other half call.
+ if (sendRemote(HC_REMOTE_CALL_PROGRESS) == false)
+ // failed commn. with the remote side - treat as a release complete
+ // from the remote side and cleanup - skip event loop.
+ {
+ DBG_LEAVE();
+ return (handleMobRemoteAbnormalRelCom());
+ }
+
+ // EFR Change
+ // Start Res. Assignment
+ // Very Early Assignment - Begin
+ // DBG_LEAVE();
+ // return (CC_RESOURCE_ASSIGN_REQ);
+ // Very Early Assignment - End
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleMobAnswer(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleMobAnswer", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // cancel alerting timer
+ hcTimer->cancelTimer();
+
+ // !< handle subaddress may be needed.
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ callState_ = HC_ST_ACTIVE;
+
+ // Now send the internal Answer message to the other H.323 half call -
+ if (sendRemote(OHC_REMOTE_ANSWER) == false)
+ // failed commn. with the remote side - treat as a release complete
+ // from the remote side and cleanup - skip event loop.
+ {
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+ voipReleaseCause_ = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+
+ DBG_LEAVE();
+ return (handleMobRemoteAbnormalRelCom());
+ }
+
+ // Build the Connect Ack. Message towards the MS.
+ if ( (msOutResult = buildConnectAck (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Release RR resources
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+ voipReleaseCause_ = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+ if (!parent->waitingCallLeg)
+ {
+ // Very Early Assignment - Begin
+ // Synchronize with the Channel state machine
+ if (channState_ != RES_ST_ASSIGNED)
+ {
+ // Channel is not assigned. Cleanup.
+ // This way, you don't accept a late msg. accidentally.
+ channState_ = RES_ST_IDLE;
+
+ // Print a log for warning
+ JCCLog1("CC Warning: H.245 channel selection for (call = %d) too late/missing?\n",
+ parent->callIndex);
+ DBG_WARNING("CC Warning: H.245 channel selection for (call = %d) too late/missing?\n",
+ parent->callIndex);
+
+ //CDR <xxu:08-21-00> BEGIN
+ rlsCause.causeValue = CNI_RIL3_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE;
+ voipReleaseCause_ = CNI_RIL3_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE;
+
+ DBG_LEAVE();
+ return (CC_TWO_STAGE_DISCONNECT);
+ }
+
+ // Very Early Assignment - End
+
+ // CDR <xxu:08-21-00>
+ parent->ccCdr.answer((unsigned char)BEARER_SPEECH, (unsigned char)currSpeechCh_.version);
+ parent->ccCdrCallState = true;
+ parent->ccCdrTimer->setTimer(CALL_CDR_10M);
+
+ }
+ else
+ {
+ if (parent->parent->isOtherLegHeld(parent->callLegNum))
+ {
+ // No longer waiting
+ parent->waitingCallLeg = false;
+ DBG_LEAVE();
+ return (CC_RESOURCE_ASSIGN_REQ);
+ }
+ else
+ {
+ // Do not allow this call
+
+ //CAUSE<xxu:08-21-00> BEGIN
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE;
+ voipReleaseCause_ = CNI_RIL3_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE;
+
+ //CAUSE<xxu:08-21-00> END
+
+ DBG_LEAVE();
+ return (CC_TWO_STAGE_DISCONNECT);
+ }
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleConnectAck(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleConnectAck", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // cancel connect timer
+ hcTimer->cancelTimer();
+
+ // CDR <xxu:08-21-00>
+ parent->ccCdr.answer((unsigned char)BEARER_SPEECH, (unsigned char)currSpeechCh_.version);
+ parent->ccCdrCallState = true;
+ parent->ccCdrTimer->setTimer(CALL_CDR_10M);
+
+ if (!isEmergencyCall)
+ {
+ PM_CCMeasurement.ansMobileOriginatingCalls.increment();
+ }
+ else
+ {
+ PM_CCMeasurement.ansMobileEmergencyCalls.increment();
+ }
+
+ callState_ = HC_ST_ACTIVE;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleMobTermAddress(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleMobTermAddress", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+ T_SUBSC_IE_MOBILE_ID_IMSI *imsiPtr;
+ T_SUBSC_IE_ISDN *msisdnPtr;
+ int i;
+
+ // declare a pointer to the setup portion of the message
+ T_CNI_RIL3CC_MSG_SETUP *setup = &(msDecodedMsg->setup);
+
+ // Copy the transaction identifier
+ ti = (msDecodedMsg->header.si_ti | ORIG_OR_MASK);
+
+ // Cancel MM Conn Est timer
+ hcTimer->cancelTimer();
+
+ setupTime_ = tickGet();
+
+ // !< BC1 is mandatory. BC2 may be included. - only look at the
+ // message data to see what the MS is saying.
+ // It shoudl be capable of Full Rate Speech, come on!
+
+ // Copy locally the above
+ cpn = setup->calledBCD;
+
+ //CDR <xxu:08-29-00>
+ parent->ccCdr.setCalledPartyNumber(&cpn);
+
+ // DBG_TRACE("CC Call Log: (called party number = %d,%d,%d,%d) \n",
+ // cpn.digits[0],
+ // cpn.digits[1],
+ // cpn.digits[2],
+ // cpn.digits[3]);
+
+ // !< CLIR suppression, invocation - 4.81
+ // !< CC Capabilities may be included.
+
+ // setup remote data struct
+ remMsgData.setup.CalledPartyNumber = cpn;
+ for (i=0; i < 3; i++)
+ {
+
+ remMsgData.setup.bearerCap.speechVersionInd[i] =
+ setup->bearCap1.speechVersionInd[i];
+
+ }
+
+ //PR1475 FR only case
+
+ DBG_TRACE("RIL3->CC code(Rx): 1st(%d,%d) 2nd(%d,%d) 3rd(%d,%d)\n",
+ setup->bearCap1.speechVersionInd[0].fieldPresent,
+ setup->bearCap1.speechVersionInd[0].version,
+ setup->bearCap1.speechVersionInd[1].fieldPresent,
+ setup->bearCap1.speechVersionInd[1].version,
+ setup->bearCap1.speechVersionInd[2].fieldPresent,
+ setup->bearCap1.speechVersionInd[2].version);
+
+ if (!(setup->bearCap1.ie_present))
+ {
+ setup->bearCap1.ie_present = true;
+ setup->bearCap1.speechVersionInd[0].fieldPresent = true;
+ setup->bearCap1.speechVersionInd[0].version = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1;
+ setup->bearCap1.speechVersionInd[1].fieldPresent = false;
+ setup->bearCap1.speechVersionInd[2].fieldPresent = false;
+ }
+
+
+ if ( !( setup->bearCap1.speechVersionInd[0].fieldPresent ||
+ setup->bearCap1.speechVersionInd[1].fieldPresent ||
+ setup->bearCap1.speechVersionInd[2].fieldPresent ) )
+ {
+ remMsgData.setup.bearerCap.speechVersionInd[0].fieldPresent = 1;
+ remMsgData.setup.bearerCap.speechVersionInd[0].version = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1;
+ }
+
+ DBG_TRACE("RIL3->CC code(Tx): 1st(%d,%d) 2nd(%d,%d) 3rd(%d,%d)\n",
+ remMsgData.setup.bearerCap.speechVersionInd[0].fieldPresent,
+ remMsgData.setup.bearerCap.speechVersionInd[0].version,
+ remMsgData.setup.bearerCap.speechVersionInd[1].fieldPresent,
+ remMsgData.setup.bearerCap.speechVersionInd[1].version,
+ remMsgData.setup.bearerCap.speechVersionInd[2].fieldPresent,
+ remMsgData.setup.bearerCap.speechVersionInd[2].version);
+
+ bearCap1speechVersionInd_[0] = remMsgData.setup.bearerCap.speechVersionInd[0];
+ bearCap1speechVersionInd_[1] = remMsgData.setup.bearerCap.speechVersionInd[1];
+ bearCap1speechVersionInd_[2] = remMsgData.setup.bearerCap.speechVersionInd[2];
+
+ remMsgData.setup.IsEmergencyCall = false;
+
+ callState_ = OHC_ST_OFFERING_CALL;
+
+ // !< Need to check with the LUDB that the call be allowed.
+ // check subscriber's permissions & other SS interactions - future
+ // Authorize the origination attempt
+ if (! gLUDB.authOrig(parent->ludbIndex(), cpn))
+ {
+ JCCLog1("Origination Authorization failed, (LUDB Index = %d)\n",
+ parent->ludbIndex());
+ DBG_TRACE("Origination Authorization failed, (LUDB Index = %d)\n",
+ parent->ludbIndex());
+ DBG_LEAVE();
+
+ return (handleMobRemoteAbnormalRelCom());
+ }
+
+ //CLIR <xxu:07-26-01> Begin
+ T_SS_SUBSC_CLIR_OPTION option;
+ bool isProvCLIR;
+ int ret;
+
+ if (ret=ludbGetCLIROption(parent->ludbIndex(), &option, &isProvCLIR))
+ {
+ DBG_ERROR("CC Half Call Log: ludbGetCLIROption() Failed (error=%d) for (ludbId=%d)\n",
+ ret, parent->ludbIndex());
+ DBG_LEAVE();
+ return (handleMobRemoteAbnormalRelCom());
+ }
+
+ DBG_TRACE("CC Half Call Log: ludbGetCLIROption() returned data (isProvCLIR=%d,option=%d,ret=%d,ludbId=%d)\n",
+ isProvCLIR, option, ret, parent->ludbIndex());
+
+ if (isProvCLIR)
+ {
+ if (setup->clirInvocation.ie_present || setup->clirSuppression.ie_present)
+ {
+ //Reject the call
+ DBG_TRACE("CC Half Call Log: Call rejected due to illegal attempt of CLIR featire clirInv(%d) clirSup(%d)!\n",
+ setup->clirInvocation.ie_present, setup->clirSuppression.ie_present);
+ rlsCause.causeValue = CNI_RIL3_CAUSE_REQUESTED_SERVICE_NOT_SUBSCRIBED;
+ DBG_LEAVE();
+ return (handleMobRemoteAbnormalRelCom());
+ }
+
+ remMsgData.setup.clir.ie_present = true;
+ remMsgData.setup.clir.clirSetting = CNI_RIL3_PRESENTATION_ALLOWED;
+
+ } else
+ {
+ switch(option)
+ {
+ case CLIR_PERMANENT:
+ //if (setup->clirSuppression.ie_present) Need to notify subscriber later
+ remMsgData.setup.clir.ie_present = true;
+ remMsgData.setup.clir.clirSetting = CNI_RIL3_PRESENTATION_RESTRICTED;
+ break;
+
+ case CLIR_TEMP_DFT_RESTRICTED:
+ remMsgData.setup.clir.ie_present = true;
+ if (setup->clirSuppression.ie_present)
+ remMsgData.setup.clir.clirSetting = CNI_RIL3_PRESENTATION_ALLOWED;
+ else
+ remMsgData.setup.clir.clirSetting = CNI_RIL3_PRESENTATION_RESTRICTED;
+ break;
+
+ case CLIR_TEMP_DFT_ALLOWED:
+ remMsgData.setup.clir.ie_present = true;
+ if (setup->clirInvocation.ie_present)
+ remMsgData.setup.clir.clirSetting = CNI_RIL3_PRESENTATION_RESTRICTED;
+ else
+ remMsgData.setup.clir.clirSetting = CNI_RIL3_PRESENTATION_ALLOWED;
+ break;
+
+ default:
+ DBG_ERROR("CC Half Call Log: ludbGetCLIROption() Incorrect Option(%d) for (ludbId=%d)\n",
+ option, parent->ludbIndex());
+ break;
+ }
+ }
+
+ DBG_TRACE("CC Half Call Log: CLIR sent to VoIP (ie_present=%d,clirSetting=%d,ludbId=%d)\n",
+ remMsgData.setup.clir.ie_present,
+ remMsgData.setup.clir.clirSetting, parent->ludbIndex());
+
+ //CLIR <xxu:07-26-01> End
+
+ // Build Call Proceeding as soon as the origination authorization
+ // is successful. Don't have to wait for a Call Proceeding from the
+ // H323 side.
+ // Build the Call Proceeding Message towards the MS.
+ if ( (msOutResult = buildCallProceeding (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Release RR resources
+
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+ // BCT <xxu:07-11-00> BEGIN
+ if ( parent->getBctInvoke() )
+ {
+ hcTimer->setTimer(CALL_BCT_NUMBER_TVB);
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+ // BCT <xxu:07-11-00> END
+
+ // copy the call reference value towards the VOIP side.
+ // remMsgData.callSetup.callRefValue = parent->callRefValue;
+
+ // Always do sendRemote at the end of the handler.
+ // Now send setup to the other half call.
+ if (sendRemote(THC_REMOTE_TERM_ADDRESS) == false)
+ // failed commn. with the remote side - treat as a release complete
+ // from the remote side and cleanup - skip event loop.
+ {
+
+ DBG_LEAVE();
+ return (handleMobRemoteAbnormalRelCom());
+ }
+
+ // set this boolean to true until we actually send a setup request to VOIP.
+ parent->disconnectSentToVoip = false;
+
+ // EFR Change
+ // Also send a request to RRM for channel assignment.
+ // Very early assignment - begin
+ // DBG_LEAVE();
+ // return (CC_RESOURCE_ASSIGN_REQ);
+ // Very early assignment - end
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleMobEmergencyOrigination(void)
+{
+ DBG_FUNC("CCHalfCall::handleMobEmergencyOrigination", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+ T_SUBSC_IE_MOBILE_ID_IMSI *imsiPtr;
+ T_SUBSC_IE_ISDN *msisdnPtr;
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+ int i;
+
+ // declare a pointer to the setup portion of the message
+ T_CNI_RIL3CC_MSG_EMERGENCY_SETUP *setup = &(msDecodedMsg->emergencySetup);
+
+ // Copy the transaction identifier
+ ti = (msDecodedMsg->header.si_ti | ORIG_OR_MASK);
+
+ // Cancel MM Conn Est timer
+ hcTimer->cancelTimer();
+
+ setupTime_ = tickGet();
+
+ cpn.ie_present = false;
+
+ cpn.numDigits = 1;
+
+ // setup remote data struct
+ remMsgData.setup.CalledPartyNumber = cpn;
+
+ // Bearer Capability is optional.
+ // If BC not present, initialize with FR
+
+ if (!(setup->bearCap.ie_present))
+ {
+ setup->bearCap.ie_present = true;
+ setup->bearCap.speechVersionInd[0].fieldPresent = true;
+ setup->bearCap.speechVersionInd[0].version = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1;
+ setup->bearCap.speechVersionInd[1].fieldPresent = false;
+ setup->bearCap.speechVersionInd[2].fieldPresent = false;
+ }
+
+ if ( !( setup->bearCap.speechVersionInd[0].fieldPresent ||
+ setup->bearCap.speechVersionInd[1].fieldPresent ||
+ setup->bearCap.speechVersionInd[2].fieldPresent ) )
+ {
+ setup->bearCap.speechVersionInd[0].fieldPresent = 1;
+ setup->bearCap.speechVersionInd[0].version = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1;
+ }
+
+ for (i=0; i < 3; i++)
+ {
+ remMsgData.setup.bearerCap.speechVersionInd[i] =
+ setup->bearCap.speechVersionInd[i];
+ }
+
+ //PR1508
+ DBG_TRACE("RIL3->CC code(Voip)(Em): 1st(%d,%d) 2nd(%d,%d) 3rd(%d,%d)\n",
+ remMsgData.setup.bearerCap.speechVersionInd[0].fieldPresent,
+ remMsgData.setup.bearerCap.speechVersionInd[0].version,
+ remMsgData.setup.bearerCap.speechVersionInd[1].fieldPresent,
+ remMsgData.setup.bearerCap.speechVersionInd[1].version,
+ remMsgData.setup.bearerCap.speechVersionInd[2].fieldPresent,
+ remMsgData.setup.bearerCap.speechVersionInd[2].version);
+
+ remMsgData.setup.IsEmergencyCall = true;
+
+ callState_ = OHC_ST_OFFERING_CALL;
+
+ // Build Call Proceeding as soon as the origination authorization
+ // is successful. Don't have to wait for a Call Proceeding from the
+ // H323 side.
+ // Build the Call Proceeding Message towards the MS.
+ if ( (msOutResult = buildCallProceeding (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Release RR resources
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_TEMPORARY_FAILURE;
+ voipReleaseCause_ = CNI_RIL3_CAUSE_TEMPORARY_FAILURE;
+
+ //CAUSE<xxu:03-21-00> END
+
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+ // copy the call reference value towards the VOIP side.
+ // remMsgData.callSetup.callRefValue = parent->callRefValue;
+
+ // Always do sendRemote at the end of the handler.
+ // Now send setup to the other half call.
+ if (sendRemote(THC_REMOTE_TERM_ADDRESS) == false)
+ // failed commn. with the remote side - treat as a release complete
+ // from the remote side and cleanup - skip event loop.
+ {
+ DBG_LEAVE();
+ return (handleMobRemoteAbnormalRelCom());
+ }
+
+ // set this boolean to true until we actually send a setup request to VOIP.
+ parent->disconnectSentToVoip = false;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+// disconnect handler
+JCCEvent_t
+CCHalfCall::handleDisconnectReq(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleDisconnectReq", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ if ((currEvent == HC_LOCAL_DISCONNECT_REQ) && // Mobile disconnected
+ (msDecodeResult == CNI_RIL3_RESULT_SUCCESS)) // not caused by protocol errors
+ {
+ // declare a pointer to the disconnect portion of the message
+ T_CNI_RIL3CC_MSG_DISCONNECT *msInMsg = &(msDecodedMsg->disconnect);
+
+ if (callState_ != HC_ST_DISCONNECT_IND)
+ rlsCause.causeValue = msInMsg->cause.causeValue;
+
+ // Make sure that release cause is not sent in the release message.
+ rlsCause.ie_present = false;
+
+ if (rlsCause.causeValue == 0)
+ {
+ DBG_TRACE("RIL3->CC Warning: cause value from the Mobile is 0!\n");
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING;
+ }
+ }
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ else if (currEvent == HC_LOCAL_PROTOCOL_TIMEOUT)
+ {
+ if (callState_ != THC_ST_ALERTING)
+ rlsCause.causeValue = CNI_RIL3_CAUSE_RECOVERY_ON_TIMER_EXPIRY;
+ }
+ else
+ {
+ if (currEvent != CC_TWO_STAGE_DISCONNECT)
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING;
+ }
+
+ voipReleaseCause_ = rlsCause.causeValue;
+
+ // Always do sendRemote at the end of the handler.
+ // Now send the internal Rel Complt message to the other H.323 half call -
+ if (sendRemote(HC_REMOTE_RELEASE_COMPLETE) == false)
+ // failed commn. with the remote side - treat as a release complete
+ // from the remote side and cleanup - skip event loop.
+ {
+ DBG_LEAVE();
+ return (handleMobRemoteAbnormalRelCom());
+ }
+
+ //switch (rlsCause.causeValue)
+ // {
+ // case CNI_RIL3_CAUSE_USER_BUSY:
+ // voipReleaseCause_ = MOBILE_CAUSE_USER_BUSY;
+ // break;
+ //
+ // case CNI_RIL3_CAUSE_CALL_REJECTED:
+ // voipReleaseCause_ = MOBILE_CAUSE_CALL_REJECTED;
+ // break;
+ //
+ // case CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING:
+ // voipReleaseCause_ = MOBILE_CAUSE_NORMAL_CALL_CLEARING;
+ // break;
+ //
+ // case CNI_RIL3_CAUSE_CHANNEL_UNACCEPTABLE:
+ // voipReleaseCause_ = MOBILE_CAUSE_CHANNEL_UNACCEPTABLE;
+ // break;
+ //
+ // case CNI_RIL3_CAUSE_NORMAL_UNSPECIFIED:
+ // voipReleaseCause_ = MOBILE_CAUSE_UNSPECIFIED;
+ // break;
+ //
+ // default:
+ // switch((rlsCause.causeValue) >> 4)
+ // {
+ // case CNI_RIL3_CAUSE_CLASS_RESOURCE_UNAVAILABLE:
+ // voipReleaseCause_ = MOBILE_CAUSE_RESOURCES_UNAVAILABLE;
+ // break;
+ //
+ // case CNI_RIL3_CAUSE_CLASS_PROTOCOL_ERROR:
+ // voipReleaseCause_ = MOBILE_CAUSE_UNSPECIFIED;
+ // break;
+ //
+ // default:
+ // voipReleaseCause_ = MOBILE_CAUSE_UNSPECIFIED;
+ // break;
+ // }
+ // }
+
+ //CAUSE<xxu:03-21-00> END
+
+ // cancel any timers
+ hcTimer->cancelTimer();
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ // Build the Release Message towards the MS.
+ if ( (msOutResult = buildReleaseReq (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Release RR resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+
+ // start the release timer
+ hcTimer->setTimer(CALL_RELEASE_T308);
+ releaseCounter = 1;
+
+ callState_ = HC_ST_RELEASE_REQ;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+// Same handler can also be used for when an abnormal Rls is received
+JCCEvent_t
+CCHalfCall::handleReleaseReq(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleReleaseReq", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // Look at Cause value?
+ if ((currEvent == HC_LOCAL_RELEASE_REQ) && // Mobile sent release
+ (msDecodeResult == CNI_RIL3_RESULT_SUCCESS)) // not caused by protocol errors
+ {
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ DBG_TRACE("CC Info: handleReleaseReq, ie_present %d, causeValue %d\n",
+ msDecodedMsg->release.cause.ie_present,
+ msDecodedMsg->release.cause.causeValue);
+
+ if (msDecodedMsg->release.cause.ie_present &&
+ callState_ != HC_ST_DISCONNECT_IND)
+ {
+ rlsCause.causeValue = msDecodedMsg->release.cause.causeValue;
+ }
+
+ //CAUSE<xxu:03-21-00> END
+
+ // Make sure that cause is not sent in the release complete message.
+ rlsCause.ie_present = false;
+ }
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ voipReleaseCause_ = rlsCause.causeValue;
+
+ //CAUSE<xxu:03-21-00> END
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ // Build the Release Message towards the MS.
+ if ( (msOutResult = buildReleaseComplete (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Release RR resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+
+ // !< Transaction Id. has to be released, maybe in res_release? Yes
+
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+}
+
+// Not be used for when an abnormal Rls Complete
+JCCEvent_t
+CCHalfCall::handleMobReleaseComplete(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleMobReleaseComplete", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ if ( (msDecodeResult == CNI_RIL3_RESULT_SUCCESS) &&
+ (msDecodedMsg->header.message_type==CNI_RIL3CC_MSGID_RELEASE_COMPLETE) &&
+ (msDecodedMsg->releaseComplete.cause.ie_present) )
+ {
+ rlsCause.causeValue = msDecodedMsg->releaseComplete.cause.causeValue;
+ voipReleaseCause_ = msDecodedMsg->releaseComplete.cause.causeValue;
+ }
+
+ //CAUSE<xxu:03-21-00> END
+
+ // No need to look at Cause value for now.
+ // !< Transaction Id. has to be released - in res_release
+
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+}
+
+//CAUSE<xxu:03-21-00> BEGIN
+JCCEvent_t
+CCHalfCall::handleMobReleaseCompleteUtil(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleMobReleaseCompleteUtil", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ callState_ = HC_ST_NULL;
+
+ // No need to look at Cause value for now.
+ // !< Transaction Id. has to be released - in res_release
+
+ // Always do sendRemote at the end of the handler.
+ // Now send the internal Rel Complt message to the other H.323 half call -
+
+ if (sendRemote(HC_REMOTE_RELEASE_COMPLETE) == false)
+ // failed commn. with the remote side - treat as a release complete
+ // from the remote side and cleanup - skip event loop.
+ {
+ DBG_LEAVE();
+ return (handleMobRemoteAbnormalRelCom());
+ }
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+}
+
+//CAUSE<xxu:03-21-00> END
+
+JCCEvent_t
+CCHalfCall::handleStartDtmf(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleStartDtmf", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ //
+ // declare a pointer to the start dtmf portion of the message
+ T_CNI_RIL3CC_MSG_START_DTMF *msInMsg = &(msDecodedMsg->startDTMF);
+
+ currKeypadFacility_ = msInMsg->keypadFacility;
+
+ // Send an Ack. back to the MS.
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ // Build the Ack Message towards the MS.
+ if ( (msOutResult = buildStartDtmfAck (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Not critical to the call.
+ JCCLog1("RIL3->CC: Build Start DTMF Ack problem, (RIL3 result = %d)\n",
+ msOutResult);
+ DBG_ERROR("RIL3->CC: Build Start DTMF Ack problem, (RIL3 result = %d)\n",
+ msOutResult);
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ DBG_TRACE ("CC DTMF Log: (keypad info. = %d) received.\n",
+ msInMsg->keypadFacility.keypadInfo);
+
+ // Nullify the digit
+ remMsgData.dtmfDigit = 0;
+
+ remMsgData.dtmfDigit = (short)(msInMsg->keypadFacility.keypadInfo);
+
+ if (remMsgData.dtmfDigit == 0x23)
+ {
+ remMsgData.dtmfDigit = 0x0b;
+ }
+ else
+ {
+ remMsgData.dtmfDigit = (remMsgData.dtmfDigit & 0x0f);
+ }
+
+ // Send an Ack. back to the MS.
+ if (sendRemote(HC_REMOTE_DTMF_REQ) == false)
+ // failed commn. with the remote side
+ {
+ // Log the error. Not critical to the call.
+ JCCLog("CC->VOIP: Start DTMF problem. Send to remote(H323) failed\n");
+ DBG_ERROR("CC->VOIP: Start DTMF problem. Send to remote(H323) failed\n");
+ }
+
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleStopDtmf(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleStopDtmf", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ //
+ // Send an Ack. back to the MS.
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ // Build the Ack Message towards the MS.
+ if ( (msOutResult = buildStopDtmfAck (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Not critical to the call.
+ JCCLog1("RIL3->CC: Build Stop DTMF Ack problem, (RIL3 result = %d)\n",
+ msOutResult);
+ DBG_ERROR("RIL3->CC: Build Stop DTMF Ack problem, (RIL3 result = %d)\n",
+ msOutResult);
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+// !< For all msgs,local and remote, User-to-User support can be added later,
+// connected subaddress is related to this.
+
+//CH<xxu:11-10-99>
+JCCEvent_t
+CCHalfCall::handleHoldAct(void)
+{
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ DBG_FUNC("CCHalfCall::handleHoldAct", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE ("CC CallLog @HoldAct: callId=%d, callState=%d, chState=%d\n",
+ parent->callIndex, callState_, chState_);
+
+ //Calling this method implies the call's main state is active right now
+ //Accept the HoldAct from mobile and behave consistently inside network
+ chState_ = CH_ST_HELD;
+
+ // Build the Hold Ack Message towards the MS.
+ if ( (msOutResult = buildHoldAck(&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the software design bug, no workaround is proper here.
+ JCCLog1("RIL3->CC: Build HoldAck problem, (RIL3 result = %d)\n",
+ msOutResult);
+ DBG_ERROR("RIL3->CC: Build HoldAck problem, (RIL3 result = %d)\n",
+ msOutResult);
+ chState_ = CH_ST_IDLE;
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //Hold the call's traffic path
+ T_CSU_PORT_ID srcPort, dstPort;
+ T_CSU_RESULT_CON csuResult;
+
+ srcPort = parent->parent->mobileCsuPort();
+ dstPort.portType = CSU_RTP_PORT;
+ dstPort.portId.rtpHandler = VoipCallGetRTPHandle(parent->h323CallHandle);
+
+ if ((csuResult = csu_DuplexBreak(&srcPort, &dstPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog2("CSU Error : Disconn. Failure, (Result = %d) for (entryId = %d)\n",
+ csuResult, parent->entryId());
+ DBG_ERROR("CSU Error : Disconn. Failure, (Result = %d) for (entryId = %d)\n",
+ csuResult, parent->entryId());
+
+ }
+
+ parent->voiceConnected = false;
+
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+//CH<xxu:11-24-99>
+JCCEvent_t
+CCHalfCall::handleHoldRej(void)
+{
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ DBG_FUNC("CCHalfCall::handleHoldRej", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE ("CC CallLog @HoldRej: callId=%d, callState=%d, chState=%d\n",
+ parent->callIndex, callState_, chState_);
+
+ //Only build and send out HOLD REJ message, nothing else!
+
+ // Build the Hold Rej Message towards the MS.
+ if ( (msOutResult = buildHoldRej(&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the software design bug, no workaround is proper here.
+ JCCLog1("RIL3->CC: Build HoldRej problem, (RIL3 result = %d)\n",
+ msOutResult);
+ DBG_ERROR("RIL3->CC: Build HoldRej problem, (RIL3 result = %d)\n",
+ msOutResult);
+ }
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+//CH<xxu:11-10-99>
+JCCEvent_t
+CCHalfCall::handleRetvAct(void)
+{
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ DBG_FUNC("CCHalfCall::handleRetvAct", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE ("CC CallLog @RetvAct: callId=%d, callState=%d, chState=%d\n",
+ parent->callIndex, callState_, chState_);
+
+ //Calling this method implies the call's main state is active right now
+ //Accept the RetvAct from mobile and behave consistently inside network
+ chState_ = CH_ST_IDLE;
+
+ // Build the Retv Ack Message towards the MS.
+ if ( (msOutResult = buildRetvAck(&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the software design bug, no workaround is proper here.
+ JCCLog1("RIL3->CC: Build RetvAck problem, (RIL3 result = %d)\n",
+ msOutResult);
+ DBG_ERROR("RIL3->CC: Build RetvAck problem, (RIL3 result = %d)\n",
+ msOutResult);
+ chState_ = CH_ST_IDLE;
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //Unhold the call's traffic path
+ T_CSU_PORT_ID srcPort, dstPort;
+ T_CSU_RESULT_CON csuResult;
+
+ srcPort = parent->parent->mobileCsuPort();
+ dstPort.portType = CSU_RTP_PORT;
+ dstPort.portId.rtpHandler = VoipCallGetRTPHandle(parent->h323CallHandle);
+
+ if ((csuResult = csu_DuplexConnect(&srcPort, &dstPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog2("CSU Error : Disconn. Failure, (Result = %d) for (entryId = %d)\n",
+ csuResult, parent->entryId());
+ DBG_ERROR("CSU Error : Disconn. Failure, (Result = %d) for (entryId = %d)\n",
+ csuResult, parent->entryId());
+ }
+
+ parent->voiceConnected = true;
+
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+//CH<xxu:11-24-99>
+JCCEvent_t
+CCHalfCall::handleRetvRej(void)
+{
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ DBG_FUNC("CCHalfCall::handleRetvRej", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE ("CC CallLog @RetvRej: callId=%d, callState=%d, chState=%d\n",
+ parent->callIndex, callState_, chState_);
+
+ //Calling this method implies the call's main state is active right now
+ //Only build and send out RETRIEVE REJ message, nothing else!
+
+ // Build the Retv Reg Message towards the MS.
+ if ( (msOutResult = buildRetvRej(&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the software design bug, no workaround is proper here.
+ JCCLog1("RIL3->CC: Build RetvRej problem, (RIL3 result = %d)\n",
+ msOutResult);
+ DBG_ERROR("RIL3->CC: Build RetvRej problem, (RIL3 result = %d)\n",
+ msOutResult);
+ }
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+//CH<xxu:11-10-99>
+JCCEvent_t
+CCHalfCall::handleHoldReq(void)
+{
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ DBG_FUNC("CCHalfCall::handleHoldReq", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE ("CC CallLog @HoldReq: callId=%d, callState=%d, chState=%d\n",
+ parent->callIndex, callState_, chState_);
+
+ //Calling this method implies the call's main state is active right now
+ //Accept the HoldReq from mobile and behave consistently inside network
+ chState_ = CH_ST_HREQ;
+
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+//CH<xxu:11-10-99>
+JCCEvent_t
+CCHalfCall::handleSwapTimerExpiry(void)
+{
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ DBG_FUNC("CCHalfCall::handleSwapTimerExpiry", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE ("CC CallLog @SwapTimerExpiry: callId=%d, callState=%d, chState=%d\n",
+ parent->callIndex, callState_, chState_);
+
+ //Calling this method implies the call's main state is active right now
+ //Accept the RetvAct from mobile and behave consistently inside network
+ chState_ = CH_ST_IDLE;
+
+ // Build the Hold Rej Message towards the MS.
+ if ( (msOutResult = buildHoldRej(&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the software design bug, no workaround is proper here.
+ JCCLog1("RIL3->CC: Build HoldRej problem, (RIL3 result = %d)\n",
+ msOutResult);
+ DBG_ERROR("RIL3->CC: Build HoldRej problem, (RIL3 result = %d)\n",
+ msOutResult);
+ //return (CC_MESSAGE_PROCESSING_COMPLT); //Allow voice is better
+ }
+
+ //Resume traffic path blindly
+ T_CSU_PORT_ID srcPort,dstPort;
+
+ srcPort = parent->parent->mobileCsuPort();
+ dstPort.portType = CSU_RTP_PORT;
+ dstPort.portId.rtpHandler = VoipCallGetRTPHandle(parent->h323CallHandle);
+
+ csu_DuplexConnect(&srcPort, &dstPort);
+
+ parent->voiceConnected = true;
+
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+//CH<xxu:Mod 12-13-99>
+JCCEvent_t
+CCHalfCall::handleRetvReq(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleRetvReq", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE ("CC CallLog @handleRetvReq: callId=%d, callState=%d, chState=%d\n",
+ parent->callIndex, callState_, chState_);
+
+ // If external handover has occurred
+ if (parent->parent->handoverSession->hoState_ == HAND_ST_ANCH_EHO_COMPLT)
+ {
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+ T_CSU_PORT_ID rfSourcePort, rtpSinkPort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSinkPort.portType = CSU_RTP_PORT;
+ rtpSinkPort.portId.rtpHandler = VoipCallGetRTPHandle(parent->h323CallHandle);
+
+ rfSourcePort = parent->parent->mobileCsuPort();
+
+ if ((csuResult = csu_DuplexConnect(&rfSourcePort, &rtpSinkPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog2("CSU Error : Duplex Conn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)rtpSinkPort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Duplex Conn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)rtpSinkPort.portId.rtpHandler);
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_TEMPORARY_FAILURE; //CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ voipReleaseCause_ = CNI_RIL3_CAUSE_TEMPORARY_FAILURE; //CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+
+ //CAUSE<xxu:03-21-00> END
+
+ DBG_LEAVE();
+ return (CC_TWO_STAGE_DISCONNECT);
+ }
+
+ parent->voiceConnected = true;
+
+ // Build the Retv Ack Message towards the MS.
+ if ( (msOutResult = buildRetvAck(&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the software design bug, no workaround is proper here.
+ JCCLog1("RIL3->CC: Build RetvAck problem, (RIL3 result = %d)\n",
+ msOutResult);
+ DBG_ERROR("RIL3->CC: Build RetvAck problem, (RIL3 result = %d)\n",
+ msOutResult);
+ }
+
+ //Voice path connected successfully for Retrive operation, send back RETV ACK
+ parent->msSide->chState_ = CH_ST_IDLE;
+
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+
+ //Change chState to CH_ST_RREQ and return CC_RESOURCE_ASSIGN_REQ to reconnect
+ //traffic channel back
+
+ chState_ = CH_ST_RREQ;
+
+ return (CC_RESOURCE_ASSIGN_REQ);
+}
+
+JCCEvent_t
+CCHalfCall::handleMobStatusInfo(void)
+{
+ DBG_FUNC("CCHalfCall::handleMobStatusInfo", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // declare a pointer to the status portion of the message
+ T_CNI_RIL3CC_MSG_STATUS *statusMsg = &(msDecodedMsg->status);
+
+ // let the developer/tester/fields person decide.
+ // The user of the system needs to check this out to find the problem.
+ DBG_WARNING("MS->CC Status: (coding = %d, cause = %d),(coding = %d, call state = %d) \n",
+ statusMsg->cause.codingStandard,
+ statusMsg->cause.causeValue,
+ statusMsg->callState.codingStandard,
+ statusMsg->callState.state);
+ if (statusMsg->auxStates.ie_present)
+ {
+ DBG_WARNING("MS->CC Status: Aux. states(hold state = %d),(mpty state = %d) \n",
+ statusMsg->auxStates.holdState,
+ statusMsg->auxStates.mptyState);
+ }
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+}
+
+JCCEvent_t
+CCHalfCall::handleMobStatusEnquiry(void)
+{
+ DBG_FUNC("CCHalfCall::handleMobStatusEnquiry", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ // Build the Status Message towards the MS.
+ if ( (msOutResult = buildStatusInfo (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Don't Release Channel resources. It is not a critical problem.
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+}
+
diff --git a/data/mnet/GP10/Host/cc/src/CCMobIntHnd.cpp b/data/mnet/GP10/Host/cc/src/CCMobIntHnd.cpp
new file mode 100644
index 0000000..73905c4
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCMobIntHnd.cpp
@@ -0,0 +1,696 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCMobIntHnd.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description : CC Handlers for events triggered internal to ViperCell.
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+//
+#include "CC/CCHalfCall.h"
+#include "CC/CallLeg.h"
+#include "CC/CCSessionHandler.h"
+
+#include "CC/CCUtil.h"
+#include "CC/CallConfig.h"
+
+#include "logging/VCLOGGING.h"
+#include "jcc/JCCLog.h"
+
+// included MD and IRT headers for messages from MS
+#include "ril3/ril3md.h"
+
+#include "stdio.h"
+
+// Temporarily use csu_head instead of csu_intf
+#include "csunew/csu_head.h"
+
+#include "JCC/LUDBapi.h"
+
+#include "JCC/JCCUtil.h"
+
+bool forcedCodec = false;
+
+extern bool callTrace;
+
+INT16 forcedCodecSpeechVersion = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_2;
+
+#include "rm/rm_head.h"
+extern u8 rm_EntryIdToTrxSlot(T_CNI_IRT_ID entryId, u16 *gsmHandler);
+
+// *******************************************************************
+// forward declarations.
+// *******************************************************************
+
+// Timeout during THC_ST_CALL_CONFIRMED, THC_ST_ALERTING,
+// THC_ST_PRESENTING_CALL and OHC_ST_CONNECT_INDICATION
+// are all handled the same as CC_TWO_STAGE_DISCONNECT
+// event, which is basically the logic in handleDisconnectReq
+// !< But in these cases, Release Cause is needed when used to
+// initiate call clearing. Set it in the timeout handlers.
+
+void
+forcedCodecOn (void)
+{
+ forcedCodec = true;
+}
+
+void
+forcedCodecOff (void)
+{
+ forcedCodec = false;
+}
+
+void
+setCodecSpeechVersion (INT16 speechVersion)
+{
+ forcedCodecSpeechVersion = speechVersion;
+}
+
+// Connection Manager functionality
+JCCEvent_t
+CCHalfCall::handleConnReq(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleConnReq", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ T_CSU_PORT_ID rfSourcePort, rtpSinkPort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSinkPort.portType = CSU_RTP_PORT;
+ rtpSinkPort.portId.rtpHandler = VoipCallGetRTPHandle(parent->h323CallHandle);
+
+ rfSourcePort = parent->parent->mobileCsuPort();
+
+ if ((csuResult = csu_DuplexConnect(&rfSourcePort, &rtpSinkPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog2("CSU Error : Duplex Conn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)rtpSinkPort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Duplex Conn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)rtpSinkPort.portId.rtpHandler);
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_TEMPORARY_FAILURE; //CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ voipReleaseCause_ = CNI_RIL3_CAUSE_TEMPORARY_FAILURE; //CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+
+ //CAUSE<xxu:03-21-00> END
+
+ DBG_LEAVE();
+ return (CC_TWO_STAGE_DISCONNECT);
+ }
+
+ parent->voiceConnected = true;
+
+ if ( (callState_==HC_ST_ACTIVE && chState_==CH_ST_RREQ) || (parent->bctArrival_) )
+ {
+ //BCT <xxuL09-22-00> BEGIN
+ if (parent->bctArrival_)
+ {
+ //Bridge voice path for BCT
+ DBG_TRACE("CC->BCT(csuDconn): chState(%d,%d) callSt(%d) bct(%d,%d) callHndl(%x) snk(%d,%x)\n",
+ parent->h245ChannState, channState_,callState_,
+ parent->getBctInvoke(), parent->bctArrival_,
+ parent->h323CallHandle,
+ rfSourcePort.portType, rfSourcePort.portId.rtpHandler);
+ parent->bctArrival_ = false;
+ }
+
+ DBG_LEAVE();
+ return (CC_CONNECT_COMPLT);
+ } else
+ {
+ // CDR <xxu:08-21-00> BEGIN
+ parent->ccCdr.answer((unsigned char)BEARER_SPEECH, (unsigned char)currSpeechCh_.version);
+ parent->ccCdrCallState = true;
+ parent->ccCdrTimer->setTimer(CALL_CDR_10M);
+
+ // CDR <xxu:08-21-00> END
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+}
+
+JCCEvent_t
+CCHalfCall::handleNullEvent(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleNullEvent", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // Do Nothing.
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+// Disconnect Timeout
+JCCEvent_t
+CCHalfCall::handleDisconnectTimeout(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleDisconnectTimeout", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // !< Release Cause (same as the Disconnect Cause) needs to be included.
+ // !< A second Release Cause may be included(timer expiry)
+
+ // print out the trx, timeslot for better debugging
+ UINT16 gsmHandler;
+ UINT8 trx, slot;
+ T_SUBSC_IE_ISDN* isdnPtr;
+
+ if (rm_EntryIdToTrxSlot(parent->entryId(),
+ &gsmHandler) ==
+ RM_TRUE)
+ {
+
+ trx = (UINT8)(gsmHandler>>8);
+ slot = (UINT8)(gsmHandler);
+
+ DBG_WARNING("CC Log: Disconnect got no response from MS on (TRX=%d),(Slot=%d),(entryId=%d)\n",
+ trx, slot, parent->entryId());
+ if ((isdnPtr = ludbGetMSISDNPtr(parent->ludbIndex())) != NULL)
+ {
+ DBG_WARNING("CC Log: MS (DN=%s)\n",
+ isdnPtr->digits);
+ }
+ }
+
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ // Build the Release Message towards the MS.
+ if ( (msOutResult = buildReleaseReq (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Release RR resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+ // start the release timer
+ hcTimer->setTimer(CALL_RELEASE_T308);
+ releaseCounter = 1;
+
+ callState_ = HC_ST_RELEASE_REQ;
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleReleaseTimeout(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleReleaseTimeout", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // print out the trx, timeslot for better debugging
+ UINT16 gsmHandler;
+ UINT8 trx, slot;
+ T_SUBSC_IE_ISDN* isdnPtr;
+
+ if (rm_EntryIdToTrxSlot(parent->entryId(),
+ &gsmHandler) ==
+ RM_TRUE)
+ {
+
+ trx = (UINT8)(gsmHandler>>8);
+ slot = (UINT8)(gsmHandler);
+
+ DBG_WARNING("CC Log: Release got no response from MS on (TRX=%d),(Slot=%d),(entryId=%d),(releaseCount=%d)\n",
+ trx, slot, parent->entryId(), releaseCounter);
+ if ((isdnPtr = ludbGetMSISDNPtr(parent->ludbIndex())) != NULL)
+ {
+ DBG_WARNING("CC Log: MS (DN=%s)\n",
+ isdnPtr->digits);
+ }
+ }
+
+
+ if (releaseCounter == 0)
+ {
+ // already repeated release msg.
+ // !< Transaction Id. has to be released, maybe in res_release? - Yes!
+
+ // Release RR resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ // Build the Release Message towards the MS.
+ if ( (msOutResult = buildReleaseReq (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Release RR resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+ // start the release timer
+ hcTimer->setTimer(CALL_RELEASE_T308);
+ releaseCounter = 0;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleMobResRelease(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleMobResRelease", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // Release Local Resources
+ // Release Connection resources, if there are any
+ if (parent->voiceConnected)
+ {
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(parent->h323CallHandle);
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+
+ JCCLog2("CSU Error : Disconn. Failure, (Result = %d) for (RTPHandle = %p)\n",
+ csuResult, (int)rtpSourcePort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Disconn. Failure, (Result = %d) for (RTPHandle = %p)\n",
+ csuResult, rtpSourcePort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+
+ parent->voiceConnected = false;
+
+ }
+
+ // Always do sendRemote at the end of the handler.
+ // Now send the internal Rel Complt message to the other H.323 half call -
+ if (sendRemote(HC_REMOTE_RELEASE_COMPLETE) == false)
+ // failed commn. with the remote side - treat as a release complete
+ // from the remote side and cleanup - skip event loop.
+ {
+ DBG_LEAVE();
+ return (handleMobRemoteAbnormalRelCom());
+ }
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+
+}
+
+JCCEvent_t
+CCHalfCall::handleChannAssignReq(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleChannAssignReq", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+
+ IntraL3Msg_t rrOutMsg;
+
+ if (forcedCodec)
+ {
+ currSpeechCh_.version =
+ (T_CNI_RIL3_SPEECH_VERSION)forcedCodecSpeechVersion;
+ }
+
+ // Assign Local Resources
+ // Send internal RR msg
+ rrOutMsg.l3_data.channAssignCmd.channelType.bearerType = BEARER_SPEECH;
+
+ rrOutMsg.l3_data.channAssignCmd.channelType.speechChann
+ = currSpeechCh_;
+
+ DBG_TRACE("CC->RR: Chann Assignment Request with Speech Version: %d",
+ rrOutMsg.l3_data.channAssignCmd.channelType.speechChann.version);
+
+ parent->parent->sendRRMsg((IntraL3PrimitiveType_t)(parent->callLegNum), INTRA_L3_RR_CHANN_ASSIGN_CMD, &rrOutMsg);
+
+ channState_ = RES_ST_ASS_REQ;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleChannAssignComplt(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleChannAssignComplt", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // Synchronize with the main state machine
+ channState_ = RES_ST_ASSIGNED;
+
+ if (parent->procType == CC_PROC_MOB_ORIG)
+ {
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ ULONG setupCompltTime;
+
+ if (!alertingSent_)
+ {
+ // calculate the setup time
+ setupCompltTime = tickGet();
+
+ DBG_TRACE("Call Setup time in number of system ticks(%d)\n",
+ (setupCompltTime - setupTime_));
+
+ PM_CCMeasurement.meanTimeToCallSetupService.addRecord(setupCompltTime - setupTime_);
+
+ if (!isEmergencyCall)
+ {
+ PM_CCMeasurement.succMobileOriginatingCalls.increment();
+ }
+ else
+ {
+ PM_CCMeasurement.succMobileEmergencyCalls.increment();
+ }
+ }
+
+ if ((callState_ == OHC_ST_CONNECT_INDICATION) &&
+ !connectSent_ )
+ {
+
+ // Build the Connect Message towards the MS.
+ if ( (msOutResult = buildConnect (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Release RR resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+ // start the connect timer
+ hcTimer->setTimer(CALL_CONNECT_T313);
+
+ connectSent_ = true;
+ }
+ }
+ else if (parent->procType == CC_PROC_MOB_TERM)
+ {
+ PM_CCMeasurement.succMobileTerminatingCalls.increment();
+ }
+
+ // Connection Manager functionality
+ if (parent->h245ChannState == RES_ST_ASSIGNED)
+ {
+ // Both channels are setup.
+ DBG_LEAVE();
+ return (CC_MAKE_CONNECTION_REQ);
+ }
+ else
+ {
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+}
+
+JCCEvent_t
+CCHalfCall::handleChannAssignFail(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleChannAssignFail", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // Synchronize with the main state machine
+ channState_ = RES_ST_IDLE;
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_REQUESTED_CIRCUIT_OR_CHANNEL_NOT_AVAILABLE;
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ voipReleaseCause_ = CNI_RIL3_CAUSE_REQUESTED_CIRCUIT_OR_CHANNEL_NOT_AVAILABLE;
+
+ //CAUSE<xxu:03-21-00> END
+
+ DBG_LEAVE();
+ return (CC_TWO_STAGE_DISCONNECT);
+}
+
+JCCEvent_t
+CCHalfCall::handleMMRelInd(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleMMRelInd", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+
+ // Release Connection resources, if there are any
+ if (parent->voiceConnected)
+ {
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(parent->h323CallHandle);
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+
+ JCCLog2("CSU Error : Disconn. Failure, (Result = %d) for (RTPHandle = %p)\n",
+ csuResult, (int)rtpSourcePort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Disconn. Failure, (Result = %d) for (RTPHandle = %p)\n",
+ csuResult, rtpSourcePort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+
+ parent->voiceConnected = false;
+
+ }
+
+ // Always do sendRemote at the end of the handler.
+ if (sendRemote(HC_REMOTE_RELEASE_COMPLETE) == false)
+ // failed commn. with the remote side - treat as a release complete
+ // from the remote side and cleanup - skip event loop.
+ {
+ DBG_LEAVE();
+ return (handleMobRemoteAbnormalRelCom());
+ }
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+
+}
+
+JCCEvent_t
+CCHalfCall::handleMMEstCnf(void)
+{
+
+ DBG_FUNC("CCHalfCall::handleMMEstCnf", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ // !! For Setup, BC 1 may be ommitted if only one directory number
+ // is allocated for all services. - 9.07 - build one BC from the 4.08
+ // first simple example
+
+ // !< For Setup, Called party subaddress may be included, if Orig. included it
+ // Build the Setup Message towards the MS. - No Mandatory IEs
+
+ char callTaskName[20];
+
+ sprintf(&callTaskName[0],
+ "Call-%d EntryId-%d\0",
+ parent->callIndex,
+ parent->entryId());
+
+ if ( (msOutResult = buildSetup (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Release RR resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+ // start the disconnect timer
+ hcTimer->setTimer(CALL_SETUP_T303);
+
+ callState_ = THC_ST_PRESENTING_CALL;
+
+ DBG_LEAVE();
+
+ if (callTrace)
+ {
+ Dbg.Func(&callTaskName[0], CC_LAYER);
+ }
+
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+}
+
+JCCEvent_t
+CCHalfCall::handleMMEstRej(void)
+{
+
+
+ DBG_FUNC("CCHalfCall::handleMMEstRej", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // Page Timeout
+
+ if (mmInMsg->l3_data.pageReq.imsi == ludbGetMobileId(parent->ludbIndex()))
+ {
+ // continue
+ }
+ else
+ {
+//TEST
+//printf("CC Log: receive handleMMEstRej for (ludbIndex = %d)\n", parent->ludbIndex());
+//T_CNI_RIL3_IE_MOBILE_ID imsi_t1, imsi_t2;
+//imsi_t1 = ludbGetMobileId(parent->ludbIndex());
+//imsi_t2 = mmInMsg->l3_data.pageReq.imsi;
+//char *p_t1, *p_t2;
+//p_t1 = (char*) &imsi_t1;
+//p_t2 = (char*) &imsi_t2;
+//printf("IMSI from MM message:\n");
+//int i;
+//for (i=0;i<9;i++)
+//{
+// printf("%2x", (*p_t1++));
+//}
+//printf("\n");
+//printf("IMSI retv from LUDB:\n");
+//for (i=0;i<9;i++)
+//{
+// printf("%2x", (*p_t2++));
+//}
+//printf("\n");
+
+//ccEntryPrint(ccSession[mobInCall(parent->ludbIndex())], JCCPrintf);
+
+ // late message for a different page request
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ // Always do sendRemote at the end of the handler.
+ //voipReleaseCause_ = MOBILE_CAUSE_USER_NO_PAGE_RESPONSE;
+
+ //rlsCause.causeValue = CNI_RIL3_CAUSE_NOT_ROUTE_TO_DESTINATION;
+
+ voipReleaseCause_ = mmInMsg->cause;
+ rlsCause.causeValue = mmInMsg->cause;
+
+ //CAUSE<xxu:03-21-00> END
+
+ if (sendRemote(HC_REMOTE_RELEASE_COMPLETE) == false)
+ // failed commn. with the remote side - treat as a release complete
+ // from the remote side and cleanup - skip event loop.
+ {
+ DBG_LEAVE();
+ return (handleMobRemoteAbnormalRelCom());
+ }
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+
+}
+
+// !< For all msgs,local and remote, User-to-User support can be added later,
+// connected subaddress is related to this.
+
+JCCEvent_t
+CCHalfCall::handleConnComplt(void)
+{
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ DBG_FUNC("CCHalfCall::handleConnComplt", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE ("CC CallLog @handleConnComplt: callId=%d, callState=%d, chState=%d\n",
+ parent->callIndex, callState_, chState_);
+
+ if (callState_ == HC_ST_ACTIVE && chState_ == CH_ST_RREQ)
+ {
+ //Voice path connected successfully for Retrive operation, send back RETV ACK
+ chState_ = CH_ST_IDLE;
+
+ // Build the Retv Ack Message towards the MS.
+ if ( (msOutResult = buildRetvAck(&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the software design bug, no workaround is proper here.
+ JCCLog1("RIL3->CC: Build RetvAck problem, (RIL3 result = %d)\n",
+ msOutResult);
+ DBG_ERROR("RIL3->CC: Build RetvAck problem, (RIL3 result = %d)\n",
+ msOutResult);
+ }
+
+ chState_ = CH_ST_IDLE;
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //Here handling other jobs triggered by CC_CONNECT_COMPLT in the future
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleConnFail(void)
+{
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ DBG_FUNC("CCHalfCall::handleConnFail", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE ("CC CallLog @handleConnComplt: callId=%d, callState=%d, chState=%d\n",
+ parent->callIndex, callState_, chState_);
+
+ if (callState_ == HC_ST_ACTIVE && chState_ == CH_ST_RREQ)
+ {
+ // Log the software design bug, no workaround is proper here.
+ JCCLog("CC->CC: Voice path connection failed\n");
+ DBG_ERROR("CC->CC: Voice path connection failed\n");
+
+ // Build the Retv Rej Message towards the MS.
+ if ( (msOutResult = buildRetvRej(&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the software design bug, no workaround is proper here.
+ JCCLog1("RIL3->CC: Build RetvRej problem, (RIL3 result = %d)\n",
+ msOutResult);
+ DBG_ERROR("RIL3->CC: Build RetvRej problem, (RIL3 result = %d)\n",
+ msOutResult);
+ }
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //Here handling other jobs triggered by CC_CONNECT_FAILED in the future
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
diff --git a/data/mnet/GP10/Host/cc/src/CCMobRemHnd.cpp b/data/mnet/GP10/Host/cc/src/CCMobRemHnd.cpp
new file mode 100644
index 0000000..7ff3b8e
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCMobRemHnd.cpp
@@ -0,0 +1,870 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCMobRemHnd.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description : CC Handlers for events triggered by the other half
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "JCC/JCCLog.h"
+
+#include "logging/VCLOGGING.h"
+#include "JCC/LUDBInstance.h"
+#include "JCC/LUDBapi.h"
+
+#include "CC/CCSessionHandler.h"
+#include "CC/CCUtil.h"
+#include "CC/CallConfig.h"
+
+// included MD and IRT headers for messages from MS
+#include "ril3/ril3md.h"
+
+//CDR <xxu:08-21-00>
+#include "CDR/CdrVoiceCall.h"
+
+#include "rm/rm_head.h"
+extern u8 rm_EntryIdToTrxSlot(T_CNI_IRT_ID entryId, u16 *gsmHandler);
+extern bool callTrace;
+
+// handle remote events
+// !< For all msgs,local and remote, User-to-User support can be added later,
+// connected subaddress is related to this.
+
+// Remote Disconnect
+JCCEvent_t
+CCHalfCall::handleMobRemoteDisconnect(void)
+{
+
+ DBG_FUNC("handleMobRemoteDisconnect", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ // Cause is Mandatory. Use rlsCause to set it before building
+ // !< For now there is a generic rlsCause in the Half Call Object.
+
+ // To avoid sending the release to H323
+ parent->disconnectSentToVoip = true;
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ rlsCause.causeValue =
+ (T_CNI_RIL3_CAUSE_VALUE) remMsgData.basicCallInMsg.ReasonCode;
+
+ // Set the release cause for the Mobile based on the Voip value.
+
+ //switch (remMsgData.basicCallInMsg.ReasonCode) {
+ //
+ //case VOIP_MOBILE_REASON_DESTINATION_BUSY:
+ // rlsCause.causeValue = CNI_RIL3_CAUSE_USER_BUSY;
+ // break;
+ //
+ //case VOIP_MOBILE_REASON_DESTINATION_REJECTED:
+ // rlsCause.causeValue = CNI_RIL3_CAUSE_CALL_REJECTED;
+ // break;
+ //
+ //case VOIP_MOBILE_REASON_DESTINATION_UNREACHABLE:
+ // rlsCause.causeValue = CNI_RIL3_CAUSE_NO_USER_RESPONDING; // Or is it CNI_RIL3_CAUSE_NOT_ROUTE_TO_DESTINATION
+ // // Or CNI_RIL3_CAUSE_USER_ALERTING_NO_ANSWER
+ // break;
+ //
+ //case VOIP_MOBILE_REASON_REMOTE_HANGUP:
+ // rlsCause.causeValue = CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING;
+ // break;
+ //
+ //case VOIP_MOBILE_REASON_VOIP_TASK_ERROR:
+ // rlsCause.causeValue = CNI_RIL3_CAUSE_TEMPORARY_FAILURE;
+ // break;
+ //
+ //default:
+ // // Do Nothing
+ // // Use the pre-stored value (normal, unspecified)
+ // break;
+ //
+ //}
+
+ // print out the trx, timeslot for better debugging
+ UINT16 gsmHandler;
+ UINT8 trx, slot;
+ T_SUBSC_IE_ISDN* isdnPtr;
+
+ if (parent->entryId() != (T_CNI_IRT_ID) JCC_UNDEFINED )
+ if (rm_EntryIdToTrxSlot(parent->entryId(),
+ &gsmHandler) ==
+ RM_TRUE)
+ {
+
+ trx = (UINT8)(gsmHandler>>8);
+ slot = (UINT8)(gsmHandler);
+
+ if (callTrace)
+ {
+ DBG_WARNING("CC Log: Remote(VOIP) Side Disconnected on (TRX=%d),(Slot=%d),(entryId=%d),(cause=%d)\n",
+ trx, slot, parent->entryId(), rlsCause.causeValue);
+ if ((isdnPtr = ludbGetMSISDNPtr(parent->ludbIndex())) != NULL)
+ {
+ DBG_WARNING("CC Log: MS (DN=%s)\n",
+ isdnPtr->digits);
+ }
+ }
+ else
+ {
+ DBG_TRACE("CC Log: Remote(VOIP) Side Disconnected on (TRX=%d),(Slot=%d),(entryId=%d),(cause=%d)\n",
+ trx, slot, parent->entryId(), rlsCause.causeValue);
+ if ((isdnPtr = ludbGetMSISDNPtr(parent->ludbIndex())) != NULL)
+ {
+ DBG_TRACE("CC Log: MS (DN=%s)\n",
+ isdnPtr->digits);
+ }
+ }
+ }
+
+
+ // If the state is currently waiting for a connection response from a lower layer
+ // then just do a mobile resource release
+ if (callState_ == THC_ST_MM_CONN_REQ)
+ {
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+ // Release Connection resources, if there are any, rightaway
+ // so that the RTP Port could be re-assigned from VOIP.
+ if (parent->voiceConnected)
+ {
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(parent->h323CallHandle);
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+
+ JCCLog2("CSU Error : Disconn. Failure, (Result = %d) for (RTPHandle = %p)\n",
+ csuResult, (int)rtpSourcePort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Disconn. Failure, (Result = %d) for (RTPHandle = %p)\n",
+ csuResult, rtpSourcePort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+
+ parent->voiceConnected = false;
+
+ }
+
+ // Build the Disconnect Message towards the MS.
+ if ( (msOutResult = buildDisconnect (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Release Channel resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+ // start the disconnect timer
+ hcTimer->setTimer(CALL_DISCONNECT_T305);
+
+ callState_ = HC_ST_DISCONNECT_IND;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+}
+
+// Remote Release Complete - Abnormal
+// Can ignore the normal ones for now - Resources are
+// released even before that msg. is received.
+
+JCCEvent_t
+CCHalfCall::handleMobRemoteAbnormalRelCom(void)
+{
+ DBG_FUNC("handleMobRemoteAbnormalRelCom", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // cancel any timers
+ hcTimer->cancelTimer();
+
+ // To avoid sending the release to H323
+ parent->disconnectSentToVoip = true;
+
+ // If the state is currently waiting for a connection response from a lower layer
+ // then just do a mobile resource release
+ if (callState_ == THC_ST_MM_CONN_REQ)
+ {
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+ // One stage release
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ // Build the Release Message towards the MS.
+ if ( (msOutResult = buildReleaseComplete (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Release RR resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+
+ // !< Transaction Id. has to be released, maybe in res_release? Yes
+
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+
+ // return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+// Remote Alerting
+JCCEvent_t
+CCHalfCall::handleMobRemoteAlerting(void)
+{
+
+ DBG_FUNC("handleMobRemoteAlerting", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ ULONG setupCompltTime;
+
+ // Make sure that the channel is assigned. Always assume that
+ // you want to do in-band alerting.
+ // if ((channState_ == RES_ST_ASSIGNED) &&
+ // !alertingSent_)
+
+ //if (!progressSent_)
+ //{
+ //Test code for progress IE
+ if (h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.ie_present)
+ {
+ DBG_TRACE("CC CALL LOG: Alerting progress IE info exist(%d) codingStd(%d) loc(%d) desc(%d)\n",
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.ie_present,
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.codingStandard,
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.location,
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.progressDesp);
+
+ if ( (msOutResult = buildProgress(&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ //Log the error. Release RR resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+ }
+
+ //} else
+ //{
+ // // Build the Alerting Message towards the MS.
+ // if ( (msOutResult = buildAlerting (&msEncodedMsg))
+ // != CNI_RIL3_RESULT_SUCCESS )
+ // {
+ // // Log the error. Release RR resources
+ // callState_ = HC_ST_NULL;
+ // DBG_LEAVE();
+ // return (CC_RES_RELEASE);
+ // }
+ //}
+
+ // Build the Alerting Message towards the MS.
+ if ( (msOutResult = buildAlerting (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Release RR resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+ // calculate the setup time
+ setupCompltTime = tickGet();
+
+ DBG_TRACE("Call Setup time in number of system ticks(%d)\n",
+ (setupCompltTime - setupTime_));
+
+ PM_CCMeasurement.meanTimeToCallSetupService.addRecord(setupCompltTime - setupTime_);
+
+ if (!isEmergencyCall)
+ {
+ PM_CCMeasurement.succMobileOriginatingCalls.increment();
+ }
+ else
+ {
+ PM_CCMeasurement.succMobileEmergencyCalls.increment();
+ }
+
+ alertingSent_ = true;
+
+ //}
+
+ callState_ = OHC_ST_ANSWER_PENDING;
+
+ // With current implementation, VOIP could send another Codec Selected
+ // just before connect. Always do Mode Modify(to traffic) just before connect.
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+// Remote Answer
+JCCEvent_t
+CCHalfCall::handleMobRemoteAnswer(void)
+{
+
+ DBG_FUNC("handleMobRemoteAnswer", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+
+ // If external handover has occurred
+ if (parent->parent->handoverSession->hoState_ == HAND_ST_ANCH_EHO_COMPLT)
+ {
+ T_CSU_PORT_ID rfSourcePort, rtpSinkPort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSinkPort.portType = CSU_RTP_PORT;
+ rtpSinkPort.portId.rtpHandler = VoipCallGetRTPHandle(parent->h323CallHandle);
+
+ rfSourcePort = parent->parent->mobileCsuPort();
+
+ if ((csuResult = csu_DuplexConnect(&rfSourcePort, &rtpSinkPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ JCCLog2("CSU Error : Duplex Conn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)rtpSinkPort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Duplex Conn. Failure, (Result = %d) for (rtp port = %x)\n",
+ csuResult,
+ (int)rtpSinkPort.portId.rtpHandler);
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_TEMPORARY_FAILURE; //CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ voipReleaseCause_ = CNI_RIL3_CAUSE_TEMPORARY_FAILURE; //CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+
+ //CAUSE<xxu:03-21-00> END
+
+ DBG_LEAVE();
+ return (CC_TWO_STAGE_DISCONNECT);
+ }
+
+ parent->voiceConnected = true;
+
+ chState_ = CH_ST_IDLE;
+ channState_ = RES_ST_ASSIGNED;
+ }
+
+ // Make sure that the channel is assigned.
+ if ( ( (channState_ == RES_ST_ASSIGNED) ) &&
+ !connectSent_)
+ {
+ // Build the Connect Message towards the MS.
+ if ( (msOutResult = buildConnect (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ //CAUSE<xxu:03-22-00> BEGIN
+
+ voipReleaseCause_ = CNI_RIL3_CAUSE_TEMPORARY_FAILURE;
+ rlsCause.causeValue = CNI_RIL3_CAUSE_TEMPORARY_FAILURE;
+
+ //CAUSE<xxu:03-22-00> END
+
+ // Log the error. Release RR resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+ // start the connect timer
+ hcTimer->setTimer(CALL_CONNECT_T313);
+
+ connectSent_ = true;
+ }
+
+ // // Very early assignment - begin
+ // // Synchronize with the Channel state machine
+ // if (channState_ != RES_ST_ASSIGNED)
+ // {
+ // // Channel is not assigned. Cleanup.
+ // channState_ = RES_ST_IDLE;
+
+ // rlsCause.causeValue = CNI_RIL3_CAUSE_TEMPORARY_FAILURE;
+
+ // DBG_LEAVE();
+ // return (CC_TWO_STAGE_DISCONNECT);
+ // }
+ // // Very early assignment - end
+
+ callState_ = OHC_ST_CONNECT_INDICATION;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleMobRemoteCallProgress1(void)
+{
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ DBG_FUNC("handleMobRemoteCallProgress1", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // !< Do we need to wait for Call Confirmed before sending Call Proceeding
+ // to the originating side to get the negotiated BCs
+ // - No need, clarified with Ian
+
+ // !! For Call Proceeding, we need the Bearer Cap1, Cap2, and Repeat Ind.
+ // if needed by Setup, as specified by 07.01.
+
+ DBG_TRACE("CC CALL LOG: Progress progress IE info exist(%d) codingStd(%d) loc(%d) desc(%d)\n",
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.ie_present,
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.codingStandard,
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.location,
+ h323InMsg->l3_data.voipMsg.basicCallInMsg.EventInfo.AlertingProgressIE.progressDesp);
+
+ if ( (msOutResult = buildProgress(&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ //Log the error. Release RR resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RES_RELEASE);
+ }
+
+
+ progressSent_ = true;
+
+ if (callState_ != OHC_ST_ANSWER_PENDING)
+ callState_ = OHC_ST_CALL_PROCEEDING;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleMobRemoteCallProgress(void)
+{
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ DBG_FUNC("handleMobRemoteCallProgress", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // !< Do we need to wait for Call Confirmed before sending Call Proceeding
+ // to the originating side to get the negotiated BCs
+ // - No need, clarified with Ian
+
+ // !! For Call Proceeding, we need the Bearer Cap1, Cap2, and Repeat Ind.
+ // if needed by Setup, as specified by 07.01.
+
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleMobRemoteTermAddress(void)
+{
+ JCCEvent_t retEvent;
+
+ DBG_FUNC("handleMobRemoteTermAddress", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ // copy from the remote message to the local var
+ cpn = remMsgData.callOffering.CalledPartyNumber;
+ callingPartyNum = remMsgData.callOffering.CallingPartyNumber;
+
+ //CDR <xxu:08-24-00>
+ if (callingPartyNum.ie_present)
+ parent->ccCdr.setCallingPartyNumber(&callingPartyNum);
+ //parent->ccCdr.setCalledPartyNumber(&cpn);
+
+ DBG_TRACE("Call: calling party number received from Voip:\n");
+ DBG_TRACE("(ie_present=%d),(numberType=%d),(plan=%d),(numDigits=%d) no(%x,%x,%x,%x)\n",
+ callingPartyNum.ie_present,
+ callingPartyNum.numberType,
+ callingPartyNum.numberingPlan,
+ callingPartyNum.numDigits,
+ callingPartyNum.digits[0],
+ callingPartyNum.digits[1],
+ callingPartyNum.digits[2],
+ callingPartyNum.digits[3]);
+ // callingPartyNum.ie_present = true;
+
+ // !< Map the incoming Called Party Number to a service (like fax, data, voice)?
+
+ // Authorize the termination attempt
+ if ( ! (gLUDB.authTerm(parent->ludbIndex(), cpn)) )
+ {
+ DBG_TRACE("Termination Authorization failed, (LUDB Index = %d)\n",
+ (int)parent->ludbIndex());
+
+ voipReleaseCause_ = CNI_RIL3_CAUSE_NOT_ROUTE_TO_DESTINATION;
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NOT_ROUTE_TO_DESTINATION;
+
+ DBG_LEAVE();
+ return(handleMobReleaseCompleteUtil());
+ }
+
+ // <Igal: 05-15-00> Allows MT Call setup during active SMS transfer.
+ if (parent->parent->isMmConnected() == false)
+ {
+ IntraL3Msg_t mmOutMsg;
+
+ // Fill the data for MM message
+ mmOutMsg.l3_data.pageReq.imsi = ludbGetMobileId(parent->ludbIndex());
+ mmOutMsg.l3_data.pageReq.qid = parent->msgQId;
+
+ DBG_TRACE("page request msgQId: %p/n", parent->msgQId);
+
+ // Send internal MM msg - imsi needs to be included for paging
+ sendMM(INTRA_L3_MM_EST_REQ, INTRA_L3_MM_LOCATE_MS, parent->entryId(), &mmOutMsg);
+
+ callState_ = THC_ST_MM_CONN_REQ;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+ else
+ {
+ // waiting call or MM connection is already established by the SMS. No need to locate him.
+ retEvent = handleMMEstCnf();
+ DBG_LEAVE();
+ return (retEvent);
+ }
+
+}
+
+JCCEvent_t
+CCHalfCall::handleMobRemoteH323ChannReady(void)
+{
+
+ DBG_FUNC("handleMobRemoteH323ChannReady", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ //BCT <xxu:09-22-00> BEGIN
+ if (parent->h245ChannState==RES_ST_ASSIGNED)
+ {
+ DBG_TRACE("CC BCT VConn: h245ChState(%d) hoHndl(%p) callSt(%d) chanSt(%d) bct(%d,%d)\n",
+ parent->h245ChannState, callState_, channState_,
+ parent->getBctInvoke(), parent->bctArrival_);
+
+ //This is a second voice connected message
+ if (callState_ != HC_ST_ACTIVE)
+ {
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+ }
+ //BCT <xxu:09-22-00> END
+
+ // Synchronize with the main state machine
+ parent->h245ChannState = RES_ST_ASSIGNED;
+
+ // Connection Manager functionality
+ if (channState_ == RES_ST_ASSIGNED)
+ {
+ // Both channels are setup.
+ DBG_LEAVE();
+ return (CC_MAKE_CONNECTION_REQ);
+ }
+ else
+ {
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+}
+
+JCCEvent_t
+CCHalfCall::handleMobRemoteChannSelected(void)
+{
+
+ DBG_FUNC("handleMobRemoteChannSelected", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ currSpeechCh_.version = remMsgData.codecSelected.Codec;
+
+ if (channState_ != RES_ST_IDLE)
+ {
+ // Ignore the second request.
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ if (!parent->waitingCallLeg)
+ {
+ DBG_LEAVE();
+ return (CC_RESOURCE_ASSIGN_REQ);
+ }
+ else
+ {
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+}
+
+
+//BCT <xxu:08-11-00> BEGIN
+JCCEvent_t
+CCHalfCall::handleBctNumberReqTimeout(void)
+{
+ DBG_FUNC("handleBctNumberReqTimeout", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("CC->BCT(BctNumReqTimeout): h245ChState(%d) hoHndl(%p) callSt(%d) chanSt(%d) bct(%d,%d)\n",
+ parent->h245ChannState, callState_, channState_,
+ parent->getBctInvoke(), parent->bctArrival_);
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ parent->disconnectSentToVoip = true;
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+ // Build the Disconnect Message towards the MS.
+ if ( (msOutResult = buildDisconnect (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Release Channel resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ // start the disconnect timer
+ hcTimer->setTimer(CALL_DISCONNECT_T305);
+
+ callState_ = HC_ST_DISCONNECT_IND;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleGetBctNumberNack(void)
+{
+ DBG_FUNC("handleGetBctNumberNack", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("CC->BCT(BctNumNack): h245ChState(%d) hoHndl(%p) callSt(%d) chanSt(%d) bct(%d,%d)\n",
+ parent->h245ChannState, callState_, channState_,
+ parent->getBctInvoke(), parent->bctArrival_);
+
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ parent->disconnectSentToVoip = true;
+
+ rlsCause.causeValue = (T_CNI_RIL3_CAUSE_VALUE)
+ remMsgData.basicCallInMsg.ReasonCode;
+
+ // Build the Disconnect Message towards the MS.
+ if ( (msOutResult = buildDisconnect (&msEncodedMsg))
+ != CNI_RIL3_RESULT_SUCCESS )
+ {
+ // Log the error. Release Channel resources
+ callState_ = HC_ST_NULL;
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ // start the disconnect timer
+ hcTimer->setTimer(CALL_DISCONNECT_T305);
+
+ callState_ = HC_ST_DISCONNECT_IND;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+}
+//BCT <xxu:08-11-00> END
+
+
+//BCT <xxu:09-22-00> BEGIN
+JCCEvent_t
+CCHalfCall::handleBctUpdateHandles(void)
+{
+ DBG_FUNC("handleBctUpdateHandles", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("CC->BCT(UpdateHandles): chanSt(%d,%d) callSt(%d) h323CallHdnl(%x,%x) bct(%d,%d)\n",
+ parent->h245ChannState, channState_, callState_,
+ parent->oH323CallHandle, parent->h323CallHandle,
+ parent->getBctInvoke(), parent->bctArrival_);
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleMobRemoteAlerting2nd(void)
+{
+ DBG_FUNC("handleMobRemoteAlerting2nd", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("CC->BCT(Alerting): h245ChState(%d) hoHndl(%p) callSt(%d) chanSt(%d) bct(%d,%d)\n",
+ parent->h245ChannState, callState_, channState_,
+ parent->getBctInvoke(), parent->bctArrival_);
+
+ //second alerting received from H323. This can only happen to BCT now
+ if (parent->h245ChannState != RES_ST_ASSIGNED)
+ {
+ //This is an unexpected alterting, ignore
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //Play annoucement in terms of handover condition
+ CCHandover *handoverSession;
+ handoverSession = parent->getHandoverSession();
+
+ if ( handoverSession != NULL )
+ {
+ if ( (handoverSession->hoState_ == HAND_ST_ANCH_HO_COMPLT) ||
+ (handoverSession->hoState_ == HAND_ST_ANCH_EHO_COMPLT) )
+ annState_ = ANN_PLAY_ON;
+ else
+ annState_ = ANN_PLAY_WAITING;
+ } else
+ annState_ = ANN_PLAY_ON;
+
+ if (annState_ == ANN_PLAY_ON)
+ {
+ //Play inband annoucement
+ T_CSU_RESULT_CON csuResult;
+
+ annSrcPort_.portType = CSU_ANN_PORT;
+ annSrcPort_.portId.annHandler = 0; //CSU_ANN_RINGBACK ID
+ annSnkPort_ = parent->parent->mobileCsuPort();
+ annSnkPort_.speechVersion = currSpeechCh_.version;
+
+ DBG_TRACE("CC->CSU(bct): start inband alert ann(%d,%x) --> snk(%d,%x,%d)\n",
+ annSrcPort_.portType,
+ (int)annSrcPort_.portId.rtpHandler,
+ annSnkPort_.portType,
+ (int)annSnkPort_.portId.rtpHandler,
+ (int)annSnkPort_.speechVersion);
+
+ if ( (csuResult = csu_SimplexConnect(&annSrcPort_, &annSnkPort_))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_WARNING("CC->CSU(bct): inband alert s-conn failed xlst(%d) ann(%d,%x) snk(%d,%x,%d)\n",
+ csuResult,
+ annSrcPort_.portType,
+ (int)annSrcPort_.portId.rtpHandler,
+ annSnkPort_.portType,
+ (int)annSnkPort_.portId.rtpHandler,
+ (int)annSnkPort_.speechVersion);
+
+ //ignore this remote alerting
+
+ }
+
+ }
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+CCHalfCall::handleMobRemoteChannSelected2nd(void)
+{
+ JCCEvent_t ret_val;
+
+ DBG_FUNC("handleMobRemoteChannSelected2nd", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("CC->BCT(ChanSelect): h245ChState(%d) hoHndl(%p) callSt(%d) chanSt(%d) bct(%d,%d)\n",
+ parent->h245ChannState, callState_, channState_,
+ parent->getBctInvoke(), parent->bctArrival_);
+
+ currSpeechCh_.version = remMsgData.codecSelected.Codec;
+
+ if ( (channState_ != RES_ST_ASSIGNED) || (callState_ != HC_ST_ACTIVE) )
+ {
+ // Ignore the unexpected 2nd request
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //Cancel current annoucement if there is one
+ if (annState_ == ANN_PLAY_ON)
+ {
+ //Stop inband annoucement
+ T_CSU_RESULT_CON csuResult;
+
+ DBG_TRACE("CC->CSU(bct): stop inband alert ann(%d,%x) --> snk(%d,%x,%d)\n",
+ annSrcPort_.portType,
+ (int)annSrcPort_.portId.rtpHandler,
+ annSnkPort_.portType,
+ (int)annSnkPort_.portId.rtpHandler,
+ (int)annSnkPort_.speechVersion);
+
+ if ( (csuResult = csu_SimplexBreak(&annSrcPort_, &annSnkPort_))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_WARNING("CC->CSU(bct): inband alert s-break failed xlst(%d) ann(%d,%x) snk(%d,%x,%d)\n",
+ csuResult,
+ annSrcPort_.portType,
+ (int)annSrcPort_.portId.rtpHandler,
+ annSnkPort_.portType,
+ (int)annSnkPort_.portId.rtpHandler,
+ (int)annSnkPort_.speechVersion);
+
+ }
+
+ }
+
+ annState_ = ANN_PLAY_OFF;
+
+ // if external handover is in effect, don't bother re-assigning
+ // channels (RR establishment), since it is still UP
+ if ( ( parent->parent->handoverSession != NULL ) &&
+ ( parent->parent->handoverSession->hoState_ == HAND_ST_ANCH_EHO_COMPLT ) )
+ {
+ channState_ = RES_ST_ASSIGNED;
+ ret_val = CC_MESSAGE_PROCESSING_COMPLT;
+ }
+ else
+ {
+ channState_ = RES_ST_ASS_REQ;
+ ret_val = CC_RESOURCE_ASSIGN_REQ;
+ }
+
+ DBG_LEAVE();
+ return (ret_val);
+}
+
+JCCEvent_t
+CCHalfCall::handleMobRemoteAnswer2nd(void)
+{
+
+ DBG_FUNC("handleMobRemoteAnswer2nd", CC_HALFCALL_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("CC->BCT(Answer): h245ChState(%d) hoHndl(%p) callSt(%d) chanSt(%d) bct(%d,%d)\n",
+ parent->h245ChannState, callState_, channState_,
+ parent->getBctInvoke(), parent->bctArrival_);
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+//BCT <xxu:08-22-00> END
diff --git a/data/mnet/GP10/Host/cc/src/CCMsgAnal.cpp b/data/mnet/GP10/Host/cc/src/CCMsgAnal.cpp
new file mode 100644
index 0000000..55cb5fc
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCMsgAnal.cpp
@@ -0,0 +1,356 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCMsgAnal.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description : CC types shared with other modules.
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+// included L3 Message header for messages from other Layer 3 modules (MM, RR)
+#include "CC/CCMsgAnal.h"
+
+#include "jcc/JCCLog.h"
+#include "logging/VCLOGGING.h"
+
+#if defined(_NO_ED) || defined(_SOFT_MOB)
+ #include "JCC/JCC_ED.h"
+#else
+ #include "ril3/ril3_common.h"
+ #define JCC_RIL3CC_Decode CNI_RIL3CC_Decode
+ #define JCC_RIL3SMS_Decode CNI_RIL3SMS_CP_Decode
+#endif
+
+#ifdef _SOFT_MOB
+ extern T_CNI_LAPDM_OID softMobLapdmOid[];
+#endif
+
+#include "taskLib.h"
+
+// *******************************************************************
+// forward declarations.
+// *******************************************************************
+
+
+CCMsgAnalyzer::CCMsgAnalyzer()
+ : msDecodeResult(CNI_RIL3_RESULT_SUCCESS)
+{
+}
+
+
+JCCEvent_t
+CCMsgAnalyzer::mapToCcEvent(T_CNI_RIL3MD_CCMM_MSG *msInMsg)
+{
+
+ DBG_FUNC (taskName(taskIdSelf()), CC_LAYER);
+ DBG_ENTER();
+
+ if (msInMsg->primitive_type != L23PT_DL_DATA_IND)
+ {
+ DBG_ERROR("CC Error : Only Data Ind expected. Bad (Primitive = %d) \n",
+ msInMsg->primitive_type);
+ return (JCC_NULL_EVENT);
+ }
+
+ // call the Decoder function to decode the message
+ if ((msDecodeResult =
+ JCC_RIL3CC_Decode
+ (
+#ifdef _NO_ED
+ TRUE,
+#else
+ #ifdef _SOFT_MOB
+ !((msInMsg->lapdm_oid) < softMobLapdmOid[0]),
+ #endif
+#endif
+ &msInMsg->l3_data, // input encoded layer-3 msg
+ &msDecodedMsg // output decoded message
+ ))
+ != CNI_RIL3_RESULT_SUCCESS)
+ {
+
+ DBG_ERROR("CC Error : Decoding MS Message (Problem = %d). \n ", msDecodeResult);
+
+ // decoding error. Something wrong with the message. Switch on
+ // the return code to handle different types of error
+ switch(msDecodeResult)
+ {
+ case CNI_RIL3_MANDATORY_IE_MISSING:
+ case CNI_RIL3_NON_SEMANTICAL_MANDATORY_IE_ERROR:
+ // mandatory IE error. This is a protocol violation from the
+ // the peer layer-3 entity
+ causeValue = CNI_RIL3_CAUSE_INVALID_MANDATORY_INFO;
+
+ switch(msDecodedMsg.header.message_type)
+ {
+ // RIL3CC Call establishment messages:
+ case CNI_RIL3CC_MSGID_SETUP:
+ return (HC_LOCAL_RELEASE_REQ);
+ break;
+
+ // RIL3CC Call clearing messages:
+ case CNI_RIL3CC_MSGID_DISCONNECT:
+ return (HC_LOCAL_DISCONNECT_REQ);
+ break;
+ case CNI_RIL3CC_MSGID_RELEASE:
+ return (HC_LOCAL_RELEASE_REQ);
+ break;
+ case CNI_RIL3CC_MSGID_RELEASE_COMPLETE:
+ return (HC_LOCAL_RELEASE_COMPLETE);
+ break;
+
+ case CNI_RIL3CC_MSGID_START_DTMF:
+ // Let the MS timeout
+ return (JCC_NULL_EVENT);
+ break;
+
+ case CNI_RIL3CC_MSGID_STATUS:
+ return (HC_LOCAL_RELEASE_REQ);
+ break;
+
+ default:
+ // ignore the message and return status message.
+ return(HC_LOCAL_STATUS_ENQUIRY);
+ break;
+
+ }
+ break;
+
+ case CNI_RIL3_INCORRECT_LENGTH:
+ // message is too short. Ignore the message. Currently RIL3 does not disntinguish between
+ // this and incorrect length for a particular i.e.. Need to fix.
+ return (JCC_NULL_EVENT);
+ break;
+
+ case CNI_RIL3_UNKNOWN_MESSAGE_TYPE:
+ // ignore the message and return status.
+ causeValue = CNI_RIL3_CAUSE_MESSAGE_TYPE_NON_EXISTENT;
+ return (HC_LOCAL_STATUS_ENQUIRY);
+ break;
+
+ case CNI_RIL3_NON_IMPERATIVE_MESSAGE_PART_ERROR:
+ // not critical. ignore the error and continue as if the ie did not exist.
+ break;
+
+
+ default:
+ //CAUSE<xxu:03-27-00> BEGIN
+
+ // internal error. continuing may lead to other problems.
+ //causeValue = CNI_RIL3_CAUSE_PROTOCOL_ERROR_UNSPECIFIED;
+ //return (HC_LOCAL_PROTOCOL_PROBLEM);
+
+ causeValue = CNI_RIL3_CAUSE_PROTOCOL_ERROR_UNSPECIFIED;
+ return (JCC_NULL_EVENT);
+ //CAUSE<xxu:03-27-00> END
+
+ break;
+ }
+
+ }
+
+ PostL3RecvMsLog(msInMsg->lapdm_oid, msInMsg->sapi, &msInMsg->l3_data);
+ // decoded layer-3 message correctly.
+ // switch on the message type
+ switch(msDecodedMsg.header.message_type) {
+ // RIL3CC Call establishment messages:
+ case CNI_RIL3CC_MSGID_ALERTING:
+ return (THC_LOCAL_ALERTING);
+ break;
+ case CNI_RIL3CC_MSGID_CALL_CONFIRMED:
+ return (HC_LOCAL_CALL_PROGRESS);
+ break;
+ case CNI_RIL3CC_MSGID_CONNECT:
+ return (THC_LOCAL_ANSWER);
+ break;
+ case CNI_RIL3CC_MSGID_CONNECT_ACKNOWLEDGE:
+ return (OHC_LOCAL_CONNECT_ACK);
+ break;
+ case CNI_RIL3CC_MSGID_EMERGENCY_SETUP:
+ return (OHC_LOCAL_EMERGENCY_ORIGINATION);
+ break;
+ case CNI_RIL3CC_MSGID_SETUP:
+ return (OHC_LOCAL_TERM_ADDRESS);
+ break;
+
+ case CNI_RIL3CC_MSGID_START_DTMF:
+ return (HC_LOCAL_START_DTMF);
+ break;
+ case CNI_RIL3CC_MSGID_STOP_DTMF:
+ return (HC_LOCAL_STOP_DTMF);
+ break;
+
+ // RIL3CC Call clearing messages:
+ case CNI_RIL3CC_MSGID_DISCONNECT:
+ return (HC_LOCAL_DISCONNECT_REQ);
+ break;
+ case CNI_RIL3CC_MSGID_RELEASE:
+ return (HC_LOCAL_RELEASE_REQ);
+ break;
+ case CNI_RIL3CC_MSGID_RELEASE_COMPLETE:
+ return (HC_LOCAL_RELEASE_COMPLETE);
+ break;
+
+ //CH<xxu:11-24-99
+ case CNI_RIL3CC_MSGID_HOLD:
+ return (HC_EXTNL_HOLD_REQ);
+ break;
+
+ case CNI_RIL3CC_MSGID_RETRIEVE:
+ return (HC_EXTNL_RETV_REQ);
+ break;
+
+ case CNI_RIL3CC_MSGID_STATUS:
+ return (HC_LOCAL_STATUS_INFO);
+ break;
+
+ case CNI_RIL3CC_MSGID_STATUS_ENQUIRY:
+ return (HC_LOCAL_STATUS_ENQUIRY);
+ break;
+
+ default:
+ // log error
+ DBG_ERROR("CC Error: Unexpected CC Message, (Msg Type = %d)\n",
+ msDecodedMsg.header.message_type);
+ return (JCC_NULL_EVENT);
+ break;
+ }
+
+ return (JCC_NULL_EVENT);
+}
+
+
+JCCEvent_t
+CCMsgAnalyzer::mapToSmsEvent (T_CNI_RIL3MD_CCMM_MSG *msInMsg)
+{
+ JCCEvent_t retVal;
+ int temp ;
+ char buffer [256];
+ unsigned char * pTemp;
+
+ sprintf (buffer, "CCMsgAnalyzer::mapToSmsEvent %s\n", taskName(taskIdSelf()));
+
+ DBG_FUNC (buffer, CC_SMS_LAYER);
+ DBG_ENTER();
+
+ if (msInMsg->primitive_type != L23PT_DL_DATA_IND)
+ {
+ DBG_ERROR("CC Error : Only Data Ind expected. Bad (Primitive = %d) \n",
+ msInMsg->primitive_type);
+ DBG_LEAVE();
+ return (JCC_NULL_EVENT);
+ }
+
+ DBG_TRACE ("SMS PDU received in decoder. Oid = %d, SAPI = %d, Msg lenght = %d\n",
+ msInMsg->lapdm_oid, msInMsg->sapi, msInMsg->l3_data.msgLength );
+
+// DBG_HEXDUMP ((UINT8 *)&msInMsg->l3_data, msInMsg->l3_data.msgLength);
+/*
+ temp = msInMsg->l3_data.msgLength;
+ pTemp = (UINT8 *)&msInMsg->l3_data;
+
+ while (temp > 0)
+ {
+ DBG_HEXDUMP (pTemp, ((temp <= 16) ? temp : 16) );
+ temp -= 16;
+ pTemp += 16;
+ }
+*/
+ // call the Decoder function to decode the message
+ if ((msDecodeResult =
+ JCC_RIL3SMS_Decode
+ (
+#ifdef _NO_ED
+ TRUE,
+#else
+ #ifdef _SOFT_MOB
+ !((msInMsg->lapdm_oid) < softMobLapdmOid[0]),
+ #endif
+#endif
+ &msInMsg->l3_data, // input encoded layer-3 msg
+ &msDecodedSmsMsg // output decoded message
+ ))
+ != CNI_RIL3_RESULT_SUCCESS)
+ {
+ DBG_ERROR ("SMS PDU decode error %d\n", msDecodeResult);
+
+ if (msDecodeResult == CNI_RIL3_INCORRECT_LENGTH)
+ retVal = JCC_NULL_EVENT; // Discard short message 04.11 9.2.1
+ else
+ retVal = SMS_EVENT_PROTOCOL_ERROR; // Investigate the nature
+ // of the error and act accordinately
+ // Use SmsLeg3 for it?
+ }
+ else
+ {
+ // decoded layer-3 message correctly.
+ // switch on the message type
+ switch(msDecodedSmsMsg.header.message_type)
+ {
+ case CNI_RIL3SMS_MSGID_CP_DATA :
+ DBG_TRACE ("Uplink CP-DATA Data: PD = %d, TI = %d, RPDU length=%d:\n",
+ msDecodedSmsMsg.cp_data.header.protocol_descriminator,
+ msDecodedSmsMsg.cp_data.header.si_ti ,
+ msDecodedSmsMsg.cp_data.cp_user_data.length );
+
+ temp = msDecodedSmsMsg.cp_data.cp_user_data.length;
+ pTemp = msDecodedSmsMsg.cp_data.cp_user_data.rpdu_data;
+
+ while (temp > 0)
+ {
+ DBG_HEXDUMP (pTemp, ((temp <= 16) ? temp : 16) );
+ temp -= 16;
+ pTemp += 16;
+ }
+
+ retVal = SMS_EVENT_CP_DATA;
+ break;
+
+ case CNI_RIL3SMS_MSGID_CP_ACK :
+ DBG_TRACE ("Uplink CP-ACK Info: PD = %d, TI = %d\n" ,
+ msDecodedSmsMsg.cp_ack.header.protocol_descriminator,
+ msDecodedSmsMsg.cp_ack.header.si_ti );
+
+ retVal = SMS_EVENT_CP_ACK ;
+ break;
+
+ case CNI_RIL3SMS_MSGID_CP_ERROR:
+ DBG_TRACE ("Uplink CP-ERROR Data: PD = %d, TI = %d. Cause is %d - %d\n" ,
+ msDecodedSmsMsg.cp_error.header.protocol_descriminator ,
+ msDecodedSmsMsg.cp_error.header.si_ti ,
+ msDecodedSmsMsg.cp_error.cp_cause.ie_present ,
+ msDecodedSmsMsg.cp_error.cp_cause.causeValue );
+
+ retVal = SMS_EVENT_CP_ERROR;
+ break;
+
+ default:
+ // log error
+ DBG_ERROR ("CC Session Error: Unexpected SMS Message, (Msg Type = %d)\n",
+ msDecodedMsg.header.message_type);
+ retVal = SMS_EVENT_PROTOCOL_ERROR;
+ break;
+ }
+ }
+
+ DBG_WARNING ("SMS PDU decode result. Event %d\n", retVal);
+
+ PostL3RecvMsLog (msInMsg->lapdm_oid, msInMsg->sapi, &msInMsg->l3_data);
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
diff --git a/data/mnet/GP10/Host/cc/src/CCOamHnd.cpp b/data/mnet/GP10/Host/cc/src/CCOamHnd.cpp
new file mode 100644
index 0000000..9ab0b45
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCOamHnd.cpp
@@ -0,0 +1,768 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCOamHnd.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 07-01-99
+// Description : CC Oam handlers trap registration, trap handling,
+// initialization, and restarts
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "stdio.h"
+#include "JCC/JCCLog.h"
+#include "logging/VCLOGGING.h"
+
+
+// declare the CC task spawning function
+extern int ccInit();
+
+// CC Types
+#include "CC/CCTypes.h"
+#include "CC/CCInt.h"
+
+#include "CC/CCconfig.h"
+#include "CC/CallConfig.h"
+
+#include "logging/VCLOGGING.h"
+
+#include "oam_api.h"
+
+#include "RIL3/ril3irt_db.h"
+
+#include "csunew/csu_head.h"
+
+extern CNI_RIL3IRT_DB CNI_IRT_database;
+
+extern void ccCallDataInit(void);
+
+//GCELL<tyu:06-01-01> BEGIN
+GlobalCellId_t MY_GLOBALCELL_ID;
+const GlobalCellId_t MY_GLOBALCELL_ID_DEF_VAL = {0, {'0','0','0'}, {'0','0','0'}, 1, 1};
+//GCELL<tyu:06-01-01> END
+
+UINT32 MY_VIPERCELL_IP_ADDRESS;
+
+//CDR <xxu:08-22-00> BEGIN
+BtsBasicPackage ccBtsBasicPackage;
+AdjCell_HandoverEntry ccAdjCellHoTable[16];
+AdjacentCellPackage ccAdjacentCellPackage;
+void ccGetBtsBasicPackage(void);
+void ccGetAdjacentCellPackage(void);
+
+//CDR <xxu:08-22-00> END
+
+// Number ticks in 10 milliseconds
+#define TICKS_PER_10MS (sysClkRateGet()) / 100
+
+int CALL_MM_CONN_EST_T999; // MM Connection Established - Network (MO)
+int CALL_ALERTING_T301; // Alerting received Timer - Network (MT)
+int CALL_SETUP_T303; // Setup sent - Network (MT)
+int CALL_CALL_CONFIRMED_T310; // Call Confirmed received Timer - Network (MT)
+int CALL_CONNECT_T313; // Connect sent Timer - Network (MO)
+int CALL_DISCONNECT_T305; // Disconnect sent Timer - Network (MO and MT)
+int CALL_RELEASE_T308; // Release sent Timer - Network (MO and MT)
+
+int SMS_WAIT_CP_ACK_TC1; // Wait for CP-ACK
+int SMS_WAIT_DISCONNECT; // Allows to send the last CP-ACK on SACCH/TCH
+
+//CH<xxu:11-24-99>
+int CALL_HOLD_RETV_TIMER; // Time control for call swapping
+
+//RETRY<xxu:04-28-00> BEGIN
+int CALL_HAND_SRC_TVB; // Time control for shake-hand btw anchor and VB
+//RETRY<xxu:04-28-00> END
+
+//BCT <xxu:08-11-00> BEGIN
+int CALL_BCT_NUMBER_TVB; // Time control for shake-hand btw VC&VB for BCT
+//RETRY<xxu:04-28-00> END
+
+//BCT <xxu:07-06-00> BEGIN
+char CALL_BCT_PREFIX[10]; // Prefix defined for blind call transfer invocation
+char CALL_BCT_PREFIX_LEN; //
+//BCT <xxu:07-06-00> END
+
+//CDR <xxu:08-24-00>
+int CALL_CDR_10M; // 10m call duration timer for CDR
+
+int CALL_SAFETY_TIMER; // Call Task running too long
+
+// Handover Config
+int CALL_HAND_SRC_THO; // Handover - waiting for Target Perform Ho Req Ack (ANCH)
+int CALL_HAND_SRC_T103; // Handover - waiting for Target Ho Complt (ANCH)
+int CALL_HAND_TRG_T204; // Handover - waiting for Mobile Handover Complt (TRG)
+
+int CALL_HAND_SRC_TSHO; // Handover - waiting for Target Perform Hb Req Ack (TRG)
+int CALL_HAND_SRC_T203; // Handover - waiting for Target Hb Complt (TRG)
+int CALL_HAND_TRG_T104; // Handover - waiting for Mobile Handover Complt (ANCH)
+
+
+//ext-HO <xxu:07-01-01>
+int CALL_HAND_TRG_T211; // Handover - waiting for Mobile Handover Complt or Failure (TRG)
+int CALL_HAND_TRG_T202; // Handover - waiting for Mobile Handover Complt btw BSSs under MSC-B
+
+SpeechChann_t currChannDef;
+
+
+void irtCCDataInit(void)
+{
+ short i;
+ for(i=0; i< MAX_RIL3IRT_DB_ENTRIES ; i++)
+ {
+ CNI_IRT_database.m_entry[i].cc_id = cc_id;
+ }
+}
+
+void ccDataInit(void)
+{
+ ccCallDataInit();
+ irtCCDataInit();
+ //csu_ClearAllTable();
+}
+
+// OAM Trap Registration
+void callOamTrapRegister(void)
+{
+ DBG_FUNC("callOamTrapRegister", CC_LAYER);
+ DBG_ENTER();
+
+ STATUS oamStatus;
+
+ // Reset any trap setting to get a clean start
+ if ((oamStatus = oam_unsetTrapByModule(MODULE_CC))
+ != STATUS_OK)
+ {
+ DBG_ERROR("OAM->Call ERROR: Failed(status = %d) for unsetTrapByModule\n",
+ oamStatus);
+ }
+
+ // Register to trap callConfigData for timers
+ if ((oamStatus = oam_setTrap(MODULE_CC, ccMsgQId, MIB_callConfigData))
+ != STATUS_OK)
+ {
+ DBG_ERROR("OAM->Call ERROR: Failed(status = %d) in setTrap for callConfigData\n",
+ oamStatus);
+ }
+
+ //CDR <xxu:08-22-00> BEGIN
+ if ((oamStatus = oam_setTrap(MODULE_CC, ccMsgQId, MIB_btsBasicPackage))
+ != STATUS_OK)
+ {
+ DBG_ERROR("OAM->Call ERROR: Failed(status = %d) in setTrap for BtsBasicPackage\n",
+ oamStatus);
+ }
+
+ if ((oamStatus = oam_setTrap(MODULE_CC, ccMsgQId, MIB_adjacentCellPackage))
+ != STATUS_OK)
+ {
+ DBG_ERROR("OAM->Call ERROR: Failed(status = %d) in setTrap for adjCellPackage\n",
+ oamStatus);
+ }
+
+ if ((oamStatus = oam_setTrap(MODULE_CC, ccMsgQId, MIB_handoverTimerMib))
+ != STATUS_OK)
+ {
+ DBG_ERROR("OAM->Call ERROR: Failed(status = %d) in setTrap for handoverTimerMib\n",
+ oamStatus);
+ }
+ //CDR <xxu:08-22-00> END
+
+ DBG_LEAVE();
+}
+
+//BCT xxu<07-17-00> BEGIN
+void setBctPrefix(char *prefix)
+{
+ printf(" OLD: prefix=%s, length=%d; NEW: prefix=%s, length=%d\n",
+ CALL_BCT_PREFIX, CALL_BCT_PREFIX_LEN,
+ prefix, strlen(prefix));
+ memset(CALL_BCT_PREFIX,0,10);
+ strcpy(CALL_BCT_PREFIX,prefix);
+ CALL_BCT_PREFIX_LEN = strlen(CALL_BCT_PREFIX);
+}
+//BCT xxu<07-17-00> END
+
+// OAM Call Data Initialization
+void callOamDataInit(void)
+{
+ DBG_FUNC("callOamDataInit", CC_LAYER);
+ DBG_ENTER();
+
+ CallConfigData callConfigVal;
+ HandoverTimerMib handoverTimerVal;
+ STATUS oamStatus;
+
+ // Temporarily assign default values here.
+ CALL_MM_CONN_EST_T999 = CALL_MM_CONN_EST_T999_DEF_VAL * TICKS_PER_10MS;
+ CALL_ALERTING_T301 = CALL_ALERTING_T301_DEF_VAL * TICKS_PER_10MS;
+ CALL_SETUP_T303 = CALL_SETUP_T303_DEF_VAL * TICKS_PER_10MS;
+ CALL_CALL_CONFIRMED_T310 = CALL_CALL_CONFIRMED_T310_DEF_VAL * TICKS_PER_10MS;
+ CALL_CONNECT_T313 = CALL_CONNECT_T313_DEF_VAL * TICKS_PER_10MS;
+ CALL_DISCONNECT_T305 = CALL_DISCONNECT_T305_DEF_VAL * TICKS_PER_10MS;
+ CALL_RELEASE_T308 = CALL_RELEASE_T308_DEF_VAL * TICKS_PER_10MS;
+ CALL_SAFETY_TIMER = CALL_SAFETY_TIMER_DEF_VAL * TICKS_PER_10MS;
+
+ //CDR <xxu:08-24-00>
+ CALL_CDR_10M = CALL_CDR_10M_DEF_VAL;
+
+ //CH<xxu:11-24-99>
+ CALL_HOLD_RETV_TIMER = CALL_HOLD_RETV_TIMER_DEF_VAL;
+
+ //RETRY<xxu:05-01-00> BEGIN
+ CALL_HAND_SRC_TVB = CALL_HAND_SRC_TVB_DEF_VAL;
+ //RETRY<xxu:05-01-00> END
+
+ //BCT <xxu:07-06-00> BEGIN
+ CALL_BCT_NUMBER_TVB = CALL_HAND_SRC_TVB_DEF_VAL;
+
+ strcpy(CALL_BCT_PREFIX, "44*");
+ CALL_BCT_PREFIX_LEN = strlen(CALL_BCT_PREFIX);
+ for (int i=0;i<CALL_BCT_PREFIX_LEN;i++)
+ {
+ switch (CALL_BCT_PREFIX[i])
+ {
+ case 0x2A: //'*'
+ CALL_BCT_PREFIX[i] = 0x0A;
+ break;
+
+ case 0x23: //'#'
+ CALL_BCT_PREFIX[i] = 0x0B;
+ break;
+ default: //'0'-'9'
+ if ( CALL_BCT_PREFIX[i] >= 0x30 && CALL_BCT_PREFIX[i] < 0x40 )
+ CALL_BCT_PREFIX[i] -= 0x30;
+ else
+ DBG_ERROR("OAM->CC@callOamDataInit: bctPrefix=%s", CALL_BCT_PREFIX);
+ break;
+ }
+ }
+ //BCT<xxu:07-06-00> END
+
+ // Temporary assignment of Handover Timers
+ CALL_HAND_SRC_THO = CALL_HAND_SRC_THO_DEF_VAL * TICKS_PER_10MS;
+ CALL_HAND_SRC_T103 = CALL_HAND_SRC_T103_DEF_VAL * TICKS_PER_10MS;
+ CALL_HAND_TRG_T204 = CALL_HAND_TRG_T204_DEF_VAL * TICKS_PER_10MS;
+
+ CALL_HAND_SRC_TSHO = CALL_HAND_SRC_TSHO_DEF_VAL * TICKS_PER_10MS;
+ CALL_HAND_SRC_T203 = CALL_HAND_SRC_T203_DEF_VAL * TICKS_PER_10MS;
+ CALL_HAND_TRG_T104 = CALL_HAND_TRG_T104_DEF_VAL * TICKS_PER_10MS;
+
+ //ext-HO <xxu:07-01-01>
+ CALL_HAND_TRG_T211 = CALL_HAND_TRG_T211_DEF_VAL * TICKS_PER_10MS;
+ CALL_HAND_TRG_T202 = CALL_HAND_TRG_T202_DEF_VAL * TICKS_PER_10MS;
+
+ // SMS timers
+ SMS_WAIT_CP_ACK_TC1= SMS_WAIT_CP_ACK_TC1_DEF_VAL * TICKS_PER_10MS;
+ SMS_WAIT_DISCONNECT= SMS_WAIT_DISCONNECT_DEF_VAL * TICKS_PER_10MS;
+
+ if ((oamStatus = getMibStruct(MIB_callConfigData,
+ (OCTET_T *)&callConfigVal, sizeof(callConfigVal)))
+ != STATUS_OK)
+ {
+ // failed to get OAM Config. data.
+ DBG_ERROR("OAM->Call FATAL ERROR: failed(status = %d) to get Call Config.\n",
+ oamStatus);
+ printf("OAM->Call FATAL ERROR: failed(status = %d) to get Call Config.\n",
+ oamStatus);
+ }
+ else
+ {
+ printf("CC Call oam data: (T301=%d), (T303=%d), (T310=%d)\n",
+ callConfigVal.cc_alerting_T301,
+ callConfigVal.cc_setup_T303,
+ callConfigVal.cc_call_confirmed_T310);
+
+ printf(" (T313=%d), (T305=%d), (T308=%d).\n\n",
+ callConfigVal.cc_connect_T313,
+ callConfigVal.cc_disconnect_T305,
+ callConfigVal.cc_release_T308);
+
+ // make the conversion between the MIB value (in 10 ms) and the
+ // actual Timer value used in the VxWorks API call (1 VxWorks ticks = 16.69ms)
+ CALL_ALERTING_T301 = (callConfigVal.cc_alerting_T301) * TICKS_PER_10MS;
+ CALL_SETUP_T303 = (callConfigVal.cc_setup_T303) * TICKS_PER_10MS;
+ CALL_CALL_CONFIRMED_T310 = (callConfigVal.cc_call_confirmed_T310) * TICKS_PER_10MS;
+ CALL_CONNECT_T313 = (callConfigVal.cc_connect_T313) * TICKS_PER_10MS;
+ CALL_DISCONNECT_T305 = (callConfigVal.cc_disconnect_T305) * TICKS_PER_10MS;
+ CALL_RELEASE_T308 = (callConfigVal.cc_release_T308) * TICKS_PER_10MS;
+ }
+
+ if ((oamStatus = getMibStruct(MIB_handoverTimerMib,
+ (OCTET_T *)&handoverTimerVal, sizeof(HandoverTimerMib)))
+ != STATUS_OK)
+ {
+ // failed to get OAM Config. data.
+ DBG_ERROR("OAM->Call FATAL ERROR: failed(status = %d) to get Handover Timer.\n",
+ oamStatus);
+ printf("OAM->Call FATAL ERROR: failed(status = %d) to get Handover Timer.\n",
+ oamStatus);
+ }
+ else
+ {
+ printf("CC Call oam data: (T101=%d), (T102=%d), (T103=%d), (T104=%d)\n",
+ handoverTimerVal.t101,
+ handoverTimerVal.t102,
+ handoverTimerVal.t103,
+ handoverTimerVal.t104);
+
+ printf(" (T201=%d), (T202=%d), (T204=%d), (T210=%d), (T211=%d).\n\n",
+ handoverTimerVal.t201,
+ handoverTimerVal.t202,
+ handoverTimerVal.t204,
+ handoverTimerVal.t210,
+ handoverTimerVal.t211);
+
+ // make the conversion between the MIB value (in 10 ms) and the
+ // actual Timer value used in the VxWorks API call (1 VxWorks ticks = 16.69ms)
+ CALL_HAND_SRC_T103 = (handoverTimerVal.t103) * TICKS_PER_10MS;
+ CALL_HAND_TRG_T104 = (handoverTimerVal.t104) * TICKS_PER_10MS;
+ CALL_HAND_TRG_T202 = (handoverTimerVal.t202) * TICKS_PER_10MS;
+ CALL_HAND_TRG_T204 = (handoverTimerVal.t204) * TICKS_PER_10MS;
+ CALL_HAND_TRG_T211 = (handoverTimerVal.t211) * TICKS_PER_10MS;
+ }
+
+
+
+
+ //CDR <xxu:08-22-00> BEGIN
+ ccGetBtsBasicPackage();
+ ccGetAdjacentCellPackage();
+ //CDR <xxu:08-22-00> END
+
+ currChannDef.version = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_2;
+
+ DBG_LEAVE();
+}
+
+// OAM CC Data Initialization
+void ccOamDataInit(void)
+{
+ DBG_FUNC("ccOamDataInit", CC_LAYER);
+ DBG_ENTER();
+
+ INT_32_T mibVal;
+ STATUS oamStatus;
+
+ if ((oamStatus = getMibIntVar(MIB_bts_operationalState, &mibVal))
+ != STATUS_OK)
+ {
+ // failed to get OAM Config. data.
+ printf("OAM->CC FATAL ERROR: failed(status = %d) to get CC Config - BTS Op State.\n",
+ oamStatus);
+ printf("CC Log: FATAL - CC Non functional - cannot get BTS Op. State.\n");
+ DBG_ERROR("OAM->CC FATAL ERROR: failed(status = %d) to get CC Config - BTS Op State.\n",
+ oamStatus);
+ DBG_ERROR("CC Log: FATAL - CC Non functional - cannot get BTS Op. State.\n");
+ }
+ else
+ {
+ ccOldBTSState = mibVal;
+ }
+
+ // Temporarily assign a default value for cc calls here.
+ CC_MAX_CC_CALLS = CC_MAX_CC_CALLS_DEF_VAL;
+
+ // if ((oamStatus = getMibIntVar(MIB_cc_max_calls, &mibVal))
+ // != STATUS_OK)
+ // {
+ // // failed to get OAM Config. data.
+ // DBG_ERROR("OAM->CC FATAL ERROR: failed(status = %d) to get CC Config - Max Calls.\n",
+ // oamStatus);
+ // printf("OAM->CC FATAL ERROR: failed(status = %d) to get CC Config - Max Calls.\n",
+ // oamStatus);
+ // }
+ // else
+ // {
+ // CC_MAX_CC_CALLS = mibVal;
+ // }
+
+ //GCELL<tyu:06-01-01> REMOVED
+
+ MY_VIPERCELL_IP_ADDRESS = inet_addr(GetViperCellIpAddress());
+
+ // Get config. data that is used by the individual calls - including the timers.
+ callOamDataInit();
+
+ DBG_LEAVE();
+}
+
+void ccOamHandleBTSOpStateChange(INT_32_T opSt)
+{
+ DBG_FUNC("ccOamHandleBTSOpStateChange", CC_LAYER);
+ DBG_ENTER();
+
+ // Handle (Disabled->Enabled) and (Enabled->Disabled) changes.
+ DBG_TRACE("OAM->CC Log: Trap received for BTS (Oper. State = %d)\n",
+ opSt);
+
+ if (ccOldBTSState == VAL_bts_operationalState_enabled)
+ {
+ if ((ccOldBTSState = opSt) == VAL_bts_operationalState_disabled)
+ {
+ ccDataInit();
+ }
+ }
+ else
+ {
+ // No special action needed.
+ ccOldBTSState = opSt;
+ }
+ DBG_LEAVE();
+}
+
+
+// OAM Trap Handling
+void callOamProcessTrapMsg(TrapMsg* oamInMsg)
+{
+ DBG_FUNC("callOamProcessTrapMsg", CC_LAYER);
+ DBG_ENTER();
+
+ // DBG_TRACE("OAM->CC Log: Trap received. (Mib Tag = %d), (MsgType = %d)\n",
+ // oamInMsg->mibTag,
+ // oamInMsg->msgType);
+
+ switch(oamInMsg->msgType) {
+
+ case MT_TRAP:
+ {
+ //Got a trap notification
+ switch (MIB_TBL(oamInMsg->mibTag))
+ {
+ case MTBL_btsBasicPackage:
+ ccGetBtsBasicPackage();
+ if (oamInMsg->mibTag == MIB_bts_operationalState)
+ ccOamHandleBTSOpStateChange(oamInMsg->val.varVal);
+ break;
+ case MTBL_adjacentCellPackage:
+ ccGetAdjacentCellPackage();
+ break;
+
+ default:
+ {
+ switch(oamInMsg->mibTag) {
+ case MIB_cc_alerting_T301:
+ CALL_ALERTING_T301 = (oamInMsg->val.varVal) * TICKS_PER_10MS;
+ break;
+
+ case MIB_cc_setup_T303:
+ CALL_SETUP_T303 = (oamInMsg->val.varVal) * TICKS_PER_10MS;
+ break;
+
+ case MIB_cc_call_confirmed_T310:
+ CALL_CALL_CONFIRMED_T310 = (oamInMsg->val.varVal) * TICKS_PER_10MS;
+ break;
+
+ case MIB_cc_connect_T313:
+ CALL_CONNECT_T313 = (oamInMsg->val.varVal) * TICKS_PER_10MS;
+ break;
+
+ case MIB_cc_disconnect_T305:
+ CALL_DISCONNECT_T305 = (oamInMsg->val.varVal) * TICKS_PER_10MS;
+ break;
+
+ case MIB_cc_release_T308:
+ CALL_RELEASE_T308 = (oamInMsg->val.varVal) * TICKS_PER_10MS;
+ break;
+
+ case MIB_t103:
+ CALL_HAND_SRC_T103 = (oamInMsg->val.varVal) * TICKS_PER_10MS;
+ break;
+
+ case MIB_t104:
+ CALL_HAND_TRG_T104 = (oamInMsg->val.varVal) * TICKS_PER_10MS;
+ break;
+
+ case MIB_t202:
+ CALL_HAND_TRG_T202 = (oamInMsg->val.varVal) * TICKS_PER_10MS;
+ break;
+
+ case MIB_t204:
+ CALL_HAND_TRG_T204 = (oamInMsg->val.varVal) * TICKS_PER_10MS;
+ break;
+
+ case MIB_t211:
+ CALL_HAND_TRG_T211 = (oamInMsg->val.varVal) * TICKS_PER_10MS;
+ break;
+
+ case MIB_t101:
+ case MIB_t102:
+ case MIB_t201:
+ case MIB_t210:
+ case MIB_cc_mm_conn_est_T999:
+ case MIB_cc_safety_timer:
+ case MIB_cc_max_L3_msgs:
+ case MIB_cc_l3_msg_q_priority:
+ case MIB_cc_task_priority:
+ case MIB_cc_task_stack_size:
+ case MIB_cc_max_calls:
+ // ignore
+ break;
+
+ //CDR <xxu:08-22-00> BEGIN
+ //case MIB_bts_operationalState:
+ // ccOamHandleBTSOpStateChange(oamInMsg->val.varVal);
+ // break;
+ //CDR <xxu:08-22-00> END
+
+ default:
+ DBG_ERROR("OAM->CC Call Error: Unexpected (Mib Tag = %d) for Trap. \n",
+ oamInMsg->mibTag);
+ break;
+ }
+ }
+ break;
+ }
+ }
+ break;
+
+ default:
+ DBG_ERROR("OAM->CC Call Error: Unexpected (Msg Type = %d).\n",
+ oamInMsg->msgType);
+ break;
+ }
+ DBG_LEAVE();
+}
+
+void ccRestart(void)
+{
+ short i;
+ for(i=0; i< CC_MAX_CC_CALLS;i++)
+ {
+ semTake(ccSession[i].semId, WAIT_FOREVER);
+ semDelete(ccSession[i].semId);
+ }
+}
+
+// cc reboot action
+int SysCommand_CC (T_SYS_CMD action)
+{
+ DBG_FUNC("SysCommand_CC", CC_LAYER);
+ DBG_ENTER();
+
+ switch(action){
+
+ case SYS_SHUTDOWN:
+ printf("[CC] shutdown notification received\n");
+ DBG_TRACE("[CC] shutdown notification received\n");
+ break;
+
+ case SYS_REBOOT:
+ printf("[CC] Reboot notification received. No action needed.\n");
+ DBG_TRACE("[CC] Reboot notification received. No action needed.\n");
+ break;
+
+ case SYS_START:
+ // Also print out a Starting marker for logs
+ DBG_TRACE("******************************************************************************\n");
+
+ printf("[CC] start notification received\n");
+ DBG_TRACE("[CC] start notification received\n");
+
+ // create message queue and put the message queue ID in a global
+ // variable so that all the Layer-3 Interface API functions can send
+ // message to this queue
+
+ ccMsgQId = msgQCreate(CC_MAX_L3_MSGS, // number of messages
+ CC_MAX_MSG_LENGTH, // size of each message
+ CC_L3_MSG_Q_PRIORITY // priority of the queue
+ );
+
+
+ // check message queue creation result
+ if(ccMsgQId == NULL)
+ {
+ // message queue creation failure. No point to continue.
+ printf("CC FATAL ERROR: failed to create message queue\n" );
+ //Abort the task.
+ DBG_LEAVE();
+ return (-1);
+ }
+
+ //Initialize for RRM to enter into IRT
+ cc_id.msgq_id = ccMsgQId;
+
+ short i;
+ // Initialize all sub tasks message queues.
+ for(i=0; i< CC_MAX_CC_CALLS_DEF_VAL;i++)
+ {
+
+ // create message queue and put the message queue ID in a global
+ // variable so that all the Layer-3 Interface API functions can send
+ // message to this queue
+
+ ccSession[i].msgQId =
+ msgQCreate(CALL_MAX_L3_MSGS, // number of messages
+ CC_MAX_MSG_LENGTH, // size of each message
+ CALL_L3_MSG_Q_PRIORITY // priority of the queue
+ );
+
+
+ // check message queue creation result
+ if(ccSession[i].msgQId == NULL)
+ {
+ // message queue creation failure. No point to continue.
+ //Abort the task.
+ // message queue creation failure. No point to continue.
+ printf("CC CALL FATAL ERROR: failed to create message queue\n" );
+
+ DBG_LEAVE();
+ return (-1);
+ }
+
+ }
+
+ // module initialization etc.
+ ccInit();
+ break;
+
+ default:
+ DBG_ERROR("Root->CC Call Error: Unexpected (action = %d).\n",
+ action);
+ DBG_LEAVE();
+ return(-1);
+
+ }
+ DBG_LEAVE();
+ return 0;
+}
+
+//CDR <xxu:08-22-00> BEGIN
+void ccGetBtsBasicPackage(void)
+{
+ DBG_FUNC("ccGetBtsBasicPackage", CC_LAYER);
+ DBG_ENTER();
+
+ STATUS oamStatus;
+
+ oamStatus = getMibStruct(MIB_btsBasicPackage, (unsigned char*)&ccBtsBasicPackage,
+ sizeof(BtsBasicPackage));
+ if (oamStatus != STATUS_OK)
+ {
+ // failed to get btsBasicPackage data.
+ DBG_ERROR("OAM->Call FATAL ERROR: failed(status = %d) to get ccbtsBasicPackage\n",
+ oamStatus);
+ printf("OAM->Call FATAL ERROR: failed(status = %d) to get ccbtsBasicPackage\n",
+ oamStatus);
+ // Temporarily assign a default value here.
+//GCELL<tyu:06-01-01> BEGIN
+ MY_GLOBALCELL_ID = MY_GLOBALCELL_ID_DEF_VAL;
+ }
+
+ // Convert mcc, mnc to byte string
+ getByteAryByInt(ccBtsBasicPackage.bts_mcc, (char *) &ccBtsBasicPackage.bts_mcc,3);
+ getByteAryByInt(ccBtsBasicPackage.bts_mnc, (char *) &ccBtsBasicPackage.bts_mnc, 2);
+
+ // Initialize MY_GLOBALCELL_ID here
+ MY_GLOBALCELL_ID.mcc[0] = ((char*)&(ccBtsBasicPackage.bts_mcc))[0];
+ MY_GLOBALCELL_ID.mcc[1] = ((char*)&(ccBtsBasicPackage.bts_mcc))[1];
+ MY_GLOBALCELL_ID.mcc[2] = ((char*)&(ccBtsBasicPackage.bts_mcc))[2];
+
+ MY_GLOBALCELL_ID.mnc[0] = ((char*)&(ccBtsBasicPackage.bts_mnc))[0];
+ MY_GLOBALCELL_ID.mnc[1] = ((char*)&(ccBtsBasicPackage.bts_mnc))[1];
+ MY_GLOBALCELL_ID.mnc[2] = 0xf;
+
+
+ MY_GLOBALCELL_ID.lac = ccBtsBasicPackage.bts_lac;
+ MY_GLOBALCELL_ID.ci = ccBtsBasicPackage.bts_ci;
+//GCELL<tyu:06-01-01> END
+
+ DBG_TRACE("MCC(%d,%d,%d) MNC(%d,%d)\n",
+ ((char*)&(ccBtsBasicPackage.bts_mcc))[0],
+ ((char*)&(ccBtsBasicPackage.bts_mcc))[1],
+ ((char*)&(ccBtsBasicPackage.bts_mcc))[2],
+ ((char*)&(ccBtsBasicPackage.bts_mnc))[0],
+ ((char*)&(ccBtsBasicPackage.bts_mnc))[1]);
+
+}
+
+void ccGetAdjacentCellPackage(void)
+{
+ DBG_FUNC("ccGetAdjacentCellPackage", CC_LAYER);
+ DBG_ENTER();
+
+ STATUS oamStatus;
+
+ if (STATUS_OK != (oamStatus = getMibStruct(MIB_adjacentCellPackage,
+ (OCTET_T *)&ccAdjacentCellPackage, sizeof(AdjacentCellPackage))))
+ {
+ // failed to get adjacentCellPackage.
+ DBG_ERROR("OAM->Call FATAL ERROR: failed(status = %d) to get adjacentCellPackage\n",
+ oamStatus);
+ printf("OAM->Call FATAL ERROR: failed(status = %d) in to get adjacentCellPackage\n",
+ oamStatus);
+ return;
+ }
+
+ //Get handover table list
+ if (STATUS_OK != (oamStatus = getMibTbl(MIBT_adjCell_handoverEntry,
+ (OCTET_T *)&ccAdjCellHoTable, sizeof(ccAdjCellHoTable))))
+ {
+ // failed to get btsBasicPackage data.
+ DBG_ERROR("OAM->Call FATAL ERROR: failed(status = %d) to get ccAdjCellHoTable\n",
+ oamStatus);
+ printf("OAM->Call FATAL ERROR: failed(status = %d) to get ccAdjCellHoTable\n",
+ oamStatus);
+ return;
+ }
+
+
+ ccAdjacentCellPackage.adjCell_handoverTable= (Table *)&ccAdjCellHoTable;
+
+ for ( int i=0; i<16; i++)
+ {
+
+ if (((unsigned int)(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_handoverCellID)))
+ {
+
+ getByteAryByInt( ((AdjCell_HandoverEntry*)(&ccAdjCellHoTable))[i].adjCell_mcc,
+ (char*)&(((AdjCell_HandoverEntry*)(&ccAdjCellHoTable))[i].adjCell_mcc),3);
+ getByteAryByInt( ((AdjCell_HandoverEntry*)(&ccAdjCellHoTable))[i].adjCell_mnc,
+ (char*)&(((AdjCell_HandoverEntry*)(&ccAdjCellHoTable))[i].adjCell_mnc),2);
+
+ DBG_TRACE("%dth ADJ-CELL MCC(%d,%d,%d) MNC(%d,%d) LAC(%d) CI(%d)\n", i,
+ ((unsigned char*)&(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_mcc))[0],
+ ((unsigned char*)&(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_mcc))[1],
+ ((unsigned char*)&(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_mcc))[2],
+ ((unsigned char*)&(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_mnc))[0],
+ ((unsigned char*)&(((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_mnc))[1],
+ ((short)((((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_lac))),
+ ((short)((((AdjCell_HandoverEntry*)
+ (ccAdjacentCellPackage.adjCell_handoverTable))[i].adjCell_ci)))
+ );
+ }
+ }
+
+}
+
+void ccSetCdrTimer(int val)
+{
+ long t;
+ t = (long)((CALL_CDR_10M * 16.7)/1000)/60;
+
+ printf("Old ccCdr Timer value(tick %d, % min): %d\n", CALL_CDR_10M, t);
+ CALL_CDR_10M = (int)((val*60000)/16.7);
+ printf("New ccCdr Timer value(tick %d, % min): %d\n", CALL_CDR_10M, val);
+
+}
+//CDR <xxu:08-22-00> END
+
+
diff --git a/data/mnet/GP10/Host/cc/src/CCSessionHandler.cpp b/data/mnet/GP10/Host/cc/src/CCSessionHandler.cpp
new file mode 100644
index 0000000..f29ad43
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCSessionHandler.cpp
@@ -0,0 +1,3580 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCSessionHandler.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-99
+// Description : CC Session Handler
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+//
+#include "taskLib.h"
+
+#include "jcc/JCCLog.h"
+
+#include "JCC/JCCUtil.h"
+
+#include "logging/VCLOGGING.h"
+
+//CH<xxu:11-24-99>
+#include "jcc/LUDBApi.h"
+#include "ril3/ie_cause.h"
+#include "ril3/ril3_sms_rp.h"
+#include "rm/rm_ccintf.h"
+
+#include "CC/CallConfig.h"
+#include "CC/CCSessionHandler.h"
+
+//CDR <xxu:08-21-00>
+#include "CDR/CdrVoiceCall.h"
+#include "CDR/CdrSSA.h"
+
+#include "CC/CCUtil.h"
+
+#include "CC/CCInt.h"
+
+#include "stdio.h"
+
+#include "CC/CCHandover.h"
+
+bool smsSendVbLinkRelease(LUDB_ID, UINT32, T_CNI_RIL3_RP_CAUSE_VALUE cause =
+ CNI_RIL3_RP_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE);
+
+extern int findCallUsingCallHandle( VOIP_CALL_HANDLE callHandle);
+
+extern void sessionDataInit(int);
+
+//BCT <xxu:07-06-00> BEGIN
+extern char CALL_BCT_PREFIX[10]; //Prefix defined for blind call transfer invocation
+extern char CALL_BCT_PREFIX_LEN; //
+extern bool sendH323Msg(TwoPartyCallLeg *, JCCEvent_t, CCRemMsgData_t);
+extern bool VBLinkTransferRequest(unsigned short,
+ T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER,
+ T_CNI_RIL3_IE_CALLING_PARTY_BCD_NUMBER);
+
+//BCT <xxu:07-06-00> END
+
+#include "rm/rm_head.h"
+extern u8 rm_EntryIdToTrxSlot(T_CNI_IRT_ID entryId, u16 *gsmHandler);
+
+extern bool callTrace;
+
+// *******************************************************************
+// forward declarations.
+// *******************************************************************
+
+CCSessionHandler::CCSessionHandler (CCSession_t *session)
+ :parent (session),
+ sapi3Queue_(this )
+{
+
+ entryId = (T_CNI_IRT_ID) JCC_UNDEFINED;
+
+ //BCT <xxu:09-25-00>
+ //anchorHandoverSession = new CCAnchorHandover(this, parent->callIndex, parent->msgQId);
+ //targetHandoverSession = new CCTargetHandover(this, parent->callIndex, parent->msgQId);
+
+ // Initialize the handover to NULL value, which means that no handover is going on
+ //handoverSession = NULL;
+
+ ma = new CCMsgAnalyzer();
+
+ callLeg1 = new TwoPartyCallLeg(this, parent->callIndex, parent->msgQId, 1);
+ callLeg2 = new TwoPartyCallLeg(this, parent->callIndex, parent->msgQId, 2);
+
+ // Placeholder to refuse a third callleg request from MS.
+ callLeg3 = new TwoPartyCallLeg(this, parent->callIndex, parent->msgQId, 3);
+
+ smsLeg1 = new SmsLeg (this, parent->callIndex, parent->msgQId, 4); //MT SMS leg
+ smsLeg2 = new SmsLeg (this, parent->callIndex, parent->msgQId, 5); //M0 SMS leg
+ smsLeg3 = new SmsLeg (this, parent->callIndex, parent->msgQId, 6); //MT SMS leg
+
+ cissCallLeg = new CISSCallLeg(this, parent->callIndex, parent->msgQId, 0);
+
+ //ext-HO <xxu:06-08-01>
+ hoCallLeg = new HOCallLeg(this, parent->callIndex, parent->msgQId, 7);
+ h3CallLeg = new HOCallLeg(this, parent->callIndex, parent->msgQId, 8);
+
+ //BCT <xxu:09-25-00>
+ anchorHandoverSession = new CCAnchorHandover(this, parent->callIndex, parent->msgQId);
+ targetHandoverSession = new CCTargetHandover(this, parent->callIndex, parent->msgQId);
+ // ext-ho <xxu:06-14-01>
+ targetHandoverSessionExtHo = new CCTargetHandoverExtHo(this, parent->callIndex, parent->msgQId);
+
+ // Initialize the handover to NULL value, which means that no handover is going on
+ handoverSession = NULL;
+
+
+ UINT16 uint16TimerValue;
+ int timerValue;
+
+ uint16TimerValue = (((UINT16)(3)) & (0x000F)) << 8;
+ uint16TimerValue = uint16TimerValue | (((UINT16)(parent->callIndex)) & 0x00FF);
+
+ timerValue = (short)uint16TimerValue;
+ sessionTimer = new JCCTimer(callTimerExpiry, timerValue);
+
+ initData();
+}
+
+
+//ext-HO <xxu:06-08-01>
+void
+CCSessionHandler::handleReleaseCallLegExtHo(CallLeg *leg)
+{
+
+ DBG_FUNC("CCSessionHandler::handleReleaseCallLegExtHo", CC_HO_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("{\nMNEThoTRACE(cs::handleReleaseCallLegExtHo): ho-Call Leg released\n}\n");
+
+ // Need to wait until all the Call Legs are released to release the session
+ if ((callLeg1->idle) && (callLeg2->idle) && (cissCallLeg->idle) &&
+ (smsLeg1->isIdle()) && (smsLeg2->isIdle()) && (smsLeg3->isIdle()) &&
+ (hoCallLeg->idle) && (h3CallLeg->idle) )
+ {
+ DBG_TRACE("{\nMNEThoTRACE(cs::handleReleaseCallLegExtHo): ho-Call Leg is released last!\n}\n");
+ cleanup();
+ }
+
+ DBG_LEAVE();
+}
+
+//ext-HO <xxu:06-08-01>
+void
+CCSessionHandler::handleReleaseCallLegExtH3(CallLeg *leg)
+{
+
+ DBG_FUNC("CCSessionHandler::handleReleaseCallLegExtH3", CC_HO_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE("{\nMNEThoTRACE(cs::handleReleaseCallLegExtH3): h3-Call Leg released\n}\n");
+
+ // Need to wait until all the Call Legs are released to release the session
+ if ((callLeg1->idle) && (callLeg2->idle) && (cissCallLeg->idle) &&
+ (smsLeg1->isIdle()) && (smsLeg2->isIdle()) && (smsLeg3->isIdle()) &&
+ (hoCallLeg->idle) && (h3CallLeg->idle) )
+ {
+ DBG_TRACE("{\nMNEThoTRACE(cs::handleReleaseCallLegExtH3): h3-Call Leg is released last!\n}\n");
+ cleanup();
+ }
+
+ DBG_LEAVE();
+}
+
+
+void
+CCSessionHandler::handleReleaseCallLeg (CallLeg *leg)
+{
+
+ DBG_FUNC("CCSessionHandler::handleReleaseCallLeg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // Need to wait until all the Call Legs are released to release the session
+ if ((callLeg1->idle) && (callLeg2->idle) && (cissCallLeg->idle) &&
+ (smsLeg1->isIdle()) && (smsLeg2->isIdle()) && (smsLeg3->isIdle()))
+ {
+ DBG_TRACE("handleReleaseCallLeg:performing CCSession cleanup\n");
+ cleanup();
+ }
+ else if (isMmSetupTermActive() && getMmTermSetupLeg() == leg)
+ { // Reset the Mobile Termination Leg if there is another active Leg in a session
+ DBG_TRACE("handleReleaseCallLeg:performing CCSession resetMmTermSetup\n");
+ resetMmTermSetup();
+ }
+
+ DBG_LEAVE();
+}
+
+void
+CCSessionHandler::initData ()
+{
+ DBG_FUNC("CCSessionHandler::initData", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // Do the following only if entry id is valid.
+ // In terminations and cleanups, it may not be setup yet.
+ // Check the case below to take care of paging failure cases.
+
+ if (entryId != (T_CNI_IRT_ID) JCC_UNDEFINED )
+ {
+
+ IntraL3Msg_t mmOutMsg;
+
+ // Send internal MM msg - no data needed
+ sendMM(INTRA_L3_MM_REL_REQ, INTRA_L3_NULL_MSG, entryId, &mmOutMsg);
+
+ resetIrt ();
+
+ entryId = (T_CNI_IRT_ID) JCC_UNDEFINED;
+ }
+
+ oid = CNI_LAPDM_NULL_OID;
+
+ ludbIndex = JCC_UNDEFINED;
+
+ releaseCause = CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING;
+
+ isEmergencyCall = false;
+
+ resetSapi3 ();
+ resetMmTermSetup ();
+
+ sapi3Queue_.reset();
+
+ handleReleaseSession(parent);
+
+ //BCT <xxu:07-06-00> BEGIN
+ bctInvoke_ = false;
+ bctTi_ = ORIG_OR_MASK;
+ bctLeg_ = NULL;
+ //BCT <xxu:07-06-00> END
+
+ //CDR <xxu:08-23-00>
+ mobileId.mobileIdType = CNI_RIL3_NO_MOBILE_ID;
+
+ //ext-HO <xxu:06-08-01>
+ hoCallHandle = VOIP_NULL_CALL_HANDLE;
+
+ DBG_LEAVE();
+}
+
+bool CCSessionHandler::resetIrt ()
+{
+ bool retVal;
+
+ DBG_FUNC ("CCSessionHandler::resetIrt", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ retVal = setIrt (entryId, cc_id);
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+// Sets all the required IRTs for CC
+bool CCSessionHandler::setIrt (T_CNI_IRT_ID inEntryId, T_CNI_L3_ID& newId)
+{
+ bool retVal = (inEntryId != (T_CNI_IRT_ID) JCC_UNDEFINED);
+
+ DBG_FUNC ("CCSessionHandler::setIrt", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // Check validity of the received entry ID and Update CC entry for FACCH IRT entry
+ if ( retVal == true &&
+ (retVal = CNI_RIL3_IRT_Set_CC_Id (inEntryId, newId)) == true )
+ {
+ // Update CC entry for SACCH IRT entry
+ retVal = CNI_RIL3_IRT_Set_CC_Id (rm_GetSacchEntryId (inEntryId), newId);
+ }
+
+ if (retVal == false)
+ DBG_WARNING ("CC Call Error : IRT Table set problem for (entry id = %d)\n ", inEntryId);
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+void
+CCSessionHandler::printData (JCCPrintStFn fnPtr)
+{
+ char * shStr1Ptr = "Session Handler Data : ";
+ char shStr2[120];
+
+ //BCT <xxu:07-12-00> BEGIN add BCT info
+ sprintf(&shStr2[0],
+ "lapId( %d), irtId( %d), (ludbId %d) (emergency %d) bct(inv %d, ti %d, leg %p)\n",
+ oid,
+ entryId,
+ ludbIndex,
+ isEmergencyCall,
+ bctInvoke_,
+ bctTi_,
+ bctLeg_
+ );
+ //BCT <xxu:07-12-00> END add BCT info
+
+ (*fnPtr)(shStr1Ptr);
+ (*fnPtr)(&shStr2[0]);
+
+ if (handoverSession == anchorHandoverSession)
+ {
+ anchorHandoverSession->printData(fnPtr);
+ }
+ else if (handoverSession == targetHandoverSession)
+ {
+ targetHandoverSession->printData(fnPtr);
+ }
+
+ callLeg1->printData (fnPtr);
+ callLeg2->printData (fnPtr);
+ cissCallLeg->printData (fnPtr);
+ smsLeg1->printData (fnPtr);
+ smsLeg2->printData (fnPtr);
+ smsLeg3->printData (fnPtr);
+
+}
+
+bool
+CCSessionHandler::setupOrig(T_CNI_IRT_ID irtId ,
+ T_CNI_RIL3_CM_SERVICE_TYPE cmServType)
+{
+ /* Called ONLY for the very first MO setup (either call or SMS-PP */
+ bool retVal = true;
+
+ DBG_FUNC("CCSessionHandler::setupOrig", CC_SESSION_LAYER);
+ DBG_ENTER();
+ entryId = irtId;
+ // Also initialize other variables in the session
+
+
+ T_CNI_RIL3_IRT_ENTRY irtEntry;
+ irtEntry.entry_id = entryId;
+
+ if ( (CNI_RIL3_IRT_Get_Entry_by_Entry_ID(&irtEntry)) == false )
+ {
+ DBG_ERROR("IRT Error : IRT Table problem, (Entry Id = %d) \n ",
+ entryId);
+
+ // Cleanup action ?? - Release all resources
+ initData();
+ DBG_LEAVE();
+ return (false);
+ }
+
+ oid = irtEntry.lapdm_oid;
+
+ if (cmServType == CNI_RIL3_CM_SERVICE_TYPE_SHORT_MESSAGE_SERVICE)
+ {
+ DBG_TRACE ("Init MO SMS connection.\n");
+
+ //Call to MO SMS setup: smsLeg2 is designated for MO SMS
+ retVal = smsLeg2->setupOrig();
+ }
+ else if (cmServType != CNI_RIL3_CM_SERVICE_TYPE_SUPPLEMENTARY_SERVICE)
+ {
+ isEmergencyCall = (cmServType == CNI_RIL3_CM_SERVICE_TYPE_EMERGENCY_CALL);
+
+ callLeg1->setupOrig(0, cmServType);
+ retVal = true;
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+SpeechChann_t
+CCSessionHandler::currSpeechCh(void)
+{
+ DBG_FUNC("CCSessionHandler::currSpeechCh", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ DBG_LEAVE();
+ if ( (activeLeg == NULL) || (activeLeg()->msSide == NULL) )
+ return (currChannDef);
+ else
+ return(activeLeg()->msSide->currSpeechCh_);
+}
+
+//Igal: Updated for SMS HO
+bool
+CCSessionHandler::isHandoverAllowed(void)
+{
+ DBG_FUNC("CCSessionHandler::isHandoverAllowed", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ bool callLeg1Ok, callLeg2Ok = false, smsHoAllowed;
+
+ if ((!callLeg1->idle) && (callLeg1->msSide != NULL))
+ {
+ DBG_TRACE("isHandoverAllowed Info: callLeg1's channState_(%d) callState_(%d)\n",
+ callLeg1->msSide->channState_,
+ callLeg1->msSide->callState_);
+
+ if (((callLeg1->msSide->channState_ == RES_ST_ASSIGNED) && // Do not allow SDCCH (or) TCH signaling mode handovers
+ ((callLeg1->msSide->callState_ != HC_ST_RELEASE_REQ) &&
+ (callLeg1->msSide->callState_ != HC_ST_DISCONNECT_IND))) ||
+ (callLeg1->waitingCallLeg))
+//
+// if ((callLeg1->msSide->callState_ == HC_ST_ACTIVE) ||
+// (callLeg1->msSide->callState_ == OHC_ST_ANSWER_PENDING) ||
+// (callLeg1->msSide->callState_ == THC_ST_ALERTING))
+
+
+ {
+ // Don't allow handovers during NON-STABLE call state!
+ if (callLeg1->isActive())
+ {
+ callLeg1Ok = true;
+ }
+ }
+ }
+ else if (!callLeg2->idle)
+ {
+ callLeg1Ok = true;
+ }
+
+ if ((!callLeg2->idle) && (callLeg2->msSide != NULL))
+ {
+ DBG_TRACE("isHandoverAllowed Info: callLeg2's channState_(%d) callState_(%d)\n",
+ callLeg2->msSide->channState_,
+ callLeg2->msSide->callState_);
+
+ if (((callLeg2->msSide->channState_ == RES_ST_ASSIGNED) &&
+ ((callLeg2->msSide->callState_ != HC_ST_RELEASE_REQ) &&
+ (callLeg2->msSide->callState_ != HC_ST_DISCONNECT_IND))) ||
+ (callLeg2->waitingCallLeg))
+//
+// if ((callLeg2->msSide->callState_ == HC_ST_ACTIVE) ||
+// (callLeg2->msSide->callState_ == OHC_ST_ANSWER_PENDING) ||
+// (callLeg2->msSide->callState_ == THC_ST_ALERTING))
+ {
+
+ // Don't allow handovers during NON-STABLE call state!
+ if (callLeg2->isActive())
+ {
+ callLeg2Ok = true;
+ }
+ }
+ }
+ else if (!callLeg1->idle)
+ {
+ callLeg2Ok = true;
+ }
+
+ //Igal: SMS Handover conditions
+ smsHoAllowed = isSmsHoAllowed();
+
+ DBG_TRACE("isHandoverAllowed Info: callLeg1Ok(%d) callLeg2Ok(%d) smsHoAllowed(%d) bctInvoke_(%d) getBctArrival(%d)\n",
+ callLeg1Ok, callLeg2Ok, smsHoAllowed, bctInvoke_, getBctArrival());
+
+ DBG_LEAVE();
+
+ //BCT <xxu:07-14-00> BEGIN
+ return (callLeg1Ok && callLeg2Ok && smsHoAllowed && !bctInvoke_ && !getBctArrival());
+ //BCT <xxu:07-14-00> BEGIN
+
+}
+
+bool
+CCSessionHandler::isOtherLegHeld(short legNum)
+{
+ DBG_FUNC("CCSessionHandler::isOtherLegHeld", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ bool returnValue = false;
+ TwoPartyCallLeg *otherLeg;
+
+ if (legNum == 1)
+ {
+ otherLeg = callLeg2;
+ }
+ else
+ {
+ otherLeg = callLeg1;
+ }
+
+ if ((otherLeg->idle) ||
+ (otherLeg->msSide == NULL))
+ {
+ returnValue = true;
+ }
+ else if (otherLeg->msSide->chState_ == CH_ST_HELD)
+ {
+ returnValue = true;
+ }
+
+ DBG_LEAVE();
+ return(returnValue);
+}
+
+
+bool CCSessionHandler::isSmsHoAllowed ()
+{
+ DBG_FUNC ("CCSessionHandler::isSmsHoAllowed", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ bool retVal = (smsLeg1->isHoAllowed() &&
+ smsLeg2->isHoAllowed() &&
+ smsLeg3->isHoAllowed() );
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+TwoPartyCallLeg *
+CCSessionHandler::activeLeg(void)
+{
+ DBG_FUNC("CCSessionHandler::activeLeg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ TwoPartyCallLeg *returnValue = NULL;
+
+ //Igal: update this message, change return type to CallLeg?
+
+ if ((!callLeg1->idle) && (callLeg1->msSide != NULL))
+ {
+ if (((callLeg2->idle) ||
+ (callLeg1->msSide->chState_ == CH_ST_IDLE) ||
+ (callLeg1->msSide->chState_ == CH_ST_HREQ)) &&
+ (!callLeg1->waitingCallLeg))
+ {
+ returnValue = callLeg1;
+ }
+ }
+
+ if ((!callLeg2->idle) && (callLeg2->msSide != NULL))
+ {
+ if (((callLeg1->idle) ||
+ (callLeg2->msSide->chState_ == CH_ST_IDLE) ||
+ (callLeg2->msSide->chState_ == CH_ST_HREQ)) &&
+ (!callLeg2->waitingCallLeg))
+ {
+ returnValue = callLeg2;
+ }
+ }
+
+ // Otherwise, we are doing a signaling activity (CISS, SMS Point to Point, etc)
+
+ DBG_LEAVE();
+ return(returnValue);
+}
+
+CallLeg *
+CCSessionHandler::getCallLegForNewTermination(bool &waitingCallLeg)
+{
+ DBG_FUNC("CCSessionHandler::getCallLegForNewTermination", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ TwoPartyCallLeg *whichLeg = NULL;
+ bool waitingAllowed = (ludbIsProvCW(ludbIndex) &&
+ ludbIsActiveCW(ludbIndex) &&
+ !isEmergencyCall ); // Override features for emergency call
+
+ if ((callLeg1->idle) &&
+ ((callLeg2->idle) || ((callLeg2->isActive()) && waitingAllowed)))
+ {
+ whichLeg = callLeg1;
+ waitingCallLeg = (!(callLeg2->idle));
+ }
+ else if ((callLeg2->idle) &&
+ ((callLeg1->idle) || ((callLeg1->isActive()) && waitingAllowed)))
+ {
+ whichLeg = callLeg2;
+ waitingCallLeg = (!(callLeg1->idle));
+ }
+
+ DBG_LEAVE();
+
+ return (whichLeg);
+}
+
+CallLeg *
+CCSessionHandler::getSmsLegForNewTermination (bool &waitingCallLeg)
+{
+ DBG_FUNC("CCSessionHandler::getSmsLegForNewTermination", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ SmsLeg *whichLeg = NULL_PTR;
+
+ if (smsLeg1->isIdle())
+ whichLeg = smsLeg1;
+
+ waitingCallLeg = false;
+
+ DBG_LEAVE();
+ return (whichLeg);
+}
+
+
+bool
+CCSessionHandler::setupTerm(VOIP_CALL_HANDLE voipCallHandle,
+ int cdrIndex ,
+ int callRefValue ,
+ bool isFirst )
+{
+ DBG_FUNC("CCSessionHandler::setupTerm", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ bool waitingCallLeg = false ;
+ bool returnValue = true ;
+
+ CallLeg *whichLeg;
+
+ if (isMmSetupTermActive() == true)
+ { // Only one MT MM connection setup in progress is allowed per MS
+ // Second attempt is rejected
+ whichLeg = NULL;
+ DBG_TRACE ("CM Log: second MT setup attempt while ongoing MT setup (%s) in progress\n",
+ (voipCallHandle != VOIP_NULL_CALL_HANDLE) ? "Voice Call" : "SMS");
+ }
+ else if (voipCallHandle != VOIP_NULL_CALL_HANDLE)
+ // Get termination leg for the Voice call
+ whichLeg = getCallLegForNewTermination (waitingCallLeg);
+ else
+ // Get termination for the SMS
+ whichLeg = getSmsLegForNewTermination (waitingCallLeg);
+
+ if (whichLeg != NULL)
+ {
+ if (isFirst)
+ setMmTermSetup (whichLeg); // Mark beginning of the MM Connection Setup
+
+ // Invoke virtual function
+ whichLeg->setupTerm (voipCallHandle, cdrIndex, callRefValue, waitingCallLeg);
+
+ if ( waitingCallLeg && (!isFirst) )
+ {
+ // CDR <xxu:08-21-00> BEGIN: for Voice call only
+ CCdrSSA cwCdr;
+ if (ludbGetSubscInfoExists(ludbIndex))
+ {
+ cwCdr.setServedIMSI(ludbGetMobileIdPtr(ludbIndex));
+ cwCdr.setServedMSISDN(ludbGetMSISDNPtr(ludbIndex));
+ }
+ cwCdr.setCorrelatedEventRefNumber(whichLeg->ccCdr.getEventRefNumber());
+ cwCdr.generateRecord(CDR_SS_ACTION_INVOCATION,SUPP_SERV_CW,CNI_RIL3_CAUSE_SUCCESS);
+ // CDR <xxu:08-21-00> END
+ }
+ returnValue = true;
+ }
+ else if (voipCallHandle == VOIP_NULL_CALL_HANDLE)
+ { // SMS MT setup during ongoing MT MM connection esteblishment
+ returnValue = false;
+ }
+ else
+ { // Either MT call setup during ongoing MT MM connection esteblishment or
+ // the call is rejected
+
+ // print out the trx, timeslot for better debugging
+ UINT16 gsmHandler;
+ UINT8 trx, slot;
+ T_SUBSC_IE_ISDN* isdnPtr;
+
+ if (rm_EntryIdToTrxSlot(entryId,
+ &gsmHandler) ==
+ RM_TRUE)
+ {
+
+ trx = (UINT8)(gsmHandler>>8);
+ slot = (UINT8)(gsmHandler);
+
+ if (callTrace)
+ {
+ DBG_WARNING("CC Log: User Busy on (TRX=%d),(Slot=%d),(entryId=%d)\n",
+ trx, slot, entryId);
+ if ((isdnPtr = ludbGetMSISDNPtr(ludbIndex)) != NULL)
+ {
+ DBG_WARNING("CC Log: MS (DN=%s)\n",
+ isdnPtr->digits);
+ }
+ }
+ else
+ {
+ DBG_TRACE("CC Log: User Busy on (TRX=%d),(Slot=%d),(entryId=%d)\n",
+ trx, slot, entryId);
+ if ((isdnPtr = ludbGetMSISDNPtr(ludbIndex)) != NULL)
+ {
+ DBG_TRACE("CC Log: MS (DN=%s)\n",
+ isdnPtr->digits);
+ }
+ }
+ }
+
+ returnValue = false;
+ }
+
+ DBG_LEAVE();
+ return(returnValue);
+}
+
+bool
+CCSessionHandler::setupTargetHandover(void)
+{
+ DBG_FUNC("CCSessionHandler::setupTargetHandover", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ handoverSession = targetHandoverSession;
+
+ DBG_LEAVE();
+ return(true);
+
+}
+
+//ext-HO <xxu:05-16-01>
+bool
+CCSessionHandler::setupTargetHandoverExtHo(void)
+{
+ DBG_TRACEei("{\nMNETeiTRACE(cs::setupTargetHandoverExtHo): entering......\n}\n");
+
+ handoverSession = targetHandoverSessionExtHo;
+
+ return(true);
+
+}
+
+bool
+CCSessionHandler::findHandle(VOIP_CALL_HANDLE voipCallHandle)
+{
+ DBG_FUNC("CCSessionHandler::findHandle", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ if (((!callLeg1->idle) && (callLeg1->h323CallHandle == voipCallHandle)) ||
+ ((!callLeg2->idle) && (callLeg2->h323CallHandle == voipCallHandle)))
+ {
+ DBG_LEAVE();
+ return(true);
+ }
+
+ DBG_LEAVE();
+ return(false);
+
+}
+
+bool
+CCSessionHandler::routeFromVoipToCallLeg(IntraL3Msg_t *h323InMsg,
+ TwoPartyCallLeg *&whichLeg)
+{
+ DBG_FUNC("CCSessionHandler::routeFromVoipToCallLeg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ bool ret; //BCT <xxu:09-21-00>
+ ret = false;
+
+ whichLeg = NULL;
+
+ if ((!callLeg1->idle) &&
+ ((callLeg1->h323CallHandle == h323InMsg->call_handle) ||
+ (callLeg1->h323CallHandle == VOIP_NULL_CALL_HANDLE)))
+ {
+ whichLeg = callLeg1;
+ callLeg1->h323CallHandle = h323InMsg->call_handle;
+ ret = true; //BCT <xxu:09-21-00>
+ }
+ else if ((!callLeg2->idle) &&
+ ((callLeg2->h323CallHandle == h323InMsg->call_handle) ||
+ (callLeg2->h323CallHandle == VOIP_NULL_CALL_HANDLE)))
+ {
+ whichLeg = callLeg2;
+ callLeg2->h323CallHandle = h323InMsg->call_handle;
+ ret = true; //BCT <xxu:09-21-00>
+ }
+
+ // This is a VOIP error. Put in a temporary fix such that we are not left with half calls
+ else if ((h323InMsg->entry_id = findCallUsingCallHandle( h323InMsg->call_handle))
+ == (CC_MAX_CC_CALLS))
+ {
+ DBG_WARNING("H323->CC: Late Msg(%d) h323CallHandle(%p) SessionId(%d)\n",
+ h323InMsg->message_type,
+ (int)h323InMsg->call_handle,
+ parent->callIndex );
+ }
+ else
+ {
+ if (ERROR == msgQSend( ccSession[h323InMsg->entry_id].msgQId,
+ (char *) h323InMsg,
+ sizeof(struct IntraL3Msg_t),
+ NO_WAIT, //PR1553 <xxu> WAIT_FOREVER
+ MSG_PRI_NORMAL
+ ) )
+ {
+ DBG_ERROR("CC Call -> CC Call Error : sendCC msgQSend (QID = %p) error\n ",
+ (int)ccSession[h323InMsg->entry_id].msgQId);
+
+ }
+ }
+
+ //BCT <xxu:09-21-00> BEGIN
+ if ( (whichLeg != NULL) &&
+ (h323InMsg->message_type == INTRA_L3_CC_BCT_UPDATE_HANDLES) )
+ {
+ whichLeg->bctArrival_ = true;
+ whichLeg->oH323CallHandle = h323InMsg->call_handle;
+ whichLeg->h323CallHandle = h323InMsg->l3_data.voipMsg.callUpdateHandles.NewHandle;
+
+ //break whatever traffic connections sunk to old rtp handler
+ bool hoSimplexConnected = false;
+ bool h3SimplexConnected = false;
+
+ if (!h323InMsg->l3_data.voipMsg.callUpdateHandles.ReconnectOnTransferFailure)
+ {
+ if ( (handoverSession != NULL)&&(handoverSession == anchorHandoverSession) )
+ {
+ hoSimplexConnected = anchorHandoverSession->hoSimplexConnected_;
+ h3SimplexConnected = anchorHandoverSession->h3SimplexConnected_;
+ anchorHandoverSession->hoSimplexConnected_ = false;
+ anchorHandoverSession->h3SimplexConnected_ = false;
+ }
+
+ if ( whichLeg->voiceConnected || hoSimplexConnected || h3SimplexConnected )
+ {
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(whichLeg->oH323CallHandle);
+
+ if ( (csuResult = csu_OrigTermBreakAll(&rtpSourcePort) )
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERROR("CC->CSU Error(bct): Disconn Failed (Result=%d)for(RTPHandle=%p)\n",
+ csuResult, rtpSourcePort.portId.rtpHandler);
+ //Can only generate OAM report
+ }
+ }
+
+ whichLeg->voiceConnected = false;
+ } else
+ {
+ //Reconnect the call between transferring and transferred party due to BCT failure
+ if (whichLeg->msSide->chState_!=CH_ST_HELD)
+ {
+ T_CSU_PORT_ID srcPort, snkPort;
+ T_CSU_RESULT_CON result;
+
+ srcPort.portType = CSU_RTP_PORT;
+ srcPort.portId.rtpHandler = VoipCallGetRTPHandle(whichLeg->h323CallHandle);
+ snkPort.portType = CSU_NIL_PORT;
+
+ if (handoverSession==NULL)
+ {
+ //connect to gsm port
+ snkPort.portType = CSU_GSM_PORT;
+ snkPort.portId.gsmHandler = entryId;
+ }
+
+ if ((handoverSession!=NULL)&&(handoverSession==anchorHandoverSession)&&
+ (anchorHandoverSession->hoState_==HAND_ST_ANCH_HO_COMPLT) )
+ {
+ //connect to rtp port
+ snkPort.portType = CSU_RTP_PORT;
+ snkPort.portId.rtpHandler = anchorHandoverSession->hoRtpSession_;
+
+ }
+
+ if ((handoverSession!=NULL)&&(handoverSession==anchorHandoverSession)&&
+ (anchorHandoverSession->hoState_==HAND_ST_ANCH_EHO_COMPLT) )
+ {
+ //connect to rtp port
+ snkPort.portType = CSU_RTP_PORT;
+ snkPort.portId.rtpHandler = VoipCallGetRTPHandle(hoCallLeg->h323CallHandle);
+
+ }
+
+ if (snkPort.portType!=CSU_NIL_PORT)
+ {
+ //make duplex connection
+ if ((result = csu_DuplexConnect(&srcPort, &snkPort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERROR("CSU Error(BCT): duplex conn (Result=%d) for src(%d,%x) snk(%d,%x)\n",
+ result,
+ srcPort.portType, srcPort.portId.rtpHandler,
+ snkPort.portType, snkPort.portId.rtpHandler );
+ }
+ }
+
+ whichLeg->voiceConnected = true;
+
+ }
+ }
+
+ }
+
+ //BCT <xxu:09-21-00> END
+
+ DBG_LEAVE();
+ return(ret);
+}
+
+SmsLeg * CCSessionHandler::findSmsReference (UINT32 refNum)
+{
+ SmsLeg * whichLeg = NULL_PTR;
+
+ DBG_FUNC ("CCSessionHandler::findSmsReference", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ if (refNum == smsLeg1->getVbRefNum())
+ whichLeg = smsLeg1;
+ else if (refNum == smsLeg2->getVbRefNum())
+ whichLeg = smsLeg2;
+ else
+ whichLeg = NULL_PTR; /* If there is no SMS leg to forward the message
+ return NULL_PTR */
+ DBG_LEAVE();
+ return (whichLeg);
+}
+
+
+bool
+CCSessionHandler::routeFromVoipToSmsLeg (IntraL3Msg_t * h323InMsg,
+ SmsLeg *&whichLeg )
+{
+ DBG_FUNC ("CCSessionHandler::routeFromVoipToSmsLeg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ SMS_VBLINK_MSGTYPE type = (SMS_VBLINK_MSGTYPE) h323InMsg->l3_data.smsVbMsg.hdr.msgType;
+
+ whichLeg = NULL_PTR;
+
+ if (type == MNSMS_EST_Req) // always forwarded to the MT Setup
+ {
+ /* Race condition could happend here:
+ MNSMS-EST Req is sent to the active MS but by the time Call task is ready to
+ process the message all the activities are complited and the session is released */
+
+ whichLeg = smsLeg1;
+ }
+ else // Otherwise, is routed according to Vb Reference number
+ whichLeg = findSmsReference (h323InMsg->l3_data.smsVbMsg.hdr.refNum);
+
+ DBG_LEAVE();
+ return (!(whichLeg == NULL_PTR));
+}
+
+
+bool
+CCSessionHandler::routeFromMsToCallLeg(T_CNI_RIL3CC_MSG *msInDecodedMsg,
+ TwoPartyCallLeg *&whichLeg)
+{
+ DBG_FUNC("CCSessionHandler::routeFromMsToCallLeg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ whichLeg = NULL;
+
+ if ((!callLeg1->idle) && (callLeg1->msSide != NULL))
+ {
+ if (((callLeg1->msSide->callState_ == HC_ST_NULL) &&
+ ((msInDecodedMsg->header.message_type == CNI_RIL3CC_MSGID_SETUP) ||
+ (msInDecodedMsg->header.message_type == CNI_RIL3CC_MSGID_EMERGENCY_SETUP)) && // can we get a disconnect here?
+ (callLeg1->procType == CC_PROC_MOB_ORIG))|| // waiting for origination setup
+ (((msInDecodedMsg->header.si_ti >> 3) == 0) && // Mobile Origination
+ (callLeg1->msSide->ti == (msInDecodedMsg->header.si_ti | ORIG_OR_MASK)) &&
+ (callLeg1->procType == CC_PROC_MOB_ORIG)) || // any origination protocol message
+ (((msInDecodedMsg->header.si_ti >> 3) == 1) && // Mobile Termination
+ (callLeg1->msSide->ti == (msInDecodedMsg->header.si_ti & TERM_AND_MASK)) &&
+ (callLeg1->procType == CC_PROC_MOB_TERM))) // any termination protocol message
+
+ {
+ whichLeg = callLeg1;
+ DBG_LEAVE();
+ return(true);
+ }
+ }
+
+ if ((!callLeg2->idle) && (callLeg2->msSide != NULL))
+ {
+ if ((((msInDecodedMsg->header.si_ti >> 3) == 0) && // Mobile Origination
+ (callLeg2->msSide->ti == (msInDecodedMsg->header.si_ti | ORIG_OR_MASK)) &&
+ (callLeg2->procType == CC_PROC_MOB_ORIG)) || // any origination protocol message
+ (((msInDecodedMsg->header.si_ti >> 3) == 1) && // Mobile Termination
+ (callLeg2->msSide->ti == (msInDecodedMsg->header.si_ti & TERM_AND_MASK)) &&
+ (callLeg2->procType == CC_PROC_MOB_TERM))) // any termination protocol message
+ {
+ whichLeg = callLeg2;
+ DBG_LEAVE();
+ return(true);
+ }
+ }
+
+ // Take care of the setup situations
+ if ( (msInDecodedMsg->header.message_type == CNI_RIL3CC_MSGID_SETUP) ||
+ (msInDecodedMsg->header.message_type == CNI_RIL3CC_MSGID_EMERGENCY_SETUP) )
+ {
+ //BCT <xxu:07-12-00> BEGIN
+
+ if ( ( (!callLeg1->idle) && (!callLeg2->idle)) ||
+ (bctInvoke_) ||
+ ((handoverSession != NULL) &&
+ ( (handoverSession->hoState_ != HAND_ST_ANCH_HO_COMPLT) &&
+ (handoverSession->hoState_ != HAND_ST_ANCH_EHO_COMPLT) ) ) )
+ {
+ //Ignore any subsequent call setup while a BCT is in progress or both call leg in use
+ //"handoverSession" supposed to be NULL while receiving a bct SETUP
+
+ DBG_WARNING("MS->CC Warning: block bct call setup for sessionId(%d) due to (bctInv %d,hoSession %p)\n",
+ parent->callIndex, bctInvoke_, handoverSession);
+
+ callLeg3->setupOrig(msInDecodedMsg->header.si_ti);
+
+ callLeg3->msSide->handleMobMsg(msInDecodedMsg,
+ CNI_RIL3_RESULT_SUCCESS, // decoding result
+ CNI_RIL3_CAUSE_RESOURCES_UNAVAILABLE_UNSPECIFIED,
+ HC_LOCAL_RELEASE_REQ); // release request
+ DBG_LEAVE();
+ return(false);
+ } else
+ {
+ if ( (msInDecodedMsg->header.message_type == CNI_RIL3CC_MSGID_SETUP) &&
+ (!memcmp(msInDecodedMsg->setup.calledBCD.digits, CALL_BCT_PREFIX, CALL_BCT_PREFIX_LEN)) )
+ {
+ //BCT invocation, and check if BCT is provisioned
+
+ DBG_TRACE("CC Call Log: (bct prefix = %d,%d,%d,%d)\n",
+ msInDecodedMsg->setup.calledBCD.digits[0],
+ msInDecodedMsg->setup.calledBCD.digits[1],
+ msInDecodedMsg->setup.calledBCD.digits[2],
+ msInDecodedMsg->setup.calledBCD.digits[3]);
+
+ msInDecodedMsg->setup.calledBCD.numDigits -= CALL_BCT_PREFIX_LEN;
+ memcpy(msInDecodedMsg->setup.calledBCD.digits,
+ &msInDecodedMsg->setup.calledBCD.digits[CALL_BCT_PREFIX_LEN],
+ msInDecodedMsg->setup.calledBCD.numDigits);
+
+ DBG_TRACE("CC Call Log: (bct-to number = %d,%d,%d,%d)\n",
+ msInDecodedMsg->setup.calledBCD.digits[0],
+ msInDecodedMsg->setup.calledBCD.digits[1],
+ msInDecodedMsg->setup.calledBCD.digits[2],
+ msInDecodedMsg->setup.calledBCD.digits[3]);
+
+ if ( !ludbIsProvECT(ludbIndex) )
+ //if (0)
+ {
+ // Handle its release through the placeholder for the third call leg.
+
+ DBG_TRACE("LUDB->CC BCT: not provisioned for (ludbIndex = %d, sessionId = %d)\n",
+ ludbIndex, parent->callIndex);
+
+ callLeg3->setupOrig(msInDecodedMsg->header.si_ti);
+
+ callLeg3->msSide->handleMobMsg(msInDecodedMsg,
+ CNI_RIL3_RESULT_SUCCESS, // decoding result
+ CNI_RIL3_CAUSE_REQUESTED_SERVICE_NOT_SUBSCRIBED ,
+ HC_LOCAL_RELEASE_REQ); // release request
+ DBG_LEAVE();
+ return(false);
+ }
+
+ //BCT race condition
+ if (getBctArrival())
+ {
+ // Handle its release through the placeholder for the third call leg.
+ DBG_TRACE("CC->BCT: a bct call arriving, block bct invoke(ludbId=%d, sessId=%d)\n",
+ ludbIndex, parent->callIndex);
+
+ callLeg3->setupOrig(msInDecodedMsg->header.si_ti);
+
+ callLeg3->msSide->handleMobMsg(msInDecodedMsg,
+ CNI_RIL3_RESULT_SUCCESS, // decoding result
+ CNI_RIL3_CAUSE_TEMPORARY_FAILURE,
+ HC_LOCAL_RELEASE_REQ); // release request
+ DBG_LEAVE();
+ return(false);
+ }
+
+ bctInvoke_ = true;
+ }
+
+ TwoPartyCallLeg *otherLeg;
+
+ if ( callLeg1->idle ) { whichLeg = callLeg1; otherLeg = callLeg2; }
+ else { whichLeg = callLeg2; otherLeg = callLeg1; }
+
+ if ( bctInvoke_ )
+ {
+ if ( otherLeg->msSide->callState_ != HC_ST_ACTIVE )
+ {
+ // Reject this BCT invocation since the call to bct is being released now
+
+ bctInvoke_ = false;
+
+ DBG_TRACE("CC BCT: call to bct is being released now (ludbIndex = %d, sessionId = %d)\n",
+ ludbIndex, parent->callIndex);
+
+ callLeg3->setupOrig(msInDecodedMsg->header.si_ti);
+
+ callLeg3->msSide->handleMobMsg(msInDecodedMsg,
+ CNI_RIL3_RESULT_SUCCESS, // decoding result
+ CNI_RIL3_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE,
+ HC_LOCAL_RELEASE_REQ); // release request
+ DBG_LEAVE();
+ return(false);
+ } else
+ {
+ //Inquire VB-TTF function for xfered-to number
+ T_SUBSC_IE_ISDN* isdnPtr;
+ if ((isdnPtr = ludbGetMSISDNPtr(ludbIndex)) != NULL)
+ {
+ //DBG_TRACE("CC Log: MS (DN=%s)\n",
+ // isdnPtr->digits);
+ msInDecodedMsg->setup.callingBCD.ie_present = true;
+ msInDecodedMsg->setup.callingBCD.numberType = CNI_RIL3_NUMBER_TYPE_INTERNATIONAL;
+ msInDecodedMsg->setup.callingBCD.numberingPlan = (T_CNI_RIL3_NUMBERING_PLAN_ID)isdnPtr->num_plan[0];
+ msInDecodedMsg->setup.callingBCD.numDigits = isdnPtr->num_digit;
+ for (int i=0;i<isdnPtr->num_digit;i++)
+ {
+ if ( isdnPtr->digits[i] >= 0x30 && isdnPtr->digits[i] < 0x40 )
+ msInDecodedMsg->setup.callingBCD.digits[i] = isdnPtr->digits[i] - 0x30;
+ else
+ DBG_ERROR("CC LOG LUDB(bct): invalid msisdn digit (%d,%c)\n",
+ i, (char) isdnPtr->digits[i]);
+ }
+ DBG_TRACE("CC Call Log: (calling Party BCD = %s)\n",
+ msInDecodedMsg->setup.callingBCD.digits);
+ }
+
+
+ if (!VBLinkTransferRequest(parent->callIndex,
+ msInDecodedMsg->setup.calledBCD,
+ msInDecodedMsg->setup.callingBCD))
+ {
+ // Reject this BCT invocation since the call to bct is being released now
+ DBG_ERROR ("CC->VB Link Err(bct): Failed on VBLinkTransferRequest\n");
+
+ bctInvoke_ = false;
+
+ DBG_TRACE("CC BCT: call to bct is being released now (ludbIndex = %d, sessionId = %d)\n",
+ ludbIndex, parent->callIndex);
+
+ callLeg3->setupOrig(msInDecodedMsg->header.si_ti);
+
+ callLeg3->msSide->handleMobMsg(msInDecodedMsg,
+ CNI_RIL3_RESULT_SUCCESS, // decoding result
+ CNI_RIL3_CAUSE_REQUESTED_SERVICE_NOT_SUBSCRIBED ,
+ HC_LOCAL_RELEASE_REQ); // release request
+ DBG_LEAVE();
+ return(false);
+ }
+
+ //Go ahead to do bct
+ DBG_TRACE("CC Call Log: (calling Party BCD = %d,%d,%d,%d)\n",
+ msInDecodedMsg->setup.callingBCD.digits[0],
+ msInDecodedMsg->setup.callingBCD.digits[1],
+ msInDecodedMsg->setup.callingBCD.digits[2],
+ msInDecodedMsg->setup.callingBCD.digits[3]);
+
+ bctTi_ = (msInDecodedMsg->header.si_ti | ORIG_OR_MASK);
+ bctLeg_ = whichLeg;
+ bctMainLeg_ = otherLeg;
+
+ CalledPartyNumber = msInDecodedMsg->setup.calledBCD;
+
+ //BCTCalling Party Number shalle be transferred party's number
+ //CallingPartyNumber = msInDecodedMsg->setup.callingBCD;
+ if (bctMainLeg_->procType==CC_PROC_MOB_ORIG)
+ {
+ CallingPartyNumber.ie_present = true;
+ CallingPartyNumber.numberType = bctMainLeg_->msSide->cpn.numberType;
+ CallingPartyNumber.numberingPlan = bctMainLeg_->msSide->cpn.numberingPlan;
+ CallingPartyNumber.presentationInd = CNI_RIL3_PRESENTATION_ALLOWED;
+ CallingPartyNumber.screeningInd = CNI_RIL3_SCREENING_NETWORK_PROVIDED; //TBD
+ CallingPartyNumber.numDigits = bctMainLeg_->msSide->cpn.numDigits;
+ memcpy(CallingPartyNumber.digits,bctMainLeg_->msSide->cpn.digits,bctMainLeg_->msSide->cpn.numDigits);
+ }
+ else
+ CallingPartyNumber = bctMainLeg_->msSide->callingPartyNum;
+
+ }
+ }
+
+ whichLeg->setupOrig(msInDecodedMsg->header.si_ti);
+ DBG_LEAVE();
+ return(true);
+ }
+
+ //BCT <xxu:07-12-00> END
+ }
+
+ DBG_WARNING("MS->CC Warning: Late Msg. for (ti = %p) (Session Id = %d)\n",
+ msInDecodedMsg->header.si_ti,
+ parent->callIndex );
+
+ DBG_LEAVE();
+ return(false);
+}
+
+bool CCSessionHandler::routeFromMsToSmsLeg (T_CNI_RIL3_CP_HEADER& msInDecodedHdr, SmsLeg *&whichLeg)
+{
+ DBG_FUNC("CCSessionHandler::routeFromMsToSmsLeg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ unsigned newTi = msInDecodedHdr.si_ti;
+
+ if (newTi <= 7 ||
+ (newTi == smsLeg2->getTi() & TI_TERM_AND_MASK &&
+ (smsLeg1->getTi() == SMS_TI_INVALID || newTi != smsLeg1->getTi()))) //CP-ERROR correction
+ whichLeg = smsLeg2; // Transaction is originated by MS
+ else
+ whichLeg = smsLeg1;
+
+ DBG_LEAVE();
+ return (false);
+}
+
+
+void
+CCSessionHandler::cleanup (T_CNI_RIL3_CAUSE_VALUE cause, BOOL normClear)
+{
+ // This function has defaul value defined for the both parameters.
+ // T_CNI_RIL3_CAUSE_VALUE cause = CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING
+ // BOOL normClear = TRUE,
+ // should be set FALSE only when called as a result of remove ViperCell failure
+
+ BOOL isMigratedCall = FALSE;
+
+ DBG_FUNC ("CCSessionHandler::cleanup", CC_SESSION_LAYER);
+ DBG_ENTER ();
+
+ // <Igal: 04-10-01>
+ if (handoverSession != NULL)
+ {
+ isMigratedCall = handoverSession->cleanup (normClear);
+ }
+
+ if (normClear == TRUE || isMigratedCall == TRUE)
+ {
+ // Either normal call session release or migrated call release
+
+ // Otherwise, if the reason is external ViperCell failure:
+ // Incomplete HO is canceled due to failure of the target ViperCell (above).
+ // Call session continues on the current cell.
+
+ if (entryId != (T_CNI_IRT_ID) JCC_UNDEFINED )
+ {
+ IntraL3Msg_t mmOutMsg ;
+ T_CNI_IRT_ID tempEntryId = entryId;
+
+ // Send internal MM msg - no data needed
+ sendMM(INTRA_L3_MM_REL_REQ, INTRA_L3_NULL_MSG, entryId, &mmOutMsg);
+
+ resetIrt ();
+
+ // do not set entryId to null here.
+ // It might be used below in one of the components
+ }
+ callLeg1->cleanup (cause);
+ callLeg2->cleanup (cause);
+
+ //ext-HO <xxu:06-07-01>
+ hoCallLeg->cleanup (cause);
+ h3CallLeg->cleanup (cause);
+
+ cissCallLeg->cleanup (cause);
+
+ if (smsLeg1)
+ smsLeg1->cleanup (cause);
+ if (smsLeg2)
+ smsLeg2->cleanup (cause);
+ if (smsLeg3)
+ smsLeg3->cleanup (cause);
+
+ // set entryId to null here
+ entryId = (T_CNI_IRT_ID) JCC_UNDEFINED;
+ initData();
+ }
+
+ DBG_LEAVE();
+
+}
+
+int
+CCSessionHandler::handleMMMsg(IntraL3Msg_t *mmMsg)
+{
+ DBG_FUNC("CCSessionHandler::handleMMMsg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ int retVal ;
+ bool hoEvent ;
+ JCCEvent_t currEvent;
+
+ mmInMsg = mmMsg;
+
+ switch (mmInMsg->primitive_type)
+ {
+ case INTRA_L3_MM_EST_CNF:
+
+ switch (mmInMsg->message_type)
+ {
+ case INTRA_L3_RR_PAGE_RSP:
+ currEvent = CC_MM_CONNECTION_CNF;
+ hoEvent = false;
+ break;
+
+ case INTRA_L3_RR_HANDOVER_REQ_ACK:
+ currEvent = HAND_TRG_HO_REQ_ACK;
+ hoEvent = true;
+ break;
+
+ default:
+ DBG_ERROR("CC Session Error: Unexpected (Msg Type = %d) from MM.\n",
+ mmInMsg->message_type);
+ currEvent = JCC_NULL_EVENT;
+
+ }
+ break;
+
+ case INTRA_L3_MM_EST_IND:
+ {
+ currEvent = CC_MM_CONNECTION_IND;
+ hoEvent = false;
+ }
+ break;
+
+ case INTRA_L3_MM_EST_REJ:
+ switch (mmInMsg->message_type)
+ {
+ case INTRA_L3_RR_PAGE_REQ:
+ currEvent = CC_MM_CONNECTION_REJ;
+ hoEvent = false;
+ break;
+
+ case INTRA_L3_RR_HANDOVER_REQ_NACK:
+ currEvent = HAND_TRG_HO_REQ_NACK;
+ hoEvent = true;
+ break;
+
+ default:
+ DBG_ERROR("CC Call Error: Unexpected (Msg Type = %d) from MM.\n",
+ mmInMsg->message_type);
+ currEvent = JCC_NULL_EVENT;
+
+ }
+ break;
+
+
+ case INTRA_L3_MM_REL_IND:
+ currEvent = CC_MM_CONNECTION_REL;
+ hoEvent = false;
+ break;
+
+ default:
+ DBG_ERROR("CC Call Error: Unexpected (Msg Primitive = %d) from MM.\n",
+ mmInMsg->primitive_type);
+ currEvent = JCC_NULL_EVENT;
+
+ }
+
+ // For call events:
+ if (currEvent != JCC_NULL_EVENT)
+ {
+ // For Handover events:
+ if (hoEvent)
+ {
+ if (handoverSession != NULL)
+ {
+ int causeValue;
+
+ if (handoverSession == anchorHandoverSession)
+ {
+ causeValue = anchorHandoverSession->handleMMMsg(mmMsg, currEvent);
+ }
+
+ //ext-HO <xxu:06-08-01>
+ else if (handoverSession == targetHandoverSession)
+ {
+ causeValue = targetHandoverSession->handleMMMsg(mmMsg, currEvent);
+
+ } else if (handoverSession == targetHandoverSessionExtHo)
+ {
+ causeValue = targetHandoverSessionExtHo->handleMMMsg(mmMsg, currEvent);
+ } else
+ {
+ DBG_ERROR("{\nMNEThoERROR(cs::handleMMMsg): invalid handoverSession (hoSession=%p, anchSession=%p, trgSession=%p, trgSessionExtHo=%p)\n}\n",
+ handoverSession, anchorHandoverSession, targetHandoverSession, targetHandoverSessionExtHo);
+ causeValue = -1;
+ }
+
+
+
+ if (causeValue != 0)
+ {
+ retVal = smHandleEvent(CC_RELEASE_CALL)
+
+ DBG_LEAVE();
+ return (retVal);
+ }
+ else
+ {
+ DBG_LEAVE();
+ return (0);
+ }
+ }
+
+ if (currEvent == HAND_TRG_HO_REQ_ACK)
+ {
+ // handle the case where a late establish confirm comes in
+ // for a handover request that was previously sent.
+ IntraL3Msg_t mmOutMsg;
+ sendMM (INTRA_L3_MM_REL_REQ,
+ INTRA_L3_NULL_MSG ,
+ mmMsg->entry_id ,
+ &mmOutMsg );
+ }
+ else
+ {
+ DBG_WARNING("CC Call Warning: Late Handover Msg? (MM Event=%d), (session id=%d).\n",
+ currEvent,
+ parent->callIndex);
+ }
+
+ DBG_LEAVE();
+ return (0);
+ }
+
+ else
+ { // non-handover events MM handling
+ int causeValue;
+
+ if (handoverSession == targetHandoverSession &&
+ currEvent == CC_MM_CONNECTION_IND )
+ {
+ /* Forwarding MM-EST Ind to the anchor side */
+
+ DBG_TRACE ("CM Session: Forward secondary MM-EST Ind to the anchor.\n");
+
+ sendMMMsg (mmMsg);
+ retVal = 0;
+
+ //ext-HO <xxu:07-01-01>
+ } else if ((handoverSession == targetHandoverSessionExtHo) &&
+ (currEvent == CC_MM_CONNECTION_IND ))
+ {
+ causeValue = targetHandoverSessionExtHo->handleMMMsg(mmMsg, currEvent);
+ if (causeValue)
+ retVal = smHandleEvent(CC_RELEASE_CALL);
+ }
+
+ else
+ retVal = smHandleEvent (currEvent);
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+ }
+
+ DBG_LEAVE();
+ return (0);
+}
+
+int
+CCSessionHandler::handleRRMsg(IntraL3Msg_t *rrMsg)
+{
+ DBG_FUNC("CCSessionHandler::handleRRMsg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ bool hoEvent;
+ JCCEvent_t currEvent;
+
+ rrInMsg = rrMsg;
+
+ switch (rrInMsg->message_type)
+ {
+ case INTRA_L3_RR_CHANN_ASSIGN_COM:
+ currEvent = CC_RESOURCE_ASSIGN_COMPLT;
+ hoEvent = false;
+ break;
+
+ case INTRA_L3_RR_CHANN_ASSIGN_FAIL:
+ currEvent = CC_RESOURCE_ASSIGN_FAIL;
+ hoEvent = false;
+ break;
+
+ case INTRA_L3_RR_HANDOVER_REQUIRED:
+ currEvent = JCC_NULL_EVENT;
+
+ if (handoverSession == NULL)
+ {
+ // Ignore any Handover Required messages in anchor, if they need to be blocked.
+ if (!isHandoverAllowed())
+ {
+ break;
+ }
+
+ handoverSession = anchorHandoverSession;
+
+ //SAPI=3 connection is local. Reset the flag
+ resetSapi3 ();
+ }
+
+ DBG_TRACE("CC->Handover Info: received Intra L3 RR Handover Required message\n");
+ //printData(JCCPrintf);
+ currEvent = HAND_SRC_HO_REQD;
+ hoEvent = true;
+ break;
+
+ case INTRA_L3_RR_HANDOVER_COMPLETE:
+ currEvent = HAND_TRG_HO_COMPLT;
+ hoEvent = true;
+ break;
+
+ //ext-HO <xxu:06-08-01>
+ case INTRA_L3_RR_HANDOVER_ACCESS:
+ currEvent = HAND_HO_ACCESS;
+ hoEvent = true;
+ break;
+
+
+ case INTRA_L3_RR_HANDOVER_FAILURE:
+ currEvent = HAND_SRC_HO_FAIL;
+ PM_CCMeasurement.unsuccExternHDOsWithReconnectionPerMSC.increment();
+ hoEvent = true;
+ break;
+
+ default:
+ DBG_ERROR("CC Call Error: Unexpected (Msg Type = %d) from RR.\n",
+ rrInMsg->message_type);
+ currEvent = JCC_NULL_EVENT;
+
+ }
+
+ // For Channel States:
+ if (currEvent != JCC_NULL_EVENT)
+ {
+ // For Handover States:
+ if (hoEvent)
+ {
+ if (handoverSession != NULL)
+ {
+ int causeValue;
+
+ if (handoverSession == anchorHandoverSession)
+ {
+ causeValue = anchorHandoverSession->handleRRMsg(rrMsg, currEvent);
+ }
+ //ext-HO <xxu:06-08-01>
+ else if (handoverSession == targetHandoverSession)
+ {
+ causeValue = targetHandoverSession->handleRRMsg(rrMsg, currEvent);
+
+ } else if (handoverSession == targetHandoverSessionExtHo)
+ {
+ causeValue = targetHandoverSessionExtHo->handleRRMsg(rrMsg, currEvent);
+ } else
+ {
+ DBG_ERROR("{\nMNEThoERROR(cs::handleRRMsg): invalid handoverSession (hoSession=%p, anchSession=%p, trgSession=%p, trgSessionExtHo=%p)\n}\n",
+ handoverSession, anchorHandoverSession, targetHandoverSession, targetHandoverSessionExtHo);
+ causeValue = -1;
+ }
+
+ if (causeValue != 0)
+ {
+ DBG_LEAVE();
+ return(smHandleEvent(CC_RELEASE_CALL));
+ }
+ else
+ {
+ DBG_LEAVE();
+ return (0);
+ }
+
+ }
+
+ DBG_WARNING("CC Call Warning: Late Handover Msg? (RR Event=%d), (session id=%d).\n",
+ currEvent,
+ parent->callIndex);
+
+ DBG_LEAVE();
+ return(0);
+
+ }
+ else
+ {
+ // non-handover events
+ int causeValue;
+
+ TwoPartyCallLeg *whichLeg;
+
+ if (handoverSession == targetHandoverSession)
+ {
+ // handover on target side.
+ targetHandoverSession->sendRRMsgToAnchorCC(rrMsg);
+ DBG_LEAVE();
+ return(0);
+ }
+
+ switch (rrInMsg->primitive_type)
+ {
+ case 1:
+ whichLeg = callLeg1;
+ break;
+
+ case 2:
+ whichLeg = callLeg2;
+ break;
+
+ default:
+ DBG_ERROR("RR->CC ERROR: Unexpected (Call Leg Num=%d) from RR , (event=%d) (session id=%d)\n",
+ rrInMsg->primitive_type,
+ currEvent,
+ parent->callIndex);
+ DBG_LEAVE();
+ return(0);
+ }
+
+ if ((!(whichLeg->idle)) && (whichLeg->msSide != NULL))
+ {
+ if ((causeValue = whichLeg->msSide->handleRRMsg(rrMsg, currEvent)) != 0)
+ {
+ handleReleaseCallLeg(whichLeg);
+ DBG_LEAVE();
+ return(causeValue);
+ }
+ }
+ else
+ {
+ // late event
+ DBG_WARNING("RR->CC Warning: Unexpected/Late RR event for (call leg Num=%d), (event=%d) (session id=%d)\n",
+ rrInMsg->primitive_type,
+ currEvent,
+ parent->callIndex);
+ }
+ }
+ }
+ else
+ {
+ }
+
+ //Do Nothing
+ DBG_LEAVE();
+ return(0);
+}
+
+int
+CCSessionHandler::handleTimeoutMsg(IntraL3Msg_t *ccInMsg)
+{
+ DBG_FUNC("CCSessionHandler::handleTimeoutMsg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ CallLeg *whichLeg;
+ // We already know that it is a timeout msg
+
+ switch (ccInMsg->entry_id)
+ {
+ case 0:
+ whichLeg = cissCallLeg;
+ break;
+
+ case 1:
+ whichLeg = callLeg1;
+ break;
+
+ case 2:
+ whichLeg = callLeg2;
+ break;
+
+ case 3:
+ whichLeg = NULL;
+ break;
+
+ case 4:
+ whichLeg = smsLeg1;
+ break;
+
+ case 5:
+ whichLeg = smsLeg2;
+ break;
+
+ case 6:
+ whichLeg = smsLeg3;
+ break;
+
+ case 7:
+ whichLeg = hoCallLeg;
+ break;
+
+ case 8:
+ whichLeg = h3CallLeg;
+ break;
+
+ default:
+ DBG_ERROR("CC Error: Invalid Timeout (call leg number=%d)\n",
+ ccInMsg->entry_id);
+ DBG_LEAVE();
+ return(0);
+ }
+
+ int causeValue;
+
+ if (whichLeg != NULL)
+ {
+ // Not Session related
+ if (whichLeg->idle == false)
+ {
+ if ((causeValue = whichLeg->handleTimeoutMsg(ccInMsg)) != 0)
+ {
+ handleReleaseCallLeg(whichLeg);
+ DBG_LEAVE();
+
+ return(causeValue);
+ }
+ else
+ {
+ DBG_LEAVE();
+ return(0);
+
+ }
+ }
+
+ // late event
+ DBG_WARNING("CC Warning: Unexpected/Late Timeout event for (call leg=%d), (session id=%d)\n",
+ ccInMsg->entry_id,
+ parent->callIndex);
+ }
+ else
+ {
+ if (handoverSession != NULL)
+ {
+ int causeValue = 0; //ext-HO <xxu:06-07-01>
+
+ if (handoverSession == anchorHandoverSession)
+ {
+ causeValue = anchorHandoverSession->handleTimeoutMsg(ccInMsg);
+ }
+ else if (handoverSession == targetHandoverSession)
+ {
+ causeValue = targetHandoverSession->handleTimeoutMsg(ccInMsg);
+
+ } //ext-HO <xxu:06-07-01>
+ else if (handoverSession == targetHandoverSessionExtHo)
+ {
+ causeValue = targetHandoverSessionExtHo->handleTimeoutMsg(ccInMsg);
+ } else
+ {
+ DBG_ERROR("CC Error: No handover session is linked to the fired session timer (callId=%d)\n",
+ parent->callIndex);
+ }
+
+ if (causeValue != 0)
+ {
+ DBG_LEAVE();
+ return(smHandleEvent(CC_RELEASE_CALL));
+ }
+ else
+ {
+ DBG_LEAVE();
+ return (0);
+ }
+ }
+ // Call Hold feature goes here
+ }
+
+ DBG_LEAVE();
+ return(0);
+}
+
+//ext-HO <xxu:05-16-01>
+int
+CCSessionHandler::handleHoaCcMsg (InterHoaVcMsg_t *ccInMsg)
+{
+ int causeValue = 0;
+
+ DBG_FUNC("CCSessionHandler::handleHoaCcMsg", CC_HO_LAYER);
+ DBG_ENTER();
+
+ if (handoverSession != NULL)
+ {
+ if (handoverSession == targetHandoverSessionExtHo)
+ {
+ causeValue = targetHandoverSessionExtHo->handleHoaCcMsg(ccInMsg);
+
+ } else if (handoverSession == anchorHandoverSession)
+ {
+ causeValue = anchorHandoverSession->handleHoaCcMsg(ccInMsg);
+ }
+ else
+ {
+ DBG_WARNING("{\nMNEThoWARNING(cs::handleHoaCcMsg): late ho msg from HOA (msgType=%d,callId=%d)\n}\n",
+ ccInMsg->msgType, parent->callIndex);
+ }
+
+ } else
+ {
+ DBG_WARNING("{\nMNEThoTRACE(cs::handleHoaCcMsg): late msg from HOA (msgType=%d,callId=%d,cause=%d)\n}\n",
+ ccInMsg->msgType, parent->callIndex);
+ }
+
+ if (causeValue != 0)
+ {
+ DBG_WARNING("{\nMNEThoWARNING(cs::handleHoaCcMsg):(cause=%d,msgType=%d,callId=%d)......\n}\n",
+ causeValue, ccInMsg->msgType, parent->callIndex);
+
+ cleanup();
+ //cleanup((T_CNI_RIL3_CAUSE_VALUE)causeValue,true);
+ }
+
+
+ DBG_LEAVE();
+
+ return (0);
+}
+
+int
+CCSessionHandler::handleVcCcMsg (InterVcMsg_t *vcCcInMsg)
+{
+ DBG_FUNC("CCSessionHandler::handleVcCcMsg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ if (handoverSession != NULL)
+ {
+ int causeValue = 0;
+
+ if (handoverSession == anchorHandoverSession)
+ {
+ causeValue = anchorHandoverSession->handleVcCcMsg(vcCcInMsg);
+ }
+ //ext-HO <xxu:05-17-01> BEGIN
+ else if (handoverSession == targetHandoverSessionExtHo)
+ {
+ //This is only expected for post-handin scenario and this GP10 functions as anchor for the remote GP10 and
+ //as target for the PLMN anchor MSC.
+
+ DBG_TRACEei("{\nMNETeiTRACE(cs::handleVcCcMsg): recv a message from another GP (msgType=%d, callId=%d):\n",
+ vcCcInMsg->msgType, parent->callIndex);
+ DBG_TRACEei(" : origGP(IPAddr=%x, subId=%d) DestGP(IPAddr=%x,subId=%d)\n}\n",
+ vcCcInMsg->origVcAddress, vcCcInMsg->origSubId,
+ vcCcInMsg->destVcAddress, vcCcInMsg->destSubId );
+
+ causeValue = targetHandoverSessionExtHo->handleVcCcMsg(vcCcInMsg);
+
+ } //ext-HO <xxu:05-17-01> END
+ else
+ { // <Igal 1-6-00> Updated for handling PDUs forwarded between ViperCells after HO
+ if (vcCcInMsg->msgType == INTER_VC_CC_POST_HANDOVER_DATA_EVENT)
+ { // PDU forwarded from anchor side CM to target LAPDm via CM Session
+ sendL2Msg (&vcCcInMsg->msgData.postHoMobEventData.msEncodedMsg);
+ causeValue = 0;
+ }
+ else
+ causeValue = targetHandoverSession->handleVcCcMsg(vcCcInMsg);
+ }
+
+ if (causeValue != 0)
+ {
+ DBG_LEAVE();
+ return (smHandleEvent(CC_RELEASE_CALL));
+ }
+ else
+ {
+ DBG_LEAVE();
+ return (0);
+ }
+ }
+
+ DBG_WARNING ("CC Call Warning: Late Handover Msg from other ViperCell, (session id=%d).\n",
+ parent->callIndex);
+
+ DBG_LEAVE();
+ return (0);
+}
+
+
+int
+CCSessionHandler::handleVbCissMsg(CISSVblinkMsg_t &cissInMsg)
+{
+ DBG_FUNC("CCSessionHandler::handleVbCissMsg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ if (!cissCallLeg->idle)
+ {
+ int causeValue;
+ if ((causeValue = cissCallLeg->handleVbMsg(cissInMsg)) != 0)
+ {
+ handleReleaseCallLeg(cissCallLeg);
+ DBG_LEAVE();
+ return(causeValue);
+ }
+ else
+ {
+ DBG_LEAVE();
+ return(0);
+ }
+ }
+
+ // late event
+ DBG_WARNING("MS->CC Warning: Unexpected/Late MS CISS event for (session id=%d)\n",
+ parent->callIndex);
+ DBG_LEAVE();
+ return(0);
+}
+
+//CH<xxu:11-22-99>
+int
+CCSessionHandler::handleMobHoldRetvReq(JCCEvent_t& event, TwoPartyCallLeg* leg)
+{
+ TwoPartyCallLeg *otherLeg;
+
+ DBG_FUNC("handleMobHoldRetvReq", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ //CDR <xxu:08-21-00> BEGIN
+ CCdrSSA chCdr;
+ if ( ludbGetSubscInfoExists(ludbIndex) && !isEmergencyCall && leg != NULL)
+ {
+ chCdr.setServedIMSI(ludbGetMobileIdPtr(ludbIndex));
+ chCdr.setServedMSISDN(ludbGetMSISDNPtr(ludbIndex));
+ chCdr.setCorrelatedEventRefNumber(leg->ccCdr.getEventRefNumber());
+ }
+ //CDR <xxu:08-21-00> END
+
+ //Check if HOLD service provisioned or not
+ if ( !ludbIsProvHOLD(this->ludbIndex) ||
+ isEmergencyCall ) // Override features for emergency call
+ {
+ //HOLD service is not provisioned, send back HOLD REJ msg
+ DBG_WARNING("Hold service not provisioned for (%d, %d)\n",
+ this->ludbIndex,event);
+ if (event==HC_EXTNL_HOLD_REQ)
+ {
+ event = HC_LOCAL_HOLD_REJ;
+ leg->msSide->chCause_ = CNI_RIL3_CAUSE_REQUESTED_SERVICE_NOT_SUBSCRIBED;
+
+ //CDR <xxu:08-21-00> BEGIN
+ if (!isEmergencyCall)
+ chCdr.generateRecord( CDR_SS_ACTION_INVOCATION,
+ (unsigned char)SUPP_SERV_HOLD,
+ CNI_RIL3_CAUSE_REQUESTED_SERVICE_NOT_SUBSCRIBED );
+ //CDR <xxu:08-21-00> END
+
+ DBG_LEAVE();
+ return (0);
+ }
+ //Retrieval of a held call is always allowed, go retrieve!
+ }
+
+ //HOLD service is provisioned and go ahead
+ if (leg==callLeg1) otherLeg=callLeg2;
+ else if (leg==callLeg2) otherLeg=callLeg1;
+ else
+ {
+ DBG_ERROR("Internal logic messed up: got invalid callLeg (%d,%d,%d)\n",
+ this->entryId, parent->callIndex, leg);
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ //Hold/Retv Ev
+ switch ( event )
+ {
+ case HC_EXTNL_HOLD_REQ:
+ //Check if only one call now
+ if (otherLeg->msSide == NULL)
+ {
+ //Only one call existing now
+ if (leg->msSide->callState_==HC_ST_ACTIVE &&
+ leg->msSide->chState_==CH_ST_IDLE )
+ {
+ //this one call is qualified for being held
+ event = HC_LOCAL_HOLD_ACT;
+
+ //CDR <xxu:08-21-00>
+ chCdr.generateRecord( CDR_SS_ACTION_INVOCATION,
+ (unsigned char)SUPP_SERV_HOLD,
+ CNI_RIL3_CAUSE_SUCCESS);
+ DBG_LEAVE();
+ return (0);
+ } else
+ {
+ //this one call is not qualified for being held
+ event = HC_LOCAL_HOLD_REJ;
+ leg->msSide->chCause_ = CNI_RIL3_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE;
+
+ //CDR <xxu:08-21-00>
+ chCdr.generateRecord( CDR_SS_ACTION_INVOCATION,
+ (unsigned char)SUPP_SERV_HOLD,
+ CNI_RIL3_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE);
+
+ DBG_LEAVE();
+ return (0);
+ }
+ }
+
+ //Sanitory check: make sure that CALL HOLD timer should not be running!
+ if (leg->msSide->hcTimer->timerSet_ || // Need to change the usage of timers
+ (otherLeg->msSide->callState_== HC_ST_ACTIVE &&
+ otherLeg->msSide->hcTimer->timerSet_)) // other services may also need it
+ {
+ //Received two HOLD REQ messages in a row, log and reject this 2nd!
+ DBG_WARNING("Received two HOLD REQs in a row, curSession(%d,%d)\n",
+ this->entryId,parent->callIndex);
+ event = HC_LOCAL_HOLD_REJ;
+ leg->msSide->chCause_ = CNI_RIL3_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE;
+
+ //CDR <xxu:08-21-00>
+ chCdr.generateRecord( CDR_SS_ACTION_INVOCATION,
+ (unsigned char)SUPP_SERV_HOLD,
+ CNI_RIL3_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE);
+
+ DBG_LEAVE();
+ return (0);
+ }
+
+ //No HOLD REQ is pending right now. Go ahead to handle it. First of all
+ //Check if this leg is staying in (active, idle), otherwise reject it.
+ if (leg->msSide->callState_ != HC_ST_ACTIVE ||
+ leg->msSide->chState_ != CH_ST_IDLE )
+ {
+ DBG_WARNING("Mobile tries HOLD a non (active,idle) call:(%d,%d)\n",
+ this->entryId, parent->callIndex);
+ event = HC_LOCAL_HOLD_REJ;
+ leg->msSide->chCause_ = CNI_RIL3_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE;
+
+ //CDR <xxu:08-22-00>
+ chCdr.generateRecord( CDR_SS_ACTION_INVOCATION,
+ (unsigned char)SUPP_SERV_HOLD,
+ CNI_RIL3_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE);
+ DBG_LEAVE();
+ return (0);
+ }
+
+ //Sanitory check: got two HolDReqs!
+ if (leg->msSide->hcTimer->timerSet_)
+ {
+ //Received two HOLD REQ messages in a row, log and reject this 2nd!
+ DBG_WARNING("Received two HOLD REQs in a row, curSession(%d,%d)\n",
+ this->entryId,parent->callIndex);
+ event = HC_LOCAL_HOLD_REJ;
+ leg->msSide->hcTimer->cancelTimer(); //doesn't make sense to keep it running!
+ leg->msSide->chCause_ = CNI_RIL3_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE;
+
+ //CDR <xxu:08-22-00>
+ chCdr.generateRecord( CDR_SS_ACTION_INVOCATION,
+ (unsigned char)SUPP_SERV_HOLD,
+ CNI_RIL3_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE);
+ DBG_LEAVE();
+ return (0);
+ }
+
+ //Current leg is qualified for HOLD,process in terms of two HOLD cases
+ if (otherLeg->msSide->callState_ == HC_ST_ACTIVE)
+ {
+ if (otherLeg->msSide->chState_ == CH_ST_HELD)
+ {
+ //SWAP case: handle HOLD part, start timer!
+ leg->msSide->hcTimer->setTimer(CALL_HOLD_RETV_TIMER);
+ event = HC_LOCAL_HOLD_REQ;
+
+ //CDR <xxu:08-22-00>
+ chCdr.generateRecord( CDR_SS_ACTION_INVOCATION,
+ (unsigned char)SUPP_SERV_HOLD,
+ CNI_RIL3_CAUSE_SUCCESS);
+ DBG_LEAVE();
+ return (0);
+ } else
+ {
+ //Kind of mess-up happened, reject and log!
+ DBG_WARNING("Mess-up occurs btw two legs in proc HOLD REQ\n");
+ event = HC_LOCAL_HOLD_REJ;
+ leg->msSide->chCause_ = CNI_RIL3_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE;
+
+ //CDR <xxu:08-22-00>
+ chCdr.generateRecord( CDR_SS_ACTION_INVOCATION,
+ (unsigned char)SUPP_SERV_HOLD,
+ CNI_RIL3_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE);
+ DBG_LEAVE();
+ return (0);
+ }
+ } else
+ {
+ //the other leg is not active, go ahead to HOLD the cur leg
+ event = HC_LOCAL_HOLD_ACT;
+
+ //CDR <xxu:08-22-00>
+ chCdr.generateRecord( CDR_SS_ACTION_INVOCATION,
+ (unsigned char)SUPP_SERV_HOLD,
+ CNI_RIL3_CAUSE_SUCCESS);
+ DBG_LEAVE();
+ return (0);
+ }
+
+ break;
+
+ case HC_EXTNL_RETV_REQ:
+ //Check if only one call now
+ if (otherLeg->msSide == NULL)
+ {
+ //Only one call existing now
+ if (leg->msSide->callState_==HC_ST_ACTIVE &&
+ leg->msSide->chState_==CH_ST_HELD )
+ {
+ //this one call is qualified for being retved
+ //CH<xxu:Mod 12-13-99>
+ //event = HC_LOCAL_RETV_ACT;
+ event = HC_LOCAL_RETV_REQ;
+ DBG_LEAVE();
+ return (0);
+ } else
+ {
+ //this one call is not qualified for being held
+ event = HC_LOCAL_RETV_REJ;
+ leg->msSide->chCause_ = CNI_RIL3_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE;
+ DBG_LEAVE();
+ return (0);
+ }
+ }
+
+ //If the leg is not on hold, log and reject this message. Sort of messed-up!
+ if (leg->msSide->callState_!=HC_ST_ACTIVE||leg->msSide->chState_!=CH_ST_HELD)
+ {
+ DBG_WARNING("RETRIEVE a non-(active, held) call (%d,%d), messed up!\n",
+ this->entryId, parent->callIndex);
+ event = HC_LOCAL_RETV_REJ;
+ leg->msSide->chCause_ = CNI_RIL3_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE;
+ DBG_LEAVE();
+ return (0);
+ }
+
+ //If the otherLeg is in (active, holdReq) and call hold is running, do swap!
+ if (otherLeg->msSide->callState_ == HC_ST_ACTIVE)
+ {
+ if (otherLeg->msSide->chState_ == CH_ST_HREQ)
+ {
+ //Do SWAP now: send the HREQ leg to HELD and pull back the HELD active!
+ otherLeg->msSide->hcTimer->cancelTimer();
+ otherLeg->msSide->handleHoldAct();
+ //CH<xxu:Mod 12-13-99>
+ //event = HC_LOCAL_RETV_ACT;
+ event = HC_LOCAL_RETV_REQ;
+
+ DBG_LEAVE();
+ return (0);
+ } else
+ {
+ //Kind of mess-up happened, reject and log!
+ DBG_WARNING("Mess-up occurs btw two legs in proc RETV REQ\n");
+ event = HC_LOCAL_RETV_REJ;
+ leg->msSide->chCause_ = CNI_RIL3_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE;
+ DBG_LEAVE();
+ return (0);
+ }
+ } else
+ {
+ //the other leg is not active, go ahead to RETV the cur leg
+ //CH<xxu:Mod 12-13-99>
+ //event = HC_LOCAL_RETV_ACT;
+ event = HC_LOCAL_RETV_REQ;
+ DBG_LEAVE();
+ return (0);
+ }
+
+ break;
+
+ default:
+ //Sanitory check, may be removed in the future
+ DBG_ERROR("Logic messed up! Got non HOLD/RETRIEVE event\n");
+ break;
+ }
+
+ event = CC_MESSAGE_PROCESSING_COMPLT;
+ DBG_LEAVE();
+ return (0);
+}
+
+int
+CCSessionHandler::handleMobMsg(T_CNI_RIL3MD_CCMM_MSG *msInMsg)
+// This function handles not only the MS PDUs but local DL management messages as well
+{
+ JCCEvent_t currEvent ;
+ CallLeg *whichLeg = NULL_PTR;
+ int retVal = 0 ;
+
+ T_CNI_RIL3_PROTOCOL_DISCRIMINATOR msgPd ;
+ T_CNI_LAPDM_L2L3PrimitiveType l2MsgType = msInMsg->primitive_type;
+
+ DBG_FUNC ("CCSessionHandler::handleMobMsg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ if (l2MsgType == L23PT_DL_DATA_IND || l2MsgType == L23PT_DL_UDATA_IND)
+ {
+ if (handoverSession == targetHandoverSession)
+ { // handover on target side
+ targetHandoverSession->sendMSMsgToAnchorCC(msInMsg);
+ DBG_LEAVE();
+ return (0);
+ }
+
+ //ext-HO <xxu:05-31-01>
+ if (handoverSession == targetHandoverSessionExtHo)
+ {
+ targetHandoverSessionExtHo->sendMSMsgToAnchorCC(msInMsg);
+ DBG_LEAVE();
+ return (0);
+ }
+
+ msgPd = extractPd (&msInMsg->l3_data);
+
+ switch (msgPd)
+ {
+ case CNI_RIL3_PD_NON_CALL_RELATED_SS: // CISS message
+
+ if (msInMsg->l3_data.msgLength < 2)
+ { // Msg is too short. Discard it
+ retVal = 0;
+ }
+ else
+ {
+ whichLeg = cissCallLeg;
+ retVal = cissCallLeg->handleMsMsg (msInMsg);
+ }
+ break;
+
+ case CNI_RIL3_PD_SMS : // SMS message
+
+ if ((currEvent = ma->mapToSmsEvent(msInMsg)) != JCC_NULL_EVENT)
+ {
+ routeFromMsToSmsLeg (ma->msDecodedSmsMsg.header, (SmsLeg *&)whichLeg);
+
+ retVal = ((SmsLeg *)whichLeg)->handleMsMsg (ma->msDecodedSmsMsg, currEvent);
+ }
+ else
+ { // garbage Message received from MS will be discarded without reaction
+ retVal = 0;
+ }
+ break;
+
+ case CNI_RIL3_PD_CC : // CC message
+
+ currEvent = ma->mapToCcEvent (msInMsg);
+
+ if (routeFromMsToCallLeg (&ma->msDecodedMsg, (TwoPartyCallLeg *&)whichLeg))
+ {
+ //CH<xxu:11-22-99>: convert to the two events to internal events
+ if (currEvent==HC_EXTNL_HOLD_REQ || currEvent==HC_EXTNL_RETV_REQ)
+ {
+ //Got a Hold or Retv msg for 1 of 2 legs
+ handleMobHoldRetvReq(currEvent, (TwoPartyCallLeg *)whichLeg);
+ }
+
+ retVal = ((TwoPartyCallLeg *)whichLeg)->msSide->handleMobMsg (&ma->msDecodedMsg ,
+ ma->msDecodeResult,
+ ma->causeValue ,
+ currEvent );
+ }
+ else
+ {
+ // late event
+ // Warning messages printed in the routing method above.
+ }
+ break;
+
+ default:
+ DBG_ERROR ("CC Session error: Message with unknown PD = %d\n", msgPd);
+ retVal = 0;
+ break;
+ }
+ }
+ else if (msInMsg->sapi == SAPI_SMS &&
+ (l2MsgType == L23PT_DL_EST_CONF || l2MsgType == L23PT_DL_EST_IND) )
+ { // SAPI3 (SMS) connection management messages (setup)
+
+ // SAPI3 connection is created and stays valid until MM connection is released
+ setSapi3 (); // SAPI3 connection is established
+
+ flashSapi3Queue ();
+
+ // SAPI=3 connection is handled by the Session Handler and
+ // will not be forwarded to the Leg level
+ }
+ else if (msInMsg->sapi == SAPI_SMS &&
+ (l2MsgType == L23PT_DL_REL_IND || l2MsgType == L23PT_MDL_ERROR) )
+ {
+ // SAPI3 (SMS) connection management messages (release)
+ // Properly release all the active SMS connections
+
+ currEvent = SMS_EVENT_MD_ERROR_IND;
+
+ if (handoverSession == targetHandoverSession)
+ { // handover on target side
+ targetHandoverSession->sendMSMsgToAnchorCC(msInMsg);
+ DBG_LEAVE();
+ return (0);
+ }
+ else
+ {
+ resetSapi3 (); // Unconditional clear SAPI=3 flag and
+ sapi3Queue_.reset(); // clean the queue
+
+ // Notify SMS legs about connection failure
+ if (!smsLeg1->isIdle())
+ {
+ smsLeg1->handleL2Msg (*msInMsg, currEvent);
+ handleReleaseCallLeg (smsLeg1);
+ }
+
+ if (!smsLeg2->isIdle())
+ {
+ smsLeg2->handleL2Msg (*msInMsg, currEvent);
+ handleReleaseCallLeg (smsLeg2);
+ }
+
+ if (!smsLeg3->isIdle())
+ {
+ smsLeg3->handleL2Msg (*msInMsg, currEvent);
+ handleReleaseCallLeg (smsLeg3);
+ }
+ }
+
+ DBG_LEAVE ();
+ return (1); // have to do this because more than one SMS leg could be released
+ }
+ else
+ {
+ DBG_ERROR ("CM Session: Unexpected Msg received from MD (L2 type = %d)\n", l2MsgType);
+ retVal = 0;
+ }
+
+ if (retVal != 0)
+ {
+ handleReleaseCallLeg (whichLeg);
+ }
+
+ DBG_LEAVE ();
+ return (retVal);
+}
+
+
+int
+CCSessionHandler::smHandleEvent(JCCEvent_t currEvent)
+{
+ DBG_FUNC("CCSessionHandler::smHandleEvent", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ JCCEvent_t resultEvent;
+
+ switch (currEvent)
+ {
+ case CC_MM_CONNECTION_CNF:
+ resultEvent = handleMMEstCnf();
+ break;
+
+ case CC_MM_CONNECTION_REL:
+ resultEvent = handleMMRelInd();
+ break;
+
+ case CC_MM_CONNECTION_REJ:
+ case CC_RELEASE_CALL:
+ case JCC_NULL_EVENT:
+ resultEvent = currEvent;
+ break;
+
+ case CC_MM_CONNECTION_IND:
+ // Igal: Take care of the new SMS Serv Req during a call or
+ // concatinated MO SMS-PP
+ resultEvent = handleMMEstInd();
+ break;
+
+ default:
+ // Should not come here
+ resultEvent = JCC_NULL_EVENT;
+ DBG_ERROR("CC Session error : Invalid event in smHandleEvent(%d)\n", currEvent);
+
+ }
+
+ switch (resultEvent)
+ {
+ case CC_MM_CONNECTION_CNF:
+ case CC_MM_CONNECTION_REJ:
+ { /* Response to the MM connection Esteblish request.
+ Requesting Leg is stored and canbe accessed using getMmTermSetupLeg() */
+ int causeValue = 0;
+ CallLeg * tempLeg = getMmTermSetupLeg ();
+
+ if (tempLeg == smsLeg1 && !smsLeg1->isIdle())
+ { // This is SMS initiated setup and it's still active
+ if (causeValue = smsLeg1->handleMmMsg (*mmInMsg, resultEvent))
+ {
+ handleReleaseCallLeg (smsLeg1);
+ DBG_LEAVE();
+ return (causeValue);
+ }
+ // Allows another CM level MT SETUP when MM connection setup is complete
+ resetMmTermSetup ();
+ }
+ else if (tempLeg == callLeg1 && ((!(callLeg1->idle)) && (callLeg1->msSide != NULL_PTR)))
+ { // This is a response for MM-EST Req (Page Request) for MT voice or data call
+ if ((causeValue = callLeg1->msSide->handleMMMsg(mmInMsg, resultEvent)) != 0)
+ {
+ handleReleaseCallLeg (callLeg1);
+ DBG_LEAVE();
+ return (causeValue);
+ }
+ // Allows another CM level MT SETUP when MM connection setup is complete
+ resetMmTermSetup ();
+ }
+ else
+ { // late event
+ int legNum = (!tempLeg) ? (-1) : tempLeg->callLegNum;
+
+ DBG_WARNING ("MM->CC Warning: Unexpected/Late MM Est Response event for leg %d,\
+ (event=%d) (session id=%d)\n",
+ legNum, resultEvent, parent->callIndex);
+ }
+ }
+ break;
+
+ case CC_MM_CONNECTION_IND:
+ {
+ if (isMmConnected()) // Avoiding possible race condition
+ {
+ if (smsLeg2->setupOrig() == false) // smsLeg2 is designated for MO SMS support
+ smsLeg2->cleanup((T_CNI_RIL3_CAUSE_VALUE)smsLeg2->getRemRelCause());
+ }
+ else
+ DBG_WARNING ("Unexpected late MM-EST Ind for SAPI=3 received by the CM session %d.\n",
+ parent->callIndex);
+ }
+ break;
+
+ case JCC_NULL_EVENT:
+ case CC_MESSAGE_PROCESSING_COMPLT:
+ //Do Nothing
+ break;
+
+ case CC_RELEASE_CALL:
+ cleanup(releaseCause, TRUE);
+ DBG_LEAVE();
+ return(-1);
+ break;
+
+ default:
+ // Should not come here
+ DBG_ERROR("CC Session error : Invalid event in smHandleEvent(%d)\n", currEvent);
+
+ }
+
+ DBG_LEAVE();
+ return (0);
+}
+
+
+JCCEvent_t
+CCSessionHandler::handleMMRelInd(void)
+{
+ DBG_FUNC("CCSessionHandler::handleMMRelInd", CC_SESSION_LAYER);
+ DBG_ENTER();
+ JCCEvent_t currEvent;
+
+ //CAUSE<xxu:03-21-00>
+ //releaseCause = CNI_RIL3_CAUSE_TEMPORARY_FAILURE;
+ releaseCause = mmInMsg->cause;
+
+ DBG_TRACE("CC <- MM: MmRelInd contained release cause %d\n", mmInMsg->cause);
+
+ // check for handover
+ if (handoverSession != NULL)
+ {
+ if (handoverSession == anchorHandoverSession)
+ {
+ currEvent = anchorHandoverSession->handleInternalEvent(CC_MM_CONNECTION_REL);
+ }
+ else
+ {
+ currEvent = targetHandoverSession->handleInternalEvent(CC_MM_CONNECTION_REL);
+ }
+
+ DBG_LEAVE();
+ return(currEvent);
+ }
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+}
+
+
+JCCEvent_t
+CCSessionHandler::handleMMEstCnf(void)
+{
+ DBG_FUNC("CCSessionHandler::handleMMEstCnf", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // MM uses the msg Q to echo back to the correct task.
+
+ if ((mmInMsg->l3_data.pageRsp.mobileId == ludbGetMobileId(ludbIndex)) && // for this mobile
+ (entryId == (T_CNI_IRT_ID) JCC_UNDEFINED)) // we are currently waiting for a confirm
+ {
+ // continue
+ }
+ else
+ {
+ // handle late page response from MM for a different Mobile.
+
+ IntraL3Msg_t mmOutMsg;
+
+ // Send internal MM msg for release
+ sendMM(INTRA_L3_MM_REL_REQ, INTRA_L3_NULL_MSG, mmInMsg->entry_id, &mmOutMsg);
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+
+ // !< Need to generate a transaction identifer to use
+ // For now, always use 0 - No Supplementary Services
+
+ T_CNI_L3_ID newId ;
+ T_CNI_IRT_ID newEntryId = mmInMsg->entry_id;
+ bool retVal ;
+
+ newId.msgq_id = parent->msgQId;
+ newId.sub_id = 0; // No sub id needed here
+
+ if (setIrt (newEntryId, newId) == false)
+ {
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ // Setup the entry id, oid, and sapi
+ entryId = mmInMsg->entry_id;
+
+ // Store Mobile Classmark Info <chenj:07-24-01>
+ classmark2Info = mmInMsg->l3_data.pageRsp.classmark2;
+
+ // GET OID AND SAPI
+ T_CNI_RIL3_IRT_ENTRY irtEntry;
+ irtEntry.entry_id = mmInMsg->entry_id;
+
+ if ( (CNI_RIL3_IRT_Get_Entry_by_Entry_ID(&irtEntry))
+ == false )
+ {
+ DBG_ERROR("CC Call Error : IRT Table Problem for (entry Id = %d)\n",
+ mmInMsg->entry_id);
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+ oid = irtEntry.lapdm_oid;
+ // sapi = SAPI_MAIN;
+
+ DBG_LEAVE();
+ return (CC_MM_CONNECTION_CNF);
+}
+
+
+JCCEvent_t CCSessionHandler::handleMMEstInd (void)
+{
+ JCCEvent_t event ;
+ bool result;
+ T_CNI_RIL3_CM_SERVICE_TYPE cmServType =
+ mmInMsg->l3_data.servReq.cmServiceType.serviceType;
+
+ DBG_FUNC("CCSessionHandler::handleMMEstInd", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ if (cmServType == CNI_RIL3_CM_SERVICE_TYPE_SHORT_MESSAGE_SERVICE)
+ {
+ event = CC_MM_CONNECTION_IND;
+
+ DBG_TRACE ("CC Session: Secondary MO SMS Serv. Request received.\n");
+ }
+ else
+ { // This CM Service Type is not expected
+ // Previously was blocked by the MM
+ DBG_ERROR ("CC Session Error: Unexpected MM_EST_IND, service type %d - releasing call!\n",
+ cmServType);
+ // PR CSCdv12866 <chenj:08-21-01>
+ // A 2nd MM establishment is sent to CC for the same mobile. This is an
+ // error condition and the MM/RR states need to be reset.
+ event = CC_RELEASE_CALL;
+ }
+
+ DBG_LEAVE();
+ return (event);
+}
+
+
+JCCEvent_t
+h323MapToEvent(IntraL3Msg_t* h323InMsg,
+ CCRemMsgData_t &remMsgData)
+{
+
+ DBG_FUNC("CCSessionHandler::h323MapToEvent", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ JCCEvent_t remoteEvent;
+
+ // Copy the incoming VOIP message to the remote message data structure
+ remMsgData = h323InMsg->l3_data.voipMsg;
+
+ switch (h323InMsg->message_type)
+ {
+ //<xxu:03-22-01> Handle Progress Message
+ case INTRA_L3_CC_Q931_PROGRESS:
+ remoteEvent = HC_REMOTE_CALL_PROGRESS_1;
+ break;
+
+ //BCT <xxu:09-21-00>
+ case INTRA_L3_CC_BCT_UPDATE_HANDLES:
+ remoteEvent = HC_REMOTE_BCT_UPDATE_HANDLES;
+ break;
+
+ //BCT <xxu:07-13-00> BEGIN
+ case INTRA_L3_CC_H450_BCT_STATUS:
+ remoteEvent = OHC_REMOTE_BCT_STATUS;
+ break;
+ //BCT <xxu:07-13-00> END
+
+ case INTRA_L3_CC_Q931_SETUP:
+ remoteEvent = THC_REMOTE_TERM_ADDRESS;
+ remMsgData.callOffering = h323InMsg->l3_data.setup.callOffering;
+ break;
+
+ case INTRA_L3_CC_Q931_CALL_PROC:
+ remoteEvent = HC_REMOTE_CALL_PROGRESS;
+ break;
+
+ case INTRA_L3_CC_Q931_ALERTING:
+ remoteEvent = OHC_REMOTE_ALERTING;
+ break;
+
+ case INTRA_L3_CC_Q931_CONNECT:
+ remoteEvent = OHC_REMOTE_ANSWER;
+ break;
+
+ case INTRA_L3_CC_Q931_DISCONNECT:
+ remoteEvent = HC_REMOTE_DISCONNECT_REQ;
+ break;
+
+ case INTRA_L3_CC_H245_CHANN_READY:
+ remoteEvent = HC_REMOTE_CONNECTION_CONTROL;
+ break;
+
+ case INTRA_L3_CC_H245_CHANN_SELECT:
+ remoteEvent = HC_REMOTE_CHANN_SELECT;
+ break;
+
+ case INTRA_L3_CC_RAS_IP_ADDRESS_RESPONSE:
+ remoteEvent = HC_VB_GET_VC_ADDRESS_RSP;
+ break;
+
+ //BCT <xxu:08-11-00> BEGIN
+ case INTRA_L3_CC_RAS_BCT_NUMBER_RESPONSE:
+ remoteEvent = HC_VB_GET_BCT_NUMBER_RSP;
+ break;
+ //BCT <xxu:08-11-00> END
+
+ case INTRA_L3_CC_VC_UPDATE_INFO:
+ // Check ViperCell Status
+ if (h323InMsg->l3_data.statusVCMsg.status == VC_STATUS_DOWN)
+ remoteEvent = EXT_VC_FAIL;
+ else
+ {
+ remoteEvent = JCC_NULL_EVENT;
+
+ DBG_ERROR ("CC Session Error: VOIP ViperCell update with unknown status %d.\n",
+ h323InMsg->l3_data.statusVCMsg.status);
+ }
+ break;
+
+ case INTRA_L3_SMS_MESSAGE:
+ { // SMS-PP related message
+ switch (h323InMsg->l3_data.smsVbMsg.hdr.msgType)
+ {
+ case MNSMS_EST_Req :
+ remoteEvent = SMS_EVENT_MNSMS_EST_REQ ;
+ break;
+
+ case MNSMS_DATA_Req :
+ remoteEvent = SMS_EVENT_MNSMS_DATA_REQ ;
+ break;
+
+ case MNSMS_ABORT_Req:
+ remoteEvent = SMS_EVENT_MNSMS_ABORT_REQ;
+ break;
+
+ case MNSMS_REL_Req :
+ remoteEvent = SMS_EVENT_MNSMS_REL_REQ ;
+ break;
+
+ default:
+ DBG_ERROR ("CM SESSION : Invalid SMS message (type = %d) from VOIP.\n",
+ h323InMsg->l3_data.smsVbMsg.hdr.msgType);
+ remoteEvent = SMS_EVENT_PROTOCOL_ERROR ;
+ break;
+ }
+ }
+ break;
+
+ default:
+ DBG_ERROR("CC Call Error: Unexpected (Msg Type = %d) from VOIP.\n",
+ h323InMsg->message_type);
+ remoteEvent = JCC_NULL_EVENT;
+
+ }
+
+ DBG_LEAVE();
+ return (remoteEvent);
+}
+
+int
+CCSessionHandler::handleH323Msg(IntraL3Msg_t* h323InMsg)
+{
+ DBG_FUNC("CCSessionHandler::handleH323Msg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ JCCEvent_t remoteEvent ;
+ CCRemMsgData_t remMsgData ;
+ CallLeg *leg ;
+ bool needResponse = true;
+ int causeValue = 0 ;
+
+ remoteEvent = h323MapToEvent (h323InMsg, remMsgData);
+
+ switch (remoteEvent)
+ {
+ //BCT <xxu: 08-11-00> BEGIN
+ case HC_VB_GET_BCT_NUMBER_RSP:
+ if (h323InMsg->l3_data.bctNumberResponse.rejectCause)
+ {
+ //Release BCT leg but keep the other
+ if (bctLeg_ != NULL && bctInvoke_ && bctLeg_->msSide != NULL)
+ {
+ //CDR <xxu:08-22-00> BEGIN
+ if ( ludbGetSubscInfoExists(ludbIndex) && bctMainLeg_ != NULL )
+ {
+ CCdrSSA bctCdr;
+ bctCdr.setServedIMSI(ludbGetMobileIdPtr(ludbIndex));
+ bctCdr.setServedMSISDN(ludbGetMSISDNPtr(ludbIndex));
+ bctCdr.setCorrelatedEventRefNumber(bctMainLeg_->ccCdr.getEventRefNumber());
+ bctCdr.generateRecord( CDR_SS_ACTION_INVOCATION, SUPP_SERV_ECT,
+ (T_CNI_RIL3_CAUSE_VALUE)remMsgData.basicCallInMsg.ReasonCode);
+ }
+
+ CCRemMsgData_t remMsgData;
+ remMsgData.basicCallInMsg.ReasonCode = h323InMsg->l3_data.bctNumberResponse.rejectCause;
+ bctLeg_->msSide->handleRemoteEvent(h323InMsg, HC_VB_GET_BCT_NUMBER_RSP, remMsgData);
+
+ }
+
+ } else
+ {
+ //Continue current BCT process
+ if (bctLeg_->msSide != NULL)
+ bctLeg_->msSide->hcTimer->cancelTimer();
+
+ DBG_TRACE("VBLink->CC Log(bct): Bct Num Rsp(reqSeqNo %d, rejCause %d) bctNo(%d,%d,%d,%d,%d)\n",
+ h323InMsg->l3_data.bctNumberResponse.reqSeqNumber,
+ h323InMsg->l3_data.bctNumberResponse.rejectCause,
+ h323InMsg->l3_data.bctNumberResponse.cpn.digits[0],
+ h323InMsg->l3_data.bctNumberResponse.cpn.digits[1],
+ h323InMsg->l3_data.bctNumberResponse.cpn.digits[2],
+ h323InMsg->l3_data.bctNumberResponse.cpn.digits[3],
+ h323InMsg->l3_data.bctNumberResponse.cpn.digits[4] );
+
+ if (bctMainLeg_ != NULL && bctLeg_ != NULL )
+ {
+ //Release the bct leg only
+ CCRemMsgData_t remMsgData;
+ remMsgData.basicCallInMsg.ReasonCode = CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING;
+ bctLeg_->msSide->handleRemoteEvent(h323InMsg, HC_VB_GET_BCT_NUMBER_RSP, remMsgData);
+
+ XltCalledPartyNumber = h323InMsg->l3_data.bctNumberResponse.cpn;
+ CCRemMsgData_t bctMsgData;
+ bctMsgData.callTransfer.CalledPartyNumber = h323InMsg->l3_data.bctNumberResponse.cpn;
+ bctMsgData.callTransfer.CallingPartyNumber = CallingPartyNumber;
+
+ sendH323Msg(bctMainLeg_, OHC_REMOTE_BCT_INVOKE, bctMsgData);
+ } else
+ {
+ DBG_TRACE("VBLink->CC Log(bct): BCT not going any more when received BCT Num Rsp\n");
+ }
+ }
+ break;
+ //BCT <xxu: 08-11-00> END
+
+ case HC_VB_GET_VC_ADDRESS_RSP:
+ {
+ if (handoverSession == anchorHandoverSession)
+ causeValue = anchorHandoverSession->handleVbCcMsg(h323InMsg);
+ else
+ causeValue = targetHandoverSessionExtHo->handleVbCcMsg(h323InMsg);
+ }
+ break;
+
+ case EXT_VC_FAIL:
+ {
+ DBG_TRACE("CC Session: Received external ViperCell failure notification.\n");
+
+ // Cancel handover in process to the failed cell but keep the call.
+ // Always disconnect calls already migrated to the failed remote cell
+ cleanup (CNI_RIL3_CAUSE_RESOURCES_UNAVAILABLE_UNSPECIFIED, FALSE);
+ causeValue = 0;
+ }
+ break;
+
+ case SMS_EVENT_MNSMS_REL_REQ :
+ case SMS_EVENT_MNSMS_ABORT_REQ:
+ {
+ needResponse = false;
+ }
+ case SMS_EVENT_MNSMS_EST_REQ :
+ case SMS_EVENT_MNSMS_DATA_REQ :
+ {
+ SmsLeg * whichLeg;
+
+ DBG_TRACE ("CM Session: SMS message (event = %d) received from VBLink.\n",
+ remoteEvent);
+ if (routeFromVoipToSmsLeg (h323InMsg, whichLeg))
+ {
+ causeValue = whichLeg->handleVbMsg (h323InMsg->l3_data.smsVbMsg, remoteEvent);
+ leg = whichLeg;
+ }
+ else
+ {
+ DBG_WARNING ("CM Session: Unable to forward a late message (event = %d) to SMS leg\n",
+ remoteEvent);
+ if (needResponse) // Respond with MNSMS-ERROR Ind. Otherwise, discard it
+ smsSendVbLinkRelease (ludbIndex, h323InMsg->l3_data.smsVbMsg.hdr.refNum);
+
+ causeValue = 0; // No need to release a leg
+ }
+ }
+ break;
+
+ case SMS_EVENT_PROTOCOL_ERROR :
+ { // Invalid SMS message type. Discard it
+ // Should never reach this point (the check is implemented in the unpacking method.
+ DBG_ERROR ("CM Session: Discard invalid SMS message received from VOIP.\n");
+ causeValue = 0;
+ }
+ break;
+
+ default:
+ {
+ //if (remoteEvent == THC_REMOTE_TERM_ADDRESS)
+ //{
+ TwoPartyCallLeg *whichLeg ;
+
+ if (routeFromVoipToCallLeg (h323InMsg, whichLeg))
+ {
+ //ProgressIE
+
+
+ //CDR <xxu:08-23-00>
+ whichLeg->ccCdr.setQ931Crv(h323InMsg->H323CRV);
+
+ //BCT <xxu: 07-13-00> BEGIN
+ if (bctInvoke_)
+ {
+ //Internal messup, debugging asap!
+ if (bctLeg_ == whichLeg) {
+ DBG_ERROR("H323->CC Warning: event(%d) VOIP msg(%d) for bctLeg (%p) (sessId=%d)\n",
+ remoteEvent, h323InMsg->message_type, bctLeg_, parent->callIndex);
+ return(0);
+ }
+
+ remoteEvent = HC_REMOTE_DISCONNECT_REQ;
+ switch(h323InMsg->message_type)
+ {
+ case INTRA_L3_CC_H450_BCT_STATUS:
+ {
+ //CDR <xxu:08-22-00> BEGIN
+ CCdrSSA bctCdr;
+ if (ludbGetSubscInfoExists(ludbIndex))
+ {
+ bctCdr.setServedIMSI(ludbGetMobileIdPtr(ludbIndex));
+ bctCdr.setServedMSISDN(ludbGetMSISDNPtr(ludbIndex));
+ }
+ bctCdr.setCorrelatedEventRefNumber(bctMainLeg_->ccCdr.getEventRefNumber());
+ //CDR <xxu:08-22-00> END
+
+ if (!remMsgData.basicCallInMsg.ReasonCode)
+ {
+ //CDR <xxu:08-22-00>
+ bctCdr.generateRecord( CDR_SS_ACTION_INVOCATION, SUPP_SERV_ECT,
+ CNI_RIL3_CAUSE_SUCCESS );
+
+ //BCT success, disconnect bct call first if not released yet
+ remMsgData.basicCallInMsg.ReasonCode =
+ (unsigned char) CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING;
+ if ( (bctLeg_ != NULL) && (bctLeg_->msSide != NULL) &&
+ (bctLeg_->msSide->callState_ == OHC_ST_OFFERING_CALL) )
+ bctLeg_->msSide->handleRemoteEvent(h323InMsg,remoteEvent, remMsgData);
+
+ //BCT success, disconnect the original call if it is active
+ remMsgData.basicCallInMsg.ReasonCode =
+ (unsigned char) CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING;
+ if (whichLeg->msSide->callState_ == HC_ST_ACTIVE)
+ whichLeg->msSide->handleRemoteEvent(h323InMsg,remoteEvent, remMsgData);
+
+ } else
+ {
+ //CDR <xxu:08-22-00>
+ bctCdr.generateRecord( CDR_SS_ACTION_INVOCATION, SUPP_SERV_ECT,
+ (T_CNI_RIL3_CAUSE_VALUE)remMsgData.basicCallInMsg.ReasonCode );
+
+ //BCT failed, disconnect the bct call only
+ remMsgData.basicCallInMsg.ReasonCode =
+ (unsigned char) CNI_RIL3_CAUSE_NORMAL_UNSPECIFIED;
+ if ( (bctLeg_ != NULL) && (bctLeg_->msSide != NULL) &&
+ (bctLeg_->msSide->callState_ == OHC_ST_OFFERING_CALL) )
+ bctLeg_->msSide->handleRemoteEvent(h323InMsg,remoteEvent, remMsgData);
+ }
+ }
+ break;
+
+ //Clean itself if senseing two side doing BCT at the same time
+ case INTRA_L3_CC_BCT_UPDATE_HANDLES:
+ case INTRA_L3_CC_Q931_DISCONNECT:
+ //BCT does not make any sense, disconnect first call
+ if ( (bctLeg_ != NULL ) && (bctLeg_->msSide != NULL) &&
+ (bctLeg_->msSide->callState_ == OHC_ST_OFFERING_CALL) )
+ bctLeg_->msSide->handleRemoteEvent(h323InMsg,remoteEvent, remMsgData);
+
+ //BCT does not make any sense, disconnect second call
+ if ( (whichLeg->msSide->callState_ == HC_ST_ACTIVE) )
+ whichLeg->msSide->handleRemoteEvent(h323InMsg,remoteEvent, remMsgData);
+
+ break;
+
+ default:
+ //Wrong landing from VoIP, ignore this message
+ DBG_WARNING ("H323->CC Warning: Unexpected VOIP event for (session id=%d) (ev = %d)\n",
+ parent->callIndex, h323InMsg->message_type);
+ break;
+ }
+ return (0);
+ }
+
+ //BCT <xxu: 07-13-00> END
+
+ if (whichLeg->msSide != NULL)
+ {
+ causeValue = whichLeg->msSide->handleRemoteEvent(h323InMsg,remoteEvent, remMsgData);
+ leg = whichLeg;
+ }
+ }
+ else
+ {
+ // late event
+ DBG_WARNING ("H323->CC: Unexpected/Late msg(%d) h323CallHandle(%d) sessionId(%d)\n",
+ h323InMsg->message_type,
+ h323InMsg->call_handle,
+ parent->callIndex);
+
+ //BCT <xxu:07-13-00> BEGIN
+ causeValue = 0;
+ //BCT <xxu:07-13-00> END
+
+ }
+ }
+ }
+
+ if (causeValue)
+ {
+ handleReleaseCallLeg (leg);
+ }
+
+ DBG_LEAVE();
+ return (causeValue);
+}
+
+
+//HO<xxu:01-31-00> extend to handle H3
+void
+CCSessionHandler::sendRRMsg(IntraL3PrimitiveType_t primType,
+ IntraL3MsgType_t msgType,
+ IntraL3Msg_t *rrOutMsg)
+{
+ DBG_FUNC("CCSessionHandler::sendRRMsg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // if handover is in progress, then we need to send it to the target vipercell.
+ if (handoverSession == anchorHandoverSession)
+ {
+ rrOutMsg->primitive_type = primType;
+ rrOutMsg->message_type = msgType;
+
+ if (( anchorHandoverSession->hoState_ == HAND_ST_ANCH_RCV_HO_REQ_ACK) ||
+ ( anchorHandoverSession->hoState_ == HAND_ST_ANCH_SND_HB_REQ_ACK) ||
+ ( anchorHandoverSession->hoState_ == HAND_ST_ANCH_RCV_H3_REQ_ACK) ||
+
+ // ext-HO <chenj:06-12-01>
+ // JOE: need to add handback and h3 states for external handovers
+ ( anchorHandoverSession->hoState_ == HAND_ST_ANCH_RCV_EHO_REQ_ACK) )
+ {
+ // Handover Command is sent. Queue messages
+ anchorHandoverSession->addToRRQueue(rrOutMsg);
+ DBG_LEAVE();
+ return;
+ }
+ else if(anchorHandoverSession->hoState_ == HAND_ST_ANCH_HO_COMPLT)
+ {
+ // handover on anchor side.
+ anchorHandoverSession->sendRRMsgToTargetCC(rrOutMsg);
+ DBG_LEAVE();
+ return;
+ }
+ // ext-HO <chenj:06-12-01>
+ else if(anchorHandoverSession->hoState_ == HAND_ST_ANCH_EHO_COMPLT)
+ {
+ // handover on anchor side.
+ // send message to target PLMN using POST HANDOVER MOB EVENT MAP message
+ anchorHandoverSession->sendRRMsgToTargetPLMN (rrOutMsg);
+ }
+ else
+ {
+ DBG_TRACE("sendRRMsg ERROR: incorrect hoState_(%d)\n",
+ anchorHandoverSession->hoState_);
+ }
+ }
+
+ sendRR (primType, msgType, entryId, rrOutMsg);
+ DBG_LEAVE();
+}
+
+
+void CCSessionHandler::sendMMMsg (IntraL3Msg_t *mmOutMsg)
+{
+ /* Forward MM messages between target and anchor CM */
+
+ DBG_FUNC("CCSessionHandler::sendMMMsg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ if (handoverSession == targetHandoverSession)
+ {
+ handoverSession->sendMMMsgToRemoteCC (mmOutMsg);
+ }
+
+ else if (handoverSession == anchorHandoverSession)
+ {
+ if ((anchorHandoverSession->hoState_ == HAND_ST_ANCH_RCV_HO_REQ_ACK) ||
+ (anchorHandoverSession->hoState_ == HAND_ST_ANCH_SND_HB_REQ_ACK) ||
+ (anchorHandoverSession->hoState_ == HAND_ST_ANCH_RCV_H3_REQ_ACK) ||
+
+ // ext-HO <chenj:06-12-01>
+ // JOE: need to add handback and h3 states for external handovers
+ ( anchorHandoverSession->hoState_ == HAND_ST_ANCH_RCV_EHO_REQ_ACK) )
+ {
+ // Handover Command is sent. Queue messages
+ handoverSession->mmQueue_.add (mmOutMsg);
+ }
+ else if(anchorHandoverSession->hoState_ == HAND_ST_ANCH_HO_COMPLT)
+ {
+ // handover on anchor side.
+ handoverSession->sendMMMsgToRemoteCC (mmOutMsg);
+ }
+ // ext-HO <chenj:06-12-01>
+ else if(anchorHandoverSession->hoState_ == HAND_ST_ANCH_EHO_COMPLT)
+ {
+ // handover on anchor side.
+ // send message to target PLMN using POST HANDOVER MOB EVENT MAP message
+ anchorHandoverSession->sendMMMsgToRemotePLMN (mmOutMsg);
+ }
+ else
+ {
+ DBG_TRACE("sendMMMsg ERROR: incorrect hoState_(%d)\n",
+ anchorHandoverSession->hoState_);
+ }
+ }
+
+ else
+ {
+ DBG_ERROR ("CM Session: Request to send MM message to non-existing remote CC.\n");
+ }
+
+ DBG_LEAVE();
+}
+
+
+void
+CCSessionHandler::sendDLMsg (L3L2MsgType_t msgType = L3L2_DL_EST_REQ,
+ T_CNI_LAPDM_SAPI sapi = SAPI_SMS )
+{ // currently handling only DL-EST Req (SAPI3) from SMS
+
+ DBG_FUNC ("CCSessionHandler::sendDLMsg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ T_CNI_LAPDM_OID msgOid = rm_GetOid (entryId, sapi);
+
+ if (msgType != L3L2_DL_EST_REQ || sapi != SAPI_SMS)
+ {
+ DBG_ERROR ("CM session error: Request to send unknown msg (type %d, SAPI %d) to LAPDm\n",
+ msgType, sapi);
+ }
+ else
+ {
+ // if handover is in progress, then we need to send it to the target vipercell.
+ if (handoverSession == anchorHandoverSession)
+ {
+ if ((anchorHandoverSession->hoState_ == HAND_ST_ANCH_RCV_HO_REQ_ACK) ||
+ (anchorHandoverSession->hoState_ == HAND_ST_ANCH_SND_HB_REQ_ACK) ||
+ (anchorHandoverSession->hoState_ == HAND_ST_ANCH_RCV_H3_REQ_ACK) )
+ {
+ /* Handover Command is sent. Not allowed to setup SAPI=3 connection.
+ IT will be set on the new cell */
+ DBG_WARNING (" Session Manager: Late request for SAPI=3 establishment is ignored.\n Handover is in process.\n");
+ }
+ else if(anchorHandoverSession->hoState_ >= HAND_ST_ANCH_HO_COMPLT)
+ {
+ // handover on anchor side.
+ DBG_ERROR (" Session Manager: Unexpected request for SAPI=3 establishment is ignored.\n Handover is completed.\n");
+ }
+ else
+ CNI_LAPDM_Dl_Establish_Request (msgOid, sapi, EM_NORMAL, NULL_PTR);
+ }
+ else
+ CNI_LAPDM_Dl_Establish_Request (msgOid, sapi, EM_NORMAL, NULL_PTR);
+ }
+
+ DBG_LEAVE();
+ return ;
+}
+
+
+//HO<xxu:01-31-00> extend to handle H3
+void
+CCSessionHandler::sendL2Msg (T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ DBG_FUNC ("CCSessionHandler::sendL2Msg", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // if handover is in progress, then we need to send it to the target vipercell.
+ if (handoverSession == anchorHandoverSession)
+ {
+ if ( ( anchorHandoverSession->hoState_ == HAND_ST_ANCH_RCV_HO_REQ_ACK) ||
+ ( anchorHandoverSession->hoState_ == HAND_ST_ANCH_SND_HB_REQ_ACK) ||
+ ( anchorHandoverSession->hoState_ == HAND_ST_ANCH_RCV_H3_REQ_ACK) ||
+
+ // ext-HO <chenj:06-12-01>
+ // JOE: need to add handback and h3 states for external handovers
+ ( anchorHandoverSession->hoState_ == HAND_ST_ANCH_RCV_EHO_REQ_ACK) )
+ {
+ // Handover Command is sent. Queue messages
+ anchorHandoverSession->addToDownlinkQueue(msEncodedMsg);
+ }
+ else if ((anchorHandoverSession->hoState_ >= HAND_ST_ANCH_HO_COMPLT) &&
+ (anchorHandoverSession->hoState_ <= HAND_ST_ANCH_RCV_H3_REQ_ACK) )
+ {
+ // handover on anchor side.
+ anchorHandoverSession->sendL2MsgToTargetCC (msEncodedMsg);
+ }
+ // ext-HO <chenj:06-12-01>
+ else if ( (anchorHandoverSession->hoState_ >= HAND_ST_ANCH_RCV_EHO_HB_REQ) &&
+ (anchorHandoverSession->hoState_ <= HAND_ST_ANCH_EHO_COMPLT) )
+ {
+ // handover on anchor side.
+ // send message to target PLMN using POST HANDOVER MOB EVENT MAP message
+ anchorHandoverSession->sendL2MsgToTargetPLMN (msEncodedMsg);
+ }
+ else
+ { // send PDU or if SAPI=3 is not ready establish it and queue message
+ forwardPdu (msEncodedMsg);
+ }
+ }
+ else
+ { // send PDU or if SAPI=3 is not ready establish it and queue message
+ forwardPdu (msEncodedMsg);
+ }
+
+ DBG_LEAVE();
+}
+
+
+bool CCSessionHandler::forwardPdu (T_CNI_LAPDM_L3MessageUnit *msEncodedMsg)
+{
+ DBG_FUNC ("CCSessionHandler::forwardPdu", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ bool retVal = true;
+
+ T_CNI_RIL3_PROTOCOL_DISCRIMINATOR msgPd = extractPd (msEncodedMsg);
+
+ T_CNI_LAPDM_SAPI sapi = (msgPd == CNI_RIL3_PD_SMS) ? SAPI_SMS : SAPI_MAIN;
+
+ // Retrieve oid for the channel according to SAPI from RR
+ T_CNI_LAPDM_OID msgOid;
+
+ if (sapi == SAPI_MAIN || getSapi3Status())
+ { // SAPI=0 message or SAPI=3 connection is already established
+ if ((msgOid = rm_GetOid (entryId, sapi)) == CNI_LAPDM_NULL_OID)
+ {
+ DBG_ERROR ("CM Session: Invalid OID received from RM (entryId = %d, sapi = %d)\n",
+ entryId, sapi);
+ retVal = false;
+ }
+
+ CNI_LAPDM_Dl_Data_Request (msgOid, sapi, msEncodedMsg);
+
+ PostL3SendMsLog (msgOid, sapi, msEncodedMsg);
+ }
+ else
+ {
+ // Establish SAPI=3 before sending SMS messages to LAPDm
+ sendDLMsg (L3L2_DL_EST_REQ, SAPI_SMS);
+ // Queue message till connection is established
+ sapi3Queue_.add (msEncodedMsg );
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+T_CSU_PORT_ID
+CCSessionHandler::mobileCsuPort(void)
+{
+
+ DBG_FUNC("CCSessionHandler::mobileCsuPort", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ // if handover is in progress, then we need to send it to the target vipercell.
+ if ((handoverSession == anchorHandoverSession) &&
+ ( (anchorHandoverSession->hoState_ == HAND_ST_ANCH_HO_COMPLT) ||
+ (anchorHandoverSession->hoState_ == HAND_ST_ANCH_EHO_COMPLT) ) )
+ {
+ // handover on anchor side. Get CSU port for handover.
+ DBG_LEAVE();
+ return(anchorHandoverSession->mobileCsuPort());
+ }
+ else
+ {
+ T_CSU_PORT_ID rfSourcePort;
+ rfSourcePort.portType = CSU_GSM_PORT;
+
+ rfSourcePort.portId.gsmHandler = entryId;
+
+ DBG_LEAVE();
+ return(rfSourcePort);
+ }
+
+}
+
+
+void CCSessionHandler::flashSapi3Queue ()
+{
+ sapi3Queue_.flash();
+}
+
+
+void
+sendStatusMsg(int sessionNum,
+ int callLeg)
+{
+ if ((0 <= sessionNum) &&
+ (sessionNum < CC_MAX_CC_CALLS))
+ {
+ switch (callLeg) {
+ case 1:
+ ccSession[sessionNum].sessionHandler->callLeg1->msSide->handleMobStatusEnquiry();
+ break;
+ case 2:
+ ccSession[sessionNum].sessionHandler->callLeg2->msSide->handleMobStatusEnquiry();
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+
+//BCT <xxu:09-22-00>
+bool
+CCSessionHandler::getBctArrival(void)
+{
+ if (callLeg1 != NULL)
+ {
+ if (callLeg1->bctArrival_)
+ return true;
+ }
+
+ if (callLeg2 != NULL)
+ {
+ if (callLeg2->bctArrival_)
+ return true;
+ }
+
+ return false;
+}
+
+//ext_HO <xxu:05-16-01>
+int
+CCSessionHandler::handleH323MsgExtH3(IntraL3Msg_t* h323InMsg)
+{
+ JCCEvent_t remoteEvent ;
+ CCRemMsgData_t remMsgData ;
+ int causeValue=0 ;
+
+ DBG_FUNC("CCSessionHandler::handleH323MsgExtH3", CC_EO_LAYER);
+ DBG_ENTER();
+
+ remoteEvent = h323MapToEventExtH3(h323InMsg, remMsgData);
+
+ if (h3CallLeg->msSide != NULL)
+ {
+ causeValue = h3CallLeg->msSide->handleRemoteEvent(h323InMsg, remoteEvent, remMsgData);
+ }
+
+ if (causeValue)
+ {
+ DBG_ERROR("{\nMNEThoERROR(cs::handleH323MsgExtH3): release h3CallLeg due to h3Call issue\n}\n");
+ handleReleaseCallLegExtH3(h3CallLeg);
+ }
+
+ DBG_LEAVE();
+ return causeValue;
+}
+
+//ext-HO <xxu:05-16-01>
+int
+CCSessionHandler::handleH323MsgExtHo(IntraL3Msg_t* h323InMsg)
+{
+ JCCEvent_t remoteEvent ;
+ CCRemMsgData_t remMsgData ;
+ int causeValue=0 ;
+
+ DBG_FUNC("CCSessionHandler::handleH323MsgExtHo", CC_HO_LAYER);
+ DBG_ENTER();
+
+ remoteEvent = h323MapToEventExtHo(h323InMsg, remMsgData);
+
+ if (hoCallLeg->msSide != NULL)
+ {
+ causeValue = hoCallLeg->msSide->handleRemoteEvent(h323InMsg, remoteEvent, remMsgData);
+ }
+
+ if (causeValue)
+ {
+ DBG_ERROR("{\nMNEThoERROR(cs::handleH323MsgExtHo): release hoCallLeg due to hoCall issue\n}\n");
+ handleReleaseCallLegExtHo(hoCallLeg);
+ }
+
+ DBG_LEAVE();
+ return causeValue;
+}
+
+//ext-HO <xxu:05-10-01>
+bool
+CCSessionHandler::setupTermExtHo(IntraL3Msg_t* h323InMsg)
+{
+ DBG_FUNC("CCSessionHandler::setupTermExtHo", CC_EI_LAYER);
+ DBG_ENTER();
+
+ if ( (handoverSession == NULL) || (handoverSession !=targetHandoverSessionExtHo) )
+ {
+ DBG_ERROR("{\nMNETeiERROR(cs::setupTermExtHo): no call session for hoCall SETUP (callId=%d,h323Handle=%x)\n}\n",
+ parent->callIndex, h323InMsg->call_handle);
+ return false;
+ }
+
+ //Invoke virtual function
+ hoCallLeg->setupTermExtHo(h323InMsg);
+
+ DBG_LEAVE();
+ return(true);
+}
+
+//ext-HO <xxu:05-16-01>
+JCCEvent_t
+CCSessionHandler::h323MapToEventExtHo(IntraL3Msg_t* h323InMsg,
+ CCRemMsgData_t &remMsgData)
+{
+ JCCEvent_t remoteEvent;
+
+ DBG_FUNC("CCSessionHandler::h323MapToEventExtHo", CC_HO_LAYER);
+ DBG_ENTER();
+
+ // Copy the incoming VOIP message to the remote message data structure
+ remMsgData = h323InMsg->l3_data.voipMsg;
+
+ switch (h323InMsg->message_type)
+ {
+ case INTRA_L3_CC_Q931_SETUP:
+ remoteEvent = THC_EHO_REMOTE_TERM_ADDRESS;
+ remMsgData.callOffering = h323InMsg->l3_data.setup.callOffering;
+ break;
+
+ case INTRA_L3_CC_Q931_CALL_PROC:
+ remoteEvent = OHC_EHO_REMOTE_CALL_PROGRESS;
+ break;
+
+ case INTRA_L3_CC_Q931_CONNECT:
+ remoteEvent = OHC_EHO_REMOTE_ANSWER;
+ break;
+
+ case INTRA_L3_CC_Q931_DISCONNECT:
+ remoteEvent = HC_EHO_REMOTE_DISCONNECT_REQ;
+ break;
+
+ case INTRA_L3_CC_H245_CHANN_READY:
+ remoteEvent = HC_EHO_REMOTE_CONNECTION_CONTROL;
+ break;
+
+ case INTRA_L3_CC_H245_CHANN_SELECT:
+ remoteEvent = HC_EHO_REMOTE_CHANN_SELECT;
+ break;
+
+ default:
+ remoteEvent = JCC_NULL_EVENT;
+ }
+
+ if (remoteEvent==JCC_NULL_EVENT)
+ {
+ DBG_WARNING("{\nMNEThoWARNING(cs::h323MapToEventExtHo): unexpected h323 message (msgType=%d,callId=%d)\n}\n",
+ h323InMsg->message_type,parent->callIndex);
+ } else
+ {
+ DBG_TRACE("{\nMNEThoTRACE(cs::h323MapToEventExtHo): received H323 Message (msgType=%d,event=%d,callId=%d)\n}\n",
+ h323InMsg->message_type, remoteEvent, parent->callIndex);
+ }
+
+ DBG_LEAVE();
+ return (remoteEvent);
+}
+
+//ext-HO <xxu:05-16-01>
+JCCEvent_t
+CCSessionHandler::h323MapToEventExtH3(IntraL3Msg_t* h323InMsg,
+ CCRemMsgData_t &remMsgData)
+{
+ JCCEvent_t remoteEvent;
+
+ DBG_FUNC("CCSessionHandler::h323MapToEventExtH3", CC_HO_LAYER);
+ DBG_ENTER();
+
+ // Copy the incoming VOIP message to the remote message data structure
+ remMsgData = h323InMsg->l3_data.voipMsg;
+
+ DBG_TRACE("{\nMNEThoTRACE(cs::h323MapToEventExtH3): received H323 Message (msgType=%d,callId=%d)\n}\n",
+ h323InMsg->message_type, parent->callIndex);
+
+ switch (h323InMsg->message_type)
+ {
+ case INTRA_L3_CC_Q931_SETUP:
+ remoteEvent = THC_EHO_REMOTE_TERM_ADDRESS;
+ remMsgData.callOffering = h323InMsg->l3_data.setup.callOffering;
+ break;
+
+ case INTRA_L3_CC_Q931_CALL_PROC:
+ remoteEvent = OHC_EHO_REMOTE_CALL_PROGRESS;
+ break;
+
+ case INTRA_L3_CC_Q931_CONNECT:
+ remoteEvent = OHC_EHO_REMOTE_ANSWER;
+ break;
+
+ case INTRA_L3_CC_Q931_DISCONNECT:
+ remoteEvent = HC_EHO_REMOTE_DISCONNECT_REQ;
+ break;
+
+ case INTRA_L3_CC_H245_CHANN_READY:
+ remoteEvent = HC_EHO_REMOTE_CONNECTION_CONTROL;
+ break;
+
+ case INTRA_L3_CC_H245_CHANN_SELECT:
+ remoteEvent = HC_EHO_REMOTE_CHANN_SELECT;
+ break;
+
+ default:
+ remoteEvent = JCC_NULL_EVENT;
+ }
+
+ if (remoteEvent==JCC_NULL_EVENT)
+ {
+ DBG_WARNING("{\nMNEThoWARNING(cs::h323MapToEventExtH3): unexpected h323 message (msgType=%d,callId=%d)\n}\n",
+ h323InMsg->message_type,parent->callIndex);
+ } else
+ {
+ DBG_TRACE("{\nMNEThoTRACE(cs::h323MapToEventExtH3): received H323 Message (msgType=%d, event=%d, callId=%d)\n}\n",
+ h323InMsg->message_type, remoteEvent, parent->callIndex);
+ }
+
+ DBG_LEAVE();
+ return (remoteEvent);
+}
+
+
+void
+CCSessionHandler::setReleaseCause(T_CNI_RIL3_CAUSE_VALUE cause)
+{
+ releaseCause = cause;
+}
+
+
+//ext-HO <xxu:07-08-01>
+BOOL
+CCSessionHandler::hoCallVoiceConnected(void)
+{
+ if (hoCallLeg->msSide != NULL)
+ {
+ return (hoCallLeg->voiceConnected);
+ } else
+ {
+ DBG_WARNINGho("{\nMNEThoWARNING(cs::hoCallVoiceConnected): no hoCall context any more (hoAgId=%d,callId=%d)\n}\n",
+ handoverSession->hoAgId_, handoverSession->callIndex);
+ return false;
+ }
+}
+
+HalfCallStates_t
+CCSessionHandler::hoCallState(void)
+{
+ if (hoCallLeg->msSide != NULL)
+ {
+ return (hoCallLeg->msSide->callState_);
+ } else
+ {
+ DBG_WARNINGho("{\nMNEThoWARNING(cs::hoCallState): no hoCall context found! (hoAgId=%d,callId=%d)\n}\n",
+ handoverSession->hoAgId_, handoverSession->callIndex);
+ return (EHO_ST_NULL);
+ }
+}
+
+//ext-HO <xxu:06-08-01>
+BOOL
+CCSessionHandler::h3CallVoiceConnected(void)
+{
+ if (hoCallLeg->msSide != NULL)
+ {
+ return (hoCallLeg->voiceConnected);
+ } else
+ {
+ DBG_WARNINGho("{\nMNEThoWARNING(cs::h3CallVoiceConnected): no h3Call context any more (hoAgId=%d,callId=%d)\n}\n",
+ handoverSession->hoAgId_, handoverSession->callIndex);
+ return false;
+ }
+}
+
+
+//ext-HO <chenj:06-11-01>
+bool
+CCSessionHandler::setupOrigExtHo(void)
+{
+ DBG_FUNC("CCSessionHandler::setupOrigExtHo", CC_EO_LAYER);
+ DBG_ENTER();
+
+ if ( (handoverSession == NULL) || (handoverSession != anchorHandoverSession) )
+ {
+ DBG_ERROR("{\nMNETeoERROR(cs::setupOrigExtHo): no call session for hoCall SETUP (callId=%d)\n}\n",
+ parent->callIndex);
+ return false;
+ }
+
+ hoCallLeg->setupOrigExtHo();
+
+ DBG_LEAVE();
+ return(true);
+}
+
+//ext-HO <chenj:06-11-01>
+bool
+CCSessionHandler::setupOrigExtHo3(void)
+{
+ DBG_FUNC("CCSessionHandler::setupOrigExtHo3", CC_EO_LAYER);
+ DBG_ENTER();
+
+ if ( (handoverSession == NULL) || (handoverSession != anchorHandoverSession) )
+ {
+ DBG_ERROR("{\nMNETeoERROR(cs::setupOrigExtHo): no call session for hoCall SETUP (callId=%d)\n}\n",
+ parent->callIndex);
+ return false;
+ }
+
+ h3CallLeg->setupOrigExtHo();
+
+ DBG_LEAVE();
+ return(true);
+} \ No newline at end of file
diff --git a/data/mnet/GP10/Host/cc/src/CCTask.cpp b/data/mnet/GP10/Host/cc/src/CCTask.cpp
new file mode 100644
index 0000000..673c296
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCTask.cpp
@@ -0,0 +1,1995 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCTask.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description : The Main Loop for the controlling root CC task.
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "stdio.h"
+#include "JCC/JCCLog.h"
+#include "logging/VCLOGGING.h"
+
+// included L3 Message header for messages from other Layer 3 modules (CC, RR)
+#include "JCC/JCCL3Msg.h"
+#include "jcc/LUDBInstance.h"
+#include "JCC/LUDBapi.h"
+
+// CC Types
+#include "CC/CCHalfCall.h"
+// ext-HO <chenj:05-16-01>
+#include "CC/HOHalfCall.h"
+
+#include "CC/CCHandover.h"
+
+#include "CC/CCSessionHandler.h"
+
+#include "CC/CCInt.h"
+#include "CC/CCUtil.h"
+
+#include "CC/CCconfig.h"
+#include "CC/CallConfig.h"
+
+#include "CC/CCH323Util.h"
+
+#include "oam_api.h"
+
+#include "CC/hortp.h"
+#include "jcc/viperchannel.h"
+#include "Os/JCTask.h"
+
+#include "ril3\ril3_sms_rp.h"
+
+bool smsSendVbLinkRelease (LUDB_ID, UINT32, T_CNI_RIL3_RP_CAUSE_VALUE cause =
+ CNI_RIL3_RP_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE);
+
+JCTask ccTaskObj("CCTask");
+
+//ext-HO <xxu: 05-16-01>
+DbgOutput ccExtHoEiDbg("GP10ei:", CC_EI_LAYER);
+DbgOutput ccExtHoEoDbg("GP10eo:", CC_EO_LAYER);
+DbgOutput ccExtHoHoDbg("GP10ho:", CC_HO_LAYER);
+bool ccCallTrace=false;
+
+// Call initialization function
+extern int callInit(const short callIndex);
+
+// Call Oam functions
+extern void callOamProcessTrapMsg(TrapMsg* oamInMsg);
+extern void ccOamDataInit(void);
+extern void callOamTrapRegister(void);
+
+FUNCPTR callTimerExpiry; // call timer action - with the Qid
+
+INT_32_T ccOldBTSState = VAL_bts_operationalState_disabled;
+
+bool callTrace = false;
+
+DBG_FUNC("CC Main", CC_LAYER);
+
+void
+callTraceOn (void)
+{
+ callTrace = true;
+}
+
+void
+callTraceOff (void)
+{
+ callTrace = false;
+}
+
+int callTimerExpiryAction(int timerData)
+{
+ // The timerData parameter is of 4 bytes long
+ //
+ // When timer is fired and this function is called by the System Clock ISR,
+ // the timerData is passed back.
+
+ // format a timer expiration message and send to the CC/MM task that
+ // is using the timer.
+
+ UINT16 uint16TimerData;
+ short callId;
+ MSG_Q_ID qid;
+
+ IntraL3Msg_t timeoutMsg;
+
+ uint16TimerData = ((UINT16)timerData) & 0x0FFF;
+
+ callId = (short)(uint16TimerData & 0x00FF);
+
+ if ((0 <= callId) &&
+ ( callId < CC_MAX_CC_CALLS))
+ {
+ qid = ccSession[callId].msgQId;
+ }
+ else
+ {
+ // send it to the cc main task so it can print out a log.
+ // Don't log from here.
+ qid = ccMsgQId;
+ }
+
+ timeoutMsg.module_id = MODULE_CC;
+
+ // send the call leg number in this field
+ timeoutMsg.entry_id = (short) ((uint16TimerData & 0x0F00) >> 8);
+
+ timeoutMsg.message_type = INTRA_L3_TIMEOUT_MSG;
+
+ // CDR <xxu:08-22-00>
+ timeoutMsg.signature = timerData;
+
+ // send the message. Since this is invoked by the System Clock ISR,
+ // we do NOT want to wait for the message delivery.
+ // Return it right away if cannot send on the message queue.
+ msgQSend( qid,
+ (char *) &timeoutMsg,
+ sizeof(struct IntraL3Msg_t),
+ NO_WAIT, // this is called by ISR, don't wait
+ MSG_PRI_NORMAL
+ );
+ return 0;
+
+}
+
+int CCTimerExpiryAction(int timerData)
+{
+ // The timerData parameter is of 4 bytes long
+ //
+ // When timer is fired and this function is called by the System Clock ISR,
+ // the timerData is passed back.
+
+ // format a timer expiration message and send to the CC/MM task that
+ // is using the timer.
+
+ IntraL3Msg_t timeoutMsg;
+
+ timeoutMsg.module_id = MODULE_CC;
+ timeoutMsg.entry_id = timerData;
+
+ timeoutMsg.message_type = INTRA_L3_TIMEOUT_MSG;
+
+ // send the message. Since this is invoked by the System Clock ISR,
+ // we do NOT want to wait for the message delivery.
+ // Return it right away if cannot send on the message queue.
+ msgQSend( ccMsgQId,
+ (char *) &timeoutMsg,
+ sizeof(struct IntraL3Msg_t),
+ NO_WAIT, // this is called by ISR, don't wait
+ MSG_PRI_NORMAL
+ );
+ return 0;
+}
+
+
+// Initialize the Message Handler Member function table.
+void msgHandlerInit(void)
+{
+ DBG_FUNC("msgHandlerInit", CC_LAYER);
+ DBG_ENTER();
+
+ // First initialize everything to a handler for invalid event.
+ short i, j;
+
+ for (i=0; i< MAX_GENERATED_EVENTS; i++)
+ {
+ generatedEventHandler[i] = &CCHalfCall::handleInvalidEvent;
+ }
+
+ for (i=0; i< MAX_CALL_EXTERNAL_EVENTS; i++)
+ {
+ for (j=0; j< MAX_CALL_STATES ; j++)
+ {
+ callStateHandler[j][i] = &CCHalfCall::handleInvalidEvent;
+ }
+ }
+
+ // ext-HO <chenj:06-13-01>
+ for (i=0; i< MAX_EHO_CALL_EXTERNAL_EVENTS; i++)
+ {
+ for (j=0; j< MAX_EHO_CALL_STATES ; j++)
+ {
+ ehoCallStateHandler[j][i] = &HOHalfCall::handleInvalidEvent;
+ }
+ }
+
+ for (i=0; i< MAX_HO_SRC_EVENTS; i++)
+ {
+ for (j=0; j< MAX_HO_SRC_STATES ; j++)
+ {
+ hoSrcHandler[j][i] = &CCHandover::handleInvalidEvent;
+ }
+ }
+
+ for (i=0; i< MAX_HO_TRG_EVENTS; i++)
+ {
+ for (j=0; j< MAX_HO_TRG_STATES ; j++)
+ {
+ hoTrgHandler[j][i] = &CCHandover::handleInvalidEvent;
+ }
+ }
+
+ for (i=0; i< MAX_HO_TRG_EVENTS+MAX_HO_SRC_EVENTS; i++)
+ {
+ for (j=0; j< MAX_HO_TRG_STATES+MAX_HO_SRC_STATES ; j++)
+ {
+ extHoTrgHandler[j][i] = &CCTargetHandoverExtHo::handleInvalidEvent;
+ }
+ }
+
+ // Handler for entire row of handover:
+ for (j=0; j< MAX_HO_SRC_STATES; j++)
+ {
+ hoSrcHandler[j][HAND_TRG_HO_REQ_ACK] = &CCHandover::handleMMLateEstCnf;
+ }
+
+ // Handler for entire row of handover:
+ for (j=0; j< MAX_HO_TRG_STATES; j++)
+ {
+ hoSrcHandler[j][HAND_TRG_HO_REQ_ACK] = &CCHandover::handleMMLateEstCnf;
+ }
+
+ for (i=0; i< MAX_CHANN_EXTERNAL_EVENTS; i++)
+ {
+ for (j=0; j< MAX_CHANN_STATES; j++)
+ {
+ channStateHandler[j][i] = &CCHalfCall::handleInvalidChannEvent;
+ }
+ }
+
+ // Assign Chann Handlers.
+ channStateHandler[RES_ST_ASS_REQ][CC_RESOURCE_ASSIGN_COMPLT - CC_INTERNAL_CHANN_EVENT_BASE]
+ = &CCHalfCall::handleChannAssignComplt ;
+
+ channStateHandler[RES_ST_ASS_REQ][CC_RESOURCE_ASSIGN_FAIL - CC_INTERNAL_CHANN_EVENT_BASE]
+ = &CCHalfCall::handleChannAssignFail;
+
+ // Generated Event Handlers.
+ generatedEventHandler[CC_TWO_STAGE_DISCONNECT - CC_INTERNAL_GEN_EVENT_BASE]
+ = &CCHalfCall::handleDisconnectReq;
+ generatedEventHandler[CC_RESOURCE_ASSIGN_REQ - CC_INTERNAL_GEN_EVENT_BASE]
+ = &CCHalfCall::handleChannAssignReq;
+ generatedEventHandler[CC_RES_RELEASE - CC_INTERNAL_GEN_EVENT_BASE]
+ = &CCHalfCall::handleMobResRelease;
+ generatedEventHandler[CC_MAKE_CONNECTION_REQ - CC_INTERNAL_GEN_EVENT_BASE]
+ = &CCHalfCall::handleConnReq;
+
+ //CH<xxu:Mod 12-13-99>
+ generatedEventHandler[CC_CONNECT_COMPLT - CC_INTERNAL_GEN_EVENT_BASE]
+ = &CCHalfCall::handleConnComplt;
+ generatedEventHandler[CC_CONNECT_FAIL - CC_INTERNAL_GEN_EVENT_BASE]
+ = &CCHalfCall::handleConnFail;
+
+ // Entire column initialization
+ for (i=0; i< MAX_CALL_EXTERNAL_EVENTS; i++)
+ {
+ callStateHandler[HC_ST_FREE][i]
+ = &CCHalfCall::handleNullEvent;
+
+ callStateHandler[HC_ST_NULL][i]
+ = &CCHalfCall::handleNullEvent;
+
+ }
+
+ // ext-HO <chenj:06-13-01>
+ // Entire column initialization
+ for (i=0; i< MAX_EHO_CALL_EXTERNAL_EVENTS; i++)
+ {
+ ehoCallStateHandler[EHO_ST_FREE][i]
+ = &HOHalfCall::handleNullEvent;
+
+ ehoCallStateHandler[EHO_ST_NULL][i]
+ = &HOHalfCall::handleNullEvent;
+ }
+
+ // Handler for entire row: for error, disconnect, release
+
+ for (j=HC_ST_ACTIVE; j< MAX_CALL_STATES ; j++)
+ {
+ // None of these events are applicable to Free or Null states.
+
+ callStateHandler[j][HC_LOCAL_PROTOCOL_PROBLEM - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobProtocolProblem;
+
+ callStateHandler[j][CC_MM_CONNECTION_REL - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMMRelInd;
+
+ callStateHandler[j][HC_REMOTE_RELEASE_COMPLETE - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteAbnormalRelCom;
+
+ callStateHandler[j][HC_LOCAL_DISCONNECT_REQ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleDisconnectReq;
+
+ callStateHandler[j][HC_REMOTE_DISCONNECT_REQ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteDisconnect;
+
+ callStateHandler[j][HC_LOCAL_RELEASE_REQ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleReleaseReq;
+
+ callStateHandler[j][HC_LOCAL_RELEASE_COMPLETE - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobReleaseComplete;
+
+ // H245 Channel established
+ callStateHandler[j][HC_REMOTE_CONNECTION_CONTROL - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteH323ChannReady;
+
+ // Status Handling
+ callStateHandler[j][HC_LOCAL_STATUS_INFO - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobStatusInfo;
+ callStateHandler[j][HC_LOCAL_STATUS_ENQUIRY - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobStatusEnquiry;
+ }
+
+ // External Event Handlers.
+
+ callStateHandler[HC_ST_FREE][THC_REMOTE_TERM_ADDRESS - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteTermAddress;
+
+ // To take care of the radio link loss even before setup arrives.
+ callStateHandler[HC_ST_NULL][CC_MM_CONNECTION_REL - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMMRelInd;
+
+ //For getting rid of CC stuck at this state. This timeout linked to T999 timer
+ callStateHandler[HC_ST_NULL][HC_LOCAL_PROTOCOL_TIMEOUT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobResRelease;
+
+ // Handle a Release coming in even before setup
+ callStateHandler[HC_ST_NULL][HC_LOCAL_RELEASE_REQ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleReleaseReq;
+ callStateHandler[HC_ST_NULL][OHC_LOCAL_TERM_ADDRESS - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobTermAddress;
+ callStateHandler[HC_ST_NULL][OHC_LOCAL_EMERGENCY_ORIGINATION - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobEmergencyOrigination;
+
+ callStateHandler[HC_ST_ACTIVE][HC_REMOTE_DISCONNECT_REQ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteDisconnect;
+ callStateHandler[HC_ST_ACTIVE][HC_LOCAL_DISCONNECT_REQ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleDisconnectReq;
+
+//BCT <xxu:09-22-00>
+// callStateHandler[HC_ST_ACTIVE][OHC_REMOTE_ALERTING - CC_INTERNAL_CALL_EVENT_BASE]
+// = &CCHalfCall::handleMobRemoteAlerting;
+// callStateHandler[HC_ST_ACTIVE][HC_REMOTE_CHANN_SELECT - CC_INTERNAL_CALL_EVENT_BASE]
+// = &CCHalfCall::handleMobRemoteChannSelected;
+
+ callStateHandler[HC_ST_ACTIVE][HC_REMOTE_CONNECTION_CONTROL - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteH323ChannReady;
+
+//BCT <xxu:09-22-00>
+//callStateHandler[HC_ST_ACTIVE][OHC_REMOTE_ANSWER - CC_INTERNAL_CALL_EVENT_BASE]
+// = &CCHalfCall::handleNullEvent;
+
+ callStateHandler[HC_ST_ACTIVE][HC_REMOTE_CALL_PROGRESS - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleNullEvent;
+
+ callStateHandler[HC_ST_ACTIVE][HC_LOCAL_START_DTMF - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleStartDtmf;
+ callStateHandler[HC_ST_ACTIVE][HC_LOCAL_STOP_DTMF - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleStopDtmf;
+
+ //CH<xxu:11-10-99>
+ callStateHandler[HC_ST_ACTIVE][HC_LOCAL_HOLD_ACT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleHoldAct;
+ callStateHandler[HC_ST_ACTIVE][HC_LOCAL_HOLD_REJ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleHoldRej;
+ callStateHandler[HC_ST_ACTIVE][HC_LOCAL_RETV_ACT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleRetvAct;
+ callStateHandler[HC_ST_ACTIVE][HC_LOCAL_RETV_REJ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleRetvRej;
+ callStateHandler[HC_ST_ACTIVE][HC_LOCAL_HOLD_REQ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleHoldReq;
+
+ //CH<xxu:Mod 12-13-99>
+ callStateHandler[HC_ST_ACTIVE][HC_LOCAL_RETV_REQ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleRetvReq;
+
+ //BCT <xxu:09-21-00> BEGIN
+ callStateHandler[HC_ST_ACTIVE][HC_REMOTE_BCT_UPDATE_HANDLES - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleBctUpdateHandles;
+ callStateHandler[HC_ST_ACTIVE][OHC_REMOTE_ALERTING - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteAlerting2nd;
+ callStateHandler[HC_ST_ACTIVE][HC_REMOTE_CHANN_SELECT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteChannSelected2nd;
+ callStateHandler[HC_ST_ACTIVE][OHC_REMOTE_ANSWER - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteAnswer2nd;
+ //BCT <xxu:09-21-00> END
+
+ callStateHandler[HC_ST_ACTIVE][HC_LOCAL_CHTR_EXP - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleSwapTimerExpiry;
+
+ callStateHandler[HC_ST_RELEASE_REQ][HC_LOCAL_RELEASE_COMPLETE - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobReleaseComplete;
+ callStateHandler[HC_ST_RELEASE_REQ][HC_LOCAL_PROTOCOL_TIMEOUT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleReleaseTimeout;
+ callStateHandler[HC_ST_RELEASE_REQ][HC_REMOTE_RELEASE_COMPLETE - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleNullEvent;
+ callStateHandler[HC_ST_RELEASE_REQ][HC_LOCAL_DISCONNECT_REQ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleNullEvent;
+ callStateHandler[HC_ST_RELEASE_REQ][HC_REMOTE_DISCONNECT_REQ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleNullEvent;
+
+ // Take care of the race condition where a release request is received
+ // when a release request is sent to the MS.
+ callStateHandler[HC_ST_RELEASE_REQ][HC_LOCAL_RELEASE_REQ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobReleaseComplete;
+
+ callStateHandler[HC_ST_DISCONNECT_IND][HC_LOCAL_RELEASE_REQ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleReleaseReq;
+ callStateHandler[HC_ST_DISCONNECT_IND][HC_LOCAL_PROTOCOL_TIMEOUT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleDisconnectTimeout;
+ callStateHandler[HC_ST_DISCONNECT_IND][HC_LOCAL_DISCONNECT_REQ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleDisconnectReq;
+ // The above rare situation will send two Disconnects to the remote side -
+ // No problem - ignored through NULL event.
+ callStateHandler[HC_ST_DISCONNECT_IND][HC_REMOTE_DISCONNECT_REQ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleNullEvent;
+ callStateHandler[HC_ST_DISCONNECT_IND][HC_REMOTE_RELEASE_COMPLETE - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleNullEvent;
+
+ callStateHandler[OHC_ST_OFFERING_CALL][HC_REMOTE_CALL_PROGRESS_1 - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteCallProgress1;
+ callStateHandler[OHC_ST_OFFERING_CALL][HC_REMOTE_CALL_PROGRESS - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteCallProgress;
+ callStateHandler[OHC_ST_OFFERING_CALL][OHC_REMOTE_ALERTING - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteAlerting;
+ callStateHandler[OHC_ST_OFFERING_CALL][OHC_REMOTE_ANSWER - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteAnswer;
+ callStateHandler[OHC_ST_OFFERING_CALL][HC_REMOTE_CHANN_SELECT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteChannSelected;
+
+ //BCT <xxu:08-11-00> BEGIN
+ callStateHandler[OHC_ST_OFFERING_CALL][HC_LOCAL_PROTOCOL_TIMEOUT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleBctNumberReqTimeout;
+ callStateHandler[OHC_ST_OFFERING_CALL][HC_VB_GET_BCT_NUMBER_RSP - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleGetBctNumberNack;
+ //BCT <xxu:08-11-00> END
+
+ callStateHandler[OHC_ST_CALL_PROCEEDING][OHC_REMOTE_ALERTING - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteAlerting;
+ callStateHandler[OHC_ST_CALL_PROCEEDING][OHC_REMOTE_ANSWER - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteAnswer;
+ callStateHandler[OHC_ST_CALL_PROCEEDING][HC_REMOTE_CHANN_SELECT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteChannSelected;
+ callStateHandler[OHC_ST_CALL_PROCEEDING][HC_REMOTE_CALL_PROGRESS_1 - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteCallProgress1;
+
+
+ callStateHandler[OHC_ST_ANSWER_PENDING][OHC_REMOTE_ANSWER - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteAnswer;
+ callStateHandler[OHC_ST_ANSWER_PENDING][HC_REMOTE_CHANN_SELECT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteChannSelected;
+ callStateHandler[OHC_ST_ANSWER_PENDING][HC_REMOTE_CALL_PROGRESS - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteCallProgress;
+ callStateHandler[OHC_ST_ANSWER_PENDING][HC_REMOTE_CALL_PROGRESS_1 - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteCallProgress1;
+
+ callStateHandler[OHC_ST_CONNECT_INDICATION][OHC_LOCAL_CONNECT_ACK - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleConnectAck;
+ callStateHandler[OHC_ST_CONNECT_INDICATION][HC_LOCAL_PROTOCOL_TIMEOUT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleDisconnectReq;
+ callStateHandler[OHC_ST_CONNECT_INDICATION][HC_REMOTE_CALL_PROGRESS_1 - CC_INTERNAL_CALL_EVENT_BASE]
+ = CCHalfCall::handleNullEvent;
+
+ callStateHandler[THC_ST_PRESENTING_CALL][HC_LOCAL_CALL_PROGRESS - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobCallProgress;
+ callStateHandler[THC_ST_PRESENTING_CALL][HC_LOCAL_PROTOCOL_TIMEOUT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleReleaseReq; // to send Release Complete
+
+ callStateHandler[THC_ST_ALERTING][THC_LOCAL_ANSWER - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobAnswer;
+ callStateHandler[THC_ST_ALERTING][HC_LOCAL_PROTOCOL_TIMEOUT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobNoReply;
+ callStateHandler[THC_ST_ALERTING][HC_REMOTE_CHANN_SELECT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteChannSelected;
+
+ callStateHandler[THC_ST_CALL_CONFIRMED][THC_LOCAL_ALERTING - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobAlerting;
+ callStateHandler[THC_ST_CALL_CONFIRMED][THC_LOCAL_ANSWER - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobAnswer;
+ callStateHandler[THC_ST_CALL_CONFIRMED][HC_LOCAL_PROTOCOL_TIMEOUT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleDisconnectReq;
+ callStateHandler[THC_ST_CALL_CONFIRMED][HC_REMOTE_CHANN_SELECT - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMobRemoteChannSelected;
+
+ callStateHandler[THC_ST_MM_CONN_REQ][CC_MM_CONNECTION_CNF - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMMEstCnf;
+ callStateHandler[THC_ST_MM_CONN_REQ][CC_MM_CONNECTION_REJ - CC_INTERNAL_CALL_EVENT_BASE]
+ = &CCHalfCall::handleMMEstRej;
+
+ // ---------------------------- EXTERNAL HANDOVER -----------------------------
+ // ext-HO <chenj:05-29-01>
+ ehoCallStateHandler[EHO_ST_NULL][OHC_EHO_LOCAL_TERM_ADDRESS - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleEHOMobTermAddress;
+
+ ehoCallStateHandler[EHO_ST_OFFERING_CALL][OHC_EHO_REMOTE_CALL_PROGRESS - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleEHOMobCallProgress;
+ ehoCallStateHandler[EHO_ST_OFFERING_CALL][HC_EHO_REMOTE_CHANN_SELECT - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleEHOMobRemoteChannSelected;
+ ehoCallStateHandler[EHO_ST_OFFERING_CALL][OHC_EHO_REMOTE_ANSWER - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleEHOMobRemoteAnswer;
+ ehoCallStateHandler[EHO_ST_OFFERING_CALL][HC_EHO_REMOTE_CONNECTION_CONTROL - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleEHOMobRemoteChannReady;
+ ehoCallStateHandler[EHO_ST_OFFERING_CALL][HC_EHO_REMOTE_DISCONNECT_REQ - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleEHOMobRemoteDisconnect;
+ ehoCallStateHandler[EHO_ST_OFFERING_CALL][HC_EHO_LOCAL_PROTOCOL_TIMEOUT - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleHoCallTimeout;
+
+ ehoCallStateHandler[EHO_ST_ACTIVE][HC_EHO_LOCAL_DISCONNECT_REQ - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleEHOMobLocalDisconnect;
+ ehoCallStateHandler[EHO_ST_ACTIVE][HC_EHO_REMOTE_DISCONNECT_REQ - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleEHOMobRemoteDisconnect;
+ ehoCallStateHandler[EHO_ST_ACTIVE][HC_EHO_LOCAL_PROTOCOL_TIMEOUT - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleHoCallTimeout;
+
+ // ext-HO <xxu:06-07-01>
+ ehoCallStateHandler[HC_ST_FREE][THC_EHO_REMOTE_TERM_ADDRESS - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleEHOMobRemoteTermAddress;
+ ehoCallStateHandler[EHO_ST_CONFIRMED][HC_EHO_LOCAL_PROTOCOL_TIMEOUT - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleHoCallTimeout;
+ ehoCallStateHandler[EHO_ST_CONFIRMED][HC_EHO_REMOTE_DISCONNECT_REQ - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleEHOMobRemoteDisconnect;
+ ehoCallStateHandler[EHO_ST_CONFIRMED][HC_EHO_REMOTE_CHANN_SELECT - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleEHOMobRemoteChannSelectedEi;
+ ehoCallStateHandler[EHO_ST_ACTIVE][HC_EHO_REMOTE_CONNECTION_CONTROL - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleEHOMobRemoteChannReady;
+ ehoCallStateHandler[EHO_ST_ACTIVE][HC_EHO_REMOTE_DISCONNECT_REQ - CC_INTERNAL_EHO_CALL_EVENT_BASE]
+ = &HOHalfCall::handleEHOMobRemoteDisconnect;
+
+ // ext-HO <chenj:05-29-01>
+ // external handout scenerio
+ hoSrcHandler[HAND_ST_ANCH_PERF_EHO_REQ][HAND_PERFORM_HO_ACK - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleExtPerformHOAck;
+ hoSrcHandler[HAND_ST_ANCH_PERF_EHO_REQ][HAND_PERFORM_HO_NACK - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleExtPerformHONack;
+ hoSrcHandler[HAND_ST_ANCH_PERF_EHO_REQ][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchEndHandover;
+ hoSrcHandler[HAND_ST_ANCH_PERF_EHO_REQ][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchExtHoTimerExpiry;
+ hoSrcHandler[HAND_ST_ANCH_PERF_EHO_REQ][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+ hoSrcHandler[HAND_ST_ANCH_PERF_EHO_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostExtHoRls;
+
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_REQ_ACK][HAND_HO_ACCESS - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent; // Nothing is done for HO ACCESS
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_REQ_ACK][HAND_COMPLT_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchExtHoComplt;
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_REQ_ACK][HAND_SRC_HO_FAIL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchExtHoFail;
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_REQ_ACK][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchEndHandover;
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_REQ_ACK][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchExtHoTimerExpiry;
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_REQ_ACK][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_REQ_ACK][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostExtHoRls;
+
+ hoSrcHandler[HAND_ST_ANCH_EHO_COMPLT][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchEndHandover;
+ hoSrcHandler[HAND_ST_ANCH_EHO_COMPLT][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostExtHoMobEvent;
+ hoSrcHandler[HAND_ST_ANCH_EHO_COMPLT][HAND_PERFORM_HO_REQ - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostExtHoHandbackEvent; // Handback event
+ hoSrcHandler[HAND_ST_ANCH_EHO_COMPLT][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostExtHoRls;
+
+
+ // external handback (to anchor GP10) scenerio
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_HB_REQ][HAND_PERFORM_HO_REQ - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_HB_REQ][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchEndHandover;
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_HB_REQ][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchExtHoTimerExpiry;
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_HB_REQ][HAND_TRG_HO_REQ_ACK - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchExtHoReqAck;
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_HB_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostExtHoRls;
+
+ hoSrcHandler[HAND_ST_ANCH_SND_EHB_REQ_ACK][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+ hoSrcHandler[HAND_ST_ANCH_SND_EHB_REQ_ACK][HAND_SRC_HO_FAIL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchExtHandbackFail;
+ hoSrcHandler[HAND_ST_ANCH_SND_EHB_REQ_ACK][HAND_TRG_HO_COMPLT - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchExtHoComplt;
+ hoSrcHandler[HAND_ST_ANCH_SND_EHB_REQ_ACK][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchEndHandover;
+ hoSrcHandler[HAND_ST_ANCH_SND_EHB_REQ_ACK][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchExtHOT104TimerExpiry;
+ hoSrcHandler[HAND_ST_ANCH_SND_EHB_REQ_ACK][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostExtHoRls;
+
+
+ // external handback (to another PLMN) scenerio AND
+ // internal handback from non-achor MNET to external MSC3
+ hoSrcHandler[HAND_ST_ANCH_PERF_EHO_H3_REQ][HAND_PERFORM_HO_ACK - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleExtPerformHOAck;
+ hoSrcHandler[HAND_ST_ANCH_PERF_EHO_H3_REQ][HAND_PERFORM_HO_NACK - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleExtPerformHONack;
+ hoSrcHandler[HAND_ST_ANCH_PERF_EHO_H3_REQ][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchEndHandover;
+ hoSrcHandler[HAND_ST_ANCH_PERF_EHO_H3_REQ][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchExtHoTimerExpiry;
+ hoSrcHandler[HAND_ST_ANCH_PERF_EHO_H3_REQ][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+ hoSrcHandler[HAND_ST_ANCH_PERF_EHO_H3_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostExtHoRls;
+
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_H3_REQ_ACK][HAND_HO_ACCESS - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent; // JOE: nothing is done with HANDOVER ACCESS
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_H3_REQ_ACK][HAND_COMPLT_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchExtHoComplt;
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_H3_REQ_ACK][HAND_SRC_HO_FAIL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchExtHandbackFail;
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_H3_REQ_ACK][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchEndHandover;
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_H3_REQ_ACK][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchExtHoTimerExpiry;
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_H3_REQ_ACK][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+ hoSrcHandler[HAND_ST_ANCH_RCV_EHO_H3_REQ_ACK][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostExtHoRls;
+
+
+ // external handback (to non-anchor GP10) scenerio
+ hoSrcHandler[HAND_ST_ANCH_EHO_H3_VC_IP_ADDRESS_REQ][HC_VB_GET_VC_ADDRESS_RSP - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleVcAddressRsp;
+ hoSrcHandler[HAND_ST_ANCH_EHO_H3_VC_IP_ADDRESS_REQ][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchTvbTimerExpiry;
+ hoSrcHandler[HAND_ST_ANCH_EHO_H3_VC_IP_ADDRESS_REQ][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+ hoSrcHandler[HAND_ST_ANCH_EHO_H3_VC_IP_ADDRESS_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostExtHoRls;
+
+
+ hoSrcHandler[HAND_ST_ANCH_EHO_SND_H3_REQ][HAND_PERFORM_HO_ACK - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchPerfHoAck;
+ hoSrcHandler[HAND_ST_ANCH_EHO_SND_H3_REQ][HAND_PERFORM_HO_NACK - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchPerfHoNack;
+ hoSrcHandler[HAND_ST_ANCH_EHO_SND_H3_REQ][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchThoTimerExpiry;
+ hoSrcHandler[HAND_ST_ANCH_EHO_SND_H3_REQ][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostHoMobEvent;
+ hoSrcHandler[HAND_ST_ANCH_EHO_SND_H3_REQ][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+ hoSrcHandler[HAND_ST_ANCH_EHO_SND_H3_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostExtHoRls;
+
+
+ hoSrcHandler[HAND_ST_ANCH_EHO_RCV_H3_REQ_ACK][HAND_COMPLT_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchExtHoComplt;
+ hoSrcHandler[HAND_ST_ANCH_EHO_RCV_H3_REQ_ACK][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchEndHandover;
+ hoSrcHandler[HAND_ST_ANCH_EHO_RCV_H3_REQ_ACK][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchT103TimerExpiry;
+ hoSrcHandler[HAND_ST_ANCH_EHO_RCV_H3_REQ_ACK][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+ hoSrcHandler[HAND_ST_ANCH_EHO_RCV_H3_REQ_ACK][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostExtHoRls;
+
+
+ // ----------------------------------------------------------------------------
+
+
+ // Source Handover Event Handlers
+ hoSrcHandler[HAND_ST_IDLE][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchHoReqd;
+
+ hoSrcHandler[HAND_ST_ANCH_VC_IP_ADDRESS_REQ][HC_VB_GET_VC_ADDRESS_RSP - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleVcAddressRsp;
+ hoSrcHandler[HAND_ST_ANCH_VC_IP_ADDRESS_REQ][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+
+ //RETRY<xxu:04-21-00> BEGIN
+ hoSrcHandler[HAND_ST_ANCH_VC_IP_ADDRESS_REQ][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchTvbTimerExpiry;
+ //RETRY<xxu:04-21-00> END
+
+ //HO<xxu:01-28-00>
+ hoSrcHandler[HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ][HC_VB_GET_VC_ADDRESS_RSP - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleVcAddressRsp;
+ hoSrcHandler[HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostHoMobEvent;
+ hoSrcHandler[HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostHoRls;
+ hoSrcHandler[HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+
+ //RETRY<xxu:04-21-00> BEGIN
+ hoSrcHandler[HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchAbortHb;
+ hoSrcHandler[HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchTvbTimerExpiry;
+ //RETRY<xxu:04-21-00> END
+
+ hoSrcHandler[HAND_ST_ANCH_SND_HO_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchPerfHoNack;
+ hoSrcHandler[HAND_ST_ANCH_SND_HO_REQ][HAND_PERFORM_HO_ACK - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchPerfHoAck;
+ hoSrcHandler[HAND_ST_ANCH_SND_HO_REQ][HAND_PERFORM_HO_NACK - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchPerfHoNack;
+ hoSrcHandler[HAND_ST_ANCH_SND_HO_REQ][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchThoTimerExpiry;
+ hoSrcHandler[HAND_ST_ANCH_SND_HO_REQ][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+
+ //HO<xxu:01-28-00> H3
+ //hoSrcHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ // = &CCAnchorHandover::handleTrgToAnchPerfHoNack;
+ hoSrcHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostHoRls;
+ hoSrcHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_PERFORM_HO_ACK - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchPerfHoAck;
+ hoSrcHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_PERFORM_HO_NACK - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchPerfHoNack;
+ hoSrcHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchThoTimerExpiry;
+ hoSrcHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostHoMobEvent;
+ hoSrcHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+
+ //RETRY<xxu:04-27-00> BEGIN
+ hoSrcHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchAbortHb;
+ //RETRY<xxu:04-27-00> END
+
+ hoSrcHandler[HAND_ST_ANCH_RCV_HO_REQ_ACK][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchPerfHoNack;
+ hoSrcHandler[HAND_ST_ANCH_RCV_HO_REQ_ACK][HAND_SRC_HO_FAIL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchHoFail;
+ hoSrcHandler[HAND_ST_ANCH_RCV_HO_REQ_ACK][HAND_PERFORM_HO_NACK - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchPerfHoNack;
+ hoSrcHandler[HAND_ST_ANCH_RCV_HO_REQ_ACK][HAND_COMPLT_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchCompltHo;
+ hoSrcHandler[HAND_ST_ANCH_RCV_HO_REQ_ACK][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchT103TimerExpiry;
+ // Race condition
+ hoSrcHandler[HAND_ST_ANCH_SND_HO_REQ][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+
+ hoSrcHandler[HAND_ST_ANCH_HO_COMPLT][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostHoRls;
+ hoSrcHandler[HAND_ST_ANCH_HO_COMPLT][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostHoMobEvent;
+ hoSrcHandler[HAND_ST_ANCH_HO_COMPLT][HAND_PERFORM_HO_REQ - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchPerfHbReq;
+
+ hoSrcHandler[HAND_ST_ANCH_RCV_HB_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostHoRls;
+ hoSrcHandler[HAND_ST_ANCH_RCV_HB_REQ][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostHoMobEvent;
+
+ //HO<xxu:02-01-00>
+ hoSrcHandler[HAND_ST_ANCH_RCV_HB_REQ][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+
+ hoSrcHandler[HAND_ST_ANCH_RCV_HB_REQ][HAND_TRG_HO_REQ_ACK - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchHoReqAck;
+ hoSrcHandler[HAND_ST_ANCH_RCV_HB_REQ][HAND_TRG_HO_REQ_NACK - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchHoReqNack;
+ hoSrcHandler[HAND_ST_ANCH_RCV_HB_REQ][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchAbortHb;
+
+ hoSrcHandler[HAND_ST_ANCH_SND_HB_REQ_ACK][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostHoRls;
+ hoSrcHandler[HAND_ST_ANCH_SND_HB_REQ_ACK][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostHoMobEvent;
+
+ //HO<xxu:02-01-00>
+ hoSrcHandler[HAND_ST_ANCH_SND_HB_REQ_ACK][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+
+ hoSrcHandler[HAND_ST_ANCH_SND_HB_REQ_ACK][HAND_TRG_HO_COMPLT - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchHoComplt;
+ hoSrcHandler[HAND_ST_ANCH_SND_HB_REQ_ACK][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchAbortHb;
+ hoSrcHandler[HAND_ST_ANCH_SND_HB_REQ_ACK][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchT104TimerExpiry;
+
+ //RETRY<xxu:04-27-00> BEGIN
+ hoSrcHandler[HAND_ST_ANCH_SND_HB_REQ_ACK][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostHoRls;
+ //RETRY<xxu:04-27-00> END
+
+ //HO<xxu:01-28-00> H3 handle RR->A or B'->A HoComplt or HAND_RLS_CALL due to timeout
+ //hoSrcHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ // = &CCAnchorHandover::handleTrgToAnchPerfHoNack;
+ hoSrcHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostHoRls;
+ hoSrcHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_COMPLT_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchCompltHo;
+ hoSrcHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleTrgToAnchAbortHb; //H3 or HB failed at MSC-B
+ hoSrcHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchT103TimerExpiry;
+ hoSrcHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleAnchPostHoMobEvent;
+ hoSrcHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCAnchorHandover::handleNullEvent;
+
+
+ // Target Handover Event Handlers
+ hoTrgHandler[HAND_ST_IDLE][HAND_PERFORM_HO_REQ - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleAnchToTrgPerfHoReq;
+
+ hoTrgHandler[HAND_ST_TRG_RCV_HO_REQ][HAND_TRG_HO_REQ_ACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleTrgHoReqAck;
+ hoTrgHandler[HAND_ST_TRG_RCV_HO_REQ][HAND_TRG_HO_REQ_NACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleTrgHoReqNack;
+ hoTrgHandler[HAND_ST_TRG_RCV_HO_REQ][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleAnchToTrgAbortHo;
+
+ hoTrgHandler[HAND_ST_TRG_SND_HO_REQ_ACK][HAND_TRG_HO_COMPLT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleTrgHoComplt;
+ hoTrgHandler[HAND_ST_TRG_SND_HO_REQ_ACK][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleAnchToTrgAbortHo;
+ hoTrgHandler[HAND_ST_TRG_SND_HO_REQ_ACK][HAND_TRG_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleTrgT204TimerExpiry;
+
+ hoTrgHandler[HAND_ST_TRG_HO_COMPLT][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleAnchToTrgAbortHo;
+ hoTrgHandler[HAND_ST_TRG_HO_COMPLT][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleTrgHoReqd;
+
+ hoTrgHandler[HAND_ST_TRG_SND_HB_REQ][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleAnchToTrgAbortHo;
+ hoTrgHandler[HAND_ST_TRG_SND_HB_REQ][HAND_PERFORM_HO_ACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleAnchToTrgPerfHbAck;
+ hoTrgHandler[HAND_ST_TRG_SND_HB_REQ][HAND_PERFORM_HO_NACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleAnchToTrgPerfHbNack;
+ hoTrgHandler[HAND_ST_TRG_SND_HB_REQ][HAND_TRG_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleTrgTshoTimerExpiry;
+ hoTrgHandler[HAND_ST_TRG_SND_HB_REQ][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleNullEvent;
+
+ hoTrgHandler[HAND_ST_TRG_RCV_HB_REQ_ACK][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleAnchToTrgAbortHo;
+ hoTrgHandler[HAND_ST_TRG_RCV_HB_REQ_ACK][HAND_SRC_HO_FAIL - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleTrgHoFail;
+ hoTrgHandler[HAND_ST_TRG_RCV_HB_REQ_ACK][HAND_PERFORM_HO_NACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleAnchToTrgPerfHbNack;
+ hoTrgHandler[HAND_ST_TRG_RCV_HB_REQ_ACK][HAND_COMPLT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleAnchToTrgCompltHb;
+ hoTrgHandler[HAND_ST_TRG_RCV_HB_REQ_ACK][HAND_TRG_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleTrgT203TimerExpiry;
+ // Race condition
+ hoTrgHandler[HAND_ST_TRG_RCV_HB_REQ_ACK][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandover::handleNullEvent;
+
+ //ext-HO <xxu:06-07-01> : External Handover--Handin case handlers
+ extHoTrgHandler[HAND_ST_IDLE][HAND_PERFORM_HO_REQ - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPerfHoReq;
+
+ extHoTrgHandler[HAND_ST_TRG_RCV_HO_REQ][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_TRG_RCV_HO_REQ][HAND_TRG_HO_REQ_ACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgHoReqAck;
+ extHoTrgHandler[HAND_ST_TRG_RCV_HO_REQ][HAND_TRG_HO_REQ_NACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgHoReqNack;
+
+ extHoTrgHandler[HAND_ST_TRG_SND_HO_REQ_ACK][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_TRG_SND_HO_REQ_ACK][HAND_TRG_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgT204TimerExpiry;
+ extHoTrgHandler[HAND_ST_TRG_SND_HO_REQ_ACK][HAND_HO_ACCESS - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgHoAccess;
+ extHoTrgHandler[HAND_ST_TRG_SND_HO_REQ_ACK][HAND_TRG_HO_COMPLT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgHoComplt;
+
+ extHoTrgHandler[HAND_ST_TRG_HO_COMPLT][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_TRG_HO_COMPLT][HAND_TRG_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgT204TimerExpiry;
+ extHoTrgHandler[HAND_ST_TRG_HO_COMPLT][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgMmRelInd;
+ extHoTrgHandler[HAND_ST_TRG_HO_COMPLT][HAND_POSTHO_HOA_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPostHoHoaEvent;
+
+ //ext-HO <xxu:06-07-01> : External Handover postHandin--Handback anchor GP->PLMN
+ extHoTrgHandler[HAND_ST_TRG_HO_COMPLT][HAND_SRC_HO_REQD - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgHoReqd;
+
+ extHoTrgHandler[HAND_ST_TRG_SND_HB_REQ][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_TRG_SND_HB_REQ][HAND_PERFORM_HO_ACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPerfHbAck;
+ extHoTrgHandler[HAND_ST_TRG_SND_HB_REQ][HAND_PERFORM_HO_NACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPerfHbNack;
+ extHoTrgHandler[HAND_ST_TRG_SND_HB_REQ][HAND_TRG_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgT211TimerExpiry; //formerly Tsho timer
+ extHoTrgHandler[HAND_ST_TRG_SND_HB_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgMmRelInd;
+ extHoTrgHandler[HAND_ST_TRG_SND_HB_REQ][HAND_POSTHO_HOA_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPostHoHoaEvent;
+
+ extHoTrgHandler[HAND_ST_TRG_RCV_HB_REQ_ACK][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_TRG_RCV_HB_REQ_ACK][HAND_SRC_HO_FAIL - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgHoFail;
+ extHoTrgHandler[HAND_ST_TRG_RCV_HB_REQ_ACK][HAND_COMPLT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgCompltHb;
+ extHoTrgHandler[HAND_ST_TRG_RCV_HB_REQ_ACK][HAND_TRG_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgT204TimerExpiry; //formerly T203 timer
+ extHoTrgHandler[HAND_ST_TRG_RCV_HB_REQ_ACK][HAND_POSTHO_HOA_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleNullEvent;
+
+ //ext-HO <xxu:06-07-01> : External Handover postHandin--Handover to another GP
+ extHoTrgHandler[HAND_ST_ANCH_VC_IP_ADDRESS_REQ][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_ANCH_VC_IP_ADDRESS_REQ][HC_VB_GET_VC_ADDRESS_RSP - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleVcAddressRsp;
+ extHoTrgHandler[HAND_ST_ANCH_VC_IP_ADDRESS_REQ][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchTvbTimerExpiry;
+ extHoTrgHandler[HAND_ST_ANCH_VC_IP_ADDRESS_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgMmRelInd;
+ extHoTrgHandler[HAND_ST_ANCH_VC_IP_ADDRESS_REQ][HAND_POSTHO_HOA_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPostHoHoaEvent;
+
+ extHoTrgHandler[HAND_ST_ANCH_SND_HO_REQ][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_ANCH_SND_HO_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgMmRelInd;
+ extHoTrgHandler[HAND_ST_ANCH_SND_HO_REQ][HAND_TRG_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgT202TimerExpiry; //interBSS handover under MSC-B
+ extHoTrgHandler[HAND_ST_ANCH_SND_HO_REQ][HAND_PERFORM_HO_ACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchPerfHoAck;
+ extHoTrgHandler[HAND_ST_ANCH_SND_HO_REQ][HAND_PERFORM_HO_NACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchPerfHoNack;
+ extHoTrgHandler[HAND_ST_ANCH_SND_HO_REQ][HAND_POSTHO_HOA_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPostHoHoaEvent;
+
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HO_REQ_ACK][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HO_REQ_ACK][HAND_TRG_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgT202TimerExpiry; //interBSS handover under MSC-B
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HO_REQ_ACK][HAND_COMPLT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchCompltHo;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HO_REQ_ACK][HAND_SRC_HO_FAIL - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchHoFail;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HO_REQ_ACK][HAND_POSTHO_HOA_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPostHoHoaEvent;
+
+ extHoTrgHandler[HAND_ST_ANCH_HO_COMPLT][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_ANCH_HO_COMPLT][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchPostHoRls;
+ extHoTrgHandler[HAND_ST_ANCH_HO_COMPLT][HAND_POSTHO_HOA_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPostHoHoaEvent;
+ extHoTrgHandler[HAND_ST_ANCH_HO_COMPLT][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchPostHoMobEvent;
+
+ //ext-HO <xxu:06-07-01> : External Handover postHandin-->Handback nonanchor GP->PLMN
+ extHoTrgHandler[HAND_ST_ANCH_HO_COMPLT][HAND_PERFORM_HO_REQ - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchPerfHbReq;
+
+ extHoTrgHandler[HAND_ST_ANCH_SND_HB_REQ][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_ANCH_SND_HB_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchPostHoRls;
+ extHoTrgHandler[HAND_ST_ANCH_SND_HB_REQ][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchAbortHb;
+ extHoTrgHandler[HAND_ST_ANCH_SND_HB_REQ][HAND_PERFORM_HO_ACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPerfHbAck;
+ extHoTrgHandler[HAND_ST_ANCH_SND_HB_REQ][HAND_PERFORM_HO_NACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPerfHbNack;
+ extHoTrgHandler[HAND_ST_ANCH_SND_HB_REQ][HAND_TRG_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgT211TimerExpiry; //formerly Tsho timer
+ extHoTrgHandler[HAND_ST_ANCH_SND_HB_REQ][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchPostHoMobEvent;
+ extHoTrgHandler[HAND_ST_ANCH_SND_HB_REQ][HAND_POSTHO_HOA_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPostHoHoaEvent;
+
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ_ACK][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ_ACK][HAND_TRG_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgT204TimerExpiry; //formerly T203 timer
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ_ACK][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchHbFail; //revert to old cell case
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ_ACK][HAND_HO_ACCESS - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchHoAccess;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ_ACK][HAND_COMPLT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgCompltHb;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ_ACK][HAND_POSTHO_HOA_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleNullEvent;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ_ACK][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchPostHoMobEvent;
+
+ //ext-HO <xxu:06-07-01> : External Handover postHandin-->Handback nonanchor GP->anchor GP
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchPostHoRls;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchAbortHb;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ][HAND_TRG_HO_REQ_ACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchHoReqAck;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ][HAND_TRG_HO_REQ_NACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchHoReqNack;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ][HAND_TRG_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgT202TimerExpiry; //formerly T203 timer
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ][HAND_POSTHO_HOA_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPostHoHoaEvent;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_HB_REQ][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchPostHoMobEvent;
+
+ extHoTrgHandler[HAND_ST_ANCH_SND_HB_REQ_ACK][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_ANCH_SND_HB_REQ_ACK][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgT202TimerExpiry; //interBSS handover under MSC-B
+ extHoTrgHandler[HAND_ST_ANCH_SND_HB_REQ_ACK][HAND_TRG_HO_COMPLT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchHoComplt;
+ extHoTrgHandler[HAND_ST_ANCH_SND_HB_REQ_ACK][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchHbFail;
+ extHoTrgHandler[HAND_ST_ANCH_SND_HB_REQ_ACK][HAND_POSTHO_HOA_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPostHoHoaEvent;
+ extHoTrgHandler[HAND_ST_ANCH_SND_HB_REQ_ACK][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchPostHoMobEvent;
+
+ //ext-HO <xxu:06-07-01> : External Handover postHandin-->Handover to 3rd within MNET
+ extHoTrgHandler[HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchPostHoRls;
+ extHoTrgHandler[HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchTvbTimerExpiry;
+ extHoTrgHandler[HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchAbortHb;
+ extHoTrgHandler[HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ][HAND_POSTHO_HOA_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPostHoHoaEvent;
+ extHoTrgHandler[HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchPostHoMobEvent;
+ extHoTrgHandler[HAND_ST_ANCH_H3_VC_IP_ADDRESS_REQ][HC_VB_GET_VC_ADDRESS_RSP - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleVcAddressRsp;
+
+ extHoTrgHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchPostHoRls;
+ extHoTrgHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgT202TimerExpiry; //formerly Tho timer
+ extHoTrgHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchAbortHb;
+ extHoTrgHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_PERFORM_HO_ACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchPerfHoAck;
+ extHoTrgHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_PERFORM_HO_NACK - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchPerfHoNack;
+ extHoTrgHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_POSTHO_HOA_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPostHoHoaEvent;
+ extHoTrgHandler[HAND_ST_ANCH_SND_H3_REQ][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchPostHoMobEvent;
+
+ extHoTrgHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_END_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgEndHandover;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_RLS_CALL - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchPostHoRls;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_SRC_TIMER_EXPIRY - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgT202TimerExpiry; //formerly Tho timer
+ extHoTrgHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchAbortHb;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_COMPLT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchCompltHo;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_ABORT_HO - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchHbFail;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_POSTHO_HOA_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleAnchToTrgPostHoHoaEvent;
+ extHoTrgHandler[HAND_ST_ANCH_RCV_H3_REQ_ACK][HAND_POSTHO_MOB_EVENT - HAND_SRC_EVENT_BASE]
+ = &CCTargetHandoverExtHo::handleTrgToAnchPostHoMobEvent;
+ DBG_LEAVE();
+
+}
+
+// Data Structure Initialization for an individual call task
+void callDataInit(void)
+{
+ DBG_FUNC("callDataInit", CC_LAYER);
+ DBG_ENTER();
+
+ // Initialize the Message Handler Member function table.
+ msgHandlerInit();
+
+
+ // create the function pointers for use in each session.
+ callTimerExpiry = (FUNCPTR) callTimerExpiryAction;
+
+ DBG_LEAVE();
+
+}
+
+// Data Structure Initialization
+void ccInitialize(void)
+{
+ DBG_FUNC("ccInitialize", CC_LAYER);
+ DBG_ENTER();
+
+ ccOamDataInit();
+ callDataInit();
+
+ short i;
+ for(i=0; i< CC_MAX_CC_CALLS;i++)
+ {
+ // First create the semaphore and hold for initialize
+ ccSession[i].semId = semMCreate(SEM_Q_PRIORITY | SEM_INVERSION_SAFE);
+
+ // Take the semaphore
+ semTake(ccSession[i].semId, WAIT_FOREVER);
+
+ // Initialize the parent session first before the Calls.
+ // Particularly the callIndex below is important, as it is used in the HC
+ ccEntryInit(&ccSession[i]);
+ ccSession[i].callIndex = i;
+ ccSession[i].taskId = NULL;
+
+ // create two way links (pointers) between the session and half call
+ ccSession[i].sessionHandler = new CCSessionHandler(&ccSession[i]);
+
+ }
+ DBG_LEAVE();
+
+}
+
+void sessionDataInit(int i)
+{
+ DBG_FUNC("sessionDataInit", CC_LAYER);
+ DBG_ENTER();
+
+ semTake(ccSession[i].semId, WAIT_FOREVER);
+ ccSession[i].safetyTimer->cancelTimer();
+
+ //CAUSE<xxu:03-27-00> Begin
+ //ccSession[i].sessionHandler->cleanup(CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER, TRUE);
+ ccSession[i].sessionHandler->cleanup(CNI_RIL3_CAUSE_TEMPORARY_FAILURE, TRUE);
+
+ //CAUSE<xxu:03-27-00> Begin
+
+ // semFlush(ccSession[i].semId);
+ handleReleaseSession(&ccSession[i]);
+ semGive(ccSession[i].semId);
+ DBG_LEAVE();
+}
+
+void ccCallDataInit(void)
+{
+ DBG_FUNC("ccCallDataInit", CC_LAYER);
+ DBG_ENTER();
+ short i;
+ for(i=0; i< CC_MAX_CC_CALLS;i++)
+ {
+ sessionDataInit(i);
+ }
+ DBG_LEAVE();
+}
+
+int findCallUsingCallHandle( VOIP_CALL_HANDLE callHandle)
+{
+ DBG_FUNC("findCallUsingCallHandle", CC_LAYER);
+ DBG_ENTER();
+
+ short i;
+ for(i=0; i< CC_MAX_CC_CALLS;i++)
+ {
+ if (!(ccSession[i].free))
+ {
+ if ((ccSession[i].sessionHandler)->findHandle(callHandle ))
+ {
+ DBG_LEAVE();
+ return (i);
+ }
+ }
+ }
+ DBG_LEAVE();
+
+ return (CC_MAX_CC_CALLS);
+
+}
+
+// entry function for the CC Module (VxWorks Task)
+int ccMain(void)
+{
+ //ext-HO <xxu: 05-16-01>
+ //Make sure external handover trace in place
+ DBG_ENTERei();
+ DBG_ENTEReo();
+ DBG_ENTERho();
+
+ // Semaphores are defined and also taken here.
+ ccInitialize();
+
+ // Register for dynamic changes in timer values for call configuration.
+ // Moved here so that the message queue is initialized correctly.
+ callOamTrapRegister();
+
+ // Initialize the Handover RTP Pool
+ if (!InitializeHandoverRtpPool() )
+ {
+ // failed to initialize Handover RTP Pool. Abort the task.
+ printf("CC MAIN FATAL ERROR: failed to create Handover RTP Pool\n" );
+ return ERROR;
+ }
+
+ // Initialize Viper to Viper channel
+ // InitializeViperChannel(TRUE); // moved to SysCommand_VChan
+
+ // create all the call tasks.
+
+ short callId;
+ for(callId=0; callId< CC_MAX_CC_CALLS;callId++)
+ {
+ if ( (ccSession[callId].taskId = callInit(callId)) == ERROR)
+ {
+ // Call task creation failure. No point to continue.
+ // Abort the CC task.
+ return ERROR;
+ }
+
+ ccSession[callId].safetyTimer
+ = new JCCTimer((FUNCPTR) CCTimerExpiryAction,
+ ccSession[callId].taskId);
+
+ semGive(ccSession[callId].semId);
+
+ }
+
+ // local message queue buffer
+ CCMMInputMsg_t inMsg;
+
+ // enter infinite loop to wait for message and process message from MS
+ // or other layer-3 modules
+ ccTaskObj.JCTaskEnterLoop();
+ while(true)
+ {
+ //
+
+ if (msgQReceive(ccMsgQId,
+ (char *) &inMsg,
+ CC_MAX_MSG_LENGTH,
+ WAIT_FOREVER)
+ == ERROR)
+ {
+ // failed to receive message. VxWorks error. Abort the task.
+ printf("CC MAIN FATAL ERROR: failed to receive on CC Message Queue\n" );
+ return ERROR;
+ }
+
+ DBG_TRACE ("M%d->CC MAIN LOG: Task \"%s\" Received a message\n",
+ inMsg.intraL3Msg.module_id, taskName(taskIdSelf()));
+
+ // check for BTS Operational first
+
+ if (ccOldBTSState == VAL_bts_operationalState_disabled)
+ {
+ switch (inMsg.intraL3Msg.module_id) {
+ case MODULE_OAM:
+ callOamProcessTrapMsg((TrapMsg *) &inMsg);
+ break;
+ default:
+ DBG_WARNING("CC MAIN WARNING: BTS Operation Disabled. Ignoring new call request from (Module = %d)\n.",
+ inMsg.intraL3Msg.module_id);
+ }
+ }
+ else
+ {
+ // action based on the sending module
+ //
+ switch (inMsg.intraL3Msg.module_id) {
+ case MODULE_MM:
+ {
+ IntraL3Msg_t *mmInMsg = &inMsg.intraL3Msg;
+
+ DBG_TRACE("MM->CC MAIN LOG: Received Msg(%d) Prim(%d) entryId(%d)\n",
+ mmInMsg->message_type,
+ mmInMsg->primitive_type,
+ mmInMsg->entry_id);
+
+ switch (mmInMsg->primitive_type) {
+ case INTRA_L3_MM_EST_IND:
+ {
+ T_CNI_RIL3_CM_SERVICE_TYPE cmServType =
+ mmInMsg->l3_data.servReq.cmServiceType.serviceType;
+
+ if ((cmServType != CNI_RIL3_CM_SERVICE_TYPE_MO_CALL_OR_PACKET_MODE) &&
+ (cmServType != CNI_RIL3_CM_SERVICE_TYPE_EMERGENCY_CALL ) &&
+ (cmServType != CNI_RIL3_CM_SERVICE_TYPE_SUPPLEMENTARY_SERVICE ) &&
+ (cmServType != CNI_RIL3_CM_SERVICE_TYPE_SHORT_MESSAGE_SERVICE ) )
+ {
+ // This CM Service Type not allowed
+ // Clear the call - Send Rel Req to MM
+ IntraL3Msg_t mmOutMsg;
+ sendMM (INTRA_L3_MM_REL_REQ,
+ INTRA_L3_NULL_MSG,
+ mmInMsg->entry_id,
+ &mmOutMsg);
+ break;
+ }
+
+ if ((callId = mobInCall2 (mmInMsg->entry_id)) != JCC_ERROR)
+ {
+ DBG_WARNING ("MM->CC MAIN WARNING: recv MM-EST-IND but CallTask already allocated sessionId(%d)\n",
+ callId);
+ }
+ else if ( initNewMSConn(mmInMsg->entry_id, callId) == JCC_ERROR )
+ {
+ DBG_WARNING("MM->CC MAIN WARNING: New Connection could not be initialized\n");
+
+ // Clear the call - Send Rel Req to MM
+ IntraL3Msg_t mmOutMsg;
+ sendMM (INTRA_L3_MM_REL_REQ,
+ INTRA_L3_NULL_MSG,
+ mmInMsg->entry_id,
+ &mmOutMsg);
+ break;
+ }
+
+ //
+ semTake(ccSession[callId].semId, WAIT_FOREVER);
+
+ // Find the ludbIndex for the Originating IMSI
+ if (JCC_ERROR ==
+ (ccSession[callId].sessionHandler->ludbIndex
+ = ludbGetEntryByMobileId(mmInMsg->l3_data.servReq.mobileId)))
+ {
+ // We need to take care of the case where we
+ // retrieve the profile when not present.
+ DBG_WARNING("MM->CC MAIN WARNING: Originating Mobile not registered in LUDB sessionId(%d)\n",
+ callId);
+
+ // Reset the IRT Table entry to point to the mother task's Queue
+ ccSession[callId].sessionHandler->resetIrt();
+
+ handleReleaseSession(&ccSession[callId]);
+ IntraL3Msg_t mmOutMsg;
+ sendMM (INTRA_L3_MM_REL_REQ,
+ INTRA_L3_NULL_MSG,
+ mmInMsg->entry_id,
+ &mmOutMsg);
+ semGive(ccSession[callId].semId);
+
+ break;
+ }
+
+ //CDR <xxu:08-23-00>
+ memcpy(&ccSession[callId].sessionHandler->mobileId,
+ &mmInMsg->l3_data.servReq.mobileId,
+ sizeof(T_CNI_RIL3_IE_MOBILE_ID));
+
+ // Store Mobile Classmark Info <chenj:07-24-01>
+ ccSession[callId].sessionHandler->classmark2Info =
+ mmInMsg->l3_data.servReq.classmark2;
+
+ // Setup the Session for Mobile Origination
+ if (!(ccSession[callId].sessionHandler->setupOrig(mmInMsg->entry_id, cmServType)))
+ {
+ handleReleaseSession(&ccSession[callId]);
+ IntraL3Msg_t mmOutMsg;
+ sendMM (INTRA_L3_MM_REL_REQ,
+ INTRA_L3_NULL_MSG,
+ mmInMsg->entry_id,
+ &mmOutMsg);
+ semGive(ccSession[callId].semId);
+ break;
+ }
+
+ // Give up the originating session semaphore.
+ semGive(ccSession[callId].semId);
+ break;
+ }
+
+ default:
+ DBG_WARNING("MM->CC MAIN WARNING: Unexpected Msg(%d) Prim(%d)MM.\n",
+ mmInMsg->message_type, mmInMsg->primitive_type);
+ }
+
+ break;
+ }
+ case MODULE_CC:
+ {
+ IntraL3Msg_t *ccInMsg = &inMsg.intraL3Msg;
+
+ DBG_TRACE("CC->CC MAIN LOG: Received msg(%d) callLeg(%d) signature(%d))\n",
+ ccInMsg->message_type, ccInMsg->entry_id, ccInMsg->signature);
+
+ if (ccInMsg->message_type != INTRA_L3_TIMEOUT_MSG)
+ {
+ DBG_ERROR("CC->CC MAIN LOG: Unexpected (Msg Type = %d) from CC.\n",
+ ccInMsg->message_type);
+ break;
+ }
+
+ // Inform for debugging
+ // Action - Kill and restart the call process?
+ DBG_ERROR("CC->CC MAIN ERROR: Call running too long(infinite loop?) CallTaskId(%d)\n",
+ ccInMsg->entry_id);
+ break;
+ }
+
+ case MODULE_H323:
+ {
+ IntraL3Msg_t *h323InMsg = &inMsg.intraL3Msg ;
+ short ludbIndex = h323InMsg->entry_id;
+ bool isFirstSetup = true ;
+
+ DBG_TRACE("H323->CC MAIN LOG: Received a VOIP message {msgType=%d, h323Hndl=%p, entryId=%d}\n",
+ h323InMsg->message_type,
+ (int)(h323InMsg->call_handle),
+ h323InMsg->entry_id);
+
+ switch (h323InMsg->message_type) {
+ case INTRA_L3_CC_Q931_SETUP:
+ if ((callId = ccIsHandoverCallSetup(h323InMsg)) != JCC_ERROR)
+ {
+ DBG_TRACEei("{\nMNETeiTRACE(ccMain): received ext-handin SETUP {msgType=%d, callId=%d, h323Hndl=%p, entryId=%d\n}\n",
+ h323InMsg->message_type,
+ callId,
+ (int)(h323InMsg->call_handle),
+ h323InMsg->entry_id);
+
+ //Proceed with setting up the handover call leg
+ if ( !ccSession[callId].sessionHandler->setupTermExtHo(h323InMsg) )
+ {
+ //Failed to setup the handover call leg, report the failure and abort ext-handin
+ DBG_ERRORei("{\nMNETeiERROR(ccMain): setupTermExtHo failed {msgType=%d, callId=%d, h323Hndl=%p, entryId=%d\n}\n",
+ h323InMsg->message_type,
+ callId,
+ (int)(h323InMsg->call_handle),
+ h323InMsg->entry_id);
+
+ DBG_CCDATA(callId);
+
+ //Give up this ext-handin call leg setup and notify VOIP task
+ if (!sendH323DisconnectMsgExtHo(h323InMsg->call_handle,
+ CNI_RIL3_CAUSE_CALL_REJECTED) )
+ {
+ DBG_ERRORei("{\nMNETeiERROR(ccMain): sendH323 DISCONNECT failed {msgType=%d, callId=%d, h323Hndl=%p, entryId=%d, ccCause=%d\n}\n",
+ h323InMsg->message_type,
+ callId,
+ (int)(h323InMsg->call_handle),
+ h323InMsg->entry_id,
+ (int)CNI_RIL3_CAUSE_CALL_REJECTED);
+ }
+
+ //Cleanup
+ sessionDataInit(callId);
+
+ break;
+ }
+
+ //Proceed the handin callleg setup to its responsible call task
+
+ ccSession[callId].sessionHandler->hoCallHandle = h323InMsg->call_handle;
+
+ if (ERROR == msgQSend( ccSession[callId].msgQId,
+ (char *) h323InMsg,
+ sizeof(struct IntraL3Msg_t),
+ NO_WAIT,
+ MSG_PRI_NORMAL
+ ) )
+ {
+ DBG_ERRORei("{\nMNETeiERROR(ccMain): msgQSend error {QID=%p, msgType=%d, callId=%d, h323Hndl=%p, entryId=%d\n}\n",
+ (int)ccSession[callId].msgQId,
+ h323InMsg->message_type,
+ callId,
+ (int)(h323InMsg->call_handle),
+ h323InMsg->entry_id
+ );
+
+ DBG_CCDATA(callId);
+
+ //vxWorks API failed, abort the the handin effort.
+ if (!sendH323DisconnectMsgExtHo( h323InMsg->call_handle,
+ CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER ))
+ {
+ DBG_ERRORei("{\nMNETeiERROR(ccMain): sendH323 DISCONNECT failed {msgType=%d, callId=%d, h323Hndl=%p, entryId=%d, ccCause=%d\n}\n",
+ h323InMsg->message_type,
+ callId,
+ (int)(h323InMsg->call_handle),
+ h323InMsg->entry_id,
+ (int)CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER);
+ }
+
+ //Cleanup
+ sessionDataInit(callId);
+
+ break;
+ }
+
+ break;
+
+ } //ext-HO <xxu:05-07-10> END
+
+ else
+ {
+ if (!ludbGetSubscInfoExists(ludbIndex))
+ {
+
+ DBG_ERROR("H323->CC MAIN ERROR: VOIP passed an invalid ludb index(%d) Msg(%d)\n",
+ ludbIndex, h323InMsg->message_type);
+
+ //CDR <xxu:08-23-00>
+ if (!sendH323DisconnectMsg(h323InMsg,
+ CDR_REC_UNSUCCESSFUL_CALL_ATTEMPT,
+ CNI_RIL3_CAUSE_CALL_REJECTED))
+ {
+ DBG_ERROR("H323->CC MAIN ERROR: Failed to send Disconnect cdrCause(%d) ccCause(%d)\n",
+ (int)CDR_REC_UNSUCCESSFUL_CALL_ATTEMPT,
+ (int)CNI_RIL3_CAUSE_CALL_REJECTED);
+ }
+
+ break;
+ }
+
+ // Check if the user is already in a call. Entry id has the ludb index
+ if ((callId = mobInCall(ludbIndex))
+ != JCC_ERROR)
+ {
+ // Need to send this event to the existing call.
+ // Use the current call Id.
+ isFirstSetup = false;
+ }
+
+ // Connection Initialization -
+ // New MS MM Connection that needs a CC level service
+ else if ((callId = ccCallAlloc ())
+ == JCC_ERROR)
+ {
+ DBG_WARNING("H323->CC MAIN WARNING: No CC Connections left for allocation Msg(%d)\n",
+ h323InMsg->message_type);
+
+ //CDR <xxu:08-23-00>
+ if (!sendH323DisconnectMsg( h323InMsg,
+ CDR_REC_UNSUCCESSFUL_CALL_ATTEMPT,
+ CNI_RIL3_CAUSE_SWITCHING_EQUIPMENT_CONGESTION ))
+ {
+
+ DBG_ERROR("H323->CC MAIN ERROR: Failed to send Disconnect cdrCause(%d) ccCause(%d)\n",
+ (int)CDR_REC_UNSUCCESSFUL_CALL_ATTEMPT,
+ (int)CNI_RIL3_CAUSE_SWITCHING_EQUIPMENT_CONGESTION);
+ }
+
+
+ break;
+ }
+
+ // first and the concecutive MT call setups
+ semTake(ccSession[callId].semId, WAIT_FOREVER);
+
+ //3TY<xxu: 04-09-99> race condition
+ ccSession[callId].free = false ;
+ ccSession[callId].sessionHandler->ludbIndex = ludbIndex;
+
+ // Setup the Session for Mobile Termination
+ if (!ccSession[callId].sessionHandler->setupTerm( h323InMsg->call_handle ,
+ (int)h323InMsg->H323CRV,
+ 0 ,
+ isFirstSetup ))
+ {
+ // Do not proceed with the termination attempt.
+ // MM Setup in progress initiated by the SMS-PP or another call setup
+ // Busy and Call Waiting cases are handled inside setupTerm.
+
+ DBG_TRACE("H323->CC MAIN TRACE: setupTerm failed Msg(%d) h323CallHandle(%p) sessionId(%d) ludbId(%d)\n",
+ h323InMsg->message_type,
+ (int)(h323InMsg->call_handle), callId,
+ h323InMsg->entry_id);
+
+ //CDR <xxu:08-23-00>
+ if (!sendH323DisconnectMsg( h323InMsg,
+ CDR_REC_UNSUCCESSFUL_CALL_ATTEMPT,
+ CNI_RIL3_CAUSE_USER_BUSY))
+ {
+ DBG_ERROR("H323->CC MAIN ERROR: Failed to send Disconnect cdrCause(%d) ccCause(%d)\n",
+ (int)CDR_REC_UNSUCCESSFUL_CALL_ATTEMPT,
+ (int)CNI_RIL3_CAUSE_USER_BUSY);
+ }
+
+ // Give up the terminating session semaphore.
+ semGive(ccSession[callId].semId);
+
+ break;
+ }
+
+ // Give up the terminating session semaphore.
+ semGive(ccSession[callId].semId);
+
+ if (ERROR == msgQSend( ccSession[callId].msgQId,
+ (char *) h323InMsg,
+ sizeof(struct IntraL3Msg_t),
+ NO_WAIT, //PR1553 <xxu> WAIT_FOREVER,
+ MSG_PRI_NORMAL
+ ) )
+ {
+
+ DBG_ERROR("H323->CC MAIN ERROR: sendCC msgQSend (QID = %p) error\n ",
+ (int)ccSession[callId].msgQId);
+
+ //CAUSE<xxu:03-21-00> BEGIN
+ //Major problem with the queue. Need to release the call!
+ //sessionDataInit(callId);
+
+ //CDR <xxu:08-23-00>
+ if (!sendH323DisconnectMsg( h323InMsg,
+ CDR_REC_UNSUCCESSFUL_CALL_ATTEMPT,
+ CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER ))
+ {
+ DBG_ERROR("H323->CC MAIN ERROR: Failed to send Disconnect cdrCause(%d) ccCause(%d)\n",
+ (int)CDR_REC_UNSUCCESSFUL_CALL_ATTEMPT,
+ (int)CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER);
+ }
+
+ sessionDataInit(callId);
+
+ break;
+ }
+
+ break;
+ }
+
+ case INTRA_L3_SMS_MESSAGE:
+ {
+ /* Expecting MNSMS-EST Req only. MNSMS-ABORT Req should be discarded.
+ All the other messages will be rejected. */
+
+ SMS_VBLINK_MSGTYPE MsgType = (SMS_VBLINK_MSGTYPE)h323InMsg->l3_data.smsVbMsg.hdr.msgType;
+
+ if (MsgType == MNSMS_ABORT_Req || MsgType == MNSMS_REL_Req)
+ {
+ // Late Abort Mobile is not involved in any activities. Do nothing
+ DBG_TRACE ("Late MNSMS-ABORT Req ref. number %d received from ViperBase.\n",
+ h323InMsg->l3_data.smsVbMsg.hdr.refNum);
+ break;
+ }
+
+ if (MsgType != MNSMS_EST_Req)
+ {
+ // Late SMS message other than Abort or Release. Need to be rejected.
+ DBG_TRACE ("Late MNSMS message type %d, ref. number %d received from ViperBase.\n",
+ MsgType, h323InMsg->l3_data.smsVbMsg.hdr.refNum);
+
+ if (!smsSendVbLinkRelease(ludbIndex, h323InMsg->l3_data.smsVbMsg.hdr.refNum))
+ {
+ DBG_ERROR("SMS->VOIP Error : Failed to reject SMS transaction.\n");
+ }
+ break;
+ }
+
+ if (!ludbGetSubscInfoExists (ludbIndex))
+ { // received ludb index is not valid
+ DBG_ERROR ("SMS->VOIP Error : Message contains invalid LUDB index =%d\n",
+ ludbIndex);
+
+ /* This error could only happend due to an implementation error in VB<->VC.
+ Send MNSMS-ERROR Ind to the originator.
+ This will require allocate Call task, initialize it, send reject and
+ reliase. Very low chance for a potential problem: could be no availiable
+ CC. */
+
+ if (!smsSendVbLinkRelease(ludbIndex, h323InMsg->l3_data.smsVbMsg.hdr.refNum,
+ CNI_RIL3_RP_CAUSE_UNIDENTIFIED_SUBSCRIBER))
+ {
+ DBG_ERROR("SMS->VOIP Error: Failed to reject SMS transaction.\n");
+ }
+ break;
+ }
+
+ if ((callId = mobInCall(ludbIndex)) != JCC_ERROR)
+ {
+ // Need to send this event to the existing call.
+ // Use an existing call Id.
+ isFirstSetup = false;
+ }
+ // Connection Initialization -
+ // New MS MM Connection that needs CM level service
+ else if ((callId = ccCallAlloc ()) == JCC_ERROR)
+ {
+ // Error - No Connections left.
+ if (!smsSendVbLinkRelease(ludbIndex, h323InMsg->l3_data.smsVbMsg.hdr.refNum,
+ CNI_RIL3_RP_CAUSE_CONGESTION ))
+ {
+ DBG_ERROR("SMS->VOIP Error: Failed to reject SMS transaction.\n");
+ }
+
+ DBG_WARNING ("CC Warning: No Connections left.\n");
+ break;
+ }
+
+ // first and the concecutive MT SMS setups
+ semTake (ccSession[callId].semId, WAIT_FOREVER);
+
+ ccSession[callId].free = false ;
+ ccSession[callId].sessionHandler->ludbIndex = ludbIndex;
+
+ // Setup the Session for SMS Mobile Termination
+ // New function (setupSmsTerm) or modify the existing one???
+ if (!ccSession[callId].sessionHandler->setupTerm(VOIP_NULL_CALL_HANDLE,
+ 0 , //CDR <xxu:08-24-00>
+ 0 , //CDR <xxu:08-24-00>
+ isFirstSetup ))
+ {
+ // Do not proceed with the termination attempt.
+ // 1.MM MT Setup in progress initiated by SMS-PP or MT call setup
+ // 2.MS is involved in ongoing MT SMS transfer
+
+ if (!smsSendVbLinkRelease (ludbIndex, h323InMsg->l3_data.smsVbMsg.hdr.refNum,
+ CNI_RIL3_RP_CAUSE_CONGESTION ))
+ {
+ DBG_ERROR ("SMS->VOIP Error: Failed to reject SMS transaction.\n");
+ }
+
+ // Give up the terminating session semaphore.
+ semGive (ccSession[callId].semId);
+
+ DBG_TRACE ("MT SMS attempt is rejected due to busy conditions.\n");
+ break;
+ }
+
+ // Give up the terminating session semaphore.
+ semGive(ccSession[callId].semId);
+
+ if (ERROR == msgQSend (ccSession[callId].msgQId ,
+ (char *) h323InMsg ,
+ sizeof(struct IntraL3Msg_t),
+ NO_WAIT , //PR1553 <xxu> WAIT_FOREVER
+ MSG_PRI_NORMAL ))
+ {
+ // Major problem with the queue. Need to release the call
+ if (!smsSendVbLinkRelease(ludbIndex, h323InMsg->l3_data.smsVbMsg.hdr.refNum))
+ {
+ DBG_ERROR ("SMS->VOIP Error: Failed to reject SMS transaction.\n");
+ }
+
+ DBG_ERROR ("CC->CC Call(SMS) Error: sendCC msgQSend (QID = %p) error\n ",
+ (int)ccSession[callId].msgQId);
+
+ sessionDataInit (callId);
+
+ break;
+ }
+ }
+ break;
+
+ case INTRA_L3_CC_VC_UPDATE_INFO:
+ {
+ DBG_TRACE ("H323->CC MAIN LOG: Received VC Update Msg(%d) for this GP\n",
+ h323InMsg->message_type);
+
+ if (h323InMsg->l3_data.statusVCMsg.status != VC_STATUS_DOWN)
+ {
+ // Unknown ViperCell Status
+ DBG_WARNING ("H323->CC MAIN WARNING: Received unknown ViperCell update status %d\n",
+ h323InMsg->l3_data.statusVCMsg.status);
+ break;
+ }
+
+ for (callId = 0; callId < CC_MAX_CC_CALLS; ++callId)
+ {
+ if (ccSession[callId].free != True &&
+ ccSession[callId].sessionHandler != NULL )
+ {
+ //GCELL<tyu:06-01-01>
+ if (ccSession[callId].sessionHandler->handoverSession->hoGlobalCellId_.ci ==
+ h323InMsg->l3_data.statusVCMsg.btsID.cellId &&
+ ccSession[callId].sessionHandler->handoverSession->hoGlobalCellId_.lac ==
+ h323InMsg->l3_data.statusVCMsg.btsID.networkId)
+ // networkId is not in use
+ {
+ // This active CC session is involved in Handover with
+ // the failed ViperCell
+ if (msgQSend (ccSession[callId].msgQId,
+ (char *)h323InMsg ,
+ sizeof (IntraL3Msg_t) ,
+ NO_WAIT , //PR1553 <xxu> WAIT_FOREVER
+ MSG_PRI_NORMAL ) == ERROR)
+ {
+ DBG_ERROR ("H323->CC MAIN ERROR: sendCC msgQSend (QID = %p) error Msg(%d)\n ",
+ (int)ccSession[h323InMsg->entry_id].msgQId,
+ h323InMsg->message_type);
+ } // Sending Msg
+ } // Compare cell ID
+ } // Check Call session
+ } // for loop
+ break;
+ }
+
+ default:
+
+ // route messages that come with a null txn id through CC Main Task.
+ if (h323InMsg->entry_id == VOIP_API_NULL_TXN_ID)
+ {
+ // Null value is received for transaction id.
+ // Check if there is a valid call with this call handle
+ if ((h323InMsg->entry_id = findCallUsingCallHandle( h323InMsg->call_handle))
+ == (CC_MAX_CC_CALLS))
+ {
+ DBG_WARNING("H323->CC MAIN WARNING: Late Msg. for (Handle = %p) with Null Transaction Id.\n",
+ (int)h323InMsg->call_handle);
+
+ }
+ else
+ {
+ if (ERROR == msgQSend( ccSession[h323InMsg->entry_id].msgQId,
+ (char *) h323InMsg,
+ sizeof(struct IntraL3Msg_t),
+ NO_WAIT, //PR1553 <xxu> WAIT_FOREVER,
+ MSG_PRI_NORMAL
+ ) )
+ {
+ DBG_ERROR("H323->CC MAIN ERROR: sendCC msgQSend (QID = %p) error Msg(%d)\n ",
+ (int)ccSession[h323InMsg->entry_id].msgQId,
+ h323InMsg->message_type);
+
+ }
+ else
+ {
+ DBG_WARNING("H323->CC MAIN WARNING: Msg(%d) for (Handle=%p) w/Null Tran. for (call=%d),(ludbId=%d)\n",
+ h323InMsg->message_type,
+ (int)h323InMsg->call_handle,
+ h323InMsg->entry_id,
+ ccSession[h323InMsg->entry_id].sessionHandler->ludbIndex);
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ //ext-HO <xxu:05-16-01>
+ case MODULE_EXTHOA:
+ {
+ InterHoaVcMsg_t *hoaInMsg = &inMsg.hoaCcMsg;
+ DBG_TRACEei("{\nMNETeiTRACE(ccMain): Received Msg from HOA (msgType=%d)\n}\n",
+ hoaInMsg->msgType);
+
+ switch (hoaInMsg->msgType)
+ {
+ case INTER_EHO_PERFORM_HANDOVER_REQUEST:
+ {
+ // Handle external-handin scenario
+ if (JCC_ERROR == (callId=ccCallAlloc()) )
+ {
+ // Error - No Connections left. N need to send Handover Nack for now
+ // other side will timeout
+ DBG_WARNINGei("{\nMNETeiWARNING(ccMain): No Connections left in GP10\n}\n");
+ break;
+ }
+
+ //
+ semTake(ccSession[callId].semId, WAIT_FOREVER);
+
+ if (ERROR == msgQSend( ccSession[callId].msgQId,
+ (char *) &inMsg,
+ sizeof(struct VcCcMsg_t),
+ NO_WAIT,
+ MSG_PRI_NORMAL
+ ) )
+ {
+ // Need to release the call!
+ handleReleaseSession(&ccSession[callId]);
+
+ // no need to send Handover Nack for now. other side will timeout
+ DBG_ERRORei("{\nMNETeiERROR(ccMain): msgQSend failed! (QID=%p, callId=%d)\n}\n",
+ (int)ccSession[callId].msgQId, callId);
+ }
+
+ // Setup the Session for Mobile Handover
+ ccSession[callId].sessionHandler->setupTargetHandoverExtHo();
+
+ // Give up the handover session semaphore.
+ semGive(ccSession[callId].semId);
+ break;
+ }
+
+ default:
+ {
+
+ DBG_ERRORei("{\nMNETeiWARNING(ccMain): received unexpected msg from HOA (msgType=%d)\n}\n",
+ hoaInMsg->msgType);
+ break;
+ }
+
+ }
+
+ break;
+
+ }
+
+ case MODULE_EXT_VC:
+ {
+ InterVcMsg_t *vcInMsg = &inMsg.vcCcMsg.vcToVcMsg;
+
+ DBG_TRACE ("VC->CC MAIN LOG: Received Msg(%d) from another GP\n",
+ vcInMsg->msgType);
+
+ switch (vcInMsg->msgType) {
+ case INTER_VC_CC_PERFORM_HANDOVER:
+ {
+
+ // Connection Initialization -
+ // New Handover Connection that needs a CC level service
+
+ if ((callId = ccCallAlloc())
+ == JCC_ERROR)
+ {
+ // Error - No Connections left.
+ // no need to send Handover Nack for now
+ // other side will timeout
+ DBG_WARNING("VC->CC MAIN WARNING: No Connections left for handover\n ");
+ break;
+ }
+
+ //
+ semTake(ccSession[callId].semId, WAIT_FOREVER);
+
+ if (ERROR == msgQSend( ccSession[callId].msgQId,
+ (char *) &inMsg,
+ sizeof(struct VcCcMsg_t),
+ NO_WAIT, //PR1553 <xxu> WAIT_FOREVER,
+ MSG_PRI_NORMAL
+ ) )
+ {
+ // Need to release the call!
+ handleReleaseSession(&ccSession[callId]);
+
+ // no need to send Handover Nack for now
+ // other side will timeout
+ DBG_ERROR("VC->CC MAIN ERROR: sendCC msgQSend (QID = %p) sessionId(%d) error\n ",
+ (int)ccSession[callId].msgQId, callId);
+ }
+
+ // Setup the Session for Mobile Handover
+ ccSession[callId].sessionHandler->setupTargetHandover();
+
+ // Give up the handover session semaphore.
+ semGive(ccSession[callId].semId);
+ break;
+ }
+
+ default:
+ DBG_ERROR("VC->CC MAIN ERROR: Unexpected (Msg Type = %d) from other ViperCell.\n",
+ vcInMsg->msgType);
+ }
+
+ break;
+ }
+
+ case MODULE_OAM:
+ TrapMsg *oamInMsg;
+ oamInMsg = (TrapMsg*)&inMsg;
+ DBG_TRACE("OAM->CC MAIN LOG: received an OAM msg(%d) tag(%x) valTyp(%d) val(%d)\n",
+ oamInMsg->msgType,
+ oamInMsg->mibTag,
+ oamInMsg->valType,
+ oamInMsg->val.varVal);
+
+ callOamProcessTrapMsg((TrapMsg *) &inMsg);
+ break;
+
+ case MODULE_RM:
+ case T_CNI_MD_ID:
+ default:
+ // log as a warning. let the user of the system take action based on other symptoms.
+ DBG_WARNING("CC MAIN WARNING: (Late?) Msg. from unexpected Module, (Mod. Id = %d)(primTyp=%d) (sapi %d, entryId %d)\n",
+ inMsg.intraL3Msg.module_id, inMsg.mdMsg.primitive_type,
+ inMsg.mdMsg.sapi,
+ inMsg.mdMsg.entry_id
+ );
+ }
+ }
+ }
+}
+
diff --git a/data/mnet/GP10/Host/cc/src/CCUtil.cpp b/data/mnet/GP10/Host/cc/src/CCUtil.cpp
new file mode 100644
index 0000000..7c81e65
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCUtil.cpp
@@ -0,0 +1,222 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCUtil.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "JCC/JCCLog.h"
+#include "logging/VCLOGGING.h"
+
+#include "stdio.h"
+
+#include "CC/CCsessionHandler.h"
+
+// included L3 Message header for messages from other Layer 3 modules (CC, RR)
+#include "JCC/JCCL3Msg.h"
+#include "rm/rm_ccintf.h"
+
+#include "ril3/ril3_sms_rp.h"
+#include "voip/vblink.h"
+
+
+// CC Message Constants
+#include "CC/CCconfig.h"
+
+#include "CC/CCUtil.h"
+
+bool smsSendVbLinkRelease (LUDB_ID, UINT32, T_CNI_RIL3_RP_CAUSE_VALUE cause =
+ CNI_RIL3_RP_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE);
+
+extern bool smsUseVblink;
+
+
+/*----------------------------------------------------------------*/
+
+void ccEntryInit(CCSession_t *session)
+{
+ session->free = true;
+
+}
+
+// Handles the release of a session
+void
+handleReleaseSession(CCSession_t *session)
+{
+ DBG_FUNC("handleReleaseSession", CC_LAYER);
+ DBG_ENTER();
+ ccEntryInit(session);
+ DBG_LEAVE();
+}
+
+short ccCallAlloc()
+{
+ DBG_FUNC("ccCallAlloc", CC_LAYER);
+ DBG_ENTER();
+ short i;
+ for(i=0; i< CC_MAX_CC_CALLS; i++)
+ {
+ if (ccSession[i].free == true)
+ {
+ // take the semaphore for the originating session.
+ semTake(ccSession[i].semId, WAIT_FOREVER);
+
+ ccSession[i].free = false;
+
+ semGive(ccSession[i].semId);
+
+ DBG_LEAVE();
+ return i;
+ }
+ }
+
+ DBG_LEAVE();
+ return JCC_ERROR;
+}
+
+
+short initNewMSConn (const T_CNI_IRT_ID newEntryId,
+ short &callIndex )
+{
+ short retVal = JCC_SUCCESS;
+ T_CNI_L3_ID newId ;
+
+ DBG_FUNC("initNewMSConn", CC_LAYER);
+ DBG_ENTER();
+
+ // Connection Initialization -
+ // New MS MM Connection that needs a CC level service
+ if ((callIndex = ccCallAlloc()) == JCC_ERROR)
+ {
+ // Error - No Connections left.
+ DBG_ERROR ("CC Error : No Connections left. \n ");
+
+ retVal = JCC_ERROR;
+ }
+ else
+ {
+ DBG_TRACE ("CC Log: (call selected = %d) for (entry id = %d) \n", callIndex, newEntryId);
+
+ newId.msgq_id = ccSession[callIndex].msgQId;
+ newId.sub_id = 0 ; // No sub id needed here
+
+ // Update IRT
+ if (ccSession[callIndex].sessionHandler->setIrt (newEntryId, newId) == false)
+ {
+ semTake ( ccSession[callIndex].semId, WAIT_FOREVER);
+ handleReleaseSession (&ccSession[callIndex] );
+ semGive ( ccSession[callIndex].semId);
+
+ retVal = JCC_ERROR;
+ }
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+void ccEntryPrint(CCSession_t &session, JCCPrintStFn fnPtr)
+{
+ char callStr1[90];
+
+ // Pre-format the call data Strings.
+ sprintf(&callStr1[0],
+ "Sess. Data: (Qid %p), (TaskId %p) (callId %d)\n",
+ session.msgQId,
+ session.taskId,
+ session.callIndex);
+
+ (*fnPtr)(&callStr1[0]);
+
+ session.sessionHandler->printData(fnPtr);
+
+}
+
+
+// Internal Data Printing
+void ccDataPrint()
+{
+ short i;
+ for(i=0; i< CC_MAX_CC_CALLS;i++)
+ {
+ printf("CC Session#(%d):", i);
+ if (ccSession[i].free)
+ {
+ printf(" is free\n");
+ }
+ else
+ {
+ ccEntryPrint(ccSession[i], JCCPrintf);
+ }
+ }
+}
+
+
+bool smsSendVbLinkRelease(LUDB_ID ludbIndex, UINT32 refNum,
+ T_CNI_RIL3_RP_CAUSE_VALUE cause = CNI_RIL3_RP_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE)
+/* Used to send MNSMS-ERROR Ind from outside SMS Leg. Mostly in error cases. */
+{
+ SmsVblinkMsg_t smsMsgOut;
+ bool retVal = true;
+
+ DBG_FUNC ("smsSendVbLinkRelease", CC_SMS_LAYER); //Igal: change it later to CC_LAYER
+ DBG_ENTER();
+
+ memset (&smsMsgOut, sizeof (SmsVblinkMsg_t), 0);
+
+ // prepare message data. Ensure the network byte order for the header elements
+ smsMsgOut.hdr.magic = htonl (SMS_MAGIC_NUMBER);
+ smsMsgOut.hdr.refNum = htonl (refNum );
+ smsMsgOut.hdr.msgType = htonl (MNSMS_ERROR_Ind );
+ smsMsgOut.hdr.status = htonl (cause );
+ smsMsgOut.hdr.msgLen = htonl (0 );
+
+ // sent message to VBLink
+ if (smsUseVblink)
+ {
+ // The total message length calculation could be wrong
+ // if ported to the different platform or
+ // compiled with the word alignment other than 4 bytes
+ retVal = VBLinkMsToNetSmspp (ludbIndex ,
+ (unsigned char *)&smsMsgOut,
+ SMS_VBLINK_HDRSIZE );
+ DBG_TRACE ("Send MNSMS-ERROR Ind, ref. number %d, cause %d \n", refNum, cause);
+ }
+ else
+ {
+ DBG_TRACE ("SMS: VBLink interface is OFF. Message will not be send to ViperBase\n");
+ DBG_HEXDUMP ((unsigned char *)&smsMsgOut, sizeof (SMS_VBLINK_HDRSIZE));
+ }
+
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+//ext-HO <xxu:05-16-01>
+void ccSetCallTrace(void)
+{
+ ccCallTrace=true;
+}
+
+void ccResetCallTrace(void)
+{
+ ccCallTrace=false;
+}
+
diff --git a/data/mnet/GP10/Host/cc/src/CCconfig.cpp b/data/mnet/GP10/Host/cc/src/CCconfig.cpp
new file mode 100644
index 0000000..f12ba9e
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CCconfig.cpp
@@ -0,0 +1,62 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCconfig.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+// included VxWorks headers
+#include "vxWorks.h"
+#include "MnetModuleId.h"
+#include "taskLib.h"
+
+#include "CC/CCconfig.h"
+
+#include "Os/JCTask.h"
+#include "GP10OsTune.h"
+
+#include "stdio.h"
+
+// declare the CC task entry function
+extern int ccMain();
+extern JCTask ccTaskObj;
+
+
+void ccInit()
+{
+ // This CC configuration function initializes the entire CC
+ // module.
+ //
+ // A typical invocation is usually be done from the
+ // OA&M subsystem
+
+ // create the CC task
+ if( ERROR == ccTaskObj.JCTaskSpawn(
+ CC_TASK_PRIORITY, // priority
+ CC_TASK_OPTION, // option word
+ CC_TASK_STACK_SIZE, // stack size
+ (FUNCPTR) ccMain, // entry function pointer
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ MODULE_CC,
+ JC_CRITICAL_TASK) )
+ {
+ // error creating task. log the error and return.
+ printf("CC FATAL ERROR: failed to create CC Main task.\n" );
+ };
+}
+
diff --git a/data/mnet/GP10/Host/cc/src/CallConfig.cpp b/data/mnet/GP10/Host/cc/src/CallConfig.cpp
new file mode 100644
index 0000000..b75f635
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CallConfig.cpp
@@ -0,0 +1,73 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CallConfig.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+// included VxWorks headers
+#include "vxWorks.h"
+#include "JCC/JCCLog.h"
+#include "MnetModuleId.h"
+#include "taskLib.h"
+#include "stdio.h"
+
+#include "CC/CCconfig.h"
+#include "Os/JCTask.h"
+#include "GP10OsTune.h"
+
+// declare the CC task entry function
+extern int callMain(const short callIndex);
+extern JCTask *CallTaskObjs[CC_MAX_CC_CALLS_DEF_VAL];
+
+
+int callInit(const short callIndex)
+{
+ // This call configuration function initializes one call session task.
+ //
+ // A typical invocation is usually be done from the
+ // CC subsystem
+
+ int taskId;
+ char callTaskName[10];
+
+ sprintf(&callTaskName[0], "Call-%d\0", callIndex);
+
+ // create the call task
+ CallTaskObjs[callIndex] = new JCTask(&callTaskName[0]);
+ if(( taskId = CallTaskObjs[callIndex]->JCTaskSpawn(
+ CC_SUB_TASK_PRIORITY, // priority
+ CC_SUB_TASK_OPTION, // option word
+// Calltask (Call-0) was overflowing at 10,352 bytes with
+// external handover turned on and doing 3 way call hold/retrieve toggling
+// The stack size is increased to 20,000 for now.
+// Need to find a better number later!
+// ext-ho <chenj:08-16-01>
+ CC_SUB_TASK_STACK_SIZE * 2, // stack size
+ (FUNCPTR) callMain, // entry function pointer
+ callIndex, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ MODULE_CC,
+ JC_NON_CRITICAL_TASK) )
+ == ERROR )
+ {
+ // error creating task. log the error and return.
+ printf("CC CALL FATAL ERROR: failed to create CC Call (task = %d)\n",
+ callIndex);
+ };
+ return taskId;
+}
diff --git a/data/mnet/GP10/Host/cc/src/CallLeg.cpp b/data/mnet/GP10/Host/cc/src/CallLeg.cpp
new file mode 100644
index 0000000..6653016
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CallLeg.cpp
@@ -0,0 +1,558 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CallLeg.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-99
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+//
+#include "taskLib.h"
+
+#include "jcc/JCCLog.h"
+
+#include "logging/VCLOGGING.h"
+
+#include "defs.h"
+#include "oam_api.h"
+#include "pm/pm_class.h"
+
+#include "CC/CCSessionHandler.h"
+
+#include "CC/CallLeg.h"
+
+extern int CALL_CDR_10M;
+
+#include "new.h"
+
+// Temporarily use csu_head instead of csu_intf
+#include "csunew/csu_head.h"
+
+//CDR <xxu:08-24-00>
+//CDR <xxu:08-21-00> BEGIN
+#include "JCC/LUDBapi.h"
+#include "CDR/CdrVoiceCall.h"
+#include "CDR/CdrSSA.h"
+extern BtsBasicPackage ccBtsBasicPackage;
+
+// *******************************************************************
+// forward declarations.
+// *******************************************************************
+
+//BCT-TEST
+//BCT <xxu:07-12-00> BEGIN
+
+T_CNI_RIL3_SI_TI
+//CallLeg::getBctTi()
+TwoPartyCallLeg::getBctTi()
+{
+ return (parent->bctTi_);
+}
+bool
+//CallLeg::getBctInvoke()
+TwoPartyCallLeg::getBctInvoke()
+{
+ return (parent->bctInvoke_);
+}
+
+TwoPartyCallLeg*
+//CallLeg::getBctLeg()
+TwoPartyCallLeg::getBctLeg()
+{
+ return (parent->bctLeg_);
+}
+
+T_CNI_IRT_ID
+//CallLeg::getEntryId()
+TwoPartyCallLeg::getEntryId()
+{
+ return (parent->entryId);
+}
+
+CCHandover*
+//CallLeg::getHandoverSession()
+TwoPartyCallLeg::getHandoverSession()
+{
+ return (parent->handoverSession);
+}
+
+CCAnchorHandover*
+//CallLeg::getAnchorHandoverSession()
+TwoPartyCallLeg::getAnchorHandoverSession()
+{
+ return (parent->anchorHandoverSession);
+}
+
+HJCRTPSESSION
+//CallLeg::getHoRtpSession()
+TwoPartyCallLeg::getHoRtpSession()
+{
+ if ( (parent->handoverSession != NULL) &&
+ (parent->handoverSession == parent->anchorHandoverSession) )
+ return (parent->handoverSession->hoRtpSession_);
+ else
+ return (NULL);
+}
+//BCT <xxu:07-12-00> END
+
+T_CNI_LAPDM_OID
+CallLeg::oid()
+{
+ return(parent->oid);
+}
+
+T_CNI_IRT_ID
+CallLeg::entryId()
+{
+ return(parent->entryId);
+}
+
+short
+CallLeg::ludbIndex()
+{
+ return(parent->ludbIndex);
+}
+
+CallLeg::CallLeg ()
+{
+}
+
+TwoPartyCallLeg::TwoPartyCallLeg (CCSessionHandler *session,
+ int callId, MSG_Q_ID qid,
+ short legNum)
+{
+ CallLeg::parent = session;
+ CallLeg::callIndex = callId;
+ CallLeg::msgQId = qid;
+ CallLeg::callLegNum = legNum;
+
+ msSide = NULL;
+
+ voiceConnected = false;
+
+ // allocate half call store to the maximum size possible.
+ halfCallStorage =
+ operator new[] ((sizeof(CCOrigHalfCall) > sizeof(CCTermHalfCall))
+ ? sizeof(CCOrigHalfCall)
+ : sizeof(CCTermHalfCall));
+
+ //PR1378 <xxu:08-16-00> Begin
+
+ UINT16 uint16TimerValue;
+ int timerValue;
+
+ uint16TimerValue = (((UINT16)(legNum)) & (0x000F)) << 8;
+ uint16TimerValue = uint16TimerValue | (((UINT16)(callIndex)) & 0x00FF);
+ timerValue = (short)uint16TimerValue;
+
+ tclTimer = new JCCTimer(callTimerExpiry, timerValue);
+
+ //PR1378 <xxu:08-16-00> End
+
+ //CDR <xxu:08-22-00> BEGIN
+ uint16TimerValue = (((UINT16)(legNum)) & (0x000F)) << 8;
+ uint16TimerValue = uint16TimerValue | (((UINT16)(callIndex)) & 0x00FF);
+ timerValue = (short)uint16TimerValue;
+ timerValue |= 0xF0000000; //add CDR timer signature
+ ccCdrTimer = new JCCTimer(callTimerExpiry, timerValue);
+ //CDR <xxu:08-22-00> END
+
+ initData();
+
+}
+
+void
+CallLeg::initData ()
+{
+ DBG_FUNC("CallLeg::initData", CC_CALLLEG_LAYER);
+ DBG_ENTER();
+
+ idle = true;
+
+ cdrIndex = 0;
+ callRefValue = 0;
+
+ DBG_LEAVE();
+}
+
+void
+TwoPartyCallLeg::cleanup (T_CNI_RIL3_CAUSE_VALUE cause)
+{
+ DBG_FUNC("TwoPartyCallLeg::cleanup", CC_CALLLEG_LAYER);
+ DBG_ENTER();
+
+ if (msSide != NULL)
+ {
+ msSide->rlsCause.causeValue = cause;
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ msSide->voipReleaseCause_ = cause;
+
+ //CAUSE<xxu:03-21-00> END
+
+ msSide->cleanup();
+ }
+
+ initData();
+
+ DBG_LEAVE();
+}
+
+void
+TwoPartyCallLeg::initData ()
+{
+ DBG_FUNC("TwoPartyCallLeg::initData", CC_CALLLEG_LAYER);
+ DBG_ENTER();
+
+ waitingCallLeg = false;
+
+ //BCT <xxu:07-13-00> BEGIN
+ if ( (parent->bctLeg_ != NULL) || (parent->bctInvoke_) )
+ {
+ parent->bctTi_ = ORIG_OR_MASK;
+ parent->bctInvoke_ = false;
+ parent->bctLeg_ = NULL;
+ }
+ //BCT <xxu:07-13-00> END
+
+ //BCT <xxu:09-22-00>
+ bctArrival_ = false;
+
+ //CDR <xxu:08-22-00>
+ ccCdrCallState = false;
+ ccCdrTimer->cancelTimer();
+ tclTimer->cancelTimer();
+
+ h323CallHandle = VOIP_NULL_CALL_HANDLE;
+ disconnectSentToVoip = false;
+
+ procType = CC_PROC_NULL;
+ msSide = NULL;
+
+ h245ChannState = RES_ST_IDLE;
+
+ // Do the following only if entry id is valid.
+ // In terminations and cleanups, it may not be setup yet.
+ // Release Connection resources, if there are any
+ if (voiceConnected)
+ {
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(h323CallHandle);
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+
+ JCCLog2("CSU Error : Disconn. Failure, (Result = %d) for (RTPHandle = %p)\n",
+ csuResult, (int)rtpSourcePort.portId.rtpHandler);
+ DBG_ERROR("CSU Error : Disconn. Failure, (Result = %d) for (RTPHandle = %p)\n",
+ csuResult, (int)rtpSourcePort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+
+ voiceConnected = false;
+ }
+
+ isEmergencyCall = false;
+
+ CallLeg::initData ();
+ DBG_LEAVE();
+
+}
+
+void
+TwoPartyCallLeg::handleReleaseCall()
+{
+ DBG_FUNC("TwoPartyCallLeg::handleReleaseCall", CC_CALLLEG_LAYER);
+ DBG_ENTER();
+
+ // check both sides - for now no VOIP in CC.
+ // if ((origSide->callState_ == HC_ST_FREE) &&
+ // (termSide->callState_ == HC_ST_FREE) )
+
+ DBG_TRACE("CC Info: CallLeg releaseCall cause(%d) ccCdrCallState(%d)\n",
+ msSide->rlsCause.causeValue, ccCdrCallState);
+
+ //CDR <xxu:08-22-00> BEGIN
+ //Collect CDR data for all call releases if its call leg already set up
+ if (msSide != NULL && this != parent->bctLeg_)
+ {
+ CdrRecCauseTerm_t cdrCause;
+
+ if (ccCdrCallState)
+ {
+ if ( msSide->rlsCause.causeValue != CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING )
+ cdrCause = CDR_REC_STABLE_CALL_ABNORMAL_TERM;
+ else
+ cdrCause = CDR_REC_NORM_RELEASE;
+ } else
+ cdrCause = CDR_REC_UNSUCCESSFUL_CALL_ATTEMPT;
+
+ ccCdr.release(msSide->rlsCause.causeValue, cdrCause);
+ ccCdrTimer->cancelTimer();
+ ccCdrCallState = false;
+ }
+ //CDR <xxu:08-22-00> END
+
+ initData();
+ DBG_LEAVE();
+}
+
+void
+CallLeg::printData (JCCPrintStFn fnPtr)
+{
+}
+
+void
+TwoPartyCallLeg::printData (JCCPrintStFn fnPtr)
+{
+ char * tpClStr1Ptr = "Two Party Call Leg :\n";
+ char tpClStr2[120];
+
+ // Pre-format the call data Strings.
+ sprintf(&tpClStr2[0],
+ "(proc %d) (h245ChSt %d) (conn. %d) (discSenttoVoip %d) (callHnd %p) (callLegNum %p)\n",
+ procType,
+ h245ChannState,
+ voiceConnected,
+ disconnectSentToVoip,
+ h323CallHandle,
+ callLegNum
+ );
+
+ (*fnPtr)(tpClStr1Ptr);
+ (*fnPtr)(&tpClStr2[0]);
+
+ if (msSide != NULL)
+ {
+ msSide->printData(fnPtr);
+ }
+
+}
+
+void
+TwoPartyCallLeg::setupOrig (T_CNI_RIL3_SI_TI ti,
+ T_CNI_RIL3_CM_SERVICE_TYPE serviceRequested)
+{
+ DBG_FUNC("TwoPartyCallLeg::setupOrig", CC_CALLLEG_LAYER);
+ DBG_ENTER();
+
+ idle = false;
+ procType = CC_PROC_MOB_ORIG;
+
+ //PR1378 <xxu:08-16-00>
+ origSide = new (halfCallStorage) CCOrigHalfCall(this, tclTimer);
+ msSide = origSide;
+
+ // set this boolean to true until we actually send a setup request to VOIP.
+ disconnectSentToVoip = true;
+
+ isEmergencyCall = (serviceRequested == CNI_RIL3_CM_SERVICE_TYPE_EMERGENCY_CALL);
+
+ origSide->setupNewCall(ti, serviceRequested);
+
+ //CDR <xxu:08-21-00> BEGIN
+ ccCdr.initialize();
+
+ if (isEmergencyCall && parent->mobileId.mobileIdType==CNI_RIL3_IMEI)
+ {
+ ccCdr.setServedIMEI(&parent->mobileId);
+ ccCdr.seisure_EmergencyOrigination(ti);
+ }
+ else
+ {
+ if (ludbGetSubscInfoExists(parent->ludbIndex))
+ {
+ ccCdr.setServedIMSI(ludbGetMobileIdPtr(parent->ludbIndex));
+ T_SUBSC_IE_ISDN *msisdn;
+ msisdn = ludbGetMSISDNPtr(parent->ludbIndex);
+ msisdn->num_plan[0] = 0x11;
+ ccCdr.setServedMSISDN(msisdn);
+ }
+
+ ccCdr.seisure_NormalOrigination(ti);
+ }
+ //Load up with Location area info
+ T_CNI_RIL3_IE_LOCATION_AREA_ID lai;
+ T_CNI_RIL3_IE_CELL_ID ci;
+
+ ci.ie_present = true;
+ ci.value = ((short)(ccBtsBasicPackage.bts_ci));
+
+ lai.ie_present = true;
+ lai.mcc[0] = ((char*)&(ccBtsBasicPackage.bts_mcc))[0];
+ lai.mcc[1] = ((char*)&(ccBtsBasicPackage.bts_mcc))[1];
+ lai.mcc[2] = ((char*)&(ccBtsBasicPackage.bts_mcc))[2];
+ lai.mnc[0] = ((char*)&(ccBtsBasicPackage.bts_mnc))[0];
+ lai.mnc[1] = ((char*)&(ccBtsBasicPackage.bts_mnc))[1];
+ lai.lac = ((short)(ccBtsBasicPackage.bts_lac));
+
+ ccCdr.setLocationAreaCID(&lai,&ci);
+
+ DBG_TRACE("mcc(%d,%d,%d) mnc(%d,%d) lac(%d) ci(%d)\n",
+ lai.mcc[0],lai.mcc[1],lai.mcc[2],lai.mnc[0],lai.mnc[1],lai.lac,ci.value);
+
+ DBG_TRACE("MCC(%d,%d,%d) MNC(%d,%d)\n",
+ ((char*)&(ccBtsBasicPackage.bts_mcc))[0],
+ ((char*)&(ccBtsBasicPackage.bts_mcc))[1],
+ ((char*)&(ccBtsBasicPackage.bts_mcc))[2],
+ ((char*)&(ccBtsBasicPackage.bts_mnc))[0],
+ ((char*)&(ccBtsBasicPackage.bts_mnc))[1]);
+
+ //CDR <xxu:08-21-00> END
+
+ DBG_LEAVE();
+
+}
+
+bool
+TwoPartyCallLeg::isActive(void)
+{
+ DBG_FUNC("TwoPartyCallLeg::isActive", CC_CALLLEG_LAYER);
+ DBG_ENTER();
+
+ if (msSide != NULL) {
+ DBG_LEAVE();
+ return(msSide->callState_==HC_ST_ACTIVE);
+ }
+}
+
+void
+TwoPartyCallLeg::setupTerm (VOIP_CALL_HANDLE voipCallHandle,
+ int index,
+ int refValue,
+ bool callWaiting)
+{
+ DBG_FUNC("TwoPartyCallLeg::setupTerm", CC_CALLLEG_LAYER);
+ DBG_ENTER();
+
+ idle = false;
+ procType = CC_PROC_MOB_TERM;
+
+ //PR1378 <xxu:08-11-00>
+ termSide = new (halfCallStorage) CCTermHalfCall(this, tclTimer);
+
+ msSide = termSide;
+ h323CallHandle = voipCallHandle;
+ waitingCallLeg = callWaiting;
+
+ //CDR <xxu:08-21-00>
+ ccCdr.initialize();
+
+ if (ludbGetSubscInfoExists(parent->ludbIndex))
+ {
+ ccCdr.setServedIMSI(ludbGetMobileIdPtr(parent->ludbIndex));
+ T_SUBSC_IE_ISDN *msisdn;
+ msisdn = ludbGetMSISDNPtr(parent->ludbIndex);
+ msisdn->num_plan[0] = 0x11;
+ ccCdr.setServedMSISDN(msisdn);
+ //ccCdr.setServedMSISDN(ludbGetMSISDNPtr(parent->ludbIndex));
+ }
+
+ ccCdr.seisure_NormalTermination(callLegNum);
+ ccCdr.setQ931Crv( (unsigned short)index );
+
+ //ccCdr.setCallingPartyNumber(h323InMsg->setup.CallingPartyNumber);
+ //ccCdr.setCalledPartyNumber(h323InMsg->setup.CalledPartyNumber);
+
+ //Load up with Location area info
+ T_CNI_RIL3_IE_LOCATION_AREA_ID lai;
+ T_CNI_RIL3_IE_CELL_ID ci;
+
+ ci.ie_present = true;
+ ci.value = ((short)(ccBtsBasicPackage.bts_ci));
+
+ lai.ie_present = true;
+ lai.mcc[0] = ((char*)&(ccBtsBasicPackage.bts_mcc))[0];
+ lai.mcc[1] = ((char*)&(ccBtsBasicPackage.bts_mcc))[1];
+ lai.mcc[2] = ((char*)&(ccBtsBasicPackage.bts_mcc))[2];
+ lai.mnc[0] = ((char*)&(ccBtsBasicPackage.bts_mnc))[0];
+ lai.mnc[1] = ((char*)&(ccBtsBasicPackage.bts_mnc))[1];
+ lai.lac = ((short)(ccBtsBasicPackage.bts_lac));
+
+ ccCdr.setLocationAreaCID(&lai,&ci);
+
+ DBG_TRACE("mcc(%d,%d,%d) mnc(%d,%d) lac(%d) ci(%d)\n",
+ lai.mcc[0],lai.mcc[1],lai.mcc[2],lai.mnc[0],lai.mnc[1],lai.lac,ci.value);
+
+ DBG_TRACE("MCC(%d,%d,%d) MNC(%d,%d)\n",
+ ((char*)&(ccBtsBasicPackage.bts_mcc))[0],
+ ((char*)&(ccBtsBasicPackage.bts_mcc))[1],
+ ((char*)&(ccBtsBasicPackage.bts_mcc))[2],
+ ((char*)&(ccBtsBasicPackage.bts_mnc))[0],
+ ((char*)&(ccBtsBasicPackage.bts_mnc))[1]);
+
+ DBG_LEAVE();
+}
+
+int
+TwoPartyCallLeg::handleTimeoutMsg(IntraL3Msg_t *ccInMsg)
+{
+ DBG_FUNC("TwoPartyCallLeg::handleTimeoutMsg", CC_CALLLEG_LAYER);
+ DBG_ENTER();
+
+ if (msSide != NULL)
+ {
+ //CDR <xxu:08-22-00> BEGIN
+ int retVal;
+
+ retVal = 0;
+
+ if ( (ccInMsg->signature & 0xF0000000) == 0xF0000000 )
+ {
+ // handle 10min call duration timeout for CDR
+ if (ccCdrCallState)
+ {
+ ccCdr.generateCallRecord(true);
+ ccCdrTimer->setTimer(CALL_CDR_10M);
+ }
+ } else
+ {
+ if ( (msSide->callState_ == OHC_ST_OFFERING_CALL) && parent->bctInvoke_ && parent->bctMainLeg_)
+ {
+ CCdrSSA bctCdr;
+ if (ludbGetSubscInfoExists(parent->ludbIndex))
+ {
+ bctCdr.setServedIMSI(ludbGetMobileIdPtr(parent->ludbIndex));
+ bctCdr.setServedMSISDN(ludbGetMSISDNPtr(parent->ludbIndex));
+ }
+ bctCdr.setCorrelatedEventRefNumber(parent->bctMainLeg_->ccCdr.getEventRefNumber());
+ bctCdr.generateRecord(CDR_SS_ACTION_INVOCATION, SUPP_SERV_ECT, CNI_RIL3_CAUSE_TEMPORARY_FAILURE);
+ }
+
+ retVal = msSide->handleTimeoutMsg(ccInMsg);
+ }
+
+ //CDR <xxu:08-22-00> END
+
+ DBG_LEAVE();
+ return (retVal);
+ }
+
+ DBG_ERROR("Call Leg Error : Unexpected Timeout Message\n");
+ DBG_LEAVE();
+ return(0);
+}
+
+
+
+
diff --git a/data/mnet/GP10/Host/cc/src/CallTask.cpp b/data/mnet/GP10/Host/cc/src/CallTask.cpp
new file mode 100644
index 0000000..1ed5178
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CallTask.cpp
@@ -0,0 +1,358 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CallTask.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description : The Main Loop for each individual task.
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+// included VxWorks headers
+#include "vxWorks.h"
+#include "taskLib.h"
+
+#include "logging/VCLOGGING.h"
+
+// included L3 Message header for messages from other Layer 3 modules (CC, RR)
+#include "JCC/JCCL3Msg.h"
+
+// CC Message Constants
+#include "CC/CallConfig.h"
+#include "CC/CCTypes.h"
+#include "CC/CCInt.h"
+#include "CC/CCUtil.h"
+#include "CC/CCH323Util.h"
+#include "CC/CCHalfCall.h"
+#include "CC/CCSessionHandler.h"
+
+#include "taskLib.h"
+
+#include "Os/JCTask.h"
+
+// included MD and IRT headers for messages from MS
+#include "ril3/ril3_common.h"
+
+#include "ril3/ril3md.h"
+
+// included LAPDm header for downlink messages
+#include "lapdm/lapdm_l3intf.h"
+
+#include "oam_api.h"
+#include "vipermib.h"
+
+extern DbgOutput Dbg;
+
+extern bool callTrace;
+
+JCTask *CallTaskObjs[CC_MAX_CC_CALLS_DEF_VAL];
+
+inline int JCCDBG_TRACE1(char *str) { DBG_TRACE(str); return true;};
+
+// entry function for the Call Module (VxWorks Task)
+int callMain(const short callIndex)
+{
+ DBG_FUNC(taskName(taskIdSelf()), CC_LAYER);
+ DBG_ENTER();
+
+ // This task's call session
+ CCSession_t *callSession = &ccSession[callIndex];
+
+ // local message queue buffer
+ CCMMInputMsg_t inMsg;
+
+ // enter infinite loop to wait for message and process message from MS
+ // or other layer-3 modules
+ CallTaskObjs[callIndex]->JCTaskEnterLoop();
+
+ while (true)
+ {
+ if (msgQReceive (callSession->msgQId,
+ (char *) &inMsg ,
+ CC_MAX_MSG_LENGTH ,
+ WAIT_FOREVER )
+ == ERROR)
+ {
+ // failed to receive message. VxWorks error. Abort the task.
+ printf("??->CC CALL FATAL ERROR: failed to read VxWorks message queue\n" );
+ DBG_LEAVE();
+ return ERROR;
+ }
+
+ DBG_TRACE ("M%d->CC CALL LOG: Call Task \"%s\" Received a message\n",
+ inMsg.intraL3Msg.module_id, taskName(taskIdSelf()));
+
+ //ISSUE<xxu:04-12-00>
+ if (callSession->free && inMsg.intraL3Msg.message_type != INTRA_L3_CC_Q931_SETUP)
+ {
+ if ( (inMsg.intraL3Msg.module_id == MODULE_MM) &&
+ (inMsg.intraL3Msg.primitive_type == INTRA_L3_MM_EST_CNF) )
+ {
+ // handle the case where a late establish confirm comes in
+ // for a page request or a handover request that was previously sent.
+ IntraL3Msg_t mmOutMsg;
+ sendMM (INTRA_L3_MM_REL_REQ,
+ INTRA_L3_NULL_MSG,
+ inMsg.intraL3Msg.entry_id,
+ &mmOutMsg);
+ }
+ else
+ {
+ DBG_WARNING("M%d->CC CALL WARNING: Received Unexpected/Late Msg(%d) Prim(%d) sessionId(%d)\n",
+ inMsg.intraL3Msg.module_id,
+ inMsg.intraL3Msg.message_type,
+ inMsg.intraL3Msg.primitive_type,
+ callSession->callIndex
+ );
+ DBG_WARNING("CC CALL WARNING: Check protocol at the source. \n");
+ }
+ }
+
+ else
+ {
+ // take the semaphore before processing the message.
+ semTake(callSession->semId, WAIT_FOREVER);
+
+ //ISSUE<xxu: 04-12-00>
+ callSession->free = false;
+
+ // Call the safety timer before processing the message,
+ // because of event loops. msg sent to mother CC task.
+ callSession->safetyTimer->setTimer(CALL_SAFETY_TIMER);
+
+ // action based on the sending module
+ //
+ switch (inMsg.intraL3Msg.module_id)
+ {
+ case T_CNI_MD_ID:
+ {
+ T_CNI_RIL3MD_CCMM_MSG *msInMsg = &inMsg.mdMsg;
+
+ DBG_TRACE("MD->CC CALL LOG: Received Prim(%d) sessionId(%d)\n",
+ msInMsg->primitive_type,
+ callSession->callIndex);
+
+ callSession->sessionHandler->handleMobMsg(msInMsg);
+
+ break;
+ }
+
+ case MODULE_MM:
+ {
+ IntraL3Msg_t *mmInMsg = &inMsg.intraL3Msg;
+
+ DBG_TRACE("MM->CC CALL LOG: Received Msg(%d) Prim(%d) entryId(%d) sessionId(%d)\n",
+ mmInMsg->message_type,
+ mmInMsg->primitive_type,
+ mmInMsg->entry_id,
+ callSession->callIndex);
+
+ callSession->sessionHandler->handleMMMsg(mmInMsg);
+
+ break;
+ }
+
+ case MODULE_RM:
+ {
+ IntraL3Msg_t *rrInMsg = &inMsg.intraL3Msg;
+
+ DBG_TRACE("RM->CC CALL LOG: Recived Msg(%d) Prim(%d) entryId(%d) sessionId(%d)\n",
+ rrInMsg->message_type,
+ rrInMsg->primitive_type,
+ rrInMsg->entry_id,
+ callSession->callIndex);
+
+ if (callTrace)
+ {
+ ccEntryPrint(*callSession, JCCDBG_TRACE1);
+ }
+
+ callSession->sessionHandler->handleRRMsg(rrInMsg);
+
+ break;
+ }
+
+ // <Igal 31-5-00> Updated for handling forwarded interVC PDUs
+ case MODULE_CC:
+ {
+ IntraL3Msg_t *ccInMsg = &inMsg.intraL3Msg ;
+
+ DBG_TRACE("CC->CC CALL LOG: Received msg(%d) callLeg(%d) signature(%d) sessionId(%d)\n",
+ ccInMsg->message_type, ccInMsg->entry_id, ccInMsg->signature,
+ callSession->callIndex);
+
+ switch (ccInMsg->message_type)
+ {
+ case INTRA_L3_TIMEOUT_MSG:
+ callSession->sessionHandler->handleTimeoutMsg (ccInMsg);
+ break;
+
+ default:
+ DBG_ERROR("CC->CC CALL ERROR: Unexpected (Msg Type = %d) from CC.\n",
+ ccInMsg->message_type);
+ }
+
+ break;
+ }
+
+ case MODULE_H323:
+ {
+ IntraL3Msg_t *h323InMsg = &inMsg.intraL3Msg;
+
+ //ext-HO <xxu: 05-10-01>
+ if ( h323InMsg->call_handle != -1 ) // If first message from VOIP in calltask, then can NOT be related to external handover
+ {
+ if ( (callSession->sessionHandler->hoCallHandle==h323InMsg->call_handle) || // note: hoCallHandle is used for hand-in case only
+ (h323InMsg->callleg_id == 7) ) // JOE: Use constant instead of hard-coded value for hoCallLeg
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(callMain): Recv VOIP Msg (msgType=%d, hoHndl=%p, callId=%d, ludbId=%d)\n}\n",
+ h323InMsg->message_type,
+ (int)(h323InMsg->call_handle),
+ callSession->callIndex,
+ h323InMsg->entry_id);
+
+ if (callSession->sessionHandler->handleH323MsgExtHo(h323InMsg) )
+ {
+ DBG_ERRORho("{\nMNEThoERROR(callMain): Recv VOIP Msg (msgType=%d, hoHndl=%p, callId=%d, ludbId=%d)\n}\n",
+ h323InMsg->message_type,
+ (int)(h323InMsg->call_handle),
+ callSession->callIndex,
+ h323InMsg->entry_id);
+ }
+ }
+ else if ( h323InMsg->callleg_id == 8 ) // JOE: Use constant instead of hard-coded value for h3CallLeg
+ {
+ DBG_TRACEho("{\nMNEThoTRACE(callMain): Recv VOIP Msg (msgType=%d, h3Hndl=%p, callId=%d, ludbId=%d)\n}\n",
+ h323InMsg->message_type,
+ (int)(h323InMsg->call_handle),
+ callSession->callIndex,
+ h323InMsg->entry_id);
+
+ if (callSession->sessionHandler->handleH323MsgExtH3(h323InMsg) )
+ {
+ DBG_ERRORho("{\nMNEThoERROR(callMain): Recv VOIP Msg (msgType=%d, h3Hndl=%p, callId=%d, ludbId=%d)\n}\n",
+ h323InMsg->message_type,
+ (int)(h323InMsg->call_handle),
+ callSession->callIndex,
+ h323InMsg->entry_id);
+ }
+ }
+ else
+ {
+ DBG_TRACE("H323->CC CALL LOG: Received Msg(%d) h323CallHandle(%p) sessionId(%d)\n",
+ h323InMsg->message_type,
+ (int)(h323InMsg->call_handle),
+ callSession->callIndex);
+
+ callSession->sessionHandler->handleH323Msg(h323InMsg);
+ }
+ }
+ else
+ {
+ DBG_TRACE("H323->CC CALL LOG: Received Msg(%d) h323CallHandle(%p) sessionId(%d)\n",
+ h323InMsg->message_type,
+ (int)(h323InMsg->call_handle),
+ callSession->callIndex);
+
+ callSession->sessionHandler->handleH323Msg(h323InMsg);
+ }
+
+ break;
+ }
+
+ //ext-HO <xxu:05-16-01>
+ case MODULE_EXTHOA:
+ {
+ InterHoaVcMsg_t *hoaInMsg = &inMsg.hoaCcMsg;
+
+ DBG_TRACEho("{\nMNEThoTRACE(callMain): Received Msg from HOA (msgType=%d, callId=%d)\n}\n",
+ hoaInMsg->msgType, callSession->callIndex);
+
+ DBG_CCDATA(callSession->callIndex);
+
+ callSession->sessionHandler->handleHoaCcMsg(hoaInMsg);
+
+ break;
+ }
+
+ case MODULE_EXT_VC:
+ {
+ InterVcMsg_t *vcInMsg = &inMsg.vcCcMsg.vcToVcMsg;
+
+ DBG_TRACE ("VC->CC CALL LOG: Received Msg(%d) from another GP\n",
+ vcInMsg->msgType);
+
+ if (callTrace)
+ {
+ ccEntryPrint (*callSession, JCCDBG_TRACE1);
+ }
+
+ callSession->sessionHandler->handleVcCcMsg (vcInMsg);
+
+ break;
+ }
+
+ case MODULE_CISS:
+ {
+ CISSVblinkMsg_t *cissInMsg = &inMsg.intraL3Msg.l3_data.cissMsg;
+
+ DBG_TRACE("VB->CC CISS: Received Msg(%d) from ViperBase\n",
+ cissInMsg->msgType);
+
+ if (callTrace)
+ {
+ ccEntryPrint(*callSession, JCCDBG_TRACE1);
+ }
+
+ callSession->sessionHandler->handleVbCissMsg(inMsg.intraL3Msg.l3_data.cissMsg);
+
+ break;
+ }
+
+ case MODULE_LUDB:
+ {
+ DBG_TRACE ("LUDB->CC CALL LOG: Received Msg (%d) sessionId(%d)\n",
+ inMsg.intraL3Msg.message_type, callSession->callIndex );
+
+ if (inMsg.intraL3Msg.message_type == INTRA_L3_LUDB_PURGE_PROFILE)
+ {
+ callSession->sessionHandler->cleanup (CNI_RIL3_CAUSE_REQUESTED_SERVICE_NOT_SUBSCRIBED);
+ }
+ else
+ {
+ DBG_ERROR ("CC Call Error: Unexpected Msg [type = %d] from LUDB.\n",
+ inMsg.intraL3Msg.message_type );
+ }
+ break;
+ }
+
+
+ default:
+ // log error
+ DBG_ERROR("CC CALL ERROR: Received a Msg from unexpected (Module = %d).\n",
+ inMsg.intraL3Msg.module_id);
+ }
+
+ // Now let go of the semaphores.
+ semGive(callSession->semId);
+
+ // Message Processing complete. Cancel the safety timer.
+ callSession->safetyTimer->cancelTimer();
+ }
+ }
+ CallTaskObjs[callIndex]->JCTaskNormExit();
+}
+
+
diff --git a/data/mnet/GP10/Host/cc/src/CissCallLeg.cpp b/data/mnet/GP10/Host/cc/src/CissCallLeg.cpp
new file mode 100644
index 0000000..57a6343
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/CissCallLeg.cpp
@@ -0,0 +1,262 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 0.1
+// Status : Under development
+// File : CissCallLeg.cpp
+// Author(s) : Bhawani Sapkota
+// Create Date : 11-22-1999
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+//
+
+#include "CC/CallLeg.h"
+#include "CC/CCSessionHandler.h"
+
+
+#define CC_CISS_LAYER 3
+
+// #include "cdr.h"
+// #include "CallCDR.h"
+
+// *******************************************************************
+//
+// *******************************************************************
+bool VBLinkMsToNetCiss(LUDB_ID, unsigned char *, int);
+
+
+
+// converts the message from host byte ordering format
+// to the network byte ordering
+static bool
+ccCissPackVblinkMsg(unsigned char buffer[],
+ int &size,
+ CISSVblinkMsg_t &cissMsg
+ )
+{
+ CISSVblinkMsg_t dstMsg;
+ size = cissMsg.msgLen + kCissVbLinkMsgHdrLen;
+ bool status = false;
+
+ DBG_FUNC("ccCissPackVblinkMsg", CC_CISS_LAYER);
+ DBG_ENTER();
+
+
+ if (size > kCissVbLinkMsgHdrLen && size <= sizeof(CISSVblinkMsg_t))
+ {
+ dstMsg.Magic = htonl(VOIP_API_MAGIC_VALUE);
+ dstMsg.callIdx = htonl(cissMsg.callIdx);
+ dstMsg.msgType = htonl(cissMsg.msgType);
+ dstMsg.status = htonl(cissMsg.status);
+ dstMsg.msgLen = htonl(cissMsg.msgLen);
+ memcpy(dstMsg.msg, cissMsg.msg, cissMsg.msgLen);
+ memcpy(buffer, (char *)&dstMsg, size);
+ status = true;
+ } else {
+ DBG_ERROR("Incorrect message size = %d\n", cissMsg.msgLen);
+ }
+
+ DBG_LEAVE();
+ return status;
+}
+
+
+// call the vbLink routine to send message
+static bool ccCissSendToViberBase(LUDB_ID ludbIdx, CISSVblinkMsg_t& cissMsg)
+{
+ unsigned char buffer[sizeof (CISSVblinkMsg_t)];
+ int msgLen;
+ bool status = false;
+
+ DBG_FUNC("ccCissSendToViberBase", CC_CISS_LAYER);
+ DBG_ENTER();
+
+ if (ccCissPackVblinkMsg(buffer, msgLen, cissMsg))
+ {
+ DBG_TRACE("Ludb Index = %d, Buffer Len = %d\n", ludbIdx, msgLen);
+ DBG_HEXDUMP(buffer, msgLen);
+ status = VBLinkMsToNetCiss(ludbIdx, buffer, msgLen);
+ }
+
+ DBG_LEAVE();
+ return status;
+}
+
+// *******************************************************************
+// forward declarations.
+// *******************************************************************
+
+
+CISSCallLeg::CISSCallLeg (CCSessionHandler *session,
+ int callId,
+ MSG_Q_ID qid,
+ short callLegNum):cissState_(CISS_ST_IDLE)
+{
+ CallLeg::parent = session;
+ CallLeg::callIndex = callId;
+ CallLeg::msgQId = qid;
+ CallLeg::callLegNum = callLegNum;
+ initData();
+ return;
+
+}
+
+
+CISSCallLeg::~CISSCallLeg()
+{
+ return;
+}
+
+void
+CISSCallLeg::cleanup (T_CNI_RIL3_CAUSE_VALUE cause)
+{
+ DBG_FUNC("CISSCallLeg::cleanup", CC_CISS_LAYER);
+ DBG_ENTER();
+ initData();
+ DBG_LEAVE();
+ return;
+}
+
+void
+CISSCallLeg::initData ()
+{
+ DBG_FUNC("CISSCallLeg::initData", CC_CISS_LAYER);
+ DBG_ENTER();
+ //Just call the parent's routine
+ CallLeg::initData ();
+ DBG_LEAVE();
+
+}
+
+int
+CISSCallLeg::handleTimeoutMsg(IntraL3Msg_t *ccInMsg)
+{
+ DBG_FUNC("CISSCallLeg::handleTimeoutMsg", CC_CALLLEG_LAYER);
+ DBG_ENTER();
+
+ DBG_ERROR("Call Leg Error : Unexpected Timeout Message\n");
+
+ DBG_LEAVE();
+ return(0);
+}
+
+
+int
+CISSCallLeg::handleMsMsg(T_CNI_RIL3MD_CCMM_MSG *msInMsg)
+{
+ int retval = 0;
+ CISSVblinkMsg_t cissVbLinkMsg;
+ unsigned char buffer[sizeof(CISSVblinkMsg_t)];
+ int msgLen;
+
+ DBG_FUNC("CISSCallLeg::handleMsMsg", CC_CISS_LAYER);
+ DBG_ENTER();
+
+ cissVbLinkMsg.msgLen = msInMsg->l3_data.msgLength;
+ if (cissVbLinkMsg.msgLen > CNI_LAPDM_MAX_L3MSG_LENGTH || cissVbLinkMsg.msgLen <=0)
+ {
+ DBG_ERROR("CISS:Incorrect CISS Msg Len (Message len = %d)\n", cissVbLinkMsg.msgLen);
+ retval = 0-CNI_RIL3_CAUSE_INVALID_MANDATORY_INFO;
+ this->idle = true;
+ this->cissState_ = CISS_ST_IDLE;
+ } else {
+
+ cissVbLinkMsg.callIdx = this->callIndex;
+ memcpy(cissVbLinkMsg.msg, msInMsg->l3_data.buffer, cissVbLinkMsg.msgLen);
+ cissVbLinkMsg.msgType = CNI_RIL3SS_MSGID_REGISTER;
+ cissVbLinkMsg.status = 0;
+ if (ccCissSendToViberBase(this->ludbIndex(), cissVbLinkMsg))
+ {
+ this->idle = false;
+ this->cissState_ = CISS_ST_VB;
+ } else {
+ DBG_ERROR("CISS: Error Sending message to ViperBase\n");
+ retval = 0-CNI_RIL3_CAUSE_TEMPORARY_FAILURE;
+ this->idle = true;
+ this->cissState_ = CISS_ST_IDLE;
+ }
+
+ }
+
+ DBG_LEAVE();
+ return retval;
+}
+
+int
+CISSCallLeg::handleVbMsg(CISSVblinkMsg_t &netInMsg)
+{
+ int retval;
+
+ DBG_FUNC("CISSCallLeg::handleVbMsg", CC_CISS_LAYER);
+ DBG_ENTER();
+
+ T_CNI_LAPDM_L3MessageUnit l3msg;
+
+ l3msg.msgLength = (unsigned short) netInMsg.msgLen;
+ for(int i=0;i<l3msg.msgLength; i++) l3msg.buffer[i]= netInMsg.msg[i];
+
+ DBG_TRACE("CISS network message status = %d\n", netInMsg.status);
+
+ DBG_TRACE("CISS-->LAPDm CISS Message to Mobile (Type = %d)\n", netInMsg.msgType);
+ DBG_TRACE( "Oid = %d, Sapimain = %d, length=%d\n", oid(), SAPI_MAIN, l3msg.msgLength);
+ DBG_HEXDUMP(l3msg.buffer, l3msg.msgLength);
+
+ // send the message to LAPDm for delivery
+ // call the session handler sendL2 method
+ // if call is handed over to anotehr cell, sendL2 will take care of
+ // sending the Mobile message to the correct cell.
+ parent->sendL2Msg(&l3msg);
+
+
+ if (netInMsg.msgType == CNI_RIL3SS_MSGID_RELEASE_COMPLETE)
+ {
+ retval = 0 - netInMsg.status;
+ idle = true;
+ cissState_ = CISS_ST_IDLE;
+
+ } else {
+ idle = false;
+ cissState_ = CISS_ST_MS;
+ retval = 0;
+ }
+ DBG_TRACE( "idle = %d, cissState_ = %d, retval = %d\n", idle, cissState_, retval);
+ DBG_LEAVE();
+ return retval;
+}
+
+
+void
+CISSCallLeg::printData (JCCPrintStFn fnPtr)
+{
+ char * tpClStr1Ptr = "CISS Call Leg :\n";
+ char tpClStr2[120];
+
+ // Pre-format the call data Strings.
+ sprintf(&tpClStr2[0],
+ "(callIndex = %d) (callRefValue= %d) (CISS State = %d) (ludbIdx = %d) \n",
+ callIndex,
+ callRefValue,
+ cissState_,
+ ludbIndex()
+ );
+ (*fnPtr)(tpClStr1Ptr);
+ (*fnPtr)(&tpClStr2[0]);
+
+}
+
+
+
+
+
+
diff --git a/data/mnet/GP10/Host/cc/src/HOCallLeg.cpp b/data/mnet/GP10/Host/cc/src/HOCallLeg.cpp
new file mode 100644
index 0000000..c98429a
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/HOCallLeg.cpp
@@ -0,0 +1,353 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : HOCallLeg.cpp
+// Author(s) : Joe Chen
+// Create Date : 05-15-2001
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+//
+
+#include <vxworks.h>
+#include <string.h>
+#include <taskLib.h>
+
+#include "CC/CCUtil.h"
+
+
+#include "Logging\vcmodules.h"
+
+#include "CC/CCSessionHandler.h"
+
+#include "CC/HOCallLeg.h"
+
+#include "new.h"
+
+extern bool callTrace;
+
+// *******************************************************************
+//
+// *******************************************************************
+
+
+// *******************************************************************
+// HOCallLeg class
+// *******************************************************************
+
+
+HOCallLeg::HOCallLeg (CCSessionHandler *session,
+ int callId ,
+ MSG_Q_ID qid ,
+ short legNum )
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::HOCallLeg): entering......\n}\n");
+
+ // Init parent class data
+ HOCallLeg::parent = session;
+ HOCallLeg::callIndex = callId ;
+ HOCallLeg::msgQId = qid ;
+ HOCallLeg::callLegNum = legNum ;
+
+ msSide = NULL;
+ voiceConnected = false;
+
+ // allocate half call store to the maximum size possible.
+ halfExtHoCallStorage =
+ operator new[] ((sizeof(HOMoHalfCall) > sizeof(HOMtHalfCall))
+ ? sizeof(HOMoHalfCall)
+ : sizeof(HOMtHalfCall));
+
+ UINT16 uint16TimerValue;
+ int timerValue;
+
+ uint16TimerValue = (((UINT16)(legNum)) & (0x000F)) << 8;
+ uint16TimerValue = uint16TimerValue | (((UINT16)(callIndex)) & 0x00FF);
+ timerValue = (short)uint16TimerValue;
+
+ tclTimer = new JCCTimer(callTimerExpiry, timerValue);
+
+ initData ();
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::HOCallLeg): leaving.\n}\n");
+}
+
+
+void
+HOCallLeg::cleanup (T_CNI_RIL3_CAUSE_VALUE cause)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::cleanup): entering......\n}\n");
+
+ if (msSide != NULL)
+ {
+ msSide->rlsCause.causeValue = cause;
+
+ msSide->voipReleaseCause_ = cause;
+
+ msSide->cleanup();
+ }
+
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::cleanup): leaving.\n}\n");
+}
+
+void
+HOCallLeg::initData ()
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::cleanup): entering......\n}\n");
+
+ tclTimer->cancelTimer();
+
+ h323CallHandle = VOIP_NULL_CALL_HANDLE;
+ disconnectSentToVoip = false;
+
+ procType = CC_PROC_NULL;
+ msSide = NULL;
+
+ // Do the following only if entry id is valid.
+ // In terminations and cleanups, it may not be setup yet.
+ // Release Connection resources, if there are any
+ if (voiceConnected)
+ {
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(h323CallHandle);
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERRORho("{\nMNEThoTRACE(HOCallLeg::cleanup):CSU Error : Disconn. Failure, (Result = %d) for (RTPHandle = %p)\n}\n",
+ csuResult, (int)rtpSourcePort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+
+ voiceConnected = false;
+ }
+
+ CallLeg::initData ();
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::cleanup): leaving.\n}\n");
+
+}
+
+void
+HOCallLeg::handleReleaseCall()
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::handleReleaseCall): entering......\n}\n");
+
+ DBG_TRACEho(" CC Info: CallLeg releaseCall cause(%d)\n}\n",
+ msSide->rlsCause.causeValue);
+
+ initData();
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::handleReleaseCall): leaving.\n}\n");
+}
+
+void
+HOCallLeg::printData (JCCPrintStFn fnPtr)
+{
+ char * tpClStr1Ptr = "HO Call Leg :\n";
+ char tpClStr2[120];
+
+ // Pre-format the call data Strings.
+ sprintf(&tpClStr2[0],
+ "(proc %d) (conn. %d) (discSenttoVoip %d) (callHnd %p) (callLegNum %p)\n",
+ procType,
+ voiceConnected,
+ disconnectSentToVoip,
+ h323CallHandle,
+ callLegNum
+ );
+
+ (*fnPtr)(tpClStr1Ptr);
+ (*fnPtr)(&tpClStr2[0]);
+
+ if (msSide != NULL)
+ {
+ msSide->printData(fnPtr);
+ }
+
+}
+
+void
+HOCallLeg::setupOrigExtHo (void)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::setupOrigExtHo): entering......\n}\n");
+
+ idle = false;
+ procType = CC_PROC_MOB_ORIG;
+
+ origSide = new (halfExtHoCallStorage) HOMoHalfCall(this , tclTimer);
+
+ msSide = origSide;
+
+ // set this boolean to true until we actually send a setup request to VOIP.
+ disconnectSentToVoip = true;
+
+ origSide->setupNewCall();
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::setupOrigExtHo): leaving.\n}\n");
+
+}
+
+void
+HOCallLeg::disconnectOrigExtHo (void)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::disconnectOrigExtHo): entering......\n}\n");
+
+ origSide->disconnectNewCall();
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::disconnectOrigExtHo): leaving.\n}\n");
+}
+
+void
+HOCallLeg::setupTermExtHo (IntraL3Msg_t* h323InMsg)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::setupTermExtHo): entering......\n}\n");
+
+
+ DBG_TRACEho("{\nMNETeiTRACE(hoLeg::setupTermExtHo): setup hoCall (hoAgId=%d, callId=%d)\n}\n",
+ hoAgId(),callIndexEHO());
+
+ idle = false;
+ procType = CC_PROC_MOB_TERM;
+
+ termSide = new (halfExtHoCallStorage) HOMtHalfCall(this, tclTimer);
+
+ msSide = termSide;
+ h323CallHandle = h323InMsg->call_handle;
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::setupTermExtHo): leaving.\n}\n");
+}
+
+int
+HOCallLeg::handleTimeoutMsg(IntraL3Msg_t *ccInMsg)
+{
+ int retVal;
+
+ retVal = 0;
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::handleTimeoutMsg): entering......\n}\n");
+
+ if (msSide != NULL)
+ {
+ retVal = msSide->handleTimeoutMsg(ccInMsg);
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::handleTimeoutMsg): leaving.\n}\n");
+ return (retVal);
+ }
+
+ DBG_ERRORho(" Call Leg ERROR : Unexpected Timeout Message\n");
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::handleTimeoutMsg): leaving.\n}\n");
+ return(retVal);
+}
+
+
+//ext-HO <xxu:06-07-01>
+JcSubId_t
+HOCallLeg::hoAgId(void)
+{
+ if (parent->handoverSession != NULL)
+ return(parent->handoverSession->hoAgId_);
+ else
+ {
+ DBG_ERRORho("{\nMNEThoERROR(holeg:hoAgId): retrieve hoAgId but no handover session\n}\n");
+ return (-1);
+
+ }
+}
+
+//ext-HO <xxu:06-07-01>
+int
+HOCallLeg::callIndexEHO(void)
+{
+ if (parent->handoverSession != NULL)
+ return(parent->handoverSession->callIndex);
+ else
+ {
+ DBG_ERRORho("{\nMNEThoERROR(holeg:callIndex): retrieve callIndex but no handover session\n}\n");
+ return (-1);
+ }
+}
+
+//ext-HO <xxu:06-07-01>
+BOOL
+HOCallLeg::authTerm(void)
+{
+ return ((parent->handoverSession==NULL) ? true:false);
+}
+
+//ext-HO <xxu:06-07-01>
+T_CNI_RIL3_SPEECH_VERSION
+HOCallLeg::speechVersion(void)
+{
+ if (parent->handoverSession != NULL)
+ return (parent->handoverSession->currSpeechCh_.version);
+ else
+ {
+ DBG_ERRORho("{\nMNEThoERROR(holeg:speechVersion): retrieve current speech version but no handover session\n}\n");
+ return (CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1);
+ }
+}
+
+//ext-HO <xxu:06-07-01>
+BOOL
+HOCallLeg::cancelHoTimerIfNeeded(void)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::cancelHoTimerIfNeeded): entering......\n}\n");
+
+ BOOL ret = true;
+
+ if ( (parent->handoverSession->hoState_ == HAND_ST_TRG_HO_COMPLT) &&
+ (parent->handoverSession ==parent->targetHandoverSessionExtHo) )
+ {
+ //external handover--handin scenario
+ DBG_TRACEho("MNETeiTRACE(hoLeg::cancelHoTimerIfNeeded): [PLMN->MNET HANDOVER COMPLETE](hoAgId=%d,callId=%d,entryId=%d)\n}\n",
+ hoAgId(),callIndexEHO(),entryId());
+
+ parent->sessionTimer->cancelTimer();
+
+ } else if ( (parent->handoverSession->hoState_ == HAND_ST_ANCH_EHO_COMPLT) &&
+ (parent->handoverSession ==parent->anchorHandoverSession) )
+ {
+ DBG_TRACEho("MNETeoTRACE(hoLeg::cancelHoTimerIfNeeded): [MNET->PLMN HANDOVER COMPLETE](hoAgId=%d,callId=%d,entryId=%d)\n}\n",
+ hoAgId(),callIndexEHO(),entryId());
+
+ parent->sessionTimer->cancelTimer();
+
+ // Swap HO data if all is completed and we had handover to THIRD
+ if ( ( parent->anchorHandoverSession->hoType_ == HO_TY_EXT_HANDMSC3 ) ||
+ ( parent->anchorHandoverSession->hoType_ == HO_TY_MNET_NONANCHOR_HANDBACK_TO_MSC3 ) )
+ {
+ parent->anchorHandoverSession->swapH3Data();
+ parent->anchorHandoverSession->hoType_ = HO_TY_EXT_HANDOVER;
+ }
+ } else
+ {
+ DBG_WARNINGho("MNETeoTRACE(hoLeg::cancelHoTimerIfNeeded): Handover Call established but waiting for HANDOVER COMPLETE(hoAgId=%d,callId=%d,entryId=%d)\n}\n",
+ hoAgId(),callIndexEHO(),entryId());
+
+ ret = true; //false;
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOCallLeg::cancelHoTimerIfNeeded): leaving.\n}\n");
+ return (ret);
+}
+
+
diff --git a/data/mnet/GP10/Host/cc/src/HOHalfCall.cpp b/data/mnet/GP10/Host/cc/src/HOHalfCall.cpp
new file mode 100644
index 0000000..61e88c8
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/HOHalfCall.cpp
@@ -0,0 +1,808 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : HOHalfCall.cpp
+// Author(s) : Xiaode and Joe
+// Create Date : 05-15-2001
+// Description : HOHalfCall functionality for External Handovers
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+
+#include "CC/CCSessionHandler.h"
+#include "CC/CallConfig.h"
+#include "CC/HOHalfCall.h"
+
+#include "voip/voipapi.h"
+#include "CC/CCH323Util.h"
+
+#include "CC/CCUtil.h"
+
+
+HOHalfCallMsgHandler_t ehoCallStateHandler[MAX_EHO_CALL_STATES][MAX_EHO_CALL_EXTERNAL_EVENTS];
+
+/*******************************************************************/
+
+HOHalfCall::HOHalfCall ()
+{
+
+}
+
+
+void
+HOHalfCall::cleanup(void)
+{
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::cleanup): entering......\n}\n");
+
+ // Release Connection resources, if there are any
+ if (parent->voiceConnected)
+ {
+ T_CSU_PORT_ID rtpSourcePort;
+ T_CSU_RESULT_CON csuResult;
+
+ rtpSourcePort.portType = CSU_RTP_PORT;
+ rtpSourcePort.portId.rtpHandler = VoipCallGetRTPHandle(parent->h323CallHandle);
+
+ if ((csuResult = csu_OrigTermBreakAll(&rtpSourcePort))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+
+ JCCLog2("CSU Error : Disconn. Failure, (Result = %d) for (RTPHandle = %p)\n",
+ csuResult, (int)rtpSourcePort.portId.rtpHandler);
+ DBG_ERRORho("CSU Error : Disconn. Failure, (Result = %d) for (RTPHandle = %p)\n",
+ csuResult, rtpSourcePort.portId.rtpHandler);
+
+ // Can only generate OA&M log.
+ }
+
+ parent->voiceConnected = false;
+
+ }
+
+ // Always do sendRemote as the LAST step of the handler.
+ sendRemote(HC_REMOTE_RELEASE_COMPLETE);
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::cleanup): leaving.\n}\n");
+}
+
+
+JCCEvent_t
+HOHalfCall::handleNullEvent(void)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleNullEvent): entering......\n}\n");
+
+ // Do Nothing.
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleNullEvent): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+
+void
+HOHalfCall::initData(void)
+{
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::initData): entering......\n}\n");
+
+ // cancel any timers
+ hcTimer->cancelTimer();
+
+ releaseCounter = 0;
+ callState_ = HC_ST_FREE;
+
+ //CH<xxu:11-10-99>
+ chState_ = CH_ST_IDLE;
+
+ channState_ = RES_ST_IDLE;
+
+ currSpeechCh_.version = CNI_RIL3_GSM_FULL_RATE_SPEECH_VERSION_1;
+
+ currEvent = JCC_NULL_EVENT;
+
+ // Have a standard release cause to use
+ memset(&rlsCause, 0, sizeof(T_CNI_RIL3_IE_CAUSE)); // first zap this ie
+ rlsCause.ie_present = true;
+ rlsCause.codingStandard = CNI_RIL3_GSMPLMN_CODING;
+ rlsCause.location = CNI_RIL3_LOCATION_PRIVATE_NETWORK_LOCAL_USER;
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NORMAL_UNSPECIFIED;
+ rlsCause.diagnosticsLength = 0;
+
+ voipReleaseCause_ = CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING;
+
+ // initialize party numbers
+ cpn.ie_present = false;
+ callingPartyNum.ie_present = false;
+
+ // Have a simple Bearer Capability to use - for speech only
+ // Allocate a full rate channel based on this.
+ memset(&bearerCap, 0, sizeof(T_CNI_RIL3_IE_BEARER_CAPABILITY)); // first zap this ie
+ bearerCap.ie_present = true;
+
+ // octet 3 after TL - only one byte needed
+ bearerCap.codingStandard = CNI_RIL3_GSM_STANDARD_CODING;
+ bearerCap.transferMode = CNI_RIL3_TRANSFER_CIRCUIT_MODE;
+ bearerCap.infoTransferCap = CNI_RIL3_INFO_TRANSFER_SPEECH;
+ // Following is used only in Mob-to-Nwk direction. It should be set to
+ // default value in the Encoding routine for the Nwk-to-Mob direction - Syang
+ bearerCap.radioChannelReq = CNI_RIL3_FULL_RATE_SUPPORT_ONLY_MS; // 01
+
+ callingPartyNum.ie_present = false;
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::initData): leaving.\n}\n");
+
+}
+
+void
+HOHalfCall::printData(JCCPrintStFn fnPtr)
+{
+ char * hcStr1Ptr = "Half Call Data: \n";
+ char hcStr2[120];
+
+ char callTaskName[22];
+
+ sprintf(&callTaskName[0],
+ "Call-%d EntryId-%d: \0",
+ parent->callIndex,
+ parent->entryId());
+
+ //JOE: Add internal variables
+ sprintf(&hcStr2[0],
+ "curEv(%d),callSt(%d),channSt(%d),chState(%d),rlsCause(%d)\n",
+ currEvent,
+ callState_,
+ channState_,
+ chState_,
+ rlsCause.causeValue
+ );
+
+ (*fnPtr)(callTaskName);
+ (*fnPtr)(hcStr1Ptr);
+ (*fnPtr)(&hcStr2[0]);
+
+}
+
+
+int
+HOHalfCall::handleTimeoutMsg(IntraL3Msg_t *ccInMsg)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleTimeoutMsg): entering......\n}\n");
+
+ currEvent = HC_EHO_LOCAL_PROTOCOL_TIMEOUT;
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_RECOVERY_ON_TIMER_EXPIRY;
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleTimeoutMsg): leaving.\n}\n");
+
+ return (smHandleFirstCallEvent());
+}
+
+int
+HOHalfCall::handleRemoteEvent(IntraL3Msg_t* h323Msg, JCCEvent_t remoteEvent,
+ CCRemMsgData_t inRemMsg)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleRemoteEvent): entering......\n}\n");
+
+ // copy message data
+ h323InMsg = h323Msg;
+ remMsgData = inRemMsg;
+
+ currEvent = remoteEvent;
+
+ // Just call the SM Handle Event
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleRemoteEvent): leaving.\n}\n");
+ return (smHandleFirstCallEvent());
+}
+
+int
+HOHalfCall::smHandleEvent(void)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::smHandleEvent): entering......\n}\n");
+
+ if (currEvent == CC_RELEASE_CALL)
+ {
+ int storedCause;
+
+ parent->handleReleaseCall();
+
+ // causeValue below Works because 0 is unused.
+ storedCause = (0 - rlsCause.causeValue);
+
+ initData();
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::smHandleEvent): leaving.\n}\n");
+ return(storedCause);
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::smHandleEvent): leaving.\n}\n");
+ return(0);
+}
+
+int
+HOHalfCall::smHandleFirstCallEvent(void)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::smHandleFirstCallEvent): entering......\n}\n");
+
+ // For Call States:
+ if (currEvent != JCC_NULL_EVENT)
+ {
+ currEvent =
+ (this->*ehoCallStateHandler[callState_][currEvent - CC_INTERNAL_EHO_CALL_EVENT_BASE])();
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::smHandleFirstCallEvent): leaving.\n}\n");
+ return(smHandleEvent());
+}
+
+JCCEvent_t
+HOHalfCall::handleInvalidEvent(void)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleInvalidEvent): entering......\n}\n");
+
+ DBG_WARNINGho("{\nMNEThoTRACE(HOHalfCall::handleInvalidEvent):CC Call Warning: Invalid (event = %d) in (State = %d) \n}\n",
+ currEvent,
+ callState_);
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleInvalidEvent): leaving.\n}\n");
+ return (JCC_NULL_EVENT);
+
+}
+
+bool
+HOHalfCall::sendRemote(JCCEvent_t remoteEvent)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::sendRemote): entering......\n}\n");
+
+ // Copy the disconnect reason, if it is a release message.
+ if (remoteEvent == HC_REMOTE_RELEASE_COMPLETE)
+ {
+ remMsgData.callRelease.cause = voipReleaseCause_;
+ }
+
+ // send to H323 task
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::sendRemote): leaving.\n}\n");
+ return (sendH323MsgExtHo(parent, remoteEvent, remMsgData, parent->callLegNum));
+}
+
+
+JCCEvent_t
+HOHalfCall::handleEHOMobTermAddress(void)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobTermAddress): entering......\n}\n");
+
+ T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER hoNumber;
+ SpeechChann_t speechchann;
+ int i;
+
+ hoNumber = parent->parent->handoverSession->hoNumber_;
+
+ DBG_TRACEho(" EHO Call Log: hoNumber (ie_present=%d),(numberType=%d),(plan=%d),(numDigits=%d)\n",
+ hoNumber.ie_present,
+ hoNumber.numberType,
+ hoNumber.numberingPlan,
+ hoNumber.numDigits
+ );
+ DBG_TRACEho(" handover number digits (%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x)\n}\n",
+ hoNumber.digits[0],hoNumber.digits[1],hoNumber.digits[2],
+ hoNumber.digits[3],hoNumber.digits[4],
+ hoNumber.digits[5],hoNumber.digits[6],
+ hoNumber.digits[7],hoNumber.digits[8],hoNumber.digits[9],hoNumber.digits[10]);
+
+ // setup remote data struct
+ remMsgData.setup.CalledPartyNumber = hoNumber;
+ // no calling party number needed
+ remMsgData.setup.CallingPartyNumber.ie_present = false;
+
+ speechchann = parent->parent->currSpeechCh();
+
+ remMsgData.setup.bearerCap.speechVersionInd[0].fieldPresent = true;
+ remMsgData.setup.bearerCap.speechVersionInd[0].version = speechchann.version;
+
+ for (i=1; i < 3; i++)
+ {
+ remMsgData.setup.bearerCap.speechVersionInd[i].fieldPresent = false;
+ }
+
+
+ DBG_TRACEho(" SpeechVersionInd: 1st(%d,%d) 2nd(%d,%d) 3rd(%d,%d)\n",
+ remMsgData.setup.bearerCap.speechVersionInd[0].fieldPresent,
+ remMsgData.setup.bearerCap.speechVersionInd[0].version,
+ remMsgData.setup.bearerCap.speechVersionInd[1].fieldPresent,
+ remMsgData.setup.bearerCap.speechVersionInd[1].version,
+ remMsgData.setup.bearerCap.speechVersionInd[2].fieldPresent,
+ remMsgData.setup.bearerCap.speechVersionInd[2].version);
+
+ remMsgData.setup.IsEmergencyCall = false;
+
+ callState_ = EHO_ST_OFFERING_CALL;
+
+
+ DBG_TRACEho(" Sending SETUP to remote side.\n");
+
+ // Now send setup to the other half call.
+ if (sendRemote(THC_REMOTE_TERM_ADDRESS) == false)
+ // failed commn. with the remote side - treat as a release complete
+ // from the remote side and cleanup - skip event loop.
+ {
+ DBG_ERRORho(" ERROR in Sending SETUP.\n");
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobTermAddress): leaving.\n}\n");
+ return (CC_RELEASE_CALL);
+ }
+
+ //reuse this timer for watch dog purpose in case no response from VOIP
+ hcTimer->setTimer(CALL_SETUP_T303);
+
+
+ // set this boolean to true until we actually send a setup request to VOIP.
+ parent->disconnectSentToVoip = false;
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobTermAddress): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+JCCEvent_t
+HOHalfCall::handleEHOMobCallProgress(void)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobCallProgress): entering......\n}\n");
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((parent->parent->activeLeg()) == NULL)
+ {
+ DBG_TRACEho(" Call no longer active.\n");
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobCallProgress): leaving.\n}\n");
+ return (CC_RELEASE_CALL);
+ }
+
+ DBG_TRACEho(" Received CALL PROGRESS. (h323InMsg->call_handle=%d)\n",
+ h323InMsg->call_handle);
+
+ // Save h323 call handle
+ parent->h323CallHandle = h323InMsg->call_handle;
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobCallProgress): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+}
+
+JCCEvent_t
+HOHalfCall::handleEHOMobRemoteChannSelected(void)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobRemoteChannSelected): entering......\n}\n");
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((parent->parent->activeLeg()) == NULL)
+ {
+ DBG_TRACEho(" Call no longer active.\n");
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobRemoteChannSelected): leaving.\n}\n");
+ return (CC_RELEASE_CALL);
+ }
+
+ currSpeechCh_.version = remMsgData.codecSelected.Codec;
+
+ DBG_TRACEho(" Received Channel Selected: speech version:(%d)\n",
+ currSpeechCh_.version);
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobRemoteChannSelected): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+
+}
+
+JCCEvent_t
+HOHalfCall::handleEHOMobRemoteAnswer(void)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobRemoteAnswer): entering......\n}\n");
+
+ //Stop guarding timer
+ hcTimer->cancelTimer();
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((parent->parent->activeLeg()) == NULL)
+ {
+ DBG_TRACEho(" Call no longer active.\n}\n");
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobRemoteAnswer): leaving.\n}\n");
+ return (CC_RELEASE_CALL);
+ }
+
+ DBG_TRACEho(" Connect received.\n");
+
+ callState_ = EHO_ST_ACTIVE;
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobRemoteAnswer): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+// Remote Disconnect
+JCCEvent_t
+HOHalfCall::handleEHOMobRemoteDisconnect(void)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobRemoteDisconnect): entering......\n}\n");
+
+ // Cause is Mandatory. Use rlsCause to set it before building
+ // !< For now there is a generic rlsCause in the Half Call Object.
+
+ // To avoid sending the release to H323
+ parent->disconnectSentToVoip = true;
+
+ //CAUSE<xxu:03-21-00> BEGIN
+
+ rlsCause.causeValue =
+ (T_CNI_RIL3_CAUSE_VALUE) remMsgData.basicCallInMsg.ReasonCode;
+
+ callState_ = EHO_ST_FREE;
+
+ // Trigger the sending of END HANDOVERS and Releasing HO Call Legs
+ // (make sure this is an anchor session... should not be called in target!)
+ if (parent->parent->handoverSession == parent->parent->anchorHandoverSession)
+ {
+ parent->parent->anchorHandoverSession->handleAnchPostExtHoRls();
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobRemoteDisconnect): leaving.\n}\n");
+ return (CC_RELEASE_CALL);
+
+}
+
+
+
+/*******************************************************************/
+HOMoHalfCall::HOMoHalfCall (HOCallLeg *callLeg, JCCTimer *tclTimer)
+{
+ parent = callLeg;
+
+ hcTimer = tclTimer;
+ initData();
+}
+
+void
+HOMoHalfCall::setupNewCall (void)
+{
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOMoHalfCall::setupNewCall): entering......\n}\n");
+
+ // set to null state so that we can take care of abnormal cleanups.
+ callState_ = EHO_ST_NULL;
+
+ // set first event of SETUP message to VoIP
+ currEvent = OHC_EHO_LOCAL_TERM_ADDRESS;
+
+ smHandleFirstCallEvent();
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOMoHalfCall::setupNewCall): leaving.\n}\n");
+}
+
+void
+HOMoHalfCall::disconnectNewCall (void)
+{
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOMoHalfCall::disconnectNewCall): entering......\n}\n");
+
+ currEvent = HC_EHO_LOCAL_DISCONNECT_REQ;
+
+ smHandleFirstCallEvent();
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOMoHalfCall::disconnectNewCall): leaving.\n}\n");
+}
+
+
+
+JCCEvent_t
+HOHalfCall::handleEHOMobLocalDisconnect(void)
+{
+ DBG_TRACEho("{\nMNEThoTRACE(HOMoHalfCall::handleEHOMobLocalDisconnect): entering......\n}\n");
+
+ voipReleaseCause_ = CNI_RIL3_CAUSE_NORMAL_CALL_CLEARING;
+
+ // Always do sendRemote at the end of the handler.
+ // Now send the internal Rel Complt message to the other H.323 half call -
+ if (sendRemote(HC_REMOTE_RELEASE_COMPLETE) == false)
+ // failed commn. with the remote side - treat as a release complete
+ // from the remote side and cleanup - skip event loop.
+ {
+ DBG_ERRORho(" ERROR in sending RELEASE COMPLETE to remote side.\n");
+
+ // Since this is the release sequence. Continue anyway.
+ DBG_TRACEho(" Continue release anyway.\n");
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(HOMoHalfCall::handleEHOMobLocalDisconnect): leaving.\n}\n");
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+void
+HOMoHalfCall::initData(void)
+{
+ HOHalfCall::initData();
+
+}
+
+
+
+/*******************************************************************/
+HOMtHalfCall::HOMtHalfCall (HOCallLeg *callLeg, JCCTimer *tclTimer)
+{
+ HOHalfCall::parent = callLeg;
+
+ hcTimer = tclTimer;
+ initData();
+}
+
+void
+HOMtHalfCall::initData(void)
+{
+ HOHalfCall::initData();
+}
+
+//ext-HO <xxu:06=07-01>
+JCCEvent_t
+HOHalfCall::handleEHOMobRemoteTermAddress(void)
+{
+ JCCEvent_t retEvent;
+
+ DBG_FUNC("HOHalfCall::handleEHOMobRemoteTermAddress", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+
+ DBG_TRACEho("{\nMNETeiTRACE(hoCall::handleEHOMobRemoteTermAddress): [<==VOIP SETUP] (hoAgId=%d,callId=%d]\n}\n",
+ parent->hoAgId(), parent->callIndexEHO() );
+
+ // copy from the remote message to the local var
+ cpn = remMsgData.callOffering.CalledPartyNumber;
+
+ DBG_TRACE("{\nMNETeiTRACE(hoCall::handleEHOMobRemoteTermAddress): hoNumber (cpn) received in SETUP\n");
+ DBG_TRACE(" : (ie_present=%d),(numberType=%d),(plan=%d),(numDigits=%d)\n",
+ cpn.ie_present,
+ cpn.numberType,
+ cpn.numberingPlan,
+ cpn.numDigits
+ );
+
+ DBG_TRACE(" : handover number digits (%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x)\n}\n",
+ cpn.digits[0],cpn.digits[1],cpn.digits[2],cpn.digits[3],cpn.digits[4],
+ cpn.digits[5],cpn.digits[6],cpn.digits[7],cpn.digits[8],cpn.digits[9],cpn.digits[10]
+ );
+
+ //Eject CALL PROGRESS to VOIP right away
+ retEvent = fakeEHOMobCallProgress();
+
+ DBG_LEAVE();
+ return (retEvent);
+}
+
+//ext-HO <xxu:06=07-01>
+JCCEvent_t
+HOHalfCall::fakeEHOMobCallProgress(void)
+{
+ DBG_FUNC("HOHalfCall::ejectEHOMobCallProgress", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ if (parent->speechVersion() == -1)
+ {
+ DBG_ERRORho("{\nMNETeiERROR(hoCall::fakeEHOMobCallProgress): no speech version recorded\n}\n");
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+ voipReleaseCause_ = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ remMsgData.callProceeding.bearerCap.speechVersionInd[0].fieldPresent = 1;
+ remMsgData.callProceeding.bearerCap.speechVersionInd[0].version = parent->speechVersion();
+
+ remMsgData.callProceeding.bearerCap.speechVersionInd[1].fieldPresent = 0;
+ remMsgData.callProceeding.bearerCap.speechVersionInd[2].fieldPresent = 0;
+
+ // Always do sendRemote at the end of the handler
+ if (sendRemote(HC_REMOTE_CALL_PROGRESS) == false)
+ {
+ DBG_ERRORho("{\nMNETeiERROR(hoCall::fakeEHOMobCallProgress): [==>VOIP PROGRESS failed] (hoAgId=%d, callId=%d,speechVersion=%d)\n}\n",
+ parent->hoAgId(), parent->callIndexEHO(),parent->speechVersion());
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+ voipReleaseCause_ = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ DBG_TRACEho("{\nMNETeiTRACE(hoCall::fakeEHOMobCallProgress): [==>VOIP CALL PROGRESS] (hoAgId=%d,callId=%d,speechVersion=%d)\n}\n",
+ parent->hoAgId(), parent->callIndexEHO(),parent->speechVersion() );
+
+ //reuse this timer for watch dog purpose in case no response from VOIP
+ hcTimer->setTimer(CALL_CALL_CONFIRMED_T310);
+
+ callState_ = EHO_ST_CONFIRMED;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+//ext-HO <xxu:06=07-01>
+JCCEvent_t
+HOHalfCall::handleHoCallTimeout(void)
+{
+
+ DBG_FUNC("HOHalfCall::handleHoCallTimeout", CC_HO_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACEho("{\nMNETeiTRACE(hoCall::handleHoCallTimeout): [<==CC HO-CALL TIMEOUT] (hoAgId=%d, callId=%d,callState=%d)\n}\n",
+ parent->hoAgId(), parent->callIndexEHO(), callState_);
+
+ if (sendRemote(HC_REMOTE_RELEASE_COMPLETE) == false)
+ {
+ DBG_ERRORho("{\nMNETeiERROR(hoCall::handleHoCallTimeout): [==>VOIP RELEASE_COMPLETE failed] (hoAgId=%d, callId=%d)\n}\n",
+ parent->hoAgId(), parent->callIndexEHO());
+ }
+
+ DBG_TRACEho("{\nMNETeiTRACE(hoCall::handleHoCallTimeout): [==>VOIP RELEASE_COMPLETE cos timeout] (hoAgId=%d, callId=%d)\n}\n",
+ parent->hoAgId(), parent->callIndexEHO());
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+ voipReleaseCause_ = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+
+ DBG_LEAVE();
+
+ // JOE: probably a better way than looking at procType (esp considering post handover cases)
+ if (parent->procType == CC_PROC_MOB_ORIG)
+ { // hand-out scenario
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+ }
+ else
+ { // Hand-in scenario
+ return (CC_RELEASE_CALL);
+ }
+
+}
+
+JCCEvent_t
+HOHalfCall::handleEHOMobRemoteChannSelectedEi(void)
+{
+ JCCEvent_t retEvent;
+
+ DBG_FUNC("HOHallCall::handleEHOMobRemoteChannSelectedEi", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ //Stop guarding timer
+ hcTimer->cancelTimer();
+
+ //Sanitory check applied
+ if (remMsgData.codecSelected.Codec != parent->speechVersion() )
+ {
+ DBG_ERRORho("{\nMNETeiERROR(hoCall::handleEHOMobRemoteChannSelectedEi): [<==VOIP CODEC SELECT failed] failed] (hoAgId=%d, callId=%d,loCodec=%d,reCodec=%d)\n}\n",
+ parent->hoAgId(), parent->callIndexEHO(), remMsgData.codecSelected.Codec,
+ parent->speechVersion());
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+ voipReleaseCause_ = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ DBG_TRACEho("{\nMNETeiTRACE(hoCall::handleEHOMobRemoteChannSelectedEi): [<==VOIP CODEC SELECT] (hoAgId=%d, callId=%d, codec=%d)\n}\n",
+ parent->hoAgId(), parent->callIndexEHO(), remMsgData.codecSelected.Codec);
+
+ currSpeechCh_.version = remMsgData.codecSelected.Codec;
+
+ //inject CONNECT to VOIP here
+ retEvent = fakeEHOMobConnect();
+
+ DBG_LEAVE();
+ return (retEvent);
+
+}
+
+//ext-HO <xxu:06-07-01>
+JCCEvent_t
+HOHalfCall::handleEHOMobRemoteChannReady(void)
+{
+ DBG_FUNC("HOHallCall::handleEHOMobRemoteChannReady", CC_HO_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACEho("{\nMNEThoTRACE(hoCall::handleEHOMobRemoteChannReady): [<==VOIP VOICE CONNECTED] (hoAgId=%d, callId=%d)\n}\n",
+ parent->hoAgId(), parent->callIndexEHO());
+
+ //JOE: to cover post-handout case where src could be either RTP or GSM
+ //Make two-way connnection
+ T_CSU_PORT_ID src, snk;
+ T_CSU_RESULT_CON csuResult;
+
+ snk.portType = CSU_RTP_PORT;
+ snk.portId.rtpHandler = VoipCallGetRTPHandle(parent->h323CallHandle);
+
+ // If hand-out then SRC is RTP, else hand-in SRC is GSM
+ // JOE: probably a better way than looking at procType (esp considering post handover cases)
+ if (parent->procType == CC_PROC_MOB_ORIG)
+ { // hand-out scenario
+ TwoPartyCallLeg *whichLeg;
+
+ // as long as handover is allowed, active leg is mandatory here.
+ if ((whichLeg = parent->parent->activeLeg()) == NULL)
+ {
+ DBG_TRACEho(" Call no longer active.\n");
+ DBG_TRACEho("{\nMNEThoTRACE(HOHalfCall::handleEHOMobRemoteChannReady): leaving.\n}\n");
+ return (CC_RELEASE_CALL);
+ }
+
+ src.portType = CSU_RTP_PORT;
+ src.portId.rtpHandler = VoipCallGetRTPHandle(whichLeg->h323CallHandle);
+ }
+ else
+ { // Hand-in scenario
+ src.portType = CSU_GSM_PORT;
+ src.portId.gsmHandler = parent->entryId();
+ }
+
+ if ( (csuResult = csu_DuplexConnect(&src, &snk))
+ != CSU_RESULT_CON_SUCCESS)
+ {
+ DBG_ERROR("{\nMNEThoERROR(hoCall::handleEHOMobRemoteChannReady): [==>CSU DUPLEX CONNECT failed] (hoAgId=%d,callId=%d,result=%d,src(%d,%x),snk(%d,%x))\n}\n",
+ parent->hoAgId(), parent->callIndexEHO(), csuResult, src.portType, src.portId.rtpHandler, snk.portType, snk.portId.rtpHandler); csuResult,
+
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+ voipReleaseCause_ = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(hoCall::handleEHOMobRemoteChannReady): [==>CSU DUPLEX CONNECTION] (hoAgId=%d,callId=%d, src(%d,%x),snk(%d,%x))\n}\n",
+ parent->hoAgId(), parent->callIndexEHO(), src.portType, src.portId.rtpHandler, snk.portType, snk.portId.rtpHandler);
+
+ parent->voiceConnected = true;
+
+ //Cancel handover timer if needed
+ parent->cancelHoTimerIfNeeded();
+ //if (!parent->cancelHoTimerIfNeeded())
+ //{
+ // DBG_WARNING("{\nMNEThoWARNING(\nMENTeiWARNING(hoCall::handleEHOMobRemoteChannReady): [HO CALL UP BUT NO HANDOVER] (hoAgId=%d,callId=%d)\n}\n",
+ // parent->hoAgId(), parent->callIndexEHO() );
+ //
+ // rlsCause.causeValue = CNI_RIL3_CAUSE_CALL_REJECTED;
+ // voipReleaseCause_ = CNI_RIL3_CAUSE_CALL_REJECTED;
+ //
+ // DBG_LEAVE();
+ // return (CC_RELEASE_CALL);
+ //}
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
+
+//ext-HO <xxu:06-07-01>
+JCCEvent_t
+HOHalfCall::fakeEHOMobConnect(void)
+{
+ DBG_FUNC("HOHallCall::fakeEHOMobConnect", CC_HO_LAYER);
+ DBG_ENTER();
+
+ //inject a fake CONNECT message sent to VOIP right now
+ if (sendRemote(OHC_REMOTE_ANSWER) == false)
+ {
+ rlsCause.causeValue = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+ voipReleaseCause_ = CNI_RIL3_CAUSE_NETWORK_OUT_OF_ORDER;
+
+
+ DBG_ERRORho("{\nMNEThoTRACE(hoCall::fakeEHOMobConnect): [==>VOIP CONNECT sendRemote failed] (hoAgId=%d, callId=%d)\n}\n",
+ parent->hoAgId(), parent->callIndexEHO());
+
+
+ DBG_LEAVE();
+ return (CC_RELEASE_CALL);
+ }
+
+ DBG_TRACEho("{\nMNEThoTRACE(hoCall::fakeEHOMobConnect): [==>VOIP CONNECT] (hoAgId=%d, callId=%d)\n}\n",
+ parent->hoAgId(), parent->callIndexEHO());
+
+ callState_ = EHO_ST_ACTIVE;
+
+ DBG_LEAVE();
+ return (CC_MESSAGE_PROCESSING_COMPLT);
+}
diff --git a/data/mnet/GP10/Host/cc/src/Makefile b/data/mnet/GP10/Host/cc/src/Makefile
new file mode 100644
index 0000000..5d584fe
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/Makefile
@@ -0,0 +1,52 @@
+##########################################################
+#
+# (c) Copyright Cisco 2000
+# All Rights Reserved
+#
+##########################################################
+
+# TOP_OF_VOB must be defined before including l3defs.mk
+TOP_OF_VOB = ..\..\..
+
+# These Must be Properly Defined
+THIS_APP_DIR = cc
+THIS_DIRECTORY = src
+MY_OUTPUT = $(OBJDIR)\ccm.out
+
+# Name(s) of Common VOB directories to include
+COMMON_BLD_DIR =
+
+include $(TOP_OF_VOB)\l3defs.mk
+
+all: makeCommonObjs $(MY_OUTPUT)
+
+# Adds the .o file(s) list needed from the Common VOB
+makeCommonObjs:
+ifneq ($(COMMON_BLD_DIR),)
+ @for %f in ($(COMMON_BLD_DIR)) do \
+ make -C $(COMMON_VOB_APP_DIR)\%f \
+ all VOB=$(VOBNAME) APPDIR=Host\$(THIS_APP_DIR)\$(THIS_DIRECTORY)
+endif
+
+# If Common VOB directories to include get the .o files from bin
+$(MY_OUTPUT): $(MODULE_OBJS)
+ifneq ($(COMMON_BLD_DIR),)
+ $(LD) -r -o $@.tmp $() $(MODULE_OBJS) $(wildcard ./bin/*.o)
+else
+ $(LD) -r -o $@.tmp $() $(MODULE_OBJS)
+endif
+ $(NM) $@.tmp | munch > _ctdt.c
+ $(CC) -traditional $(CC_ARCH_SPEC) -c _ctdt.c
+ $(LD) -r -o $@ _ctdt.o $@.tmp
+ $(RM)$(subst /,$(DIRCHAR), _ctdt.c _ctdt.o $@.tmp)
+
+cleanall:
+ @for %f in ($(notdir $(MODULE_OBJS))) do \
+ $(RM) ..\bin\%f
+
+ $(RM) $(MY_OUTPUT)
+
+ifneq ($(COMMON_BLD_DIR),)
+ $(RM) bin\*.o
+ $(RM) bin\*.out
+endif
diff --git a/data/mnet/GP10/Host/cc/src/SmsCommon.cpp b/data/mnet/GP10/Host/cc/src/SmsCommon.cpp
new file mode 100644
index 0000000..6560441
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/SmsCommon.cpp
@@ -0,0 +1,53 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : SmsCommon.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 01-20-2000
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files. SMS common functions
+// *******************************************************************
+//
+
+#include <vxworks.h>
+#include <string.h>
+
+#include "Logging\vcmodules.h"
+
+#include "CC/CCSessionHandler.h"
+
+#include "CC/SmsLeg.h"
+
+
+// call the vbLink routine to send message
+static bool ccSmsSendToViberBase(LUDB_ID ludbIdx, SmsVblinkMsg_t smsMsg)
+{
+ unsigned char buffer[sizeof (SmsVblinkMsg_t)];
+ int msgLen;
+ bool status = false;
+
+ DBG_FUNC ("ccSmsSendToViberBase", CC_SMS_LAYER);
+ DBG_ENTER ();
+/*
+ if (ccSmsPackVblinkMsg(buffer, msgLen, cissMsg))
+ {
+ DBG_TRACE("Ludb Index = %d, Buffer Len = %d\n", ludbIdx, msgLen);
+ DBG_HEXDUMP(buffer, msgLen);
+ status = VBLinkMsToNetCiss(ludbIdx, buffer, msgLen);
+ }
+*/
+ DBG_LEAVE ();
+ return status;
+}
diff --git a/data/mnet/GP10/Host/cc/src/SmsFsm.cpp b/data/mnet/GP10/Host/cc/src/SmsFsm.cpp
new file mode 100644
index 0000000..50ec85c
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/SmsFsm.cpp
@@ -0,0 +1,222 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : SmsFsm.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 01-20-2000
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+//
+
+#include <vxworks.h>
+
+#include "CC/SmsHalfCall.h"
+
+const int SmsOneFsm_ = 0;
+
+/* ================================================================ */
+/* SMS FSM tables */
+
+/* MO SMS FSM tables */
+const smsEventTableEntry_t smsHandlersMoIdle [] =
+{
+ {SMS_EVENT_MM_EST_IND , (SFH)smsHandlerMmEstInd , SMS_STATE_CONNECTED },
+
+ {SMS_EVENT_TIMEOUT , smsHandlerDef , SMS_STATE_NONE },
+
+ {SMS_EVENT_DEFAULT , smsHandlerDef , SMS_STATE_NONE }
+};
+
+
+// SMS_STATE_MT_CONNECT_MM is valid for MT FSM only
+const smsEventTableEntry_t smsHandlersMoInvalid [] =
+{
+ {SMS_EVENT_DEFAULT , smsHandlerDef , SMS_STATE_IDLE }
+};
+
+
+const smsEventTableEntry_t smsHandlersMoConnected [] =
+{
+ {SMS_EVENT_MM_REL_IND , smsHandlerMmRelInd , SMS_STATE_IDLE },
+
+ {SMS_EVENT_MD_ERROR_IND , smsHandlerMdErrInd , SMS_STATE_IDLE },
+
+ {SMS_EVENT_CP_DATA , (SFH)smsHandlerCpData , SMS_STATE_NONE },
+ {SMS_EVENT_CP_ACK , (SFH)smsHandlerCpReject , SMS_STATE_NONE },
+ {SMS_EVENT_CP_ERROR , (SFH)smsHandlerCpError , SMS_STATE_IDLE },
+
+ {SMS_EVENT_MNSMS_DATA_REQ , (SFH)smsHandlerMnDataReq, SMS_STATE_WAIT_CP_ACK},
+ {SMS_EVENT_MNSMS_REL_REQ , smsHandlerDef , SMS_STATE_IDLE },
+ {SMS_EVENT_MNSMS_ABORT_REQ, (SFH)smsHandlerMnAbortReq,SMS_STATE_DISCONNECT },
+
+ {SMS_EVENT_TIMEOUT , smsHandlerTimeout , SMS_STATE_IDLE },
+
+ {SMS_EVENT_DEFAULT , smsHandlerDef , SMS_STATE_NONE }
+};
+
+const smsEventTableEntry_t smsHandlersMoWaitCpAck [] =
+{
+// {SMS_EVENT_MM_EST_IND , smsHandlerMmRelInd , SMS_STATE_NONE }, //Concatineted MO Msg notifitation
+ {SMS_EVENT_MM_REL_IND , smsHandlerMmRelInd , SMS_STATE_IDLE },
+
+ {SMS_EVENT_MD_ERROR_IND , smsHandlerMdErrInd , SMS_STATE_IDLE },
+
+ {SMS_EVENT_CP_DATA , (SFH)smsHandlerCpData , SMS_STATE_NONE },
+ {SMS_EVENT_CP_ACK , (SFH)smsHandlerCpAck , SMS_STATE_CONNECTED },
+ {SMS_EVENT_CP_ERROR , (SFH)smsHandlerCpError , SMS_STATE_IDLE },
+
+ {SMS_EVENT_MNSMS_REL_REQ , smsHandlerDef , SMS_STATE_DISCONNECT },
+ {SMS_EVENT_MNSMS_ABORT_REQ, (SFH)smsHandlerMnAbortReq,SMS_STATE_DISCONNECT },
+
+ {SMS_EVENT_TIMEOUT , smsHandlerTimeoutAck , SMS_STATE_NONE },
+
+ {SMS_EVENT_DEFAULT , smsHandlerDef , SMS_STATE_NONE }
+};
+
+/*==================================================================*/
+/* MT SMS FSM tables */
+
+const smsEventTableEntry_t smsHandlersMtIdle [] =
+{
+ {SMS_EVENT_MNSMS_EST_REQ , (SFH)smsHandlerMnEstReq , SMS_STATE_MT_CONNECT_MM},
+
+ {SMS_EVENT_TIMEOUT , smsHandlerDef , SMS_STATE_NONE },
+
+ {SMS_EVENT_DEFAULT , smsHandlerDef , SMS_STATE_NONE }
+};
+
+
+/* Wait for MM (SAPI=0) and L2 (SAPI=3) connection establishment */
+const smsEventTableEntry_t smsHandlersMtWaitMm [] =
+{
+ {SMS_EVENT_MM_EST_CNF , smsHandlerMmEstCnf , SMS_STATE_NONE },
+ {SMS_EVENT_MM_EST_REJ , smsHandlerMmEstRej , SMS_STATE_IDLE },
+ {SMS_EVENT_MM_REL_IND , smsHandlerMmRelInd , SMS_STATE_IDLE },
+
+ {SMS_EVENT_MD_ERROR_IND , smsHandlerMdErrInd , SMS_STATE_IDLE },
+
+ {SMS_EVENT_MNSMS_REL_REQ , (SFH)smsHandlerMnRelReq , SMS_STATE_IDLE },
+ {SMS_EVENT_MNSMS_ABORT_REQ, (SFH)smsHandlerMnAbortReq,SMS_STATE_DISCONNECT },
+
+ {SMS_EVENT_TIMEOUT , smsHandlerTimeout , SMS_STATE_IDLE },
+
+ {SMS_EVENT_DEFAULT , smsHandlerDef , SMS_STATE_NONE }
+};
+
+
+const smsEventTableEntry_t smsHandlersMtConnected [] =
+{
+ {SMS_EVENT_MM_REL_IND , smsHandlerMmRelInd , SMS_STATE_IDLE },
+
+ {SMS_EVENT_MD_ERROR_IND , smsHandlerMdErrInd , SMS_STATE_IDLE },
+
+ {SMS_EVENT_CP_DATA , (SFH)smsHandlerCpData , SMS_STATE_NONE },
+ {SMS_EVENT_CP_ACK , (SFH)smsHandlerCpReject , SMS_STATE_NONE },
+ {SMS_EVENT_CP_ERROR , (SFH)smsHandlerCpError , SMS_STATE_IDLE },
+
+ {SMS_EVENT_MNSMS_DATA_REQ , (SFH)smsHandlerMnDataReq, SMS_STATE_WAIT_CP_ACK},
+ {SMS_EVENT_MNSMS_REL_REQ , (SFH)smsHandlerMnRelReq , SMS_STATE_DISCONNECT },
+ {SMS_EVENT_MNSMS_ABORT_REQ, (SFH)smsHandlerMnAbortReq,SMS_STATE_DISCONNECT },
+
+ {SMS_EVENT_TIMEOUT , smsHandlerTimeout , SMS_STATE_IDLE },
+
+ {SMS_EVENT_DEFAULT , smsHandlerDef , SMS_STATE_NONE }
+};
+
+
+const smsEventTableEntry_t smsHandlersMtWaitCpAck [] =
+{
+ {SMS_EVENT_MM_REL_IND , smsHandlerMmRelInd , SMS_STATE_IDLE },
+
+ {SMS_EVENT_MD_ERROR_IND , smsHandlerMdErrInd , SMS_STATE_IDLE },
+
+ {SMS_EVENT_CP_DATA , (SFH)smsHandlerCpData , SMS_STATE_CONNECTED },
+ {SMS_EVENT_CP_ACK , (SFH)smsHandlerCpAck , SMS_STATE_CONNECTED },
+ {SMS_EVENT_CP_ERROR , (SFH)smsHandlerCpError , SMS_STATE_IDLE },
+
+// {SMS_EVENT_MNSMS_DATA_REQ , smsHandlerDef , SMS_STATE_NONE },
+ {SMS_EVENT_MNSMS_REL_REQ , (SFH)smsHandlerMnRelReq , SMS_STATE_DISCONNECT },
+ {SMS_EVENT_MNSMS_ABORT_REQ, (SFH)smsHandlerMnAbortReq,SMS_STATE_DISCONNECT },
+
+ {SMS_EVENT_TIMEOUT , smsHandlerTimeoutAck , SMS_STATE_NONE },
+
+ {SMS_EVENT_DEFAULT , smsHandlerDef , SMS_STATE_NONE }
+};
+
+
+/*==================================================================*/
+/* Common tables */
+
+//SMS_STATE_DISCONNECT
+const smsEventTableEntry_t smsHandlersDisconnect [] =
+{
+ {SMS_EVENT_MM_REL_IND , smsHandlerMmRelInd , SMS_STATE_IDLE },
+
+ {SMS_EVENT_MD_ERROR_IND , smsHandlerMdErrInd , SMS_STATE_IDLE },
+
+ {SMS_EVENT_CP_ACK , (SFH)smsHandlerCpAck , SMS_STATE_IDLE },
+ {SMS_EVENT_CP_ERROR , (SFH)smsHandlerCpError , SMS_STATE_IDLE },
+
+ {SMS_EVENT_TIMEOUT , smsHandlerTimerDisc , SMS_STATE_NONE },
+
+ {SMS_EVENT_DEFAULT , smsHandlerDef , SMS_STATE_NONE }
+
+};
+
+/*==================================================================*/
+/* State tables */
+
+const smsEventTableEntry_t *smsMoTable [SMS_STATE_MAX] =
+{
+ smsHandlersMoIdle ,
+ smsHandlersMoInvalid ,
+ smsHandlersMoConnected,
+ smsHandlersMoWaitCpAck,
+ smsHandlersDisconnect
+};
+
+const smsEventTableEntry_t *smsMtTable [SMS_STATE_MAX] =
+{
+ smsHandlersMtIdle ,
+ smsHandlersMtWaitMm ,
+ smsHandlersMtConnected,
+ smsHandlersMtWaitCpAck,
+ smsHandlersDisconnect
+};
+
+
+/*==================================================================*/
+/*
+const smsEventTableEntry_t smsHandlersState??? [] =
+{
+ {SMS_EVENT_MM_EST_IND , smsHandlerDef, SMS_STATE_NONE },
+ {SMS_EVENT_MM_EST_CNF , smsHandlerDef, SMS_STATE_NONE },
+ {SMS_EVENT_MM_EST_REJ , smsHandlerDef, SMS_STATE_NONE },
+ {SMS_EVENT_MM_REL_IND , smsHandlerDef, SMS_STATE_NONE },
+
+ {SMS_EVENT_MD_ERROR_IND , smsHandlerDef, SMS_STATE_NONE },
+
+ {SMS_EVENT_CP_DATA , smsHandlerDef, SMS_STATE_NONE },
+ {SMS_EVENT_CP_ACK , smsHandlerDef, SMS_STATE_NONE },
+ {SMS_EVENT_CP_ERROR , smsHandlerDef, SMS_STATE_NONE },
+
+ {SMS_EVENT_MNSMS_DATA_REQ , smsHandlerDef, SMS_STATE_NONE },
+ {SMS_EVENT_MNSMS_REL_REQ , smsHandlerDef, SMS_STATE_NONE },
+ {SMS_EVENT_MNSMS_ABORT_REQ, smsHandlerDef, SMS_STATE_NONE },
+ {SMS_EVENT_TIMEOUT , smsHandlerDef, SMS_STATE_NONE },
+ {SMS_EVENT_DEFAULT , smsHandlerDef, SMS_STATE_NONE }
+};
+*/ \ No newline at end of file
diff --git a/data/mnet/GP10/Host/cc/src/SmsHalfCall.cpp b/data/mnet/GP10/Host/cc/src/SmsHalfCall.cpp
new file mode 100644
index 0000000..b9d667c
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/SmsHalfCall.cpp
@@ -0,0 +1,263 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : SmsHalfCall.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 01-20-2000
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+
+#include "CC/CCSessionHandler.h"
+#include "CC/CallConfig.h"
+#include "CC/SmsHalfCall.h"
+
+extern const smsEventTableEntry_t *smsMoTable [],
+ *smsMtTable [];
+
+// *******************************************************************
+//
+// *******************************************************************
+#define SMS_EVENT_NUMBER (CC_MM_CONNECTION_IND - CC_MM_CONNECTION_REQ + SMS_EVENT_DEFAULT-SMS_EVENT_BASE)
+
+const char * SmsEventNames[SMS_EVENT_NUMBER] =
+{
+ {"Invalid" }, // 0
+ {"MM-EST Cnf" }, //92 1
+ {"MM-Est Rej" }, //93 2
+ {"MM-REL Ind" }, //94 3
+ {"MM-EST Ind" }, //95 4
+
+ {"DL-ERROR Ind" }, //301 5
+
+ {"CP-DATA" }, //302 6
+ {"CP-ACK" }, //303 7
+ {"CP-ERROR" }, //304 8
+ {"MNSMS-EST Req" }, //305 9
+ {"MNSMS-DATA Req" }, //306 10
+ {"MNSMS-REL Req" }, //307 11
+ {"MNSMS-ABORT Req" }, //308 12
+ {"TIMEOUT" }, //309 13
+ {"SMS-PROTOCOL ERROR"} //310 14
+};
+
+
+/*******************************************************************/
+
+SmsHalfCall::SmsHalfCall (SmsLeg& smsLeg, smsEventTableEntry_t **table)
+ : parent_ (smsLeg),
+ smsTable_(table )
+{
+ UINT16 uint16TimerValue;
+ int timerValue ;
+
+ // Timer Data below is used for sending timeout to the correct task.
+ uint16TimerValue = (((UINT16)(parent_.callLegNum)) & (0x000F)) << 8;
+ uint16TimerValue = uint16TimerValue | (((UINT16)(parent_.callIndex)) & 0x00FF);
+
+ timerValue = (short)uint16TimerValue;
+
+ smsTimer_ = new JCCTimer(callTimerExpiry, timerValue);
+
+ initData ();
+}
+
+
+SmsHalfCall::~SmsHalfCall ()
+{
+ delete smsTimer_;
+}
+
+
+void SmsHalfCall::initData ()
+{
+ currentState_ = SMS_STATE_IDLE;
+
+ resetNextState ();
+ resetLastAttemt ();
+ resetRpdu ();
+}
+
+
+void SmsHalfCall::cleanup (T_CNI_RIL3_CAUSE_VALUE cause)
+{
+ // Not used upon VBLink abnormal release!!!
+ initData ();
+}
+
+
+void SmsHalfCall::resetRpdu ()
+{
+ CNI_RIL3_ZAPMSG ((void *)&rpdu_, sizeof(T_CNI_RIL3_IE_CP_USER_DATA));
+}
+
+
+void SmsHalfCall::saveRpdu (SmsVblinkMsg_t *vbMsgData)
+{
+ DBG_FUNC ("SmsHalfCall::saveRpdu", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ if (vbMsgData->hdr.msgLen > 0)
+ {
+ rpdu_.ie_present = true;
+ rpdu_.length = vbMsgData->hdr.msgLen;
+
+ memcpy ((void *)&rpdu_.rpdu_data, vbMsgData->msg, rpdu_.length);
+ }
+ else
+ DBG_WARNING ("SMS: RP data is not presented.\n");
+
+ DBG_LEAVE();
+}
+
+
+void SmsHalfCall::setNewState (SmsState_t state)
+{
+ DBG_FUNC ("SmsHalfCall::setNewState", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ /*
+ New state is set according to the following rules:
+ 1. Equal to nextState_ (override the table default)
+ if it's set to a legal state [0, SMS_STATE_MAX) , else
+ 2. Stay without change if nextState_ == SMS_STATE_NONE, else
+ 3. Equal to required state, if it's a legal state , else
+ 4. Stay without change if state == SMS_STATE_NONE,
+ */
+
+ currentState_ = (nextState_ < SMS_STATE_MAX)
+ ? nextState_
+ : (nextState_ != SMS_STATE_NONE && state < SMS_STATE_MAX )
+ ? state
+ : currentState_;
+
+ nextState_ = SMS_STATE_MAX; // Reset it
+
+ DBG_WARNING ("SMS leg %d, new state = %d\n",
+ (parent_.callLegNum - SMS_LEGNUM_OFFSET), currentState_);
+
+ DBG_LEAVE();
+}
+
+
+// SMS FSM main access method
+bool SmsHalfCall::invokeHandler (JCCEvent_t newEvent, void *data, INT32 param1)
+{
+ bool retVal ;
+ int index = 0;
+
+ DBG_FUNC ("SmsHalfCall::invokeHandler", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ const smsEventTableEntry_t *stateTable = smsTable_[getState()];
+
+ if (validateEvent (newEvent))
+ {
+
+ DBG_TRACE ("invokeHandler (%s SMS Leg %d).\n\
+ Current State = %d, event %s (%d)\n",
+ (parent_.getSmsLegType() == SMS_MO_LEG) ? "MO" : "MT",
+ (parent_.callLegNum - SMS_LEGNUM_OFFSET), getState(),
+ getEventName(newEvent), newEvent);
+
+ while ((stateTable + index)->event != newEvent &&
+ (stateTable + index)->event != SMS_EVENT_DEFAULT )
+ {
+ ++index;
+ }
+
+ DBG_WARNING ("SMS FSM table entry num %d is selected for state %d.\n",
+ index, getState());
+
+ // Invoke an appropriate handler
+ retVal = (stateTable + index)->handler (this, data, param1);
+
+ // Set new state
+ // This state could be overrided by the handler!
+ if (retVal == false) // Call Continues
+ setNewState ((stateTable + index)->nextState);
+ else
+ setNewState (SMS_STATE_IDLE); // force state to IDLE
+
+ if (getState() == SMS_STATE_IDLE)
+ retVal = true; // safety measure
+ }
+
+ else
+ { // Invalid event (out of the range). No change in a state of the half call.
+ DBG_ERROR ("SMS Error: (SmsHalfCall::smsInvokeHandler) Event = %d is out of range\n",
+ newEvent);
+ retVal = false;
+ }
+
+ DBG_LEAVE ();
+ return (retVal);
+}
+
+const char * SmsHalfCall::getEventName (JCCEvent_t event)
+{
+ static char buff [50];
+
+ unsigned index;
+
+ switch (event)
+ {
+ case SMS_EVENT_MM_EST_CNF :
+ case SMS_EVENT_MM_EST_REJ :
+ case SMS_EVENT_MM_REL_IND :
+ case SMS_EVENT_MM_EST_IND :
+ index = event - CC_INTERNAL_CALL_EVENT_BASE -1;
+ break;
+
+ case SMS_EVENT_MD_ERROR_IND :
+ case SMS_EVENT_CP_DATA :
+ case SMS_EVENT_CP_ACK :
+ case SMS_EVENT_CP_ERROR :
+ case SMS_EVENT_MNSMS_EST_REQ :
+ case SMS_EVENT_MNSMS_DATA_REQ :
+ case SMS_EVENT_MNSMS_REL_REQ :
+ case SMS_EVENT_MNSMS_ABORT_REQ:
+ case SMS_EVENT_TIMEOUT :
+ case SMS_EVENT_PROTOCOL_ERROR :
+ index = event - SMS_EVENT_BASE + 4;
+ break;
+
+ default:
+ sprintf (buff, "Unknown SMS event %d", event);
+ return (buff);
+ }
+
+ return (SmsEventNames [index]);
+}
+
+
+/*******************************************************************/
+SmsMoHalfCall::SmsMoHalfCall (SmsLeg& smsLeg)
+ : SmsHalfCall (smsLeg, (smsEventTableEntry_t **)smsMoTable)
+{
+ ;
+}
+
+
+
+
+/*******************************************************************/
+SmsMtHalfCall::SmsMtHalfCall (SmsLeg& smsLeg)
+ : SmsHalfCall (smsLeg, (smsEventTableEntry_t **)smsMtTable)
+{
+ ;
+}
+
diff --git a/data/mnet/GP10/Host/cc/src/SmsHandlers.cpp b/data/mnet/GP10/Host/cc/src/SmsHandlers.cpp
new file mode 100644
index 0000000..fa47de4
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/SmsHandlers.cpp
@@ -0,0 +1,537 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : SmsHandlers.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 01-20-2000
+// Description : Contains handlers for the SMS-PP FSM
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+//
+
+#include <vxworks.h>
+
+#include "logging\vclogging.h"
+#include "jcc\LUDBApi.h"
+
+#include "CC\CallConfig.h"
+#include "CC\CCUtil.h"
+#include "CC\CCSessionHandler.h"
+
+#include "CC\SmsLeg.h"
+#include "CC\SmsHalfCall.h"
+
+#define SMS_SEND_ABORT_TIMEOUT ((int)(SMS_WAIT_DISCONNECT * 1.5))
+
+
+/* SMS Event handlers */
+/* Handlers will return true is the Leg should be released, otherwise false */
+
+/* ========================================================== */
+/* SMS Default Event handler */
+
+bool smsHandlerDef (SmsHalfCall *hcall, void *data, INT32 param1)
+{
+ DBG_FUNC ("smsHandlerDef", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ SmsLeg & leg = hcall->getParent();
+
+ DBG_WARNING ("SMS: Event inconsistent with protocol state %d received by %s SMS leg %d\n",
+ hcall->getState(), (leg.getSmsLegType() == SMS_MO_LEG) ? "MO" : "MT",
+ (leg.callLegNum - SMS_LEGNUM_OFFSET));
+
+ DBG_LEAVE();
+ return (false);
+}
+
+
+/* ========================================================== */
+/* DL Layer handlers */
+
+bool smsHandlerMdErrInd (SmsHalfCall *hcall, void * data, INT32 param1)
+{
+ DBG_FUNC ("smsHandlerMdErrInd", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ SmsLeg & leg = hcall->getParent();
+
+ hcall->smsTimer_->cancelTimer();
+
+ // take cause in account
+ leg.setRemRelCause (CNI_RIL3_RP_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
+
+ DBG_LEAVE();
+ return (true);
+}
+
+
+/* ========================================================== */
+/* MM handlers */
+
+bool smsHandlerMmEstInd (SmsHalfCall *hcall, void *data, T_CNI_RIL3_SI_TI newTi)
+{
+ bool retVal = false ;
+ SmsLeg & leg = hcall->getParent();
+
+ DBG_FUNC ("smsHandlerMmEstInd", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ // Currently will reject second MO SMS request !!!
+ // Later will take care of concatenated MO SMS here:
+ // will not reject the message with different TI
+ // while waiting for the final CP-ACK
+ if (hcall->getState () == SMS_STATE_IDLE)
+ {
+ // set transaction Id - first message for SMS
+ // The starting entity uses 0. Other side uses 1.
+ // hcall->getParent().setTi (newTi | TI_ORIG_OR_MASK);
+
+ DBG_TRACE ("SMS Leg %d: Set TI = %d\n", (leg.callLegNum - SMS_LEGNUM_OFFSET),
+ leg.getTi());
+
+ // start the timer while waiting for the first CM level setup message
+ // Wait for the following SMS PDU
+ hcall->smsTimer_->setTimer (CALL_MM_CONN_EST_T999);
+ }
+ else
+ {
+ ; // Yet unexpected. Will be handled later
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+bool smsHandlerMmEstCnf (SmsHalfCall *hcall, void * data, INT32 param1)
+{
+ int result;
+ DBG_FUNC ("smsHandlerMmEstCnf", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ CCSessionHandler * session = hcall->getParent().parent;
+ bool retVal = false ;
+
+ hcall->smsTimer_->cancelTimer ();
+
+ /* MM connection has been established.
+ Forward CP-DATA to the session */
+ if ((result = hcall->getParent().msgBuilder->sendCpData())
+ == CNI_RIL3_RESULT_SUCCESS )
+ {
+ hcall->setNextState (SMS_STATE_WAIT_CP_ACK);
+ hcall->smsTimer_->setTimer (SMS_WAIT_CP_ACK_TC1 );
+ }
+ else
+ {
+ DBG_ERROR ("SMS: Unable to send CP-DATA. Error code %d\n", result);
+ retVal = true; // Release connection on packing error
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+bool smsHandlerMmEstRej (SmsHalfCall *hcall, void * data, INT32 param1)
+{
+ DBG_FUNC ("smsHandlerMmEstRej", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ hcall->smsTimer_->cancelTimer();
+
+ // Set error code for SMR to identify the case when Page request failed
+ // This error code is used ONLY inside ViperNet between VC and VB based
+ // SMS Entities and should not be forwarded to the SM-SC
+ hcall->getParent().setRemRelCause (CNI_RIL3_RP_CAUSE_UNKNOWN_SUBSCRIBER);
+
+ DBG_LEAVE();
+ return (true);
+}
+
+
+bool smsHandlerMmRelInd (SmsHalfCall *hcall, void *msgData, INT32 param1)
+{
+ DBG_FUNC ("smsHandlerMmRelInd", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ hcall->smsTimer_->cancelTimer();
+
+ DBG_LEAVE();
+ return (true);
+}
+
+
+/* ========================================================== */
+/* MS PDU handlers */
+
+bool smsHandlerCpData (SmsHalfCall *hcall, T_CNI_RIL3SMS_MSG_CP_DATA *msgCpData, INT32 param1)
+{
+ DBG_FUNC ("smsHandlerCpData", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ int result ;
+ bool retVal = false ;
+ SmsLeg & leg = hcall->getParent() ;
+ T_CNI_RIL3_SI_TI oldTi = leg.getTi() ,
+ newTi = msgCpData->header.si_ti & TI_TERM_AND_MASK;
+
+ // Cancel timer T999
+ hcall->smsTimer_->cancelTimer();
+
+ DBG_TRACE ("CP-DATA received by %s SMS leg %d, TI = %d\n",
+ (leg.getSmsLegType() == SMS_MO_LEG) ? "MO" : "MT",
+ (leg.callLegNum - SMS_LEGNUM_OFFSET), msgCpData->header.si_ti);
+
+ if (leg.getSmsLegType() == SMS_MO_LEG &&
+ (oldTi == SMS_TI_INVALID || // Condition 1.
+ (oldTi != newTi && hcall->getState() == SMS_STATE_WAIT_CP_ACK)) ) // Condition 2.
+ {
+ /* Valid for MO SMS Leg only!
+ 1. For the very first CP PDU received in the dialog OR
+ 2. Received next part of a concatenated MO message
+ described in GSM 04.11, ver 6.0.1, 5.4, page 23.
+ Accept and save received TI */
+ leg.setTi (newTi);
+ }
+ else if (oldTi == newTi)
+ { // Normal case. Consecutive PDU in the trasfer
+ ;
+ }
+ else
+ { // Handle unexpected CP-DATA
+ retVal = smsHandlerCpReject (hcall, (T_CNI_RIL3SMS_CP_MSG *)msgCpData, param1);
+
+ DBG_LEAVE();
+ return (retVal);
+ }
+
+ // send CP-ACK
+ if ((result = leg.msgBuilder->sendCpAck())
+ == CNI_RIL3_RESULT_SUCCESS )
+ {
+ if (leg.getSmsLegType() == SMS_MO_LEG)
+ { // MO (first uplink PDU) - send MNSMS-EST ind (msgCpData->cp_user_data) via VBLink
+ leg.msgBuilder->sendMnSmsEstInd (msgCpData->cp_user_data.length ,
+ msgCpData->cp_user_data.rpdu_data);
+ }
+ else
+ leg.msgBuilder->sendMnSmsDataInd (msgCpData->cp_user_data.length ,
+ msgCpData->cp_user_data.rpdu_data);
+ }
+ else
+ {
+ retVal = true; // Release connection on packing error
+ DBG_ERROR ("SMS: Unable to send CP-ACK. Error code %d\n", result);
+ }
+
+ DBG_LEAVE();
+ return (false);
+}
+
+
+// Response for CP-ACK. Valid in Wait_for_CP-ACK state
+bool smsHandlerCpAck (SmsHalfCall *hcall, T_CNI_RIL3SMS_MSG_CP_ACK *msgCpAck, INT32 param1)
+{
+ bool retVal = false;
+
+ DBG_FUNC ("smsHandlerCpAck", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ hcall->smsTimer_->cancelTimer();
+
+ if (hcall->getState() == SMS_STATE_DISCONNECT)
+ {
+ /* This is an ack for the last CP-DATA in a dialog. Release the leg. */
+ hcall->getParent().resetVbRefNum (); // no need to notify SMR
+ retVal = true;
+ }
+ else
+ hcall->resetRpdu(); // Cleanup RPDU storage
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+bool smsHandlerCpError (SmsHalfCall *hcall, T_CNI_RIL3SMS_MSG_CP_ERROR* msgCpError, INT32 param1)
+{
+ DBG_FUNC ("smsHandlerCpError", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ hcall->smsTimer_->cancelTimer();
+
+ hcall->getParent().setRemRelCause ((T_CNI_RIL3_RP_CAUSE_VALUE)
+ msgCpError->cp_cause.causeValue);
+
+ DBG_LEAVE();
+ return (true);
+}
+
+
+// Used to notify MS about receiving unexpected PDU
+bool smsHandlerCpReject (SmsHalfCall *hcall, T_CNI_RIL3SMS_CP_MSG* msgCpMsg, INT32 param1)
+{
+ DBG_FUNC ("smsHandlerCpReject", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ int result ;
+ bool retVal = false;
+ SmsLeg& leg = hcall->getParent();
+
+ hcall->smsTimer_->cancelTimer();
+
+ leg.setRemRelCause (CNI_RIL3_RP_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE);
+
+ // send CP-ERROR (Error = Msg not compatible with the protocol state[98])
+ if ((result = leg.msgBuilder->sendCpError(CNI_RIL3_CP_CAUSE_MSG_NOT_COMPATIBLE))
+ == CNI_RIL3_RESULT_SUCCESS )
+ {
+ hcall->setNewState (SMS_STATE_DISCONNECT );
+ hcall->smsTimer_->setTimer (SMS_SEND_ABORT_TIMEOUT);
+ }
+ else
+ {
+ DBG_ERROR ("SMS: Unable to send CP-ERROR. Error code %d\n", result);
+ retVal = true;
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+/* ========================================================== */
+/* VB Event handlers */
+
+// Use it for the accepted MT setup only. Otherwise, invoke reject method
+bool smsHandlerMnEstReq (SmsHalfCall *hcall ,
+ SmsVblinkMsg_t *vbMsgData,
+ T_CNI_RIL3_CP_CAUSE_VALUE cause )
+{
+ DBG_FUNC ("smsHandlerMnSmsEstReq", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ bool retVal = false ;
+ SmsLeg & leg = hcall->getParent();
+ IntraL3Msg_t mmOutMsg;
+
+ // Save RP data first
+ hcall->saveRpdu (vbMsgData);
+
+ // Initiate MM Setup (send MM-Est Req)
+
+ // Fill the data for MM message
+ mmOutMsg.l3_data.pageReq.imsi = ludbGetMobileId (leg.ludbIndex());
+ mmOutMsg.l3_data.pageReq.qid = leg.msgQId;
+
+ // Store received VB ref. number
+ leg.setVbRefNum (vbMsgData->hdr.refNum);
+ leg.allocateTi ();
+
+ if (leg.parent->isMmConnected() == false)
+ { // MM connection yet to be established
+ DBG_TRACE ("SMS: handover session = %p, anchor = %p, target = %p\n entryId %d\n",
+ leg.parent->handoverSession, leg.parent->anchorHandoverSession,
+ leg.parent->targetHandoverSession, leg.parent->entryId);
+
+ sendMM (INTRA_L3_MM_EST_REQ, INTRA_L3_MM_LOCATE_MS,
+ leg.entryId() , &mmOutMsg );
+
+ hcall->smsTimer_->setTimer (CALL_MM_CONN_EST_T999);
+ }
+ else
+ { /* Continue with the process by forwarding CP-DATA to MS */
+ retVal = smsHandlerMmEstCnf (hcall, NULL_PTR, 0);
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+bool smsHandlerMnDataReq (SmsHalfCall *hcall ,
+ SmsVblinkMsg_t *vbMsgData,
+ T_CNI_RIL3_CP_CAUSE_VALUE cause )
+{
+ bool retVal = false;
+ int result;
+
+ DBG_FUNC ("smsHandlerMnSmsDataReq", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ hcall->smsTimer_->cancelTimer();
+
+ // Save RP data first
+ hcall->saveRpdu (vbMsgData);
+
+ // Send CP-DATA
+ if ((result = hcall->getParent().msgBuilder->sendCpData())
+ == CNI_RIL3_RESULT_SUCCESS )
+ {
+ if (vbMsgData->hdr.status)
+ hcall->setNextState (SMS_STATE_DISCONNECT);
+ /* Indicates that this is a final message
+ from SMS-SC and the leg should be
+ disconnected upon completion. */
+ hcall->getParent().resetVbRefNum (); /* prevents sending notification to SMR on delivery error */
+
+ hcall->smsTimer_->setTimer (SMS_WAIT_CP_ACK_TC1);
+ }
+ else
+ {
+ retVal = true; // Release connection on packing error
+ DBG_ERROR ("SMS: Unable to send CP-DATA. Error code %d\n", result);
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+bool smsHandlerMnAbortReq (SmsHalfCall *hcall ,
+ SmsVblinkMsg_t *vbMsgData,
+ T_CNI_RIL3_CP_CAUSE_VALUE cause )
+{
+ DBG_FUNC ("smsHandlerMnAbortReq", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ int result ;
+ bool retVal = false;
+ SmsLeg& leg = hcall->getParent();
+
+ hcall->smsTimer_->cancelTimer();
+
+ // send CP-ERROR
+ if ((result = leg.msgBuilder->sendCpError(cause))
+ == CNI_RIL3_RESULT_SUCCESS )
+ {
+ leg.resetVbRefNum ();
+ hcall->smsTimer_->setTimer (SMS_SEND_ABORT_TIMEOUT);
+ }
+ else
+ {
+ DBG_ERROR ("SMS: Unable to send CP-ERROR. Error code %d\n", result);
+ retVal = true;
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+bool smsHandlerMnRelReq (SmsHalfCall *hcall ,
+ SmsVblinkMsg_t *vbMsgData,
+ T_CNI_RIL3_CP_CAUSE_VALUE cause )
+{
+ DBG_FUNC ("smsHandlerMnRelReq", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ SmsLeg & leg = hcall->getParent();
+
+ hcall->smsTimer_->cancelTimer ();
+ leg.resetVbRefNum();
+
+ /* This will allow us to send the final CP-ACK before the channel is released. */
+ if (leg.getSmsLegType() == SMS_MT_LEG &&
+ hcall->getState () == SMS_STATE_CONNECTED )
+ {
+ hcall->smsTimer_->setTimer (SMS_WAIT_DISCONNECT );
+ }
+
+ DBG_LEAVE();
+ return (false);
+}
+
+
+/* ========================================================== */
+/* Timer handlers */
+
+// Fatal SMS timeout handling
+bool smsHandlerTimeout (SmsHalfCall *hcall, void *data, INT32 param1)
+{
+ IntraL3Msg_t mmOutMsg;
+
+ DBG_FUNC ("smsHandlerTimeout", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ hcall->smsTimer_->cancelTimer();
+
+ // Igal: will take cause in account later
+
+ DBG_LEAVE();
+ return (true);
+}
+
+
+// Use it in Wait for CP-ACK state
+bool smsHandlerTimeoutAck (SmsHalfCall *hcall, void *data, INT32 param1)
+{
+ int result ;
+ IntraL3Msg_t mmOutMsg;
+ bool retVal = false;
+
+ DBG_FUNC ("smsHandlerTimeoutAck", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ if (hcall->isLastAttemt())
+ retVal = smsHandlerTimeout (hcall, data, param1); // second attempt has failed
+ else
+ { // resend CP-DATA
+ hcall->smsTimer_->cancelTimer();
+
+ hcall->setLastAttemt();
+
+ // send CP-DATA
+ if ((result = hcall->getParent().msgBuilder->sendCpData())
+ == CNI_RIL3_RESULT_SUCCESS )
+ {
+ hcall->smsTimer_->setTimer (SMS_WAIT_CP_ACK_TC1);
+ }
+ else
+ {
+ DBG_ERROR ("SMS: Unable to send CP-DATA. Error code %d\n", result);
+ retVal = true; // Release connection on packing error
+ }
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+// Use it state Wait for disconnect state
+bool smsHandlerTimerDisc (SmsHalfCall *hcall, void *data, INT32 param1)
+{
+ DBG_FUNC ("smsHandlerTimerDisc", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ bool retVal = true;
+
+ // No need to notify Remote side
+ hcall->getParent().resetVbRefNum ();
+
+ if (hcall->isRpdu())
+ { // This timeout is due to TC1 expiry for a last CP-DATA in a dialog.
+ // Possibly need to resend it.
+ retVal = smsHandlerTimeoutAck (hcall, data, param1);
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
diff --git a/data/mnet/GP10/Host/cc/src/SmsLeg.cpp b/data/mnet/GP10/Host/cc/src/SmsLeg.cpp
new file mode 100644
index 0000000..9b2710c
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/SmsLeg.cpp
@@ -0,0 +1,405 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : SmsLeg.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 01-20-2000
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+//
+
+#include <vxworks.h>
+#include <string.h>
+#include <taskLib.h>
+
+
+#include "Logging\vcmodules.h"
+
+#include "CC/CCSessionHandler.h"
+
+#include "CC/SmsCommonDef.h"
+#include "CC/SmsLeg.h"
+
+extern bool callTrace;
+
+// *******************************************************************
+//
+// *******************************************************************
+
+
+// *******************************************************************
+// SmsLeg class
+// *******************************************************************
+
+// Definition of the static data member
+UINT32 SmsLeg::lastVbRefNum_ (0);
+
+
+SmsLeg::SmsLeg (CCSessionHandler *session,
+ int callId ,
+ MSG_Q_ID qid ,
+ short legNum )
+ : CallLeg ()
+{
+ DBG_FUNC ("SmsLeg::SmsLeg (...)", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ msgBuilder = new SmsMsgBuilder (*this);
+
+ initData ();
+
+ // Init parent class data
+ CallLeg::parent = session;
+ CallLeg::callIndex = callId ;
+ CallLeg::msgQId = qid ;
+ CallLeg::callLegNum = legNum ;
+
+ if (callLegNum == SMS_MO_LEG_NUM)
+ InitMoLeg (); // MO SMS Leg
+ else
+ InitMtLeg (); // MT SMS leg
+
+ DBG_LEAVE();
+}
+
+
+void SmsLeg::initData ()
+{
+ DBG_FUNC ("SmsLeg::initData", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ //Init parent class
+ CallLeg::initData ();
+
+ // Reset local data
+ resetTi ();
+ resetVbRefNum ();
+ setRemRelCause (CNI_RIL3_RP_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
+
+ DBG_LEAVE();
+}
+
+
+bool SmsLeg::InitMoLeg ()
+{
+ DBG_FUNC ("SmsLeg::InitMoLeg", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ legType_ = SMS_MO_LEG;
+ smsFsm_ = new SmsMoHalfCall (*this);
+
+ DBG_LEAVE();
+ return true;
+}
+
+
+bool SmsLeg::InitMtLeg ()
+{
+ DBG_FUNC ("SmsLeg::InitMtLeg", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ legType_ = SMS_MT_LEG;
+ smsFsm_ = new SmsMtHalfCall (*this);
+
+ DBG_LEAVE();
+ return (true);
+}
+
+
+SmsLeg::~SmsLeg ()
+{
+ // Allocated memory cleanup
+
+ if (smsFsm_)
+ delete smsFsm_;
+ if (msgBuilder)
+ delete msgBuilder;
+}
+
+
+void SmsLeg::cleanup (T_CNI_RIL3_CAUSE_VALUE cause)
+{
+ DBG_FUNC ("SmsLeg::cleanup", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ smsFsm_->cleanup (cause);
+
+ initData();
+
+ DBG_LEAVE();
+ return;
+}
+
+
+bool SmsLeg::setupOrig (T_CNI_RIL3_SI_TI ti)
+{
+ // false to reject the setup
+ bool retVal;
+
+ DBG_FUNC ("SmsLeg::setupOrig", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ if (getSmsLegType() != SMS_MO_LEG)
+ {
+ DBG_ERROR ("SMS Error: SMS leg %d is of wrong type (MT).\n",
+ (callLegNum - SMS_LEGNUM_OFFSET));
+ return (isIdle()); // keep current state of the Leg
+ }
+
+ if (smsFsm_->invokeHandler (SMS_EVENT_MM_EST_IND, NULL_PTR, ti) == false)
+ { // returns true if the connection is rejected and the leg is released (reverse logic),
+ // otherwise mark the leg as Busy
+
+ setBusy ();
+ retVal = true;
+
+ if (callTrace)
+ {
+ char callTaskName[20];
+
+ sprintf (callTaskName, "Sms-%d EntryId-%d\0 MO", callIndex, entryId());
+
+ DBG_FUNC(callTaskName, CC_LAYER);
+ }
+ }
+ else
+ retVal = false;
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+void SmsLeg::setupTerm (VOIP_CALL_HANDLE voipCallHandle, int index ,
+ int refValue , bool callWaiting)
+{
+ DBG_FUNC ("SmsLeg::setupTerm", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ if (isIdle())
+ {
+ /* voipCallHandle and callWaiting are not in use for the SMS */
+ /* CDR parameters */
+ cdrIndex = index ;
+ callRefValue = refValue;
+
+ setBusy ();
+ }
+
+ DBG_LEAVE();
+}
+
+
+bool SmsLeg::isHoAllowed ()
+{
+ // HO is allowed when SMS is Idle or in the stage of active signalling
+ return (isIdle() || getHc()->isActive());
+}
+
+
+int SmsLeg::handleTimeoutMsg (IntraL3Msg_t *smsTimerMsg)
+{
+ int retVal = 0;
+
+ DBG_FUNC ("SmsLeg::handleTimeoutMsg", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ if (!isIdle())
+ {
+ /* Pass timer message to the FSM
+ Returns 0 if the leg is keep going,
+ otherwise returns disconnect cause value */
+ retVal = handleMsg (SMS_EVENT_TIMEOUT, NULL_PTR, 0);
+ }
+ else
+ {
+ DBG_ERROR ("SMS Leg %d Error: Unexpected Timeout Message.\n",
+ (callLegNum - SMS_LEGNUM_OFFSET) );
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+bool SmsLeg::handleL2Msg (T_CNI_RIL3MD_CCMM_MSG& l2InMsg, JCCEvent_t event)
+{ // L2 service messages (without PDU)
+ bool retVal;
+
+ DBG_FUNC ("SmsLeg::handleL2Msg", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ retVal = handleMsg (event, &l2InMsg, 0);
+
+ DBG_LEAVE ();
+ return (retVal);
+}
+
+
+bool SmsLeg::handleMmMsg (IntraL3Msg_t& msInMsg, JCCEvent_t event)
+{ // Handle MM service messages
+ bool retVal = false;
+
+ DBG_FUNC ("SmsLeg::handleMmMsg", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ // don't forward late MM Release Ind (in fact confirmation)
+ if (!(isIdle() && event == SMS_EVENT_MM_REL_IND))
+ {
+ // Don't check TI here
+ retVal = handleMsg (event, &msInMsg, 0);
+ }
+
+ DBG_LEAVE ();
+ return (retVal);
+}
+
+
+bool SmsLeg::handleMsMsg (T_CNI_RIL3SMS_CP_MSG& msInMsg, JCCEvent_t event)
+{
+ bool retVal;
+
+ DBG_FUNC ("SmsLeg::handleMsMsg", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ // Don't check TI here
+ retVal = handleMsg (event, &msInMsg, 0);
+
+ DBG_LEAVE ();
+ return (retVal);
+}
+
+
+bool SmsLeg::handleVbMsg (SmsVblinkMsg_t& netInMsg, JCCEvent_t event)
+{
+ bool retVal;
+
+ DBG_FUNC ("SmsLeg::handleVbMsg", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ retVal = handleMsg (event, &netInMsg, netInMsg.hdr.status);
+
+ DBG_LEAVE ();
+ return (retVal);
+}
+
+
+bool SmsLeg::handleMsg (JCCEvent_t event, void *data, INT32 param1)
+{
+ bool retVal;
+ T_CNI_RIL3_RP_CAUSE_VALUE cause ;
+
+ DBG_FUNC ("SmsLeg::handleMsg", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ if (isIdle()) // Protection: The Leg is not initiated
+ {
+ retVal = true; // The leg is already inactive
+ DBG_WARNING ("Idle %s SMS Leg %d received event %d. The message will be discarded.\n",
+ (getSmsLegType() == SMS_MO_LEG) ? "MO":"MT",
+ (callLegNum - SMS_LEGNUM_OFFSET) , event);
+ }
+ else if (retVal = smsFsm_->invokeHandler (event, data, param1))
+ {
+ cause = getRemRelCause ();
+
+ releaseRemSide (cause);
+ cleanup ((T_CNI_RIL3_CAUSE_VALUE)cause);
+ }
+
+ DBG_LEAVE ();
+ return (retVal);
+}
+
+
+bool SmsLeg::releaseRemSide (T_CNI_RIL3_RP_CAUSE_VALUE cause)
+{
+ DBG_FUNC ("SmsLeg::releaseRemSide", CC_SMS_LAYER);
+ DBG_ENTER ();
+
+ /* There is no Network side if reference number isn't allocated */
+ if (getVbRefNum() != INVALID_VC_SMS_REF_NUM)
+ { // release remote side on low layer error
+ msgBuilder->sendMnSmsErrorInd (cause);
+ resetVbRefNum ();
+ }
+
+ DBG_LEAVE ();
+ return (true);
+}
+
+
+/*===============================================================*/
+
+void SmsLeg::printData (JCCPrintStFn fnPtr)
+{
+ char strLeg [] = "Sms Leg:\n";
+ char strInfo[120];
+
+ sprintf (strInfo,
+ "(%s SMS Leg number = %d) (Idle - %s) (SMS FSM State = %d) (TI= %d) (VB ref. num %lu).\n",
+ (legType_ == SMS_MO_LEG) ? "MO" : "MT", callLegNum ,
+ (isIdle() ) ? "Yes" : "No",
+ smsFsm_->getState(), getTi(), getVbRefNum());
+
+ (*fnPtr)(strLeg );
+ (*fnPtr)(strInfo);
+}
+
+//static
+UINT32 SmsLeg::allocateVbRefNum ()
+{
+ if (++lastVbRefNum_ > MAX_VC_SMS_REF_NUM)
+ lastVbRefNum_ = MIN_VC_SMS_REF_NUM;
+
+ return (lastVbRefNum_);
+}
+
+
+void SmsLeg::setVbRefNum (UINT32 refNum = INVALID_VC_SMS_REF_NUM)
+{
+ DBG_FUNC ("SmsLeg::setVbRefNum", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ // Store new ref. number in the object
+ vbRefNum_ = (refNum != INVALID_VC_SMS_REF_NUM)
+ ? refNum
+ : allocateVbRefNum ();
+
+ DBG_TRACE ("SMS: Set VBLink ref.num = %u by the task %s , SMS Leg %d\n",
+ vbRefNum_, taskName(taskIdSelf()), (callLegNum - SMS_LEGNUM_OFFSET));
+ DBG_LEAVE();
+}
+
+
+void SmsLeg::allocateTi ()
+{
+ /* Should be used for MT leg only */
+ DBG_FUNC ("SmsLeg::AllocateTi", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ if (getSmsLegType() == SMS_MT_LEG)
+ {
+ setTi (callLegNum);
+ DBG_TRACE ("SMS: Allocate Ti = %d by the task %s , SMS Leg %d\n",
+ getTi(), taskName(taskIdSelf()), (callLegNum - SMS_LEGNUM_OFFSET));
+ }
+ else
+ DBG_ERROR ("SMS: MO Leg should use received TI. TI is not allocated.\n");
+
+ DBG_LEAVE();
+}
+
diff --git a/data/mnet/GP10/Host/cc/src/SmsMsgBuilder.cpp b/data/mnet/GP10/Host/cc/src/SmsMsgBuilder.cpp
new file mode 100644
index 0000000..bccc2ae
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/SmsMsgBuilder.cpp
@@ -0,0 +1,368 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : SmsMsgBuilder.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 02-10-2000
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+//
+
+#include <vxworks.h>
+#include <string.h>
+
+#include "logging\vcmodules.h"
+
+#include "smspp\smspp_inf.h"
+
+#include "CC/CCSessionHandler.h"
+#include "CC/SmsLeg.h"
+#include "CC/SmsMsgBuilder.h"
+
+bool VBLinkMsToNetSmspp (LUDB_ID, unsigned char *, int);
+
+extern bool smsUseVblink ; // Controls whether to forward MNSMS msg's to ViperBase
+ int smsDamageCpData = 0; // For Test purposes only!!!
+
+/*===============================================================================*/
+/* Ud SMS-related messages pack and send methods */
+
+
+T_CNI_RIL3_RESULT SmsMsgBuilder::sendCpAck ()
+{
+ T_CNI_RIL3_RESULT retVal;
+
+ DBG_FUNC ("SmsMsgBuilder::buildCpAck", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ if (buildMsMsgCommon ())
+ {
+ msOutMsg_.header.message_type = CNI_RIL3SMS_MSGID_CP_ACK;
+ retVal = sendMsMsg ();
+ }
+ else
+ retVal = CNI_RIL3_NON_CC_MESSAGE; // Used to indicate an error
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+T_CNI_RIL3_RESULT SmsMsgBuilder::sendCpError (T_CNI_RIL3_CP_CAUSE_VALUE cause)
+{
+ T_CNI_RIL3_RESULT retVal;
+
+ DBG_FUNC ("SmsMsgBuilder::buildCpError", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ if (buildMsMsgCommon ())
+ {
+ msOutMsg_.header.message_type = CNI_RIL3SMS_MSGID_CP_ERROR;
+ msOutMsg_.cp_error.cp_cause.ie_present = true ;
+ msOutMsg_.cp_error.cp_cause.causeValue = cause ;
+
+ retVal = sendMsMsg ();
+ }
+ else
+ retVal = CNI_RIL3_NON_CC_MESSAGE; // Used to indicate an error
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+T_CNI_RIL3_RESULT SmsMsgBuilder::sendCpData ()
+{
+ T_CNI_RIL3_RESULT retVal;
+
+ DBG_FUNC ("SmsMsgBuilder::buildCpData", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ const T_CNI_RIL3_IE_CP_USER_DATA & rpdu = parent_.getHc()->getRpdu();
+
+ if (buildMsMsgCommon ())
+ {
+ msOutMsg_.header.message_type = CNI_RIL3SMS_MSGID_CP_DATA;
+
+ if (rpdu.ie_present)
+ {
+ memcpy (&(msOutMsg_.cp_data.cp_user_data), &rpdu,
+ sizeof(T_CNI_RIL3_IE_CP_USER_DATA) );
+/*
+ DBG_TRACE ("SMS CP-DATA: RPDU length = %u Is present = %d\n",
+ msOutMsg_.cp_data.cp_user_data.length ,
+ msOutMsg_.cp_data.cp_user_data.ie_present );
+
+ DBG_HEXDUMP (msOutMsg_.cp_data.cp_user_data.rpdu_data,
+ msOutMsg_.cp_data.cp_user_data.length );
+*/
+ retVal = sendMsMsg ();
+ }
+ else
+ retVal = CNI_RIL3_MANDATORY_IE_MISSING;
+ }
+ else
+ retVal = CNI_RIL3_NON_CC_MESSAGE; // Used to indicate an error
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+bool SmsMsgBuilder::buildMsMsgCommon ()
+{
+ bool retVal = true;
+
+ DBG_FUNC ("SmsMsgBuilder::buildMsCommon", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ T_CNI_RIL3_SI_TI ti = parent_.getTi();
+
+ if (ti == SMS_TI_INVALID)
+ {
+ DBG_WARNING ("SMS PDU builder error: TI isn't initialized\n");
+ retVal = false;
+ }
+ else
+ {
+ // But, before we start populating the message content,
+ // zap it clean first.
+ CNI_RIL3_ZAPMSG (&msOutMsg_, sizeof(T_CNI_RIL3SMS_CP_MSG));
+
+ if (parent_.getSmsLegType () == SMS_MO_LEG)
+ ti |= TI_ORIG_OR_MASK;
+
+ // CP message header portion
+ msOutMsg_.header.protocol_descriminator = CNI_RIL3_PD_SMS;
+ msOutMsg_.header.si_ti = ti ;
+
+ DBG_TRACE ("SMS->MS: Build downlink PDU: PD = %d, TI = %d\n",
+ msOutMsg_.header.protocol_descriminator ,
+ msOutMsg_.header.si_ti );
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+T_CNI_RIL3_RESULT SmsMsgBuilder::sendMsMsg ()
+{
+ T_CNI_RIL3_RESULT msOutResult ;
+ T_CNI_LAPDM_L3MessageUnit msEncodedMsg;
+
+ DBG_FUNC ("SmsMsgBuilder::sendMSMsg", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ // call the Encoder function to encode the message
+ msOutResult = CNI_RIL3SMS_CP_Encode (&msOutMsg_ , // input message definition
+ &msEncodedMsg); // encoded layer-3 message
+
+ if (smsDamageCpData &&
+ msOutMsg_.header.message_type == CNI_RIL3SMS_MSGID_CP_DATA )
+ { // intentional damage CP-DATA PDU for testing purpose
+ if (smsDamageCpData == 1)
+ {
+ msEncodedMsg.buffer[1] = 3; /* Change CP-PDU type. Fatal error */
+ DBG_WARNING ("Damaging CP-DATA PDU type!!!\n");
+ }
+ if (smsDamageCpData == 2)
+ {
+ msEncodedMsg.buffer[2] = 0; /* Put RPDU lenght to 0. No RP-ACK will be sent by MS */
+ DBG_WARNING ("Damaging CP-DATA PDU. Reset RPDU length to 0!!!\n");
+ }
+ if (smsDamageCpData == 3)
+ {
+ msEncodedMsg.buffer[2] = 0x03; /* Put RPDU lenght to 0. No RP-ACK will be sent by MS */
+ DBG_WARNING ("Damaging CP-DATA PDU. Reset RPDU msg type to invalid value 0x03!!!\n");
+ }
+ }
+
+ // check the encoding result before sending the message
+ if (msOutResult != CNI_RIL3_RESULT_SUCCESS)
+ {
+ DBG_ERROR ("SMS Error: Encoding CP PDU (Problem = %d) \n ", msOutResult);
+ }
+ else
+ {
+ // encoding successful, send the message to LAPDm for delivery
+ parent_.parent->sendL2Msg (&msEncodedMsg);
+
+ DBG_TRACE ("SMS->MS: Sent PDU (Type = %d, Length = %d)to LAPDm\n",
+ msOutMsg_.header.message_type, msEncodedMsg.msgLength );
+ DBG_HEXDUMP ((unsigned char *)msEncodedMsg.buffer, msEncodedMsg.msgLength);
+ }
+
+ DBG_LEAVE();
+ return (msOutResult);
+}
+
+
+/*===============================================================================*/
+/* VBLink SMS-related pack and send methods */
+
+bool SmsMsgBuilder::sendMnSmsEstInd (UINT32 dataLength, UINT8* rpdu)
+{
+ bool retVal;
+
+ DBG_FUNC ("SmsMsgBuilder::sendMnSmsEstInd", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ // Allocate and store new VB ref. number
+ setVbRefNum ();
+
+ retVal = sendVbMsg (MNSMS_EST_Ind, dataLength, rpdu);
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+bool SmsMsgBuilder::sendMnSmsDataInd (UINT32 dataLength, UINT8* rpdu)
+{
+ bool retVal;
+
+ DBG_FUNC ("SmsMsgBuilder::sendMnSmsDataInd", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ retVal = sendVbMsg (MNSMS_DATA_Ind, dataLength, rpdu);
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+bool SmsMsgBuilder::sendMnSmsErrorInd (T_CNI_RIL3_RP_CAUSE_VALUE cause, UINT32 tempRefNum = 0)
+{
+ bool retVal = true;
+
+ DBG_FUNC ("SmsMsgBuilder::sendMnSmsErrorInd", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ retVal = sendVbMsg (MNSMS_ERROR_Ind, 0, NULL_PTR, cause, tempRefNum);
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+bool SmsMsgBuilder::sendVbMsg (SMS_VBLINK_MSGTYPE msgType ,
+ UINT32 msgLength ,
+ UINT8 *msgData ,
+ UINT32 status = 0,
+ UINT32 tempRefNum = 0)
+{
+ /* status - disconnect cause or zero otherwise
+ tempRefNum - Used to reject incorrect message
+ that doesn't belong to the current SMS session */
+
+ int temp ;
+ unsigned char * pTemp ;
+ bool retVal = true;
+
+ DBG_FUNC ("SmsMsgBuilder::sendVbMsg", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ UINT32 refNum = (tempRefNum) ? tempRefNum : getVbRefNum();
+
+ CNI_RIL3_ZAPMSG (&vbOutMsg_, sizeof(SmsVblinkMsg_t));
+
+ if (refNum == INVALID_VC_SMS_REF_NUM)
+ {
+ DBG_ERROR ("SMS->VBLINK: VB ref. number is not initialized. \
+ Abort sending VB Msg (type = %d)\n", msgType);
+
+ DBG_LEAVE();
+ return (false);
+ }
+
+ if (msgLength <= SMS_MAX_RP_MSG_LEN &&
+ (msgType > MNSMS_MSG_BASE && msgType < MNSMS_MSG_MAX) )
+ {
+ // prepare message data. Ensure the network byte order for the header elements
+ vbOutMsg_.hdr.magic = htonl (SMS_MAGIC_NUMBER);
+ vbOutMsg_.hdr.refNum = htonl (refNum );
+ vbOutMsg_.hdr.msgType = htonl (msgType );
+ vbOutMsg_.hdr.status = htonl (status );
+ vbOutMsg_.hdr.msgLen = htonl (msgLength );
+
+ if (msgLength)
+ { // copy RP message raw data
+ memcpy (vbOutMsg_.msg, msgData, msgLength);
+ }
+
+ DBG_TRACE ("SMS->VBLINK: Attempt to send MNSMS message (type %u) from entity (LUDB = %d),\n\
+ ref number %u, status = %u, RPDU length = %u. RPDU dump: \n",
+ msgType, parent_.ludbIndex(), refNum, status, msgLength);
+
+// DBG_HEXDUMP ((unsigned char *)&vbOutMsg_.msg, msgLength);
+
+ temp = msgLength;
+ pTemp = (unsigned char *)&vbOutMsg_.msg;
+
+ while (temp > 0)
+ {
+ DBG_HEXDUMP (pTemp, ((temp <= 16) ? temp : 16) );
+ temp -= 16;
+ pTemp += 16;
+ }
+
+ // sent message to VBLink
+ if (smsUseVblink)
+ {
+ // The total message length calculation could be wrong
+ // if ported to the different platform or
+ // compiled with the word alignment other than 4 bytes
+ retVal = VBLinkMsToNetSmspp (parent_.parent->ludbIndex ,
+ (unsigned char *)&vbOutMsg_ ,
+ SMS_VBLINK_HDRSIZE + msgLength);
+ }
+ else
+ {
+ DBG_WARNING ("SMS->VBLINK: VBLink interface is OFF. Message will not be send to ViperBase.\n");
+ DBG_HEXDUMP ((unsigned char *)&vbOutMsg_, sizeof (SmsVblinkMsg_t));
+ retVal = false;
+ }
+ }
+ else
+ {
+ DBG_ERROR ("SMS->VBLINK: VBLink message data (Msg type %d) is invalid.\n", msgType);
+ retVal = false;
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+UINT32 SmsMsgBuilder::getVbRefNum ()
+{
+ return (parent_.getVbRefNum());
+}
+
+
+// Allocate and store new VB ref. number
+void SmsMsgBuilder::setVbRefNum ()
+{
+ DBG_FUNC ("SmsMsgBuilder::setVbRefNum", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ parent_.setVbRefNum ();
+
+ DBG_LEAVE();
+}
+
+
diff --git a/data/mnet/GP10/Host/cc/src/hortp.cpp b/data/mnet/GP10/Host/cc/src/hortp.cpp
new file mode 100644
index 0000000..3085551
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/hortp.cpp
@@ -0,0 +1,217 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+#include "string.h"
+#include "logging\vcmodules.h"
+#include "logging\vclogging.h"
+#include "CC/hortp.h"
+
+
+HANDOVER_CHANNEL HandoverChannelArray[MAX_HANDOVER_CHANNELS];
+
+
+/*
+ * InitializeHandpverRtpPool
+ */
+BOOL
+InitializeHandoverRtpPool()
+{
+ DBG_FUNC("InitializeHandoverRtpPool",CC_LAYER);
+ DBG_ENTER();
+ BOOL RetStatus=FALSE;
+ PHANDOVER_CHANNEL pChannel;
+
+ int Counter,ArraySize;
+
+ ArraySize = MAX_HANDOVER_CHANNELS * sizeof(HANDOVER_CHANNEL);
+
+ memset(HandoverChannelArray,0,ArraySize);
+
+
+ for(Counter=0;Counter<MAX_HANDOVER_CHANNELS;Counter++)
+ {
+ pChannel = (PHANDOVER_CHANNEL)&HandoverChannelArray[Counter];
+
+ pChannel->LocalPort = Counter+HANDOVER_RTP_POOL_BEGIN;
+
+ pChannel->RtpHandle = jcRtpOpenEx(pChannel->LocalPort, 1, 0xff, "JetCellBTS" );
+
+ ASSERT(pChannel->RtpHandle != NULL);
+ if (pChannel->RtpHandle == NULL)
+ {
+ DBG_ERROR("Could not open RTP port !!\n");
+ DBG_LEAVE();
+ return RetStatus;
+ }
+
+ jcRtpSetEventHandler(pChannel->RtpHandle,HoRtpEventHandler,NULL,"HOver");
+
+#ifdef FAST_RTP_READ
+ jcRtpSetFastReadHandler(pChannel->RtpHandle,HoRtpFastReadHandler);
+#endif
+ /*
+ * Notify CSU of the new RTP port
+ */
+ T_CSU_PORT_ID CsuPort;
+ CsuPort.portType = CSU_RTP_PORT;
+ CsuPort.portId.rtpHandler = pChannel->RtpHandle;
+ if (csu_RegSrcSnkPort(&CsuPort) != CSU_RESULT_REG_SUCCESS) {
+ DBG_ERROR("Unable to register RTP port with CSU!!\n");
+ }
+ else {
+ RetStatus = TRUE;
+ }
+
+ DBG_TRACE("RTP %X\n",pChannel->RtpHandle);
+ }
+
+ DBG_LEAVE();
+ return(RetStatus);
+}
+
+
+
+/*
+ * AssignHandoverRtpChannel
+ */
+HJCRTPSESSION
+AssignHandoverRtpChannel()
+{
+ DBG_FUNC("AssignHandoverRtpChannel",CC_LAYER);
+ DBG_ENTER();
+ int Count;
+ PHANDOVER_CHANNEL pChannel;
+
+
+ for(Count=0;Count<MAX_HANDOVER_CHANNELS;Count++) {
+ pChannel = &HandoverChannelArray[Count];
+ if (pChannel->Used == FALSE) {
+ pChannel->Used = TRUE;
+ DBG_LEAVE();
+ return(pChannel->RtpHandle);
+ }
+ }
+
+ DBG_LEAVE();
+ return(NULL);
+}
+
+
+
+/*
+ * ReleaseHandoverRtpChannel
+ */
+void
+ReleaseHandoverRtpChannel(HJCRTPSESSION RtpHandle)
+{
+ DBG_FUNC("ReleaseHandoverRtpChannel",CC_LAYER);
+ DBG_ENTER();
+ int Count;
+ PHANDOVER_CHANNEL pChannel;
+
+ for(Count=0;Count<MAX_HANDOVER_CHANNELS;Count++) {
+ pChannel = &HandoverChannelArray[Count];
+ if (pChannel->RtpHandle == RtpHandle) {
+ pChannel->Used = FALSE;
+ break;
+ }
+ }
+ DBG_LEAVE();
+}
+
+
+
+/*
+ * handoverRtpDataPrint
+ */
+void
+handoverRtpDataPrint(void)
+{
+
+ int Count;
+ PHANDOVER_CHANNEL pChannel;
+
+
+ for(Count=0;Count<MAX_HANDOVER_CHANNELS;Count++) {
+ pChannel = &HandoverChannelArray[Count];
+ if (pChannel->Used == FALSE)
+ {
+ printf("RtpHandle = %p is not used\n", pChannel->RtpHandle);
+ }
+ else
+ {
+ printf("RtpHandle = %p is used\n", pChannel->RtpHandle);
+ }
+ }
+
+}
+
+
+
+/*
+ * GetIncomingHandoverRtpPort
+ */
+UINT16
+GetIncomingHandoverRtpPort(HJCRTPSESSION RtpHandle)
+{
+ DBG_FUNC("GetIncomingHandoverRtpPort",CC_LAYER);
+ DBG_ENTER();
+ int Count;
+ PHANDOVER_CHANNEL pChannel;
+ int RetStatus = 0;
+
+ for(Count=0;Count<MAX_HANDOVER_CHANNELS;Count++) {
+ pChannel = &HandoverChannelArray[Count];
+ if (pChannel->RtpHandle == RtpHandle) {
+ RetStatus = pChannel->LocalPort;
+ break;
+ }
+ }
+
+ DBG_LEAVE();
+ return(RetStatus);
+}
+
+
+
+/*
+ * SetRemoteHandoverRtpPort
+ */
+void
+SetRemoteHandoverRtpPort(HJCRTPSESSION RtpHandle,UINT32 ip,UINT16 port)
+{
+ DBG_FUNC("SetRemoteHandoverRtpPort",CC_LAYER);
+ DBG_ENTER();
+
+ jcRtpSetRemoteAddress( RtpHandle, ip, port );
+
+ DBG_LEAVE();
+}
+
+
+
+/*
+ * HoRtpEventHandler
+ */
+RTP_READ_STATUS HoRtpEventHandler(HJCRTPSESSION RtpHandle,void *Context)
+{
+ RTPEventHandler(RtpHandle, (int)Context,0);
+}
+
+
+
+#ifdef FAST_RTP_READ
+/*
+ * HoRtpFastReadHandler
+ */
+void
+HoRtpFastReadHandler(HJCRTPSESSION RtpHandle,unsigned char *newPacket,int packetLength,rtpParam RtpParam,void *Context)
+{
+ RTPFastReadHandler(RtpHandle,newPacket,packetLength,RtpParam,(int)Context,0);
+
+}
+#endif
diff --git a/data/mnet/GP10/Host/cc/src/smqueue.cpp b/data/mnet/GP10/Host/cc/src/smqueue.cpp
new file mode 100644
index 0000000..54ec1e8
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src/smqueue.cpp
@@ -0,0 +1,120 @@
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems, Inc 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : SmsLeg.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 26-05-2000
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+//
+
+#include <vxworks.h>
+
+#include "cc/ccsessionhandler.h"
+#include "cc/smqueue.h"
+
+
+
+
+/*=========================================================================*/
+
+void SmQueue::flash ()
+{
+ unsigned index = 0;
+
+ DBG_FUNC ("SmQueue::flash", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ lock();
+
+ while (!isEmpty ())
+ {
+ DBG_TRACE ("SmQueue: Send PDU %d to LAPDm\n", (index+1));
+ parent_.sendL2Msg (storage_ + index++);
+ --queueCounter_;
+ }
+
+ initData();
+
+ DBG_LEAVE();
+}
+
+
+bool SmQueue::add (const T_CNI_LAPDM_L3MessageUnit * inMsg)
+{
+ bool retVal = false;
+
+ DBG_FUNC ("SmQueue::add", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ if (!(isLocked() || isFull()))
+ {
+ storage_[queueCounter_++] = *inMsg;
+ retVal = true ;
+ }
+ else
+ DBG_ERROR ("SmQueue: attempt to add message to the full queue. lock=%d, full=%d\n",
+ isLocked(), isFull() );
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+/*=========================================================================*/
+
+void SmQueueMm::flash ()
+{
+ unsigned index = 0;
+
+ DBG_FUNC ("SmQueueMm::flash", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ lock();
+
+ while (!isEmpty ())
+ {
+ DBG_TRACE ("SmQueueMm: Send MM Message %d\n", (index+1));
+ parent_.parent->sendMMMsg (storage_ + index++);
+ --queueCounter_;
+ }
+
+ initData();
+
+ DBG_LEAVE();
+}
+
+
+bool SmQueueMm::add (const IntraL3Msg_t * inMsg)
+{
+ bool retVal = false;
+
+ DBG_FUNC ("SmQueueMm::add", CC_SESSION_LAYER);
+ DBG_ENTER();
+
+ if (!(isLocked() || isFull()))
+ {
+ storage_[queueCounter_++] = *inMsg;
+ retVal = true ;
+ }
+ else
+ DBG_ERROR ("SmQueueMm: attempt to add message to the full queue. lock=%d, full=%d\n",
+ isLocked(), isFull() );
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
diff --git a/data/mnet/GP10/Host/cc/src_api/CCMobUtil.cpp b/data/mnet/GP10/Host/cc/src_api/CCMobUtil.cpp
new file mode 100644
index 0000000..e59de74
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src_api/CCMobUtil.cpp
@@ -0,0 +1,124 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCMobUtil.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+#include "stdio.h"
+
+#include "jcc/JCCLog.h"
+
+#include "logging/VCLOGGING.h"
+
+#include "CC/CCUtil.h"
+
+// Need to include MM Message Queue
+#include "mm/MMInt.h"
+
+// Need to include RR Message Queue
+#ifndef _NO_RRM
+extern MSG_Q_ID rm_MsgQId;
+#endif
+
+bool
+sendRR (IntraL3PrimitiveType_t prim ,
+ IntraL3MsgType_t msgType ,
+ T_CNI_IRT_ID entryId ,
+ IntraL3Msg_t *rrOutMsg)
+{
+ DBG_FUNC("sendRR", CC_LAYER);
+ DBG_ENTER();
+
+ rrOutMsg->module_id = MODULE_CC;
+ rrOutMsg->primitive_type = prim;
+ rrOutMsg->message_type = msgType;
+
+ rrOutMsg->entry_id = entryId;
+
+ // send the message.
+#ifndef _NO_RRM
+ if (ERROR == msgQSend( rm_MsgQId,
+ (char *) rrOutMsg,
+ sizeof(struct IntraL3Msg_t),
+ NO_WAIT, //PR1553 <xxu> WAIT_FOREVER,
+ MSG_PRI_NORMAL
+ ) )
+ {
+ DBG_ERROR("CC Error : sendRR msgQSend (QID = %d) error\n ",
+ (int)rm_MsgQId);
+ DBG_LEAVE();
+ return(false);
+ }
+ else
+ {
+ DBG_TRACE("CC Call Log: Sent Message to RR, (Prim. Type = %d), (Msg Type = %d)\n",
+ prim,
+ msgType);
+ if (msgType == INTRA_L3_RR_CHANN_ASSIGN_CMD)
+ {
+ DBG_TRACE("CC->RR: Chann Assignment Request with Speech Version: %d",
+ rrOutMsg->l3_data.channAssignCmd.channelType.speechChann.version);
+ }
+
+ DBG_LEAVE();
+ return(true);
+ }
+
+#endif
+ DBG_LEAVE();
+ return(true);
+}
+
+bool
+sendMM (IntraL3PrimitiveType_t prim ,
+ IntraL3MsgType_t msgType ,
+ T_CNI_IRT_ID entryId ,
+ IntraL3Msg_t *mmOutMsg)
+{
+ DBG_FUNC("sendMM", CC_LAYER);
+ DBG_ENTER();
+
+ mmOutMsg->module_id = MODULE_CC;
+ mmOutMsg->primitive_type = prim;
+ mmOutMsg->message_type = msgType;
+
+ mmOutMsg->entry_id = entryId;
+
+ // send the message.
+ if (ERROR == msgQSend( mmMsgQId,
+ (char *) mmOutMsg,
+ sizeof(struct IntraL3Msg_t),
+ NO_WAIT, //PR1553 <xxu> WAIT_FOREVER,
+ MSG_PRI_NORMAL
+ ) )
+ {
+ DBG_ERROR("CC Error : sendMM msgQSend (QID=%d) error\n ",
+ (int)mmMsgQId);
+ DBG_LEAVE();
+ return(false);
+ }
+ else
+ {
+ DBG_TRACE("CC Call Log: Sent Message to MM, Prim. Type, Msg Type: %d %d\n",
+ prim,
+ msgType);
+ DBG_LEAVE();
+ return(true);
+ }
+}
+
diff --git a/data/mnet/GP10/Host/cc/src_api/CCapiH323.cpp b/data/mnet/GP10/Host/cc/src_api/CCapiH323.cpp
new file mode 100644
index 0000000..e4fec03
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src_api/CCapiH323.cpp
@@ -0,0 +1,450 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCapiH323.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 02-15-98
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include <stdlib.h>
+
+// included L3 Message header for messages from other Layer 3 modules (CC, RR)
+#include "logging/VCLOGGING.h"
+
+#include "voip/voipapi.h"
+#include "jcc/JCCUtil.h"
+#include "jcc/JCCVcMsg.h"
+#include "CC/CCInt.h"
+#include "CC/CCconfig.h"
+#include "CC/CCTypes.h"
+#include "voip/vblink.h"
+
+// Global Variables for current Call Sessions
+CCSession_t ccSession[CC_MAX_CC_CALLS_DEF_VAL];
+short CC_MAX_CC_CALLS; //
+
+bool
+checkTransactionId( VOIP_CALL_HANDLE callHandle,
+ T_CNI_IRT_ID txnId,
+ IntraL3Msg_t *ccOutMsg)
+{
+ DBG_FUNC("checkTransactionId", CC_LAYER);
+ DBG_ENTER();
+
+ short callId;
+ short callLegId;
+
+ // get the call id and call leg id bits out
+ callId = (txnId & 0xff);
+ callLegId = ((txnId >> 8) & 0xff);
+
+ // Get the Message Queue Id for the Call Control Task
+ if ( (0 > callId) ||
+ ( callId >= CC_MAX_CC_CALLS) )
+ {
+ if (callId == VOIP_API_NULL_TXN_ID)
+ {
+ // Null value is received for transaction id.
+ // send this message to the parent cc task
+
+ }
+ else
+ {
+ DBG_ERROR("H323->CC Error : Bad (txnId = %d) with (Handle = %p)\n",
+ txnId,
+ (int)callHandle
+ );
+ DBG_LEAVE();
+ return (false);
+ }
+ }
+ else
+ {
+ // if (ccSession[transactionId].h323CallHandle != VOIP_NULL_CALL_HANDLE)
+ // {
+ // if ((ccSession[transactionId].sessionHandler)->findHandle(callHandle))
+ // {
+ // // Transaction id is not valid.
+ // DBG_WARNING("H323->CC Warning: Late Msg. for (Handle = %p) (Txn.Id = %d)\n",
+ // (int)callHandle,
+ // transactionId );
+ // DBG_LEAVE();
+ // return (false);
+ // }
+ // }
+ };
+
+ // check call leg id range
+ if ( (callLegId < 0) || // When callLegId == 0 signifies non-external handover callp event
+ (callLegId > 8) ) // JOE: Replace hardcoded values with CONSTANT.
+ {
+ DBG_ERROR("H323->CC Error : Bad (txnId = %d) with (Handle = %p)\n",
+ txnId,
+ (int)callHandle
+ );
+ DBG_LEAVE();
+ return (false);
+ };
+
+ ccOutMsg->entry_id = callId;
+ DBG_LEAVE();
+ return (true);
+}
+
+bool
+CcVoipMessageHandler(VOIP_API_MESSAGE *voipInMsg)
+{
+ DBG_FUNC("CcVoipMessageHandler", CC_LAYER);
+ DBG_ENTER();
+
+ MSG_Q_ID qid;
+ IntraL3Msg_t ccOutMsg;
+ short callId;
+ short callLegId;
+
+ ccOutMsg.module_id = MODULE_H323;
+ ccOutMsg.call_handle = voipInMsg->VoipCallHandle;
+
+ //CDR <xxu:08-24-00>
+ ccOutMsg.H323CRV = voipInMsg->H323CRV;
+
+ // EHO <chenj:06-25-01>
+ // get the call id and call leg id bits out
+ callId = (voipInMsg->TxnId & 0xff);
+ callLegId = ((voipInMsg->TxnId >> 8) & 0xff);
+
+ ccOutMsg.callleg_id = callLegId;
+
+ DBG_TRACE("H323->CC API LOG: Sending CC a Msg(%d) callHandle(%d) ludbId(%d) sessionId(%d) callleg (%d)\n",
+ (int)voipInMsg->MessageType,(int)voipInMsg->VoipCallHandle, (int)voipInMsg->LudbId,
+ (int)callId,
+ (int)callLegId);
+
+ switch (voipInMsg->MessageType) {
+
+ //BCT <xxu:09-21-00> BEGIN
+ case VOIP_API_CALL_UPDATE_HANDLES:
+ {
+ if (callId == VOIP_API_NULL_TXN_ID)
+ {
+ qid = ccMsgQId;
+ }
+ else
+ {
+ qid = ccSession[callId].msgQId;
+ }
+
+ ccOutMsg.l3_data.voipMsg.callUpdateHandles.NewHandle = voipInMsg->CallUpdateHandles.NewHandle;
+
+ //DBG_TRACE("VOIP->CC(api): BCT update call handles at transferred party:\n");
+ //DBG_TRACE("VOIP->CC(api): oldHandle(%x), newHandle(%x), sessionId(%d), ludbId(%d) qId(%x)\n",
+ // voipInMsg->VoipCallHandle,
+ // voipInMsg->CallUpdateHandles.NewHandle,
+ // voipInMsg->TxnId,
+ // voipInMsg->LudbId,
+ // qid);
+
+ ccOutMsg.entry_id = voipInMsg->LudbId;
+
+ ccOutMsg.message_type = (IntraL3MsgType_t)INTRA_L3_CC_BCT_UPDATE_HANDLES;
+ break;
+ }
+ //BCT <xxu:09-21-00> END
+
+ case VOIP_API_CALL_OFFERING:
+ {
+ qid = ccMsgQId;
+
+ ccOutMsg.l3_data.setup.callOffering = voipInMsg->CallOffering;
+
+ // DBG_TRACE("API: calling party number received from Voip:\n");
+ // DBG_TRACE(
+ // "(ie_present=%d),(numberType=%d),(plan=%d),(numDigits=%d)\n",
+ // voipInMsg->CallOffering.CallingPartyNumber.ie_present,
+ // voipInMsg->CallOffering.CallingPartyNumber.numberType,
+ // voipInMsg->CallOffering.CallingPartyNumber.numberingPlan,
+ // voipInMsg->CallOffering.CallingPartyNumber.numDigits);
+
+ // DBG_TRACE("API: called party number received from Voip:\n");
+ // DBG_TRACE("(numDigits=%d), (%d), (%d), (%d), (%d), (%d)\n",
+ // voipInMsg->CallOffering.CalledPartyNumber.numDigits,
+ // voipInMsg->CallOffering.CalledPartyNumber.digits[0],
+ // voipInMsg->CallOffering.CalledPartyNumber.digits[1],
+ // voipInMsg->CallOffering.CalledPartyNumber.digits[2],
+ // voipInMsg->CallOffering.CalledPartyNumber.digits[3],
+ // voipInMsg->CallOffering.CalledPartyNumber.digits[4]
+ // );
+
+ ccOutMsg.entry_id = voipInMsg->LudbId;
+
+ ccOutMsg.message_type =
+ (IntraL3MsgType_t)
+ INTRA_L3_CC_Q931_SETUP;
+ break;
+ }
+
+ case VOIP_API_CODEC_SELECTED:
+ {
+ if (!(checkTransactionId(voipInMsg->VoipCallHandle,
+ voipInMsg->TxnId,
+ &ccOutMsg)))
+ {
+ DBG_LEAVE();
+ return (false);
+ }
+
+ if (ccOutMsg.entry_id == VOIP_API_NULL_TXN_ID)
+ {
+ qid = ccMsgQId;
+ }
+ else
+ {
+ qid = ccSession[ccOutMsg.entry_id].msgQId;
+ }
+
+ ccOutMsg.message_type = INTRA_L3_CC_H245_CHANN_SELECT;
+ ccOutMsg.l3_data.voipMsg.codecSelected = voipInMsg->CodecSelected;
+ break;
+ }
+
+ case VOIP_API_CALL_EVENT:
+ {
+ if (!(checkTransactionId(voipInMsg->VoipCallHandle,
+ voipInMsg->TxnId,
+ &ccOutMsg)))
+ {
+ DBG_LEAVE();
+ return (false);
+ }
+
+ if (ccOutMsg.entry_id == VOIP_API_NULL_TXN_ID)
+ {
+ qid = ccMsgQId;
+ }
+ else
+ {
+ qid = ccSession[ccOutMsg.entry_id].msgQId;
+ }
+
+ ccOutMsg.message_type = (IntraL3MsgType_t)
+ (INTRA_L3_CC_Q931_BASE + (voipInMsg->CallEvent.CallEvent - VOIP_MOBILE_CALL_EVENT_BASE));
+ ccOutMsg.l3_data.voipMsg.basicCallInMsg = voipInMsg->CallEvent;
+ break;
+ }
+
+ default:
+ {
+ DBG_ERROR("H323->CC API ERROR: Unexpected Msg(%d) callHandle(%d) ludbId(%d) sessionId(%d) callleg(%d)\n",
+ (int)voipInMsg->MessageType, (int)voipInMsg->VoipCallHandle, (int)voipInMsg->LudbId,
+ (int)callId,
+ (int)callLegId);
+
+ DBG_LEAVE();
+ return(false);
+ }
+
+ }
+
+ // send the message.
+ if (ERROR == msgQSend( qid,
+ (char *) &ccOutMsg,
+ sizeof(struct IntraL3Msg_t),
+ NO_WAIT, //PR1553 <xxu> WAIT_FOREVER,
+ MSG_PRI_NORMAL
+ ) )
+ {
+ DBG_ERROR("H323->CC API ERROR: sendCC msgQSend (QID = %p) error\n ",
+ (int)qid);
+ DBG_LEAVE();
+ return (false);
+ }
+ else
+ {
+ //DBG_TRACE("H323 Log: Sent Message to CC, (Call Handle = %p), (Msg Type = %d), (reason = %d)\n",
+ // (int)ccOutMsg.call_handle,
+ // ccOutMsg.message_type,
+ // voipInMsg->CallEvent.ReasonCode);
+ DBG_LEAVE();
+ return (true);
+ }
+}
+
+bool
+CcVBLinkMessageHandler(char *cellId, char *ipAddress, TXN_ID txnId)
+{
+
+ DBG_FUNC("CcVBLinkMessageHandler", CC_LAYER);
+ DBG_ENTER();
+
+ MSG_Q_ID qid;
+ IntraL3Msg_t ccOutMsg;
+
+ ccOutMsg.module_id = MODULE_H323;
+
+ DBG_TRACE("VBL->CC API LOG: Sending CC IP Addr Rsp Msg(%d) cellId(%s) ipAddr(%s) sessionId(%d)\n",
+ (int)INTRA_L3_CC_RAS_IP_ADDRESS_RESPONSE,
+ cellId, ipAddress, txnId);
+
+ if ( (0 > txnId) ||
+ (txnId >= CC_MAX_CC_CALLS) )
+ {
+ DBG_ERROR("VBL->CC API ERROR: Bad txnId(%d)\n",
+ txnId);
+ DBG_LEAVE();
+ return(false);
+ }
+
+ ccOutMsg.entry_id = txnId;
+
+ qid = ccSession[ccOutMsg.entry_id].msgQId;
+
+ ccOutMsg.message_type = INTRA_L3_CC_RAS_IP_ADDRESS_RESPONSE;
+
+ strcpy(&(ccOutMsg.l3_data.ipAddressResponse.ViperCellId[0]), cellId);
+
+ strcpy(&(ccOutMsg.l3_data.ipAddressResponse.ViperCellIpAddress[0]), ipAddress);
+
+ // send the message.
+ if (ERROR == msgQSend( qid,
+ (char *) &ccOutMsg,
+ sizeof(struct IntraL3Msg_t),
+ NO_WAIT, //PR1553 <xxu> WAIT_FOREVER,
+ MSG_PRI_NORMAL
+ ) )
+ {
+ DBG_ERROR("VBL->CC API ERROR: sendCC msgQSend (QID = %p) error\n ",
+ (int)qid);
+ DBG_LEAVE();
+ return(false);
+ }
+ else
+ {
+ //DBG_TRACE("VB Link Log: Sent Message to CC (cell id requested = %s)",
+ // cellId);
+ DBG_LEAVE();
+ return(true);
+ }
+
+}
+
+
+BOOL CcVBLinkCellStatusUpdate (char *pCellId, VBLINK_VC_STATUS_INFO status)
+{
+ IntraL3Msg_t ccOutMsg;
+ int cellNum ;
+
+ DBG_FUNC ("CcVBLinkCellStatusUpdate", CC_LAYER);
+ DBG_ENTER ();
+
+ ccOutMsg.module_id = MODULE_H323 ;
+ ccOutMsg.call_handle = 0 ;
+ ccOutMsg.message_type = INTRA_L3_CC_VC_UPDATE_INFO;
+
+ if ((cellNum = atoi (pCellId)) <= 0)
+ {
+ // Invalid ViperCell ID
+ DBG_ERROR ("VBL->CC API ERROR: Sending CC a Msg(%d) w. Invalid CellID(%s) cellNum(%d) status(%d)\n",
+ (int)INTRA_L3_CC_VC_UPDATE_INFO, pCellId, cellNum, status);
+ DBG_LEAVE ();
+ return (FALSE);
+ }
+
+ DBG_TRACE("VBL->CC API LOG: Sending CC GP StatusUpdate Msg(%d) cellId(%s) cellNum(%d) StatusUpdate(%d)\n",
+ (int)INTRA_L3_CC_VC_UPDATE_INFO, pCellId, cellNum, status);
+
+ // Correct Network ID is not provided at this time
+ ccOutMsg.l3_data.statusVCMsg.btsID.networkId = 0 ;
+ ccOutMsg.l3_data.statusVCMsg.btsID.cellId = cellNum;
+ ccOutMsg.l3_data.statusVCMsg.status = status ;
+
+ // send the message.
+ if (ERROR == msgQSend (ccMsgQId ,
+ (char *) &ccOutMsg ,
+ sizeof (struct IntraL3Msg_t),
+ NO_WAIT , //PR1553 <xxu> WAIT_FOREVER
+ MSG_PRI_NORMAL ) )
+ {
+ DBG_ERROR ("VBL->CC API ERROR : sendCC msgQSend (QID = %p) error.\n",
+ (int)ccMsgQId);
+ DBG_LEAVE ();
+
+ return (FALSE);
+ }
+
+ //DBG_TRACE ("ViperLink Log: Sent VC update message to CC, ID = %d, status = %d .\n",
+ // cellNum, status);
+ DBG_LEAVE ();
+
+ return (TRUE);
+}
+
+
+//BCT <xxu:08-11-00> BEGIN
+bool
+CcVBLinkTransferResponse (
+ unsigned short reqSeqNumber,
+ unsigned char rejectCause,
+ T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER cpn )
+{
+
+ DBG_FUNC("CCVBLinkTransferResponse", CC_LAYER);
+ DBG_ENTER();
+
+ MSG_Q_ID qid;
+ IntraL3Msg_t ccOutMsg;
+
+ ccOutMsg.module_id = MODULE_H323;
+
+ DBG_TRACE("VBL->CC API LOG: Sending BCT No. Rsp reqSeqNo(%d) rejectCause(%d) bctNo(%d,%d,%d,%d,%d,%d)\n",
+ reqSeqNumber, rejectCause, cpn.digits[0], cpn.digits[1], cpn.digits[2], cpn.digits[3],
+ cpn.digits[4], cpn.digits[5]);
+
+ if ( reqSeqNumber >= CC_MAX_CC_CALLS )
+ {
+ DBG_ERROR("VBL->CC API ERROR: Bad reqSegNumber(%d)\n",
+ reqSeqNumber);
+ DBG_LEAVE();
+ return(false);
+ }
+
+ ccOutMsg.entry_id = reqSeqNumber;
+
+ qid = ccSession[ccOutMsg.entry_id].msgQId;
+ ccOutMsg.message_type = INTRA_L3_CC_RAS_BCT_NUMBER_RESPONSE;
+ ccOutMsg.l3_data.bctNumberResponse.reqSeqNumber = reqSeqNumber;
+ ccOutMsg.l3_data.bctNumberResponse.rejectCause = rejectCause;
+ memcpy(&(ccOutMsg.l3_data.bctNumberResponse.cpn), &cpn,
+ sizeof(T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER));
+
+ // send the message.
+ if (ERROR == msgQSend( qid,
+ (char *) &ccOutMsg,
+ sizeof(struct IntraL3Msg_t),
+ NO_WAIT, //PR1553 <xxu> WAIT_FOREVER,
+ MSG_PRI_NORMAL
+ ) )
+ {
+ DBG_ERROR("VBL->CC API ERROR: sendCC msgQSend (QID = %p) error\n ",
+ (int)qid);
+ DBG_LEAVE();
+ return(false);
+ }
+
+ DBG_LEAVE();
+ return(true);
+}
+//BCT <xxu:08-11-00> END
diff --git a/data/mnet/GP10/Host/cc/src_api/CCapiViperLink.cpp b/data/mnet/GP10/Host/cc/src_api/CCapiViperLink.cpp
new file mode 100644
index 0000000..4c77d85
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src_api/CCapiViperLink.cpp
@@ -0,0 +1,150 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 0.1
+// Status : Under development
+// File : CCapiViperLink.cpp
+// Author(s) : Bhawani Sapkota
+// Create Date : 11-24-1999
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+// included L3 Message header for messages from other Layer 3 modules (CC, RR)
+
+#include "logging/VCLOGGING.h"
+
+#include "voip/voipapi.h"
+#include "jcc/JCCLog.h"
+#include "jcc/JCCUtil.h"
+#include "CC/CCInt.h"
+#include "CC/CCconfig.h"
+#include "CC/CCTypes.h"
+
+// converts the message from network byte ordering format
+// to the host byte ordering format
+
+static bool
+ccCissUnpackVblinkMsg(CISSVblinkMsg_t &cissMsg,
+ unsigned char buffer[],
+ int size
+ )
+{
+ CISSVblinkMsg_t &orgMsg = (CISSVblinkMsg_t &) *buffer;
+ DBG_FUNC("ccCissUnpackVblinkMsg", CC_CISS_LAYER);
+ DBG_ENTER();
+
+
+ // Check the integrity of the message first
+ cissMsg.Magic = ntohl(orgMsg.Magic);
+ if (cissMsg.Magic != VOIP_API_MAGIC_VALUE)
+ {
+ // corrupt message
+
+ DBG_ERROR("Corrupt message (magic number = %d)\n", cissMsg.Magic);
+ DBG_LEAVE();
+ return false;
+ }
+
+ cissMsg.msgLen = ntohl(orgMsg.msgLen);
+ if (cissMsg.msgLen <= 0
+ || (int) (cissMsg.msgLen + kCissVbLinkMsgHdrLen) != size)
+ {
+
+ DBG_ERROR("Incorrect msg length (expected = %d, actual = %d)\n",
+ cissMsg.msgLen+kCissVbLinkMsgHdrLen,
+ size
+ );
+
+ DBG_LEAVE();
+ return false;
+ // message size is not correct, corrupt message
+ }
+
+ cissMsg.callIdx = ntohl(orgMsg.callIdx);
+ cissMsg.msgType = (T_CNI_RIL3_MESSAGE_TYPE) ntohl(orgMsg.msgType);
+ cissMsg.status = ntohl(orgMsg.status);
+ memcpy(cissMsg.msg, orgMsg.msg, cissMsg.msgLen);
+
+ DBG_LEAVE();
+ return true;
+}
+
+// Actual call back function called by VBLink task
+bool
+ccCissProcessViperBaseMsg(LUDB_ID ludbIdx, char * buffer, int size)
+{
+ CISSVblinkMsg_t cissMsg;
+ bool status = false;
+ int cause;
+
+ DBG_FUNC("ccCissProcessViperBaseMsg", CC_CISS_LAYER);
+ DBG_ENTER();
+
+ DBG_HEXDUMP((unsigned char *) buffer, size);
+ status = ccCissUnpackVblinkMsg(cissMsg, (unsigned char *) buffer, size);
+ DBG_TRACE("CISS STATUS = %d\n", cissMsg.status);
+
+
+ if (status)
+ {
+
+ MSG_Q_ID qid;
+ IntraL3Msg_t ccOutMsg;
+
+ memset((void *) &ccOutMsg, 0, sizeof(IntraL3Msg_t));
+
+ ccOutMsg.module_id = MODULE_CISS;
+
+ if ( cissMsg.callIdx < 0 || cissMsg.callIdx >= CC_MAX_CC_CALLS)
+ {
+ DBG_ERROR("CISS->CC Error : Bad (Transaction Id = %d)\n",
+ cissMsg.callIdx);
+ DBG_LEAVE();
+ return false;
+ }
+
+ ccOutMsg.entry_id = cissMsg.callIdx;
+
+ qid = ccSession[cissMsg.callIdx].msgQId;
+
+ ccOutMsg.message_type = (IntraL3MsgType_t) cissMsg.msgType;
+
+ ccOutMsg.l3_data.cissMsg = cissMsg;
+
+
+ // send the message.
+ if (ERROR == msgQSend(
+ qid,
+ (char *) &ccOutMsg,
+ sizeof(CISSVblinkMsg_t),
+ NO_WAIT, //PR1553 <xxu> WAIT_FOREVER,
+ MSG_PRI_NORMAL)
+ )
+ {
+ DBG_ERROR("CISS->CC Error : sendCC msgQSend (QID = %p) error\n ",
+ (int)qid);
+ status = false;
+
+ } else {
+ DBG_TRACE("CISS Log: Sent Message to CC, (Entry ID = %p), (Msg Type = %d)\n",
+ (int)ccOutMsg.entry_id,
+ ccOutMsg.message_type);
+ status = true;
+ }
+ }
+ DBG_LEAVE();
+ return status;
+
+}
+
diff --git a/data/mnet/GP10/Host/cc/src_api/Makefile b/data/mnet/GP10/Host/cc/src_api/Makefile
new file mode 100644
index 0000000..096aeca
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src_api/Makefile
@@ -0,0 +1,52 @@
+##########################################################
+#
+# (c) Copyright Cisco 2000
+# All Rights Reserved
+#
+##########################################################
+
+# TOP_OF_VOB must be defined before including l3defs.mk
+TOP_OF_VOB = ..\..\..
+
+# These Must be Properly Defined
+THIS_APP_DIR = cc
+THIS_DIRECTORY = src_api
+MY_OUTPUT = $(OBJDIR)\ccm_api.out
+
+# Name(s) of Common VOB directories to include
+COMMON_BLD_DIR =
+
+include $(TOP_OF_VOB)\l3defs.mk
+
+all: makeCommonObjs $(MY_OUTPUT)
+
+# Adds the .o file(s) list needed from the Common VOB
+makeCommonObjs:
+ifneq ($(COMMON_BLD_DIR),)
+ @for %f in ($(COMMON_BLD_DIR)) do \
+ make -C $(COMMON_VOB_APP_DIR)\%f \
+ all VOB=$(VOBNAME) APPDIR=Host\$(THIS_APP_DIR)\$(THIS_DIRECTORY)
+endif
+
+# If Common VOB directories to include get the .o files from bin
+$(MY_OUTPUT): $(MODULE_OBJS)
+ifneq ($(COMMON_BLD_DIR),)
+ $(LD) -r -o $@.tmp $() $(MODULE_OBJS) $(wildcard ./bin/*.o)
+else
+ $(LD) -r -o $@.tmp $() $(MODULE_OBJS)
+endif
+ $(NM) $@.tmp | munch > _ctdt.c
+ $(CC) -traditional $(CC_ARCH_SPEC) -c _ctdt.c
+ $(LD) -r -o $@ _ctdt.o $@.tmp
+ $(RM)$(subst /,$(DIRCHAR), _ctdt.c _ctdt.o $@.tmp)
+
+cleanall:
+ @for %f in ($(notdir $(MODULE_OBJS))) do \
+ $(RM) ..\bin\%f
+
+ $(RM) $(MY_OUTPUT)
+
+ifneq ($(COMMON_BLD_DIR),)
+ $(RM) bin\*.o
+ $(RM) bin\*.out
+endif
diff --git a/data/mnet/GP10/Host/cc/src_api/SmsVblink.cpp b/data/mnet/GP10/Host/cc/src_api/SmsVblink.cpp
new file mode 100644
index 0000000..ade59e5
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src_api/SmsVblink.cpp
@@ -0,0 +1,169 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : SmsVblink.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 31-03-2000
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+//
+
+#include <vxworks.h>
+#include <string.h>
+
+#include "logging\vcmodules.h"
+#include "logging\vclogging.h"
+
+#include "jcc\jcccommsg.h"
+
+//#include "voip\vblink.h"
+
+#include "CC\ccint.h"
+#include "CC\ccutil.h"
+
+bool smsUseVblink = true; /* Controls whether to forward MNSMS msg's from SMS to
+ ViperBase and visa versa. */
+
+// Local declarations
+static bool smsUnpackVblinkMsg (SmsVblinkMsg_t&, const SmsVblinkMsg_t *, unsigned int);
+
+
+/* Parser and routing function for the MNSMS messages received from SMR entity */
+bool smsReceiveSmrMsg (LUDB_ID ludbIdx, unsigned char *msgData, unsigned int msgLen)
+{
+ MSG_Q_ID qid ;
+ bool retVal ;
+ int sessionId;
+ IntraL3Msg_t l3MsgOut ;
+ SMS_VBLINK_MSGTYPE msgType ;
+
+ SmsVblinkMsg_t& smsMsgOut = l3MsgOut.l3_data.smsVbMsg;
+
+ DBG_FUNC ("smsReceiveSmrMsg", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ DBG_TRACE ("VBLINK->SMS: received message from ViperBase.\n");
+// DBG_HEXDUMP (msgData, msgLen);
+
+ if (smsUseVblink == false)
+ {
+ DBG_WARNING ("VBLink->SMS: VBLink interface is OFF. The message will not be forwarded to SMS.\n");
+ DBG_LEAVE ();
+ return (false);
+ }
+
+ if (msgLen < SMS_VBLINK_HDRSIZE || msgLen > sizeof (SmsVblinkMsg_t))
+ {
+ DBG_ERROR ("VBLink->SMS Error : Invalid message length = %d \n", msgLen);
+ DBG_LEAVE ();
+ return (false);
+ }
+
+ // Reset the output message pool
+ memset (&l3MsgOut, 0, sizeof(IntraL3Msg_t));
+
+ if (smsUnpackVblinkMsg (smsMsgOut, (SmsVblinkMsg_t *)msgData, msgLen) == false)
+ {
+ DBG_LEAVE ();
+ return (false);
+ }
+
+ msgType = ( SMS_VBLINK_MSGTYPE)smsMsgOut.hdr.msgType;
+
+ if (msgType <= MNSMS_MSG_BASE || msgType >= MNSMS_MSG_MAX)
+ {
+ DBG_ERROR ("VBLink->SMS Error : Unknown message type = %d \n", smsMsgOut.hdr.msgType);
+ DBG_LEAVE ();
+ return (false);
+ }
+
+ l3MsgOut.module_id = MODULE_H323 ;
+ l3MsgOut.message_type = INTRA_L3_SMS_MESSAGE ;
+ l3MsgOut.entry_id = ludbIdx ;
+
+ // The following parameters are not in use
+ l3MsgOut.call_handle = VOIP_NULL_CALL_HANDLE;
+
+ // Forward the message to the appropriate CC entity (either CC main or Call-x task)
+ // MNSMS-EST Req always sent to CC Main task in order to avoid race conditions
+ if (msgType != MNSMS_EST_Req && (sessionId = mobInCall(ludbIdx)) != JCC_ERROR)
+ qid = ccSession[sessionId].msgQId; // MS is already engaged
+ else
+ qid = ccMsgQId; // MS is not involved in any, forward to the CC main task
+
+ // send the message
+ if (ERROR == msgQSend (qid ,
+ (char *)&l3MsgOut ,
+ sizeof (IntraL3Msg_t),
+ NO_WAIT, //PR1553 <xxu> WAIT_FOREVER,
+ MSG_PRI_NORMAL ))
+ {
+ DBG_ERROR ("VBLINK->SMS Error : sendCC msgQSend (QID = %p) error\n ",
+ (int)qid);
+ retVal = false;
+ }
+ else
+ {
+ DBG_TRACE ("VBLINK->SMS: Sent Message to SMS, (LUDB = %d), (Msg Type = %d)\n",
+ ludbIdx, smsMsgOut.hdr.msgType);
+ retVal = true;
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+static bool smsUnpackVblinkMsg (SmsVblinkMsg_t& smsMsgOut,
+ const SmsVblinkMsg_t *smsMsgIn ,
+ unsigned int msgLen )
+{
+ DBG_FUNC("smsUnpackVblinkMsg", CC_SMS_LAYER);
+ DBG_ENTER();
+
+ // Check integrity of the message
+ if ((smsMsgOut.hdr.magic = ntohl (smsMsgIn->hdr.magic)) != SMS_MAGIC_NUMBER)
+ {
+ // corrupted or non-SMS message
+ DBG_ERROR ("VBLINK->SMS Error: Corrupted message is received (magic number = %#x)\n",
+ smsMsgOut.hdr.magic);
+ DBG_LEAVE ();
+ return (false);
+ }
+
+ // Check the associated RP message data length
+ if ((smsMsgOut.hdr.msgLen = ntohl(smsMsgIn->hdr.msgLen)) > SMS_MAX_RP_MSG_LEN)
+ {
+ DBG_ERROR ("VBLINK->SMS Error: Invalid RP message data length = %ul is received\n",
+ smsMsgOut.hdr.msgLen);
+ DBG_LEAVE ();
+ return (false);
+ }
+
+ smsMsgOut.hdr.refNum = ntohl (smsMsgIn->hdr.refNum );
+ smsMsgOut.hdr.msgType = ntohl (smsMsgIn->hdr.msgType);
+ smsMsgOut.hdr.status = ntohl (smsMsgIn->hdr.status );
+
+ memcpy (smsMsgOut.msg, smsMsgIn->msg, smsMsgOut.hdr.msgLen);
+
+ DBG_TRACE ("VBLINK->SMS: Received message type %d, ref.num = %d, status = %d\n RPDU Data: ",
+ smsMsgOut.hdr.msgType, smsMsgOut.hdr.refNum, smsMsgOut.hdr.status);
+ DBG_HEXDUMP (smsMsgOut.msg, smsMsgOut.hdr.msgLen);
+
+ DBG_LEAVE();
+ return (true);
+}
+
diff --git a/data/mnet/GP10/Host/cc/src_api/ccutil2.cpp b/data/mnet/GP10/Host/cc/src_api/ccutil2.cpp
new file mode 100644
index 0000000..93a2d66
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src_api/ccutil2.cpp
@@ -0,0 +1,201 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCUtil2.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 04-04-00
+// Description : This file contains common CC utility functions
+// required by the ccm_api module.
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include <vxworks.h>
+
+#include "jcc/JCCComMsg.h"
+#include "cc/CCsessionHandler.h"
+#include "cc/cc_util_ext.h"
+
+//ext-HO <xxu:06-08-01>
+//ext-HO <xxu:06-08-01>
+short ccHoNumberCompare(T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER *hoNumber,
+ T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER *cpn,
+ int length )
+{
+ short result;
+
+ DBG_FUNC("ccHoNumberCompare", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ result = 1;
+
+ if ( (hoNumber->ie_present==cpn->ie_present) &&
+ (hoNumber->numberType==cpn->numberType) &&
+ (hoNumber->numberingPlan==cpn->numberingPlan) &&
+ (hoNumber->numDigits==cpn->numDigits) )
+
+ {
+ if (memcmp(hoNumber->digits, cpn->digits, hoNumber->numDigits)==0)
+ {
+ DBG_TRACE("{\nccHoNumberCompare: CPN is Handove Number\n}\n");
+ result = 0;
+ } else
+ {
+ DBG_TRACE("{\nccHoNumberCompare: CPN is NOT Handove Number\n}\n");
+ }
+ } else
+ {
+
+ DBG_TRACE("{\nccHoNumberCompare: CPN is NOT Handove Number\n}\n");
+ }
+
+ DBG_LEAVE();
+ return result;
+}
+
+short ccIsHandoverCallSetup(IntraL3Msg_t *h323InMsg)
+{
+ T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER cpn;
+ cpn = h323InMsg->l3_data.voipMsg.callOffering.CalledPartyNumber;
+
+ DBG_FUNC("ccIsHandoverCallSetup", CC_ETRG_LAYER);
+ DBG_ENTER();
+
+ //Dump cpn for debugging purpose
+ DBG_TRACE("{\nMNETeiTRACE(ccIsHandoverCallSetup): handover call SETUP cpn:\n");
+ DBG_TRACE(" (cpn.ie_present=%d, cpn.numberType=%d, cpn.numberingPlan=%d\n",
+ cpn.ie_present,cpn.numberType,cpn.numberingPlan);
+ DBG_TRACE(" (cpn.numDigits=%d digits:%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x)\n\n",
+ cpn.numDigits,cpn.digits[0],cpn.digits[1],cpn.digits[2],
+ cpn.digits[3],cpn.digits[4],cpn.digits[5],cpn.digits[6],
+ cpn.digits[7],cpn.digits[8],cpn.digits[9],cpn.digits[10]);
+ DBG_TRACE(" SETUP CPN Hex Dump:\n");
+ DBG_HEXDUMP((unsigned char*)&cpn, sizeof(T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER));
+ DBG_TRACE("}\n\n");
+
+ short i;
+ for(i=0; i< CC_MAX_CC_CALLS; i++)
+ {
+ if ( (ccSession[i].free==false) &&
+ (ccSession[i].sessionHandler->handoverSession
+ == ccSession[i].sessionHandler->targetHandoverSessionExtHo) )
+ {
+ if (ccHoNumberCompare(&ccSession[i].sessionHandler->handoverSession->hoNumber_, &cpn,
+ sizeof(T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER)) == 0)
+ {
+ DBG_TRACE("\nMNETeiTRACE(ccIsHandoverCallSetup): found Handover Session(callId=%d)\n}\n",
+ i);
+ DBG_LEAVE();
+ return i;
+ }
+
+ }
+ }
+
+ DBG_LEAVE();
+ return JCC_ERROR;
+}
+
+
+//Overloaded method for searching according to ludbIndex
+short mobInCall (const short ludbIndex)
+{
+ DBG_FUNC("mobInCall(ludbIndex)", CC_LAYER);
+ DBG_ENTER();
+
+ short i;
+ for(i=0; i< CC_MAX_CC_CALLS; i++)
+ {
+ if (ccSession[i].free == false)
+ {
+ if (ccSession[i].sessionHandler->ludbIndex == ludbIndex)
+ {
+ DBG_LEAVE();
+ return i;
+ }
+ }
+ }
+
+ DBG_LEAVE();
+ return JCC_ERROR;
+}
+
+//Overloaded method for searching according to entry ID
+short mobInCall2 (const T_CNI_IRT_ID entryId)
+{
+ DBG_FUNC("mobInCall(entryId)", CC_LAYER);
+ DBG_ENTER();
+
+ short index;
+ for (index = 0; index < CC_MAX_CC_CALLS; index++)
+ {
+ if (ccSession[index].free == false)
+ {
+ if (ccSession[index].sessionHandler->entryId == entryId)
+ {
+ DBG_LEAVE();
+ return (index);
+ }
+ }
+ }
+
+ DBG_LEAVE();
+ return JCC_ERROR;
+}
+
+
+// <Igal: 04-10-01>
+// Unconditional release CC session(s) by the LUDB index
+bool CcNotifyPurge (short ludbIndex)
+{
+ DBG_FUNC("CcNotifyPurge", CC_LAYER);
+ DBG_ENTER();
+
+ bool retVal = true;
+ short callIdx ;
+ IntraL3Msg_t ccOutMsg;
+
+ memset (&ccOutMsg, 0, sizeof(IntraL3Msg_t));
+
+ ccOutMsg.module_id = MODULE_LUDB ;
+ ccOutMsg.primitive_type = INTRA_L3_DATA ;
+ ccOutMsg.message_type = INTRA_L3_LUDB_PURGE_PROFILE;
+
+ for (callIdx = 0; callIdx < CC_MAX_CC_CALLS; ++callIdx)
+ {
+ if (ccSession[callIdx].free != True &&
+ ccSession[callIdx].sessionHandler != NULL )
+ {
+ if (ccSession[callIdx].sessionHandler->ludbIndex == ludbIndex)
+ {
+ // Use priority in order to prevent CC from accessing removed LUDB entry
+ // while processing other inputs
+ if (msgQSend (ccSession[callIdx].msgQId ,
+ (char *)&ccOutMsg ,
+ sizeof (struct IntraL3Msg_t),
+ NO_WAIT ,
+ MSG_PRI_URGENT ) == ERROR)
+ {
+ DBG_ERROR ("LUDB->CC API ERROR: send CC Call task [QID = %p] error.\n",
+ (int)ccSession[callIdx].msgQId );
+ retVal = false;
+ }
+ }
+ }
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
diff --git a/data/mnet/GP10/Host/cc/src_init/CCinit.cpp b/data/mnet/GP10/Host/cc/src_init/CCinit.cpp
new file mode 100644
index 0000000..038b444
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src_init/CCinit.cpp
@@ -0,0 +1,30 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCinit.cpp
+// Author(s) : Sheausong Yang
+// Create Date : 11-01-98
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "ril3/ril3md.h"
+
+// Global variable for Message Queue
+MSG_Q_ID ccMsgQId;
+
+// Used by RRM to create IRT entries.
+T_CNI_L3_ID cc_id;
+
diff --git a/data/mnet/GP10/Host/cc/src_init/Makefile b/data/mnet/GP10/Host/cc/src_init/Makefile
new file mode 100644
index 0000000..6a2f622
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/src_init/Makefile
@@ -0,0 +1,52 @@
+##########################################################
+#
+# (c) Copyright Cisco 2000
+# All Rights Reserved
+#
+##########################################################
+
+# TOP_OF_VOB must be defined before including l3defs.mk
+TOP_OF_VOB = ..\..\..
+
+# These Must be Properly Defined
+THIS_APP_DIR = cc
+THIS_DIRECTORY = src_init
+MY_OUTPUT = $(OBJDIR)\ccm_init.out
+
+# Name(s) of Common VOB directories to include
+COMMON_BLD_DIR =
+
+include $(TOP_OF_VOB)\l3defs.mk
+
+all: makeCommonObjs $(MY_OUTPUT)
+
+# Adds the .o file(s) list needed from the Common VOB
+makeCommonObjs:
+ifneq ($(COMMON_BLD_DIR),)
+ @for %f in ($(COMMON_BLD_DIR)) do \
+ make -C $(COMMON_VOB_APP_DIR)\%f \
+ all VOB=$(VOBNAME) APPDIR=Host\$(THIS_APP_DIR)\$(THIS_DIRECTORY)
+endif
+
+# If Common VOB directories to include get the .o files from bin
+$(MY_OUTPUT): $(MODULE_OBJS)
+ifneq ($(COMMON_BLD_DIR),)
+ $(LD) -r -o $@.tmp $() $(MODULE_OBJS) $(wildcard ./bin/*.o)
+else
+ $(LD) -r -o $@.tmp $() $(MODULE_OBJS)
+endif
+ $(NM) $@.tmp | munch > _ctdt.c
+ $(CC) -traditional $(CC_ARCH_SPEC) -c _ctdt.c
+ $(LD) -r -o $@ _ctdt.o $@.tmp
+ $(RM)$(subst /,$(DIRCHAR), _ctdt.c _ctdt.o $@.tmp)
+
+cleanall:
+ @for %f in ($(notdir $(MODULE_OBJS))) do \
+ $(RM) ..\bin\%f
+
+ $(RM) $(MY_OUTPUT)
+
+ifneq ($(COMMON_BLD_DIR),)
+ $(RM) bin\*.o
+ $(RM) bin\*.out
+endif
diff --git a/data/mnet/GP10/Host/cc/test/CCtestUpdateVC.cpp b/data/mnet/GP10/Host/cc/test/CCtestUpdateVC.cpp
new file mode 100644
index 0000000..a5b7844
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/test/CCtestUpdateVC.cpp
@@ -0,0 +1,54 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CCtestUpdateVC.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 11-01-98
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+// included VxWorks headers
+#include <vxWorks.h>
+
+#include "jcc/JCCVcMsg.h"
+#include "voip/vblink.h"
+
+#include "CC/CCTypes.h"
+
+bool sendVcFailNotification (unsigned short);
+
+bool sendVcFailNotification (unsigned short cellId)
+{
+ BOOL retVal ;
+ VOIP_API_MESSAGE voipMsg;
+ char vcName [256];
+
+ sprintf ((char *)vcName, "%d", cellId);
+
+ if ((retVal = CcVBLinkCellStatusUpdate (vcName, VC_STATUS_DOWN)) == TRUE)
+ {
+ printf ("DBG: Using test function for sending ViperCell Num %s Failure Msg.\n",
+ vcName );
+ }
+ else
+ {
+ printf ("DBG: Failed to send ViperCell Num %s Failure Msg to CC using test function.\n",
+ vcName );
+ }
+
+ return retVal;
+}
+
diff --git a/data/mnet/GP10/Host/cc/test/ForC.h b/data/mnet/GP10/Host/cc/test/ForC.h
new file mode 100644
index 0000000..3931150
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/test/ForC.h
@@ -0,0 +1,83 @@
+#ifndef ForC_H
+#define ForC_H
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : ForC.h
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+// included VxWorks headers
+#include "vxWorks.h"
+#include "JCC/JCCLog.h"
+#include "JCC/JCCL3Msg.h"
+
+#include "lapdm/lapdm_l3intf.h"
+
+#include "MM/MMConfig.h"
+#include "MM/MMInt.h"
+#include "RIL3/ril3irt_db.h"
+
+#include "CC/CallConfig.h"
+#include "CC/CCconfig.h"
+#include "CC/CCInt.h"
+#include "CC/CCTypes.h"
+
+#include "JCC/LUDBInstance.h"
+#include "JCC/LUDBConfig.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+extern void populateLUDB();
+
+extern void tccInit();
+
+extern void tmmPrint();
+
+extern void tccPrint();
+
+extern void tmmInit();
+
+
+extern void ccTest();
+
+extern void irtDataPrint();
+
+void fromMS(short entryId,
+ T_CNI_LAPDM_L2L3PrimitiveType prim,
+ unsigned char buff0,
+ unsigned char buff1);
+extern
+void fromRRtoMM(short entryId,
+ IntraL3PrimitiveType_t prim,
+ IntraL3MsgType_t msgType);
+extern
+void fromRRtoCC(short entryId,
+ IntraL3PrimitiveType_t prim,
+ IntraL3MsgType_t msgType,
+ short msSide);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ForC_H
diff --git a/data/mnet/GP10/Host/cc/test/Makefile b/data/mnet/GP10/Host/cc/test/Makefile
new file mode 100644
index 0000000..0e01078
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/test/Makefile
@@ -0,0 +1,52 @@
+##########################################################
+#
+# (c) Copyright Cisco 2000
+# All Rights Reserved
+#
+##########################################################
+
+# TOP_OF_VOB must be defined before including l3defs.mk
+TOP_OF_VOB = ..\..\..
+
+# These Must be Properly Defined
+THIS_APP_DIR = cc
+THIS_DIRECTORY = test
+MY_OUTPUT = $(OBJDIR)\cc_test.out
+
+# Name(s) of Common VOB directories to include
+COMMON_BLD_DIR =
+
+include $(TOP_OF_VOB)\l3defs.mk
+
+all: makeCommonObjs $(MY_OUTPUT)
+
+# Adds the .o file(s) list needed from the Common VOB
+makeCommonObjs:
+ifneq ($(COMMON_BLD_DIR),)
+ @for %f in ($(COMMON_BLD_DIR)) do \
+ make -C $(COMMON_VOB_APP_DIR)\%f \
+ all VOB=$(VOBNAME) APPDIR=Host\$(THIS_APP_DIR)\$(THIS_DIRECTORY)
+endif
+
+# If Common VOB directories to include get the .o files from bin
+$(MY_OUTPUT): $(MODULE_OBJS)
+ifneq ($(COMMON_BLD_DIR),)
+ $(LD) -r -o $@.tmp $() $(MODULE_OBJS) $(wildcard ./bin/*.o)
+else
+ $(LD) -r -o $@.tmp $() $(MODULE_OBJS)
+endif
+ $(NM) $@.tmp | munch > _ctdt.c
+ $(CC) -traditional $(CC_ARCH_SPEC) -c _ctdt.c
+ $(LD) -r -o $@ _ctdt.o $@.tmp
+ $(RM)$(subst /,$(DIRCHAR), _ctdt.c _ctdt.o $@.tmp)
+
+cleanall:
+ @for %f in ($(notdir $(MODULE_OBJS))) do \
+ $(RM) ..\bin\%f
+
+ $(RM) $(MY_OUTPUT)
+
+ifneq ($(COMMON_BLD_DIR),)
+ $(RM) bin\*.o
+ $(RM) bin\*.out
+endif
diff --git a/data/mnet/GP10/Host/cc/test/ccVarTest.cpp b/data/mnet/GP10/Host/cc/test/ccVarTest.cpp
new file mode 100644
index 0000000..c762857
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/test/ccVarTest.cpp
@@ -0,0 +1,441 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : ccVarTest.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+#include "stdio.h"
+
+#include "vxWorks.h"
+#include "oam_api.h"
+#include "JCC/JCCL3Msg.h"
+
+#include "lapdm/lapdm_l3intf.h"
+
+#include "MM/MMConfig.h"
+#include "MM/MMInt.h"
+
+
+extern MobilityConfigData mmCfg;
+
+// Used by RRM to create IRT entries.
+extern T_CNI_L3_ID mm_id;
+
+#include "RIL3/ril3irt_db.h"
+
+#include "CC/CallConfig.h"
+#include "CC/CCconfig.h"
+#include "CC/CCInt.h"
+#include "CC/CCTypes.h"
+
+#include "JCC/LUDBInstance.h"
+#include "JCC/LUDBConfig.h"
+
+#include "JCC/JCCLog.h"
+
+extern void mmDataInit(void);
+extern void ccDataInit(void);
+
+extern short registerUser(const T_CNI_RIL3_IE_MOBILE_ID& imsi);
+
+extern short testIMSIindex;
+
+extern T_CNI_RIL3_IE_MOBILE_ID testIMSI[];
+
+extern short origSoftMobDialedNumIndex;
+
+extern T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER testDialedNum[];
+
+extern T_CNI_IRT_ID softMobEntryId[];
+
+extern T_CNI_LAPDM_OID softMobLapdmOid[]; // Any large number
+
+extern int termSoftMobIndex,
+ origSoftMobIndex;
+
+T_CNI_LAPDM_L2L3CallBackData callback[CC_MAX_CC_CALLS_DEF_VAL];
+
+T_CNI_L3_ID l3Id1, l3Id2;
+
+bool readIMSITable( char* dnFile )
+{
+ FILE* pfd;
+ short i, j;
+ int inp;
+
+ if( NULL == ( pfd = fopen( dnFile, "r" ) ) )
+ {
+ printf( "Error opening file '%s'\n", dnFile );
+ return (false);
+ }
+
+ for(i=0; i< CC_MAX_CC_CALLS;i++)
+ {
+ testIMSI[i].numDigits = 15;
+
+ for (j=0; j < testIMSI[i].numDigits; j++)
+ {
+ fscanf( pfd , "%d", &inp);
+ testIMSI[i].digits[j] = inp;
+ }
+
+ fscanf(pfd, "\n");
+
+ testIMSI[i].ie_present = true;
+
+ testIMSI[i].mobileIdType = CNI_RIL3_IMSI;
+
+ for (j=0; j < testIMSI[i].numDigits; j++)
+ {
+ printf( "%d ", testIMSI[i].digits[j]);
+ }
+
+ printf("\n");
+ }
+
+ fclose( pfd );
+
+ return (true);
+}
+
+void locReqSet(short imsiIndex)
+{
+ testIMSIindex = imsiIndex;
+}
+
+void origSoftMobSet(short dialedNum)
+{
+ origSoftMobDialedNumIndex = dialedNum;
+}
+
+void softMobSet(short imsiIndex)
+{
+ testIMSIindex = imsiIndex;
+}
+
+void softMobStart(short imsiIndex)
+{
+
+ // Prepare L3 Ids
+ l3Id1.msgq_id = mmMsgQId;
+ l3Id1.sub_id = (unsigned short) mmCfg.mm_max_mm_connections;
+
+ l3Id2.msgq_id = ccMsgQId;
+
+ softMobSet(imsiIndex);
+
+ callback[imsiIndex].lapdm_oid = softMobLapdmOid[imsiIndex];
+ callback[imsiIndex].data.msgLength = 2;
+ callback[imsiIndex].sapi = 0;
+ callback[imsiIndex].layer3_ID = 1;
+ callback[imsiIndex].unserved_data_after_release = false;
+
+ callback[imsiIndex].error_cause = EC_NO_ERROR;
+
+ // Create the IRT entry
+
+ softMobEntryId[imsiIndex] =
+ // lapdm_oid, rr_id, mm_id, cc_id
+ CNI_RIL3_IRT_Register(softMobLapdmOid[imsiIndex], l3Id2, l3Id1, l3Id2 );
+
+}
+
+extern CNI_RIL3IRT_DB CNI_IRT_database;
+
+void
+irtEntryPrint(T_CNI_RIL3IRT_DB_ENTRY &irtDBEntry)
+{
+ printf("IRT DBEntry: %d, %d, %p, %d, %p, %d, %p, %d \n",
+ irtDBEntry.entry_id,
+ irtDBEntry.lapdm_oid,
+ irtDBEntry.rrm_id.msgq_id,
+ irtDBEntry.rrm_id.sub_id,
+ irtDBEntry.mm_id.msgq_id,
+ irtDBEntry.mm_id.sub_id,
+ irtDBEntry.cc_id.msgq_id,
+ irtDBEntry.cc_id.sub_id);
+}
+
+void irtDataPrint()
+{
+ short i;
+ JCCLog("***************************************************************************************\n");
+ JCCLog("**************************************Synchronize with ShowAll*************************\n");
+ JCCLog("***************************************************************************************\n");
+
+ for(i=0; i< 38; i++)
+ {
+ irtEntryPrint(CNI_IRT_database.m_entry[i]);
+ }
+}
+
+// void irtMMDataInit()
+// {
+// short i;
+// for(i=0; i< 25 ; i++)
+// {
+// CNI_IRT_database.m_entry[i].mm_id = mm_id;
+// }
+// }
+
+// void mmDataInit()
+// {
+// mmConnDataInit();
+// irtMMDataInit();
+// }
+
+void softMobInit(short imsiIndex)
+{
+ softMobSet(imsiIndex);
+ mmDataInit();
+ ccDataInit();
+}
+
+void fromMS(short callbackIndex,
+ T_CNI_LAPDM_L2L3PrimitiveType prim,
+ unsigned char buff0,
+ unsigned char buff1)
+{
+ callback[callbackIndex].primitive_type = prim;
+ callback[callbackIndex].data.buffer[0] = buff0;
+ callback[callbackIndex].data.buffer[1] = buff1;
+
+ CNI_RIL3MD_L3CallBack (&callback[callbackIndex]);
+ printf("CC Test Log: Sent Message from Soft MS, Prim. Type, Buffer Contents: %d %d %d\n",
+ prim,
+ buff0,
+ buff1);
+}
+
+void fromRRtoMM(short callIndex,
+ IntraL3PrimitiveType_t prim,
+ IntraL3MsgType_t msgType)
+{
+ short entryId = softMobEntryId[callIndex];
+
+ IntraL3Msg_t rrToMMMsg;
+
+ rrToMMMsg.module_id = MODULE_RM;
+ rrToMMMsg.primitive_type = prim;
+ rrToMMMsg.message_type = msgType;
+
+ rrToMMMsg.entry_id = entryId;
+
+ // Fill in the required message fields.
+ rrToMMMsg.l3_data.pageRsp.mobileId = testIMSI[callIndex];
+
+ // send the message.
+ if (ERROR == msgQSend( mmMsgQId,
+ (char *) &rrToMMMsg,
+ sizeof(struct IntraL3Msg_t),
+ NO_WAIT,
+ MSG_PRI_NORMAL
+ ) )
+ {
+ printf("CC Test Error : fromRRtoMM msgQSend (QID=%d) error\n ",
+ mmMsgQId);
+ }
+ else
+ {
+ printf("CC Test Log: Sent Message from RR to MM, Prim. Type, Msg Type: %d %d\n",
+ prim,
+ msgType);
+ }
+}
+
+void fromRRtoCC(IntraL3PrimitiveType_t prim,
+ IntraL3MsgType_t msgType,
+ short callIndex)
+{
+ CCSession_t *sess = &ccSession[callIndex];
+ short entryId = softMobEntryId[callIndex];
+
+ IntraL3Msg_t rrToCCMsg;
+
+ rrToCCMsg.module_id = MODULE_RM;
+ rrToCCMsg.primitive_type = prim;
+ rrToCCMsg.message_type = msgType;
+
+ rrToCCMsg.entry_id = entryId;
+
+ // send the message.
+ if (ERROR == msgQSend( sess->msgQId,
+ (char *) &rrToCCMsg,
+ sizeof(struct IntraL3Msg_t),
+ NO_WAIT,
+ MSG_PRI_NORMAL
+ ) )
+ {
+ printf("CC Test Error : fromRRtoCC msgQSend (QID=%d) error\n ",
+ ccMsgQId);
+ }
+ else
+ {
+ printf("CC Test Log: Sent Message from RR to CC, Prim. Type, Msg Type: %d %d\n",
+ prim,
+ msgType);
+ }
+}
+
+bool readDialedNumberTable( char* dnFile )
+{
+ FILE* pfd;
+ short i, j;
+ int inp;
+
+ if( NULL == ( pfd = fopen( dnFile, "r" ) ) )
+ {
+ printf( "Error opening file '%s'\n", dnFile );
+ return (false);
+ }
+
+ for(i=0; i< CC_MAX_CC_CALLS;i++)
+ {
+ testDialedNum[i].numDigits = 4;
+
+ for (j=0; j < testDialedNum[i].numDigits; j++)
+ {
+ fscanf( pfd , "%d", &inp);
+ testDialedNum[i].digits[j] = inp;
+ }
+ fscanf(pfd, "\n");
+
+ testDialedNum[i].ie_present = true;
+ testDialedNum[i].numberType = CNI_RIL3_NUMBER_TYPE_NETWORK_SPECIFIC;
+ testDialedNum[i].numberingPlan = CNI_RIL3_NUMBERING_PLAN_PRIVATE;
+
+
+ for (j=0; j < testDialedNum[i].numDigits; j++)
+ {
+ printf( "%d ", testDialedNum[i].digits[j]);
+ }
+
+ printf("\n");
+
+ }
+
+ fclose( pfd );
+
+ return (true);
+}
+
+/*
+
+void readIMSITable()
+{
+ int i = origSoftMobIndex;
+
+ testIMSI[i].ie_present = true;
+
+ testIMSI[i].mobileIdType = CNI_RIL3_IMSI;
+
+ testIMSI[i].numDigits = 15;
+
+ testIMSI[i].digits[0] = 3;
+ testIMSI[i].digits[1] = 1;
+ testIMSI[i].digits[2] = 0;
+ testIMSI[i].digits[3] = 1;
+ testIMSI[i].digits[4] = 7;
+ testIMSI[i].digits[5] = 0;
+ testIMSI[i].digits[6] = 1;
+ testIMSI[i].digits[7] = 0;
+ testIMSI[i].digits[8] = 7;
+ testIMSI[i].digits[9] = 4;
+ testIMSI[i].digits[10] = 1;
+ testIMSI[i].digits[11] = 2;
+ testIMSI[i].digits[12] = 2;
+ testIMSI[i].digits[13] = 2;
+ testIMSI[i].digits[14] = 2;
+
+ i = termSoftMobIndex;
+
+ testIMSI[i].ie_present = true;
+
+ testIMSI[i].mobileIdType = CNI_RIL3_IMSI;
+
+ testIMSI[i].numDigits = 15;
+
+ testIMSI[i].digits[0] = 3;
+ testIMSI[i].digits[1] = 1;
+ testIMSI[i].digits[2] = 0;
+ testIMSI[i].digits[3] = 1;
+ testIMSI[i].digits[4] = 7;
+ testIMSI[i].digits[5] = 0;
+ testIMSI[i].digits[6] = 1;
+ testIMSI[i].digits[7] = 0;
+ testIMSI[i].digits[8] = 7;
+ testIMSI[i].digits[9] = 5;
+ testIMSI[i].digits[10] = 9;
+ testIMSI[i].digits[11] = 9;
+ testIMSI[i].digits[12] = 9;
+ testIMSI[i].digits[13] = 9;
+ testIMSI[i].digits[14] = 2;
+}
+
+*/
+
+/*
+void readDialedNumberTable()
+{
+ short i = origSoftMobIndex;
+
+ testDialedNum[i].ie_present = true;
+ testDialedNum[i].numberType = CNI_RIL3_NUMBER_TYPE_NETWORK_SPECIFIC;
+ testDialedNum[i].numberingPlan = CNI_RIL3_NUMBERING_PLAN_PRIVATE;
+
+ testDialedNum[i].numDigits = 4;
+
+ testDialedNum[i].digits[0] = 2;
+ testDialedNum[i].digits[1] = 2;
+ testDialedNum[i].digits[2] = 0;
+ testDialedNum[i].digits[3] = 4;
+
+ i = termSoftMobIndex;
+
+ testDialedNum[i].digits[0] = 2;
+ testDialedNum[i].digits[1] = 2;
+ testDialedNum[i].digits[2] = 0;
+ testDialedNum[i].digits[3] = 5;
+
+ i = 4;
+
+ testDialedNum[i].digits[0] = 8;
+ testDialedNum[i].digits[1] = 8;
+ testDialedNum[i].digits[2] = 2;
+ testDialedNum[i].digits[3] = 4;
+
+ i = 5;
+
+ testDialedNum[i].digits[0] = 8;
+ testDialedNum[i].digits[1] = 8;
+ testDialedNum[i].digits[2] = 2;
+ testDialedNum[i].digits[3] = 5;
+
+ i = 6;
+
+ testDialedNum[i].digits[0] = 8;
+ testDialedNum[i].digits[1] = 8;
+ testDialedNum[i].digits[2] = 2;
+ testDialedNum[i].digits[3] = 6;
+
+
+}
+*/
+
+
+
diff --git a/data/mnet/GP10/Host/cc/test/closeLogFile b/data/mnet/GP10/Host/cc/test/closeLogFile
new file mode 100644
index 0000000..63a7158
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/test/closeLogFile
@@ -0,0 +1,5 @@
+# Force an update write on the log file.
+
+logFdDelete(logFile)
+
+close(logFile) \ No newline at end of file
diff --git a/data/mnet/GP10/Host/cc/test/disconnecTerm b/data/mnet/GP10/Host/cc/test/disconnecTerm
new file mode 100644
index 0000000..725990c
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/test/disconnecTerm
@@ -0,0 +1,18 @@
+#Disconnect Terminator
+
+# Disconnect to CC - T
+# Soft Mobile Index L1L2Prim PD Msg. Type
+fromMS(termSoftMobIndex, 4, 3, 0x25)
+
+
+# Release Complete to CC - T
+# Soft Mobile Index L1L2Prim PD Msg. Type
+fromMS(termSoftMobIndex, 4, 3, 0x2a)
+
+# Make sure that all resource data is back in idle state
+
+tmmPrint
+
+tccPrint
+
+irtDataPrint
diff --git a/data/mnet/GP10/Host/cc/test/disconnectOrig b/data/mnet/GP10/Host/cc/test/disconnectOrig
new file mode 100644
index 0000000..3d40dde
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/test/disconnectOrig
@@ -0,0 +1,17 @@
+#Disconnect Originator
+
+# Disconnect to CC - O
+# Soft Mobile Index L1L2Prim PD Msg. Type
+fromMS(origSoftMobIndex, 4, 3, 0x25)
+
+# Release Complete to CC - O
+# Soft Mobile Index L1L2Prim PD Msg. Type
+fromMS(origSoftMobIndex, 4, 3, 0x2a)
+
+# Make sure that all resource data is back in idle state
+
+tmmPrint
+
+tccPrint
+
+irtDataPrint
diff --git a/data/mnet/GP10/Host/cc/test/integ b/data/mnet/GP10/Host/cc/test/integ
new file mode 100644
index 0000000..0110837
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/test/integ
@@ -0,0 +1,101 @@
+#
+# load all the module-init files (with global variables)
+#
+ld < K:/Workdirs/integration/l1proxy/I80486/l1proxy_init.out
+ld < K:/Workdirs/integration/lapdm/I80486/lapdm_init.out
+ld < K:/Workdirs/integration/mm/I80486/mmm_init.out
+ld < K:/Workdirs/integration/cc/I80486/ccm_init.out
+ld < K:/Workdirs/integration/rm/I80486/rm_init.out
+
+#
+# load all the module-api files (used by other modules)
+#
+ld < K:/Workdirs/integration/lapdm/I80486/lapdm_api.out
+ld < K:/Workdirs/integration/rm/I80486/rm_api.out
+
+#
+# load all the core module files next
+#
+ld < K:/Workdirs/integration/l1proxy/I80486/l1proxy.out
+ld < K:/Workdirs/integration/lapdm/I80486/lapdm.out
+ld < K:/Workdirs/integration/ril3/I80486/ril3.out
+ld < K:/Workdirs/integration/jcc/I80486/jcc.out
+ld < K:/Workdirs/integration/mm/I80486/mmm.out
+ld < K:/Workdirs/integration/cc/I80486/ccm.out
+ld < K:/Workdirs/integration/cc/I80486/cc_test.out
+ld < K:/Workdirs/integration/rm/I80486/rm.out
+
+
+#
+# Initialization of all modules
+#
+CNI_LAPDM_Initialization
+
+#
+# Ready-to-send scheme: 1 means LAPDm will remember the RTS and will not require
+# L1 to send RTS all the times. 0 means use the standard way, L1 needs to send up
+# RTS all the times. LAPDm will not cache the RTS. 0 is the default.
+#
+cni_lapdm_enable_rts_caching = 1
+# cni_lapdm_enable_rts_caching = 0
+
+#cni_testInit
+
+#create a lapdm instance channel type 0, trx 0, channel num 1, link 1
+#CNI_LAPDM_Create_Instance(0, 0 , 0x2000, 0)
+#CNI_LAPDM_Create_Instance(0, 0 , 0x2800, 0)
+#CNI_LAPDM_Create_Instance(0, 0 , 0x3000, 0)
+#CNI_LAPDM_Create_Instance(0, 0 , 0x3800, 0)
+
+
+#L3 register a lapdm instance oid 0, sapi 0, layer3_id 10, and a call back function
+#CNI_LAPDM_Instance_Registration(0, 0, 0x20, cni_l3CallBack)
+#CNI_LAPDM_Instance_Registration(1, 0, 0x28, cni_l3CallBack)
+#CNI_LAPDM_Instance_Registration(2, 0, 0x30, cni_l3CallBack)
+#CNI_LAPDM_Instance_Registration(3, 0, 0x38, cni_l3CallBack)
+
+# MD debugging dump. 0 (disable) or 1 (enable)
+CNI_RIL3MD_EnableDebug = 0
+
+# Start MM Task and print its data
+mmInit
+mmDataPrint
+
+# Start CC Task and print its data
+ccInit
+ccDataPrint
+
+# Initialize the IRT Table
+CNI_RIL3_IRT_Init
+
+# Start RRM Task
+rm_Task
+
+# Start the Orig and Term Soft Mobiles
+# LUDB Index for Terminating Mobile
+origSoftMobStart(0 )
+termSoftMobStart()
+
+# load dsp coff file
+pBlkDev = ramDevCreate(0, 512, 2000, 2000, 0)
+dosFsMkfs("/RAM1", pBlkDev)
+pwd
+#copy " K:/Workdirs/integration/dsp/Dsp.out","/RAM1/Dsp.out"
+#copy "integration/dsp/hpitest.out","/RAM1/dsp.out"
+#
+initL1
+newInitDsp
+newGo
+
+# Send logs to a file under pre-alpha
+# open the log file
+logFile = open("K:/Workdirs/integration/Pre-Alpha/mmcc-log.txt", 2, 0)
+# Go to the end to append the new logs
+lseek(logFile, 0, 2)
+# Set the file as the new log file
+logFdSet(logFile)
+
+#
+i
+
+
diff --git a/data/mnet/GP10/Host/cc/test/kill b/data/mnet/GP10/Host/cc/test/kill
new file mode 100644
index 0000000..27a155e
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/test/kill
@@ -0,0 +1,37 @@
+td lapdm_phserver
+td lapdm_dlserver
+
+td mmMain
+td ccMain
+td OrigCall
+td TermCall
+td L1TaskUp
+td L1TaskDn
+td rmTask
+
+
+unld "l1proxy_init.out"
+
+unld "lapdm_init.out"
+unld "mmm_init.out"
+unld "ccm_init.out"
+unld "rm_init.out"
+
+unld "lapdm_api.out"
+unld "rm_api.out"
+
+unld "l1proxy.out"
+unld "lapdm.out"
+unld "ril3.out"
+unld "jcc.out"
+unld "mmm.out"
+unld "ccm.out"
+unld "cc_test.out"
+unld "rm.out"
+
+# Force an update write on the log file.
+
+logFdDelete(logFile)
+
+close(logFile)
+
diff --git a/data/mnet/GP10/Host/cc/test/makeOrigCall b/data/mnet/GP10/Host/cc/test/makeOrigCall
new file mode 100644
index 0000000..18471b3
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/test/makeOrigCall
@@ -0,0 +1,23 @@
+# LUDB Index for Terminating Mobile
+origSoftMobInit(1 )
+
+
+# CM Service Request to MM - O
+# Soft Mobile Index L1L2Prim PD Msg. Type
+fromMS(origSoftMobIndex, 1, 5, 0x24)
+
+# Setup to CC - O
+# Soft Mobile Index L1L2Prim PD Msg. Type
+fromMS(origSoftMobIndex, 4 , 3, 5)
+
+# Chann Assigned - O
+# IRT EntryId JCCL3Prim Msg. Type O/T
+fromRRtoCC(origSoftMobEntryId, 0, 2, origSoftMobIndex)
+
+# Connect Ack to CC - O
+# Soft Mobile Index L1L2Prim PD Msg. Type
+fromMS(origSoftMobIndex, 4, 3, 0x0f)
+
+
+
+
diff --git a/data/mnet/GP10/Host/cc/test/makeTermCall b/data/mnet/GP10/Host/cc/test/makeTermCall
new file mode 100644
index 0000000..20a48af
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/test/makeTermCall
@@ -0,0 +1,27 @@
+#
+termSoftMobInit()
+
+# Page Response - T
+# IRT EntryId JCCL3Prim Msg. Type
+fromRRtoMM(termSoftMobEntryId, 13, 11)
+
+
+# Call Confirmed to CC - T
+# Soft Mobile Index L1L2Prim PD Msg. Type
+fromMS(termSoftMobIndex, 4, 3, 0x08)
+
+# Chann Assigned - T
+# IRT EntryId JCCL3Prim Msg. Type O/T
+fromRRtoCC(termSoftMobEntryId, 0, 2, termSoftMobIndex)
+
+# Alerting to CC - T
+# Soft Mobile Index L1L2Prim PD Msg. Type
+fromMS(termSoftMobIndex, 4, 3, 0x01)
+
+# Connect to CC - T
+# Soft Mobile Index L1L2Prim PD Msg. Type
+fromMS(termSoftMobIndex, 4, 3, 0x07)
+
+
+
+
diff --git a/data/mnet/GP10/Host/cc/test/setLogFile b/data/mnet/GP10/Host/cc/test/setLogFile
new file mode 100644
index 0000000..65033a7
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/test/setLogFile
@@ -0,0 +1,8 @@
+# Send logs to a file under pre-alpha
+# open the log file
+logFile = open("K:/Workdirs/integration/Pre-Alpha/mmcc-log.txt", 2, 0)
+# Go to the end to append the new logs
+lseek(logFile, 0, 2)
+# Set the file as the new log file
+logFdSet(logFile)
+
diff --git a/data/mnet/GP10/Host/cc/test/test1.zip b/data/mnet/GP10/Host/cc/test/test1.zip
new file mode 100644
index 0000000..81cc547
--- /dev/null
+++ b/data/mnet/GP10/Host/cc/test/test1.zip
Binary files differ