public void sendComponent(Component componentRequest) throws TCAPSendException {

        if (this.previewMode)
            return;

        if (this.provider.getStack().getStatisticsEnabled()) {
            switch (componentRequest.getType()) {
                case Invoke:
                    this.provider.getStack().getCounterProviderImpl().updateInvokeSentCount(this, (Invoke) componentRequest);

                    Invoke inv = (Invoke) componentRequest;
                    OperationCodeImpl oc = (OperationCodeImpl) inv.getOperationCode();
                    if (oc != null) {
                        this.provider.getStack().getCounterProviderImpl()
                                .updateOutgoingInvokesPerOperationCode(oc.getStringValue());
                    }
                    break;
                case ReturnResult:
                    this.provider.getStack().getCounterProviderImpl().updateReturnResultSentCount(this);
                    break;
                case ReturnResultLast:
                    this.provider.getStack().getCounterProviderImpl().updateReturnResultLastSentCount(this);
                    break;
                case ReturnError:
                    this.provider.getStack().getCounterProviderImpl().updateReturnErrorSentCount(this);

                    ReturnError re = (ReturnError) componentRequest;
                    ErrorCodeImpl ec = (ErrorCodeImpl) re.getErrorCode();
                    if (ec != null) {
                        this.provider.getStack().getCounterProviderImpl().updateOutgoingErrorsPerErrorCode(ec.getStringValue());
                    }
                    break;
                case Reject:
                    this.provider.getStack().getCounterProviderImpl().updateRejectSentCount(this);

                    Reject rej = (Reject) componentRequest;
                    ProblemImpl prob = (ProblemImpl) rej.getProblem();
                    if (prob != null) {
                        this.provider.getStack().getCounterProviderImpl().updateOutgoingRejectPerProblem(prob.getStringValue());
                    }
                    break;
            }
        }

        try {
            this.dialogLock.lock();
            if (componentRequest.getType() == ComponentType.Invoke) {
                InvokeImpl invoke = (InvokeImpl) componentRequest;

                // check if its taken!
                int invokeIndex = DialogImpl.getIndexFromInvokeId(invoke.getInvokeId());
                if (this.operationsSent[invokeIndex] != null) {
                    throw new TCAPSendException("There is already operation with such invoke id!");
                }

                invoke.setState(OperationState.Pending);
                invoke.setDialog(this);

                // if the Invoke timeout value has not be reset by TCAP-User
                // for this invocation we are setting it to the the TCAP stack
                // default value
                if (invoke.getTimeout() == TCAPStackImpl._EMPTY_INVOKE_TIMEOUT)
                    invoke.setTimeout(this.provider.getStack().getInvokeTimeout());
            } else {
                if (componentRequest.getType() != ComponentType.ReturnResult) {
                    // we are sending a response and removing invokeId from
                    // incomingInvokeList
                    this.removeIncomingInvokeId(componentRequest.getInvokeId());
                }
            }
            this.scheduledComponentList.add(componentRequest);
        } finally {
            this.dialogLock.unlock();
        }
    }
public void sendComponent ( Component componentRequest ) throws TCAPSendException { if ( this . previewMode ) return ; if ( this . provider . getStack ( ) . getStatisticsEnabled ( ) ) { switch ( componentRequest . getType ( ) ) { case Invoke : this . provider . getStack ( ) . getCounterProviderImpl ( ) . updateInvokeSentCount ( this , ( Invoke ) componentRequest ) ; Invoke inv = ( Invoke ) componentRequest ; OperationCodeImpl oc = ( OperationCodeImpl ) inv . getOperationCode ( ) ; if ( oc != null ) { this . provider . getStack ( ) . getCounterProviderImpl ( ) . updateOutgoingInvokesPerOperationCode ( oc . getStringValue ( ) ) ; } break ; case ReturnResult : this . provider . getStack ( ) . getCounterProviderImpl ( ) . updateReturnResultSentCount ( this ) ; break ; case ReturnResultLast : this . provider . getStack ( ) . getCounterProviderImpl ( ) . updateReturnResultLastSentCount ( this ) ; break ; case ReturnError : this . provider . getStack ( ) . getCounterProviderImpl ( ) . updateReturnErrorSentCount ( this ) ; ReturnError re = ( ReturnError ) componentRequest ; ErrorCodeImpl ec = ( ErrorCodeImpl ) re . getErrorCode ( ) ; if ( ec != null ) { this . provider . getStack ( ) . getCounterProviderImpl ( ) . updateOutgoingErrorsPerErrorCode ( ec . getStringValue ( ) ) ; } break ; case Reject : this . provider . getStack ( ) . getCounterProviderImpl ( ) . updateRejectSentCount ( this ) ; Reject rej = ( Reject ) componentRequest ; ProblemImpl prob = ( ProblemImpl ) rej . getProblem ( ) ; if ( prob != null ) { this . provider . getStack ( ) . getCounterProviderImpl ( ) . updateOutgoingRejectPerProblem ( prob . getStringValue ( ) ) ; } break ; } } try { this . dialogLock . lock ( ) ; if ( componentRequest . getType ( ) == ComponentType . Invoke ) { InvokeImpl invoke = ( InvokeImpl ) componentRequest ; int invokeIndex = DialogImpl . getIndexFromInvokeId ( invoke . getInvokeId ( ) ) ; if ( this . operationsSent [ invokeIndex ] != null ) { throw new TCAPSendException ( "There is already operation with such invoke id!" ) ; } invoke . setState ( OperationState . Pending ) ; invoke . setDialog ( this ) ; if ( invoke . getTimeout ( ) == TCAPStackImpl . _EMPTY_INVOKE_TIMEOUT ) invoke . setTimeout ( this . provider . getStack ( ) . getInvokeTimeout ( ) ) ; } else { if ( componentRequest . getType ( ) != ComponentType . ReturnResult ) { this . removeIncomingInvokeId ( componentRequest . getInvokeId ( ) ) ; } } this . scheduledComponentList . add ( componentRequest ) ; } finally { this . dialogLock . unlock ( ) ; } }
/*
(non-Javadoc)

@see org.restcomm.protocols.ss7.tcap.api.tc.dialog.Dialog#sendComponent(org
.mobicents.protocols.ss7.tcap.api.tc.component.ComponentRequest)