void TSC_324m::Tsc_UII_Alphanumeric(const uint8* str, uint16 str_len)
{
    S_ControlMsgHeader           infHeader;
    PS_UserInputIndication       pUserInputIndication;
    PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                    (0, "TSC_324m:Tsc_UII_Alphanumeric - len(%d)", str_len));

    // Allocate the UII structure
    pUserInputIndication = (PS_UserInputIndication)OSCL_DEFAULT_MALLOC(sizeof(S_UserInputIndication));

    // Fill in the 'signal'
    pUserInputIndication->index = 1;  /* alphanumeric */
    pUserInputIndication->alphanumeric = (PS_int8STRING) OSCL_DEFAULT_MALLOC(sizeof(S_int8STRING));
    pUserInputIndication->alphanumeric->size = str_len;
    pUserInputIndication->alphanumeric->data = (uint8*) OSCL_DEFAULT_MALLOC(str_len * sizeof(uint8));
    oscl_memcpy(pUserInputIndication->alphanumeric->data, str, str_len);

    // Send the message
    Tsc_SendDataSet(&infHeader, H245_PRIMITIVE, E_PtvId_Idc_Ui, 0, 0, (uint8*)pUserInputIndication,
                    sizeof(S_UserInputIndication));
    iH245->DispatchControlMessage(&infHeader);
    Delete_UserInputIndication(pUserInputIndication);
    OSCL_DEFAULT_FREE(pUserInputIndication);
    return;
}
//-----------------------------------------------------------------------------
// Tsc_UII_DTMF()                                              (RAN-UII)
//
// This routine sends a DTMF signal via H.245 UserInputIndication message.
// It takes two input values:
//
//   uint8   dtmf_value      (ascii value of a character in [0123456789#*ABCD!])
//   uint16  dtmf_duration   (duration of pulse in mSec; 0 means no duration)
//-----------------------------------------------------------------------------
void TSC_324m::Tsc_UII_DTMF(uint8 dtmf_value, uint16 dtmf_duration)
{
    S_ControlMsgHeader           infHeader;
    PS_UserInputIndication       pUserInputIndication;

    // Allocate the UII structure
    pUserInputIndication = (PS_UserInputIndication)OSCL_DEFAULT_MALLOC(sizeof(S_UserInputIndication));

    // Fill in the 'signal'
    pUserInputIndication->index = 3;  /* signal */
    pUserInputIndication->signal = (PS_Signal) OSCL_DEFAULT_MALLOC(sizeof(S_Signal));

    pUserInputIndication->signal->option_of_signalRtp = 0;
    pUserInputIndication->signal->signalType.size = 1;
    pUserInputIndication->signal->signalType.data = (uint8*) OSCL_DEFAULT_MALLOC(1 * sizeof(uint8));
    pUserInputIndication->signal->signalType.data[0] = dtmf_value;

    if (dtmf_duration == 0)
    {
        pUserInputIndication->signal->option_of_duration = 0;
    }
    else
    {
        pUserInputIndication->signal->option_of_duration = 1;
        pUserInputIndication->signal->duration = dtmf_duration;
    }

    // Send the message
    Tsc_SendDataSet(&infHeader, H245_PRIMITIVE, E_PtvId_Idc_Ui, 0, 0, (uint8*)pUserInputIndication,
                    sizeof(S_UserInputIndication));
    iH245->DispatchControlMessage(&infHeader);
    Delete_UserInputIndication(pUserInputIndication);
    OSCL_DEFAULT_FREE(pUserInputIndication);
    return;
}
TPVStatusCode H223LowerLayer::Open()
{
    unsigned pdu_rate = (unsigned)(1000.0 / (float)H223_MIN_SAMPLE_INTERVAL + .5) + 1;
    iMemFragmentAlloc = OSCL_NEW(PVMFBufferPoolAllocator, ());
    iMemFragmentAlloc->SetLeaveOnAllocFailure(false);
    iMemFragmentAlloc->size((uint16)(pdu_rate*2), (uint16)(iSendPduSz + H223_SEND_PDU_SIZE_EXTRA));

    iMediaMsgPoolAlloc = OSCL_NEW(OsclMemPoolFixedChunkAllocator, (pdu_rate));
    iMediaMsgPoolAlloc->enablenullpointerreturn();

    uint media_data_imp_size = oscl_mem_aligned_size(sizeof(PVMFMediaFragGroup<OsclMemAllocator>)) +
                               oscl_mem_aligned_size(sizeof(OsclRefCounterDA));
    iMediaDataImplMemAlloc = OSCL_NEW(OsclMemPoolFixedChunkAllocator, (pdu_rate, media_data_imp_size));
    iMediaDataImplMemAlloc->enablenullpointerreturn();
    iDispatchPacketAlloc = OSCL_NEW(PVMFMediaFragGroupCombinedAlloc<OsclMemAllocator>, (pdu_rate, 30, iMediaDataImplMemAlloc));
    iDispatchPacketAlloc->create();

    iDemuxBufferSize = (uint32)((float)(H223_DEMUX_BUFFER_INTERVAL_MS * iBitrate) / 8000.0);
    PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "H223LowerLayer::Open iBitrate=%d, iDemuxBufferSize=%d", iBitrate, iDemuxBufferSize));
    iDemuxBufferPos = iDemuxBuffer = (uint8*)OSCL_DEFAULT_MALLOC(H223_DEMUX_BUFFER_SIZE);
    iIdleSyncCheckBuffer = (uint8*)OSCL_DEFAULT_MALLOC(H223_DEMUX_BUFFER_SIZE);
    return EPVT_Success;
}
OSCL_EXPORT_REF PVMFBufferDataSource::PVMFBufferDataSource(int32 aPortTag,
        unsigned bitrate,
        unsigned min_sample_sz,
        unsigned max_sample_sz,
        uint8*   fsi,
        unsigned fsi_len):
        PvmfPortBaseImpl(aPortTag, this),
        iTimer("PVMFBufferDataSource"),
        iMediaDataAlloc(NULL),
        iFsi(NULL),
        iFsiLen(0)
{
    iBitrate = bitrate;
    iMinSampleSz = min_sample_sz;
    iMaxSampleSz = max_sample_sz;
    iTimestamp = 0;
    iSampleInterval = 0;
    if (fsi && fsi_len)
    {
        iFsi = (uint8*)OSCL_DEFAULT_MALLOC(fsi_len);
        oscl_memcpy(iFsi, fsi, fsi_len);
        iFsiLen = fsi_len;
    }
}
void TSC_324m::Tsc_IdcVi(void)
{
    S_ControlMsgHeader infHeader;
    PS_VendorIdentification      pVendorIdentification;

    if (iVendor == NULL)
    {
        PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                        (0, "TSC_324m:Tsc_IdcVi - Not sending vendor id\n"));
        return;
    }
    /* Buffer Allocate */
    pVendorIdentification = (PS_VendorIdentification)OSCL_DEFAULT_MALLOC(sizeof(S_VendorIdentification));
    oscl_memset(pVendorIdentification, 0, sizeof(S_VendorIdentification));
    if (iVendor->GetVendorType() == EObjectIdentifier)
    {
        PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                        (0, "TSC_324m:Tsc_IdcVi - EObjectIdentifier\n"));
        pVendorIdentification->vendor.index = 0; /* object */
        pVendorIdentification->vendor.object = (PS_OBJECTIDENT) OSCL_DEFAULT_MALLOC(sizeof(S_OBJECTIDENT));
        uint16 sz = 0;
        uint8* data = ((TPVH245VendorObjectIdentifier*)iVendor)->GetVendor(&sz);
        pVendorIdentification->vendor.object->size = sz;
        pVendorIdentification->vendor.object->data = (uint8*)OSCL_DEFAULT_MALLOC(sz);
        oscl_memcpy(pVendorIdentification->vendor.object->data, data, sz);
    }
    else if (iVendor->GetVendorType() == EH221NonStandard)
    {
        PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                        (0, "TSC_324m:Tsc_IdcVi - EH221NonStandard\n"));
        pVendorIdentification->vendor.index = 1; /* H221Nonstandard */
        pVendorIdentification->vendor.h221NonStandard =
            (struct _H221NonStandard *)OSCL_DEFAULT_MALLOC(sizeof(struct _H221NonStandard));
        pVendorIdentification->vendor.h221NonStandard->manufacturerCode =
            (uint16)((TPVVendorH221NonStandard*)iVendor)->GetManufacturerCode();
        pVendorIdentification->vendor.h221NonStandard->t35CountryCode =
            ((TPVVendorH221NonStandard*)iVendor)->GetT35CountryCode();
        pVendorIdentification->vendor.h221NonStandard->t35Extension =
            ((TPVVendorH221NonStandard*)iVendor)->GetT35Extension();
    }
    else
    {
        PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                        (0, "TSC_324m:Tsc_IdcVi - ERROR - Invalid vendor type\n"));
        OSCL_DEFAULT_FREE(pVendorIdentification);
        return;
    }
    pVendorIdentification->option_of_productNumber = false;
    if (iProductNumberLen)
    {
        pVendorIdentification->option_of_productNumber = true;
        pVendorIdentification->productNumber.size =
            (uint16)iProductNumberLen;
        pVendorIdentification->productNumber.data =
            (uint8*)OSCL_DEFAULT_MALLOC(iProductNumberLen);
        oscl_memcpy(pVendorIdentification->productNumber.data,
                    iProductNumber, iProductNumberLen);
    }
    pVendorIdentification->option_of_versionNumber = false;
    if (iVersionNumberLen)
    {
        pVendorIdentification->option_of_versionNumber = true;
        pVendorIdentification->versionNumber.size =
            (uint16)iVersionNumberLen;
        pVendorIdentification->versionNumber.data =
            (uint8*)OSCL_DEFAULT_MALLOC(iVersionNumberLen);
        oscl_memcpy(pVendorIdentification->versionNumber.data,
                    iVersionNumber, iVersionNumberLen);
    }

    Tsc_SendDataSet(&infHeader, H245_PRIMITIVE, E_PtvId_Idc_Vi, 0, 0,
                    (uint8*)pVendorIdentification, sizeof(S_VendorIdentification));
    /* Primitive Send */
    iH245->DispatchControlMessage(&infHeader);
    Delete_VendorIdentification(pVendorIdentification);
    OSCL_DEFAULT_FREE(pVendorIdentification);
    return;
}
uint32 TSC_324m::VendorIdRecv(PS_ControlMsgHeader  pReceiveInf)
{
    PS_VendorIdentification  pVendorIdentification =
        (PS_VendorIdentification)pReceiveInf->pParameter;

    PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                    (0, "TSC_324m: Vendor Id Received - vendor index(%d), opn(%d), ovn(%d)\n",
                     pVendorIdentification->vendor.index,
                     pVendorIdentification->option_of_productNumber,
                     pVendorIdentification->option_of_versionNumber));
    if (iVendorR)
    {
        OSCL_DELETE(iVendorR);
        iVendorR = NULL;
    }

    if (iProductNumberR)
    {
        OSCL_DEFAULT_FREE(iProductNumberR);
        iProductNumberR = NULL;
        iProductNumberLenR = 0;
    }
    if (iVersionNumberR)
    {
        OSCL_DEFAULT_FREE(iVersionNumberR);
        iVersionNumberR = NULL;
        iVersionNumberLenR = 0;
    }

    if (pVendorIdentification->vendor.index == 0) // object identifier
    {
        if (pVendorIdentification->vendor.object->size &&
                (pVendorIdentification->vendor.object->size < MAX_VENDOR_ID_OID_LEN))
        {
            if (pVendorIdentification->vendor.object->data[pVendorIdentification->vendor.object->size - 1] == '\0')
            {
                PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                                (0, "TSC_324m: Vendor Id - %s\n",
                                 pVendorIdentification->vendor.object->data));
            }
            iVendorR = new TPVH245VendorObjectIdentifier((uint8*)pVendorIdentification->vendor.object->data,
                    pVendorIdentification->vendor.object->size);
        }
        else
        {
            PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                            (0, "TSC_324m:VendorIdRecv - Error - invalid length(%d)\n",
                             pVendorIdentification->vendor.object->size));
            return iTerminalStatus;
        }
    }
    else if (pVendorIdentification->vendor.index == 1) // H221NonStandard
    {
        iVendorR = new TPVVendorH221NonStandard(pVendorIdentification->vendor.h221NonStandard->t35CountryCode,
                                                pVendorIdentification->vendor.h221NonStandard->t35Extension,
                                                pVendorIdentification->vendor.h221NonStandard->manufacturerCode);
    }
    else
    {
        PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                        (0, "TSC_324m:VendorIdRecv - Error - invalid index(%d)\n",
                         pVendorIdentification->vendor.index));
        return iTerminalStatus;
    }
    if (pVendorIdentification->option_of_productNumber)
    {
        iProductNumberLenR = pVendorIdentification->productNumber.size;
    }
    if (iProductNumberLenR)
    {
        if (pVendorIdentification->productNumber.data[iProductNumberLenR-1] == '\0')
        {
            PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                            (0, "TSC_324m: Product Number - %s\n",
                             pVendorIdentification->productNumber.data));
        }
        iProductNumberR = (uint8*)OSCL_DEFAULT_MALLOC(iProductNumberLenR);
        oscl_memcpy(iProductNumberR, pVendorIdentification->productNumber.data,
                    iProductNumberLenR);
    }
    if (pVendorIdentification->option_of_versionNumber)
    {
        iVersionNumberLenR = pVendorIdentification->versionNumber.size;
    }
    if (iVersionNumberLenR)
    {
        if (pVendorIdentification->versionNumber.data[iVersionNumberLenR-1] == '\0')
        {
            PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
                            (0, "TSC_324m: Version Number - %s\n",
                             pVendorIdentification->versionNumber.data));
        }
        iVersionNumberR = (uint8*)OSCL_DEFAULT_MALLOC(iVersionNumberLenR);
        oscl_memcpy(iVersionNumberR, pVendorIdentification->versionNumber.data, iVersionNumberLenR);
    }
    if (iTSC_324mObserver)
    {
        iTSC_324mObserver->IncomingVendorId(iVendorR, iProductNumberR,
                                            (uint16)iProductNumberLenR, iVersionNumberR, (uint16)iVersionNumberLenR);
    }
    return iTerminalStatus;
}