public void send(TCUniRequest event) throws TCAPSendException {

        if (this.previewMode)
            return;

        if (this.isStructured()) {
            throw new TCAPSendException("Structured dialogs do not use Uni");
        }

        try {
            this.dialogLock.lock();
            TCUniMessageImpl msg = (TCUniMessageImpl) TcapFactory.createTCUniMessage();

            if (event.getApplicationContextName() != null) {
                DialogPortion dp = TcapFactory.createDialogPortion();
                DialogUniAPDU apdu = TcapFactory.createDialogAPDUUni();
                apdu.setDoNotSendProtocolVersion(doNotSendProtocolVersion());
                apdu.setApplicationContextName(event.getApplicationContextName());
                if (event.getUserInformation() != null) {
                    apdu.setUserInformation(event.getUserInformation());
                }
                dp.setUnidirectional(true);
                dp.setDialogAPDU(apdu);
                msg.setDialogPortion(dp);

            }

            if (this.scheduledComponentList.size() > 0) {
                Component[] componentsToSend = new Component[this.scheduledComponentList.size()];
                this.prepareComponents(componentsToSend);
                msg.setComponent(componentsToSend);

            }

            AsnOutputStream aos = new AsnOutputStream();
            try {
                msg.encode(aos);
                if (this.provider.getStack().getStatisticsEnabled()) {
                    this.provider.getStack().getCounterProviderImpl().updateTcUniSentCount(this);
                }
                this.provider.send(aos.toByteArray(), event.getReturnMessageOnError(), this.remoteAddress, this.localAddress,
                        this.seqControl, this.networkId, this.localSsn, this.remotePc);
                this.scheduledComponentList.clear();
            } catch (Exception e) {
                if (logger.isEnabledFor(Level.ERROR)) {
                    logger.error("Failed to send message: ", e);
                }
                throw new TCAPSendException("Failed to send TC-Uni message: " + e.getMessage(), e);
            } finally {
                release();
            }
        } finally {
            this.dialogLock.unlock();
        }
    }
public void send ( TCUniRequest event ) throws TCAPSendException { if ( this . previewMode ) return ; if ( this . isStructured ( ) ) { throw new TCAPSendException ( "Structured dialogs do not use Uni" ) ; } try { this . dialogLock . lock ( ) ; TCUniMessageImpl msg = ( TCUniMessageImpl ) TcapFactory . createTCUniMessage ( ) ; if ( event . getApplicationContextName ( ) != null ) { DialogPortion dp = TcapFactory . createDialogPortion ( ) ; DialogUniAPDU apdu = TcapFactory . createDialogAPDUUni ( ) ; apdu . setDoNotSendProtocolVersion ( doNotSendProtocolVersion ( ) ) ; apdu . setApplicationContextName ( event . getApplicationContextName ( ) ) ; if ( event . getUserInformation ( ) != null ) { apdu . setUserInformation ( event . getUserInformation ( ) ) ; } dp . setUnidirectional ( true ) ; dp . setDialogAPDU ( apdu ) ; msg . setDialogPortion ( dp ) ; } if ( this . scheduledComponentList . size ( ) > 0 ) { Component [ ] componentsToSend = new Component [ this . scheduledComponentList . size ( ) ] ; this . prepareComponents ( componentsToSend ) ; msg . setComponent ( componentsToSend ) ; } AsnOutputStream aos = new AsnOutputStream ( ) ; try { msg . encode ( aos ) ; if ( this . provider . getStack ( ) . getStatisticsEnabled ( ) ) { this . provider . getStack ( ) . getCounterProviderImpl ( ) . updateTcUniSentCount ( this ) ; } this . provider . send ( aos . toByteArray ( ) , event . getReturnMessageOnError ( ) , this . remoteAddress , this . localAddress , this . seqControl , this . networkId , this . localSsn , this . remotePc ) ; this . scheduledComponentList . clear ( ) ; } catch ( Exception e ) { if ( logger . isEnabledFor ( Level . ERROR ) ) { logger . error ( "Failed to send message: " , e ) ; } throw new TCAPSendException ( "Failed to send TC-Uni message: " + e . getMessage ( ) , e ) ; } finally { release ( ) ; } } finally { this . dialogLock . unlock ( ) ; } }
/*
(non-Javadoc)

@see org.restcomm.protocols.ss7.tcap.api.tc.dialog.Dialog#sendUni()