This example shows a workflow configured to, via Diameter Stack, receive requests and, through the Analysis agent, sends messages to and receives messages from the PSI agent.
Example workflow with the PSI agent
An example for the Analysis agent can be as follows:
consume { if (instanceOf(input, Diameter.RequestCycleUDR)) { Diameter.RequestCycleUDR diameterUDR = (Diameter.RequestCycleUDR )input; Credit_Control_Request ccr = (Credit_Control_Request)diameterUDR.Request; // Create and populate PSI.ApplyTariffRequest PSI.ApplyTariffRequest applyTariffReq = udrCreate(PSI.ApplyTariffRequest); applyTariffReq.originatingCallerId = ccr.Subscription_Id.Subscription_Id_Data; applyTariffReq.terminatingSubscriberMSCAddress = "10.0.17.42"; applyTariffReq.subscriberType = 1; applyTariffReq.bearerCapability = "2"; applyTariffReq.discount = "0"; // etc ... // Create and populate PSICycleUDR PSI.PSICycleUDR cycle = udrCreate(PSI.PSICycleUDR); cycle.context = ccr; cycle.reqUDR = applyTariffReq; udrRoute(cycle,"to_psi"); } else if (instanceOf(input, PSI.PSICycleUDR)) { // Create and route Credit_Control_Answer udrRoute(createCCA((PSI.PSICycleUDR)input), "to_diameter"); // Create transactionId ack PSI.PSICycleUDR cycle = (PSI.PSICycleUDR)input; if (cycle.hasErrors) { for (int i=0; i < listSize(cycle.errors); i++) { string error = listGet(cycle.errors, i); // handle errors debug(error); } } else { if (instanceOf(cycle.respUDR, PSI.ApplyTariffResponse)) { PSI.TransactionIdAcknowledge trIdAck = udrCreate(PSI.TransactionIdAcknowledge); trIdAck.statusId = 0; cycle.ackUDR = trIdAck; udrRoute(cycle, "to_psi"); } } } }