use of javax.slee.ActivityContextInterface in project charging-server by RestComm.
the class DataSourceSbb method executeTask.
// ---------------------------- Event Handlers ----------------------------
/**
* Simple method to create JDBC activity and execute given task.
*
* @param jdbcTask
*/
private void executeTask(SimpleJdbcTask jdbcTask) {
JdbcActivity jdbcActivity = jdbcRA.createActivity();
ActivityContextInterface jdbcACI = jdbcACIF.getActivityContextInterface(jdbcActivity);
jdbcACI.attach(sbbContextExt.getSbbLocalObject());
jdbcActivity.execute(jdbcTask);
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class MtSbb method sendMtSms.
private void sendMtSms(MAPApplicationContext mapApplicationContext, MessageProcessingState messageProcessingState, MAPDialogSms mapDialogSms, int networkId) throws SmscProcessingException {
SmsSet smsSet = getSmsSet();
if (smsSet == null) {
throw new SmscProcessingException("CMP smsSet is missed", -1, -1, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
}
Sms sms = this.getMessageInSendingPool(0);
if (sms == null) {
throw new SmscProcessingException("sms is missed in CMP", -1, -1, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
}
boolean moreMessagesToSend = false;
try {
if (this.getTotalUnsentMessageCount() > 1) {
moreMessagesToSend = true;
}
} catch (Throwable e) {
}
try {
boolean newDialog = false;
if (mapDialogSms == null) {
newDialog = true;
String mtLocalSccpGt = sms.getMtLocalSccpGt();
SccpAddress originSccpAddress;
if (mtLocalSccpGt != null) {
originSccpAddress = this.getServiceCenterSccpAddress(mtLocalSccpGt, networkId);
} else {
originSccpAddress = this.getServiceCenterSccpAddress(networkId);
}
mapDialogSms = this.mapProvider.getMAPServiceSms().createNewDialog(mapApplicationContext, originSccpAddress, null, this.getNetworkNode(), null);
mapDialogSms.setNetworkId(networkId);
ActivityContextInterface mtFOSmsDialogACI = this.mapAcif.getActivityContextInterface(mapDialogSms);
mtFOSmsDialogACI.attach(this.sbbContext.getSbbLocalObject());
}
// setting TON / NPI to unknown for unsupported source TON / NPI
int sourceAddrTon = sms.getSourceAddrTon();
if (sourceAddrTon < 0 || sourceAddrTon > 6)
sourceAddrTon = 0;
int sourceAddrNpi = sms.getSourceAddrNpi();
if (sourceAddrTon == SmppConstants.TON_ALPHANUMERIC) {
sourceAddrNpi = SmppConstants.NPI_UNKNOWN;
} else {
if (sourceAddrNpi >= 0 && sourceAddrNpi <= 1 || sourceAddrNpi >= 3 && sourceAddrNpi <= 9 || sourceAddrNpi >= 10 && sourceAddrNpi <= 1 || sourceAddrNpi == 18) {
} else {
sourceAddrNpi = SmppConstants.NPI_UNKNOWN;
}
}
SM_RP_DA sm_RP_DA = this.getSmRpDa();
SM_RP_OA sm_RP_OA = this.getSmRpOa();
SmsSignalInfo smsSignalInfo;
if (messageProcessingState == MessageProcessingState.firstMessageSending) {
int dcs = sms.getDataCoding();
Tlv dest_addr_subunit = sms.getTlvSet().getOptionalParameter(SmppConstants.TAG_DEST_ADDR_SUBUNIT);
if (dest_addr_subunit != null) {
try {
int mclass = dest_addr_subunit.getValueAsByte();
if (mclass >= 1 && mclass <= 4) {
dcs |= (0x10 + (mclass - 1));
}
} catch (TlvConvertException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
DataCodingScheme dataCodingScheme = this.mapSmsTpduParameterFactory.createDataCodingScheme(dcs);
Tlv sarMsgRefNum = sms.getTlvSet().getOptionalParameter(SmppConstants.TAG_SAR_MSG_REF_NUM);
Tlv sarTotalSegments = sms.getTlvSet().getOptionalParameter(SmppConstants.TAG_SAR_TOTAL_SEGMENTS);
Tlv sarSegmentSeqnum = sms.getTlvSet().getOptionalParameter(SmppConstants.TAG_SAR_SEGMENT_SEQNUM);
SmsSignalInfo[] segments;
SmsDeliveryReportData smsDeliveryReportData = SmsDeliveryReportData.decodeFromString(sms.getShortMessageText());
if (smsDeliveryReportData != null) {
// this is SMS-STATUS-REPORT
segments = new SmsSignalInfo[1];
segments[0] = this.createSignalInfoStatusReport(sms, moreMessagesToSend, smsDeliveryReportData);
} else if ((sms.getEsmClass() & SmppConstants.ESM_CLASS_UDHI_MASK) != 0) {
// message already contains UDH - we can not slice it
segments = new SmsSignalInfo[1];
segments[0] = this.createSignalInfo(sms, sms.getShortMessageText(), sms.getShortMessageBin(), moreMessagesToSend, 0, 1, 1, dataCodingScheme, 0, 0, sourceAddrTon, sourceAddrNpi);
} else if (sarMsgRefNum != null && sarTotalSegments != null && sarSegmentSeqnum != null) {
// we have tlv's that define message count/number/reference
int messageSegmentCount = sarTotalSegments.getValueAsUnsignedByte();
int messageSegmentNumber = sarSegmentSeqnum.getValueAsUnsignedByte();
int messageReferenceNumber = sarMsgRefNum.getValueAsUnsignedShort();
segments = new SmsSignalInfo[1];
segments[0] = this.createSignalInfo(sms, sms.getShortMessageText(), null, moreMessagesToSend, messageReferenceNumber, messageSegmentCount, messageSegmentNumber, dataCodingScheme, sms.getNationalLanguageLockingShift(), sms.getNationalLanguageSingleShift(), sourceAddrTon, sourceAddrNpi);
} else {
// possible a big message and segmentation
String[] segmentsByte;
segmentsByte = MessageUtil.sliceMessage(sms.getShortMessageText(), dataCodingScheme, sms.getNationalLanguageLockingShift(), sms.getNationalLanguageSingleShift());
segments = new SmsSignalInfo[segmentsByte.length];
// TODO messageReferenceNumber should be generated
// int messageReferenceNumber = (int) (this.getCurrentMsgNumValue() + 1);
int messageReferenceNumber = (int) (this.getCurrentMsgNumValue());
for (int i1 = 0; i1 < segmentsByte.length; i1++) {
segments[i1] = this.createSignalInfo(sms, segmentsByte[i1], null, (i1 < segmentsByte.length - 1 ? true : moreMessagesToSend), messageReferenceNumber, segmentsByte.length, i1 + 1, dataCodingScheme, sms.getNationalLanguageLockingShift(), sms.getNationalLanguageSingleShift(), sourceAddrTon, sourceAddrNpi);
}
}
this.setSegments(segments);
smsSignalInfo = segments[0];
this.setMessageSegmentNumber(0);
if (segments.length > 1)
moreMessagesToSend = true;
} else {
int messageSegmentNumber = this.getMessageSegmentNumber();
SmsSignalInfo[] segments = this.getSegments();
smsSignalInfo = segments[messageSegmentNumber];
if (messageSegmentNumber < segments.length - 1)
moreMessagesToSend = true;
}
long invokeId = 0;
switch(mapDialogSms.getApplicationContext().getApplicationContextVersion()) {
case version3:
invokeId = mapDialogSms.addMtForwardShortMessageRequest(sm_RP_DA, sm_RP_OA, smsSignalInfo, moreMessagesToSend, null);
if (this.logger.isInfoEnabled()) {
this.logger.info("Sending: MtForwardShortMessageRequest: sm_RP_DA=" + sm_RP_DA + ", sm_RP_OA=" + sm_RP_OA + ", si=" + smsSignalInfo + ", moreMessagesToSend=" + moreMessagesToSend);
}
break;
case version2:
case version1:
invokeId = mapDialogSms.addForwardShortMessageRequest(sm_RP_DA, sm_RP_OA, smsSignalInfo, moreMessagesToSend);
if (this.logger.isInfoEnabled()) {
this.logger.info("Sending: ForwardShortMessageRequest: sm_RP_DA=" + sm_RP_DA + ", sm_RP_OA=" + sm_RP_OA + ", si=" + smsSignalInfo + ", moreMessagesToSend=" + moreMessagesToSend);
}
break;
default:
break;
}
int messageUserDataLengthOnSend = mapDialogSms.getMessageUserDataLengthOnSend();
int maxUserDataLength = mapDialogSms.getMaxUserDataLength();
if (mapDialogSms.getApplicationContext().getApplicationContextVersion() != MAPApplicationContextVersion.version1 && newDialog && messageUserDataLengthOnSend >= maxUserDataLength - SmscPropertiesManagement.getInstance().getMaxMessageLengthReducer()) {
mapDialogSms.cancelInvocation(invokeId);
this.setTcEmptySent(1);
} else {
this.setTcEmptySent(0);
}
mapDialogSms.send();
sms.putMsgPartDeliveryTime(getMessageSegmentNumber(), System.currentTimeMillis());
} catch (MAPException e) {
if (mapDialogSms != null)
mapDialogSms.release();
throw new SmscProcessingException("MAPException when sending MtForwardSM. Sms=" + sms, -1, -1, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null, e);
} catch (TlvConvertException e) {
if (mapDialogSms != null)
mapDialogSms.release();
throw new SmscProcessingException("TlvConvertException when sending MtForwardSM", -1, -1, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null, e);
}
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class SriSbb method sendSRI.
// *********
// Main service methods
private void sendSRI(SmsSet smsSet, String destinationAddress, int ton, int npi, MAPApplicationContext mapApplicationContext) {
// Send out SRI
MAPDialogSms mapDialogSms = null;
try {
Sms sms0 = smsSet.getSms(0);
String mtLocalSccpGt = null;
Integer mtRemoteSccpTt = null;
if (sms0 != null) {
mtLocalSccpGt = sms0.getMtLocalSccpGt();
mtRemoteSccpTt = sms0.getMtRemoteSccpTt();
}
// 1. Create Dialog first and add the SRI request to it
mapDialogSms = this.setupRoutingInfoForSMRequestIndication(destinationAddress, ton, npi, mapApplicationContext, smsSet.getNetworkId(), mtLocalSccpGt, mtRemoteSccpTt);
// 2. Create the ACI and attach this SBB
ActivityContextInterface sriDialogACI = this.mapAcif.getActivityContextInterface(mapDialogSms);
sriDialogACI.attach(this.sbbContext.getSbbLocalObject());
// 3. Finally send the request
mapDialogSms.send();
} catch (MAPException e) {
if (mapDialogSms != null) {
mapDialogSms.release();
}
String reason = "MAPException when sending SRI from sendSRI(): " + e.toString();
this.logger.severe(reason, e);
ErrorCode smStatus = ErrorCode.SC_SYSTEM_ERROR;
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, smStatus, reason, true, null, false, ProcessingType.SS7_SRI);
}
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class RxSipServerSbb method sendMessage.
// *********
// Main service methods
/**
* Sending of a SIP message after initial message or when all sent messages was sent
*
* @param smsSet
* @throws SmscProcessingException
*/
private void sendMessage(SmsSet smsSet) throws SmscProcessingException {
smscStatAggregator.updateMsgOutTryAll();
smscStatAggregator.updateMsgOutTrySip();
Sms sms = this.obtainNextMessage(ProcessingType.SIP);
if (sms == null) {
this.markDeliveringIsEnded(true);
return;
}
try {
// TODO: let make here a special check if SIP is in a good state
// if not - skip sending and set temporary error
String fromAddressStr = sms.getSourceAddr();
String toAddressStr = smsSet.getDestAddr();
Sip sip = sipManagement.getSipByName(SipManagement.SIP_NAME);
ListeningPoint listeningPoint = sipRA.getListeningPoints()[0];
SipURI fromAddressUri = addressFactory.createSipURI(fromAddressStr, listeningPoint.getIPAddress() + ":" + listeningPoint.getPort());
javax.sip.address.Address fromAddress = addressFactory.createAddress(fromAddressUri);
FromHeader fromHeader = headerFactory.createFromHeader(fromAddress, null);
SipURI toAddressUri = addressFactory.createSipURI(toAddressStr, sip.getSipAddress());
javax.sip.address.Address toAddress = addressFactory.createAddress(toAddressUri);
ToHeader toHeader = headerFactory.createToHeader(toAddress, null);
List<ViaHeader> viaHeaders = new ArrayList<ViaHeader>(1);
ViaHeader viaHeader = headerFactory.createViaHeader(listeningPoint.getIPAddress(), listeningPoint.getPort(), listeningPoint.getTransport(), null);
viaHeaders.add(viaHeader);
ContentTypeHeader contentTypeHeader = headerFactory.createContentTypeHeader("text", "plain");
CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(2L, Request.MESSAGE);
MaxForwardsHeader maxForwardsHeader = headerFactory.createMaxForwardsHeader(70);
CallIdHeader callId = this.sipRA.getNewCallId();
String msgStr = sms.getShortMessageText();
byte[] msgUdh = sms.getShortMessageBin();
byte[] msg;
msg = recodeShortMessage(sms.getDataCoding(), msgStr, msgUdh);
// create request
Request request = messageFactory.createRequest(toAddressUri, Request.MESSAGE, callId, cSeqHeader, fromHeader, toHeader, viaHeaders, maxForwardsHeader, contentTypeHeader, msg);
// Custom X Headers
// SMSC-ID
String originEsmeName = sms.getOrigEsmeName();
if (originEsmeName != null) {
Header smsIdHeader = headerFactory.createHeader(SipXHeaders.XSmscId, originEsmeName);
request.addHeader(smsIdHeader);
}
// data-coding
DataCodingScheme dataCodingScheme = new DataCodingSchemeImpl(sms.getDataCoding());
Header smsIdHeader = headerFactory.createHeader(SipXHeaders.XSmsCoding, Integer.toString(dataCodingScheme.getCharacterSet().getCode()));
request.addHeader(smsIdHeader);
// TODO X header message class
// X header delivery time, use SUBMIT_DATE
Date submitDate = sms.getSubmitDate();
if (submitDate != null) {
String submitDateStr = MessageUtil.formatDate(submitDate);
Header submitDateHeader = headerFactory.createHeader(SipXHeaders.XDeliveryTime, submitDateStr);
request.addHeader(submitDateHeader);
}
// Validity Period
Date validityPeriod = sms.getValidityPeriod();
if (validityPeriod != null) {
String validityPeriodStr = MessageUtil.formatDate(validityPeriod);
Header validityHeader = headerFactory.createHeader(SipXHeaders.XSmsValidty, validityPeriodStr);
request.addHeader(validityHeader);
}
// X header UDH
if (msgUdh != null) {
String udhString = hexStringToByteArray(msgUdh);
Header udhHeader = headerFactory.createHeader(SipXHeaders.XSmsUdh, udhString);
request.addHeader(udhHeader);
}
// create client transaction and send request
ClientTransaction clientTransaction = sipRA.getNewClientTransaction(request);
ActivityContextInterface sipClientTxaci = this.sipACIFactory.getActivityContextInterface(clientTransaction);
sipClientTxaci.attach(this.sbbContext.getSbbLocalObject());
clientTransaction.sendRequest();
} catch (Exception e) {
throw new SmscProcessingException("RxSipServerSbb.sendMessage(): Exception while trying to send SIP Message =" + e.getMessage() + "Message: " + sms, 0, 0, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null, e);
}
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class ChargingSbb method setupChargingRequestInterface.
// public void onActivityEndEvent(ActivityEndEvent event, ActivityContextInterface aci) {
// logger.info(" Activity Ended[" + aci.getActivity() + "]");
// }
// Setup charging request
public void setupChargingRequestInterface(ChargingMedium chargingType, Sms sms) {
if (logger.isFineEnabled()) {
logger.fine("ChargingSbb: received message for process charging process: chargingType=" + chargingType + ", message=[" + sms + "]");
}
ChargingData chargingData = new ChargingData();
chargingData.setSms(sms);
chargingData.setChargingType(chargingType);
this.setChargingData(chargingData);
String sourceAddress = sms.getSourceAddr();
int sourceTon = sms.getSourceAddrTon();
String originatorSccpAddress = sms.getOriginatorSccpAddress();
String origMoServiceCentreAddressDA = sms.getOrigMoServiceCentreAddressDA();
if (origMoServiceCentreAddressDA == null) {
origMoServiceCentreAddressDA = smscPropertiesManagement.getServiceCenterGt(sms.getSmsSet().getNetworkId());
}
String recipientAddress = sms.getSmsSet().getDestAddr();
int destTon = sms.getSmsSet().getDestAddrTon();
int dataCodingScheme = sms.getDataCoding();
String interfaceId = Integer.toString(sms.getSmsSet().getNetworkId());
String interfaceText = sms.getOrigEsmeName();
try {
DiameterIdentity destHost = null;
if (smscPropertiesManagement.getDiameterDestHost() != null && !smscPropertiesManagement.getDiameterDestHost().equals("")) {
// destHost = new DiameterIdentity("aaa://" +
// smscPropertiesManagement.getDiameterDestHost() + ":" +
// smscPropertiesManagement.getDiameterDestPort());
destHost = new DiameterIdentity(smscPropertiesManagement.getDiameterDestHost());
}
DiameterIdentity destRealm = new DiameterIdentity(smscPropertiesManagement.getDiameterDestRealm());
RoClientSessionActivity activity = this.roProvider.createRoClientSessionActivity(destHost, destRealm);
ActivityContextInterface roACI = acif.getActivityContextInterface(activity);
roACI.attach(getSbbContext().getSbbLocalObject());
RoCreditControlRequest ccr = activity.createRoCreditControlRequest(CcRequestType.EVENT_REQUEST);
// ccr.setDestinationRealm(destRealm);
// ccr.setAuthApplicationId(APPLICATION_ID_OF_THE_DIAMETER_CREDIT_CONTROL_APPLICATION);
ccr.setServiceContextId(SERVICE_CONTEXT_ID_SMSC);
ccr.setCcRequestNumber(0);
// ((SipUri)fromHeader.getAddress().getURI()).getUser();
if (smscPropertiesManagement.getDiameterUserName() != null && !smscPropertiesManagement.getDiameterUserName().equals("")) {
ccr.setUserName(smscPropertiesManagement.getDiameterUserName());
}
// This field contains the state associated to the CTF
// do not know how to use it
// a monotonically increasing value that is advanced whenever a
// Diameter
// entity restarts with loss of previous state, for example upon
// reboot
// ccr.setOriginStateId(smscRebootStep);
// do not know if we need it
ccr.setEventTimestamp(Calendar.getInstance().getTime());
SubscriptionIdAvp subId = avpFactory.createSubscriptionId(SubscriptionIdType.END_USER_E164, sourceAddress);
ccr.setSubscriptionId(subId);
ccr.setRequestedAction(RequestedActionType.DIRECT_DEBITING);
// ccr.setMultipleServicesIndicator(MultipleServicesIndicatorType.MULTIPLE_SERVICES_NOT_SUPPORTED);
// requested units
int messageCount = 1;
int serviceIdentifier = 1;
MultipleServicesCreditControlAvp multipleServicesCreditControl = avpFactory.createMultipleServicesCreditControl();
RequestedServiceUnitAvp requestedServiceUnit = avpFactory.createRequestedServiceUnit();
requestedServiceUnit.setCreditControlServiceSpecificUnits(messageCount);
multipleServicesCreditControl.setRequestedServiceUnit(requestedServiceUnit);
multipleServicesCreditControl.setServiceIdentifier(serviceIdentifier);
ccr.setMultipleServicesCreditControl(multipleServicesCreditControl);
// RequestedServiceUnitAvp RSU =
// avpFactory.createRequestedServiceUnit();
// RSU.setCreditControlTime(_FIRST_CHARGE_TIME);
// ccr.setRequestedServiceUnit(RSU);
// ServiceInformation - SMS info 2000
ArrayList<DiameterAvp> smsInfoAvpLst = new ArrayList<DiameterAvp>();
int vendorID = 10415;
// Originator-SCCP-Address 2008
if (originatorSccpAddress != null) {
byte[] originatorSccpAddressAddrPartByteArr = originatorSccpAddress.getBytes(utf8Charset);
byte[] originatorSccpAddressByteArr = new byte[2 + originatorSccpAddressAddrPartByteArr.length];
originatorSccpAddressByteArr[1] = 8;
System.arraycopy(originatorSccpAddressAddrPartByteArr, 0, originatorSccpAddressByteArr, 2, originatorSccpAddressAddrPartByteArr.length);
DiameterAvp avpOriginatorSccpAddress = avpFactory.getBaseFactory().createAvp(vendorID, 2008, originatorSccpAddressByteArr);
smsInfoAvpLst.add(avpOriginatorSccpAddress);
}
// SMSC-Address 2017
if (origMoServiceCentreAddressDA != null) {
byte[] origMoServiceCentreAddressDAPartByteArr = origMoServiceCentreAddressDA.getBytes(utf8Charset);
byte[] origMoServiceCentreAddressDAByteArr = new byte[2 + origMoServiceCentreAddressDAPartByteArr.length];
origMoServiceCentreAddressDAByteArr[1] = 8;
System.arraycopy(origMoServiceCentreAddressDAPartByteArr, 0, origMoServiceCentreAddressDAByteArr, 2, origMoServiceCentreAddressDAPartByteArr.length);
DiameterAvp avpOrigMoServiceCentreAddressDA = avpFactory.getBaseFactory().createAvp(vendorID, 2017, origMoServiceCentreAddressDAByteArr);
smsInfoAvpLst.add(avpOrigMoServiceCentreAddressDA);
}
// Data-Coding-Scheme 2001
DiameterAvp avpDataCodingScheme = avpFactory.getBaseFactory().createAvp(vendorID, 2001, dataCodingScheme);
smsInfoAvpLst.add(avpDataCodingScheme);
// SM-Message-Type 2007
DiameterAvp avpSmMessageType = avpFactory.getBaseFactory().createAvp(vendorID, 2007, SmMessageTypeEnum.SUBMISSION.getValue());
smsInfoAvpLst.add(avpSmMessageType);
// Originator-Interface 2009
ArrayList<DiameterAvp> originatorInterfaceAvpLst = new ArrayList<DiameterAvp>();
DiameterAvp avpInterfaceId = avpFactory.getBaseFactory().createAvp(vendorID, 2003, interfaceId);
originatorInterfaceAvpLst.add(avpInterfaceId);
if (interfaceText != null) {
DiameterAvp avpInterfaceText = avpFactory.getBaseFactory().createAvp(vendorID, 2005, interfaceText);
originatorInterfaceAvpLst.add(avpInterfaceText);
}
DiameterAvp[] originatorInterfaceAvpArr = new DiameterAvp[originatorInterfaceAvpLst.size()];
originatorInterfaceAvpLst.toArray(originatorInterfaceAvpArr);
DiameterAvp avpOriginatorInterface = avpFactory.getBaseFactory().createAvp(vendorID, 2009, originatorInterfaceAvpArr);
smsInfoAvpLst.add(avpOriginatorInterface);
// Recipient-Address 1201
ArrayList<DiameterAvp> recipientAddressAvpLst = new ArrayList<DiameterAvp>();
DiameterAvp avpAddressType;
if (destTon == 1)
avpAddressType = avpFactory.getBaseFactory().createAvp(vendorID, 899, AddressTypeEnum.Msisdn.getValue());
else
avpAddressType = avpFactory.getBaseFactory().createAvp(vendorID, 899, AddressTypeEnum.Others.getValue());
recipientAddressAvpLst.add(avpAddressType);
DiameterAvp avpAddressData = avpFactory.getBaseFactory().createAvp(vendorID, 897, recipientAddress);
recipientAddressAvpLst.add(avpAddressData);
DiameterAvp[] recipientAddressAvpArr = new DiameterAvp[recipientAddressAvpLst.size()];
recipientAddressAvpLst.toArray(recipientAddressAvpArr);
DiameterAvp avpRecipientAddress = avpFactory.getBaseFactory().createAvp(vendorID, 1201, recipientAddressAvpArr);
// Recipient-Info 2026
ArrayList<DiameterAvp> recipientInfoAvpLst = new ArrayList<DiameterAvp>();
recipientInfoAvpLst.add(avpRecipientAddress);
DiameterAvp[] recipientInfoAvpArr = new DiameterAvp[recipientInfoAvpLst.size()];
recipientInfoAvpLst.toArray(recipientInfoAvpArr);
DiameterAvp avpRecipientInfo = avpFactory.getBaseFactory().createAvp(vendorID, 2026, recipientInfoAvpArr);
smsInfoAvpLst.add(avpRecipientInfo);
// Originator-Received-Address 2027
ArrayList<DiameterAvp> originatorReceivedAddressAvpLst = new ArrayList<DiameterAvp>();
if (sourceTon == 1)
avpAddressType = avpFactory.getBaseFactory().createAvp(vendorID, 899, AddressTypeEnum.Msisdn.getValue());
else
avpAddressType = avpFactory.getBaseFactory().createAvp(vendorID, 899, AddressTypeEnum.Others.getValue());
originatorReceivedAddressAvpLst.add(avpAddressType);
avpAddressData = avpFactory.getBaseFactory().createAvp(vendorID, 897, sourceAddress);
originatorReceivedAddressAvpLst.add(avpAddressData);
DiameterAvp[] originatorReceivedAddressAvpArr = new DiameterAvp[originatorReceivedAddressAvpLst.size()];
originatorReceivedAddressAvpLst.toArray(originatorReceivedAddressAvpArr);
DiameterAvp avpOriginatorReceivedAddress = avpFactory.getBaseFactory().createAvp(vendorID, 2027, originatorReceivedAddressAvpArr);
smsInfoAvpLst.add(avpOriginatorReceivedAddress);
// final assembling
DiameterAvp[] smsInfoAvpArr = new DiameterAvp[smsInfoAvpLst.size()];
smsInfoAvpLst.toArray(smsInfoAvpArr);
DiameterAvp[] smsInfo = new DiameterAvp[1];
smsInfo[0] = avpFactory.getBaseFactory().createAvp(vendorID, 2000, smsInfoAvpArr);
ServiceInformation si = avpFactory.createServiceInformation();
si.setExtensionAvps(smsInfo);
ccr.setServiceInformation(si);
activity.sendEventRoCreditControlRequest(ccr);
if (logger.isFineEnabled()) {
logger.fine("Sent INITIAL CCR: " + ccr);
}
// set new timer for the case we will not get CCA in time
timerFacility.setTimer(roACI, null, System.currentTimeMillis() + (CCR_TIMEOUT * 1000), defaultTimerOptions);
} catch (Exception e1) {
logger.severe("setupChargingRequestInterface(): error while sending RoCreditControlRequest: " + e1.getMessage(), e1);
generateCDR(sms, CdrGenerator.CDR_SUBMIT_FAILED_CHARGING, e1.getMessage(), false, true);
}
}
Aggregations