JSLEE Discussions
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Developing SIP Applications with VSA
Forum Index » Visual Service Architect (VSA) Discussions
Author Message
skrueger

[Avatar]

Joined: 12/07/2011 10:08:05
Messages: 43
Location: Wellington, New Zealand
Offline

A customer asked the following questions, which are reproduced here with answers for the benefit of the VSA Developer Community.

How to create transient Input with VSA?

All FSM inputs in VSA are transient by default. If a durable input is required, this can be changed in VSA by right-clicking on the FSM Diagram canvas and selecting Edit Input Dictionary from the context menu. A dialog will pop up which will allow you to change the input type from transient to durable.

Remember that if you need to use durable inputs, you will need to manually unset them.

In VSA this can be done either through an Action Diagram using the Unset Input operation, or through a Java Action (on an FSM Diagram) using the following code.

Replace xxxxxxxxxxx with the input that needs to be cleared.

Can VSA graphically assign values to input event parameters? (parameters like header of Invite event, etc)

The VSA Action Diagram has an Assign operation that can be used for this purpose.

Drag the Assign operation onto the Action Diagram. Then douple click the assign operation to open the Assign Properties dialog. To drill down to the event parameters, select the EVENT_PARAM parameter type. Then click on the button labeled '...'. This will open the Event Parameter Properties dialog letting you select any parameter from the event definition.

To read more about the Assign operation please see the VSA Documentation for Action Flowchart Elements.

How to read parameters of SIP event (e.g. Invite)?

As shown above, it is possible to use the Assign operation in the Action Diagram to read event parameters graphically. However, currently (as of version 1.0.1.5) VSA only supports the graphical Assign Operation for CGIN 1.3 and CGIN 1.4.

So, to read parameters of a SIP event, VSA Developers need to create Java Actions in the FSM Diagram. Then use Java code to extract event parameters from the associated inputs.

An example of how this could be achieved for JSIP is shown below.

Getting a parameter property:

In the above example the FSM Endpint of JSIPCom is connected to a JSIP Interface Component on the VSA Scenario Diagram.
The SIP Message Content is added to the inputs.local.message_content input which can then be read by other states/actions.

How to create Response for incoming SIP Invite? How to create SIP factories?

To create the SIP factories, the following code might be helpful:


Sending a SIP Resonse:


Please let us know if there are any further questions.

Regards, Sebastian.

This message was edited 1 time. Last update was at 04/10/2011 22:44:22


Sebastian Krueger
Open Cloud
VSA - Developer
[Email]
joaofalcao


Joined: 25/09/2011 04:14:40
Messages: 3
Offline

Hi,

I'm new to Rhino and VSA, and after reading all the tuturials and stuff, I would like to develop my first SIP App.
I'm trying a really simple scenario just receiving a Notify and sending a message reply (like ACK or 200OK) just to see it work.
Unfortunatelly none of the examples available have a source code from VSA. The only thing I've found was this post and I'm not been able to make it work (because I'm new here).

I designed this simple scenario and now I would like to know how can I make it work:
I already generated the java code, and I was trying to put the validations and the sent message code from the example above to work. But it seems to have some errors.
Can you please help me on that? Is there any really simple SIP tuturial for VSA that helps me to start coding with it? All the tuturials and examples only helps developing the model and deploying the service. I couldn't find any thing that helps me to write the first lines...

Thanks a lot.
skrueger

[Avatar]

Joined: 12/07/2011 10:08:05
Messages: 43
Location: Wellington, New Zealand
Offline

Hi joaofalcao,

You're probably wondering why when you generate your VSA code you get something like this when sending an output from the Diagram Action Send Output method.



In order for VSA to generate the correct code, VSA does a lookup to a 'code template'. The template will determine what code to generate. In VSA we call these 'downcall templates' because they make a 'down call to the SLEE'.

VSA provides a View into the 'Downcall Template Repository' for your convenience.
Window Menu -> Show View -> Downcall Template Repository
This View lets you edit existing template, add new templates, and associate templates with RA Types.

Open this view in VSA and scroll down until you find the templates that start with jsip_. Right-click on any one and select edit. You'll be presented with text like this:



So when you create a 'Send Output' operation on your Action Diagram, VSA looks into the corresponding downcall template and only find that single comment. Hence, no 'correct' code is being produced.

As of VSA 1.0.1 there are no correct SIP downcall tempates. In future versions of VSA we will provide support for JSIP.

Until then, there are two solutions that we recommend.

1. Don't use Diagram Actions for sending SIP Messages. Use Java Actions instead.
2. Override the Send Output method of the Diagram Action in the ActionsImplementationEx.java class.

The code snippets in my initial forum post of this thread were intended for Java Actions that are called directory from your FSM Diagram State object.

Let's take your scenario and see how to create it in VSA. You receive a SIP Notify and respond with a SIP Message.

1. Create a new VSA project.
2. Add the JSIP Interface to your Scenario Digram and connect (ie. create a channel) it to the existing FSM1 FSM object in the Application box.
3. Make sure you double click on the channel for VSA to update its endpoint selection.
4. Open the FSM1 FSM and create a second state called 'SendSIPReply'.
5. Create a Java action called sendSIPMessage in the Entry Action of the SendSIPReply state.
6. Create a Transition between the StartState and the SendSIPReply state.
7. Set the Transition Condition to ep.NOTIFY.
8. Select the SendSIPReply state and right-click and make it the "Final State".
9. Generate the VSA code. Right-click on project -> Generate VSA Artifacts -> Generate Java Code.

Now we need to implement the code that will send the SIP Message. Open the src/com.opencloud.ui.vsa.fsm1.FSM1ActionsImplementationEx.java class.

You should see the following method:



Our action implementation will have to do the following:

1. Get access to the SIP Activity Context
2. Create a ServerTransaction
3. Do a JNDI Lookup to the JSIP Provider
4. Get the message factory from the JSIP Provider
5. Create a SIP Response object from the message factory
6. Send the SIP Response object

The code snipets for all this are provided in the first post of this thread.

For example, insert the following code into your sendSIPMessageAction method.



There's a good tutorial about using the JAIN SIP API which will be helpful in writing SIP Code in VSA as well.

http://www.oracle.com/technetwork/articles/entarch/introduction-jain-sip-090386.html

Regards, Sebastian.

This message was edited 1 time. Last update was at 10/10/2011 22:49:36


Sebastian Krueger
Open Cloud
VSA - Developer
[Email]
nelson.cintra


Joined: 01/10/2011 00:10:26
Messages: 18
Offline

Hi Sebastian,

I'm new to VSA and SIP, I've tested your example, everything works OK except when I try to deploy from VSA using SLEE->"Deploy Service" it shows an error, but with no info inside the MessageBox, so I have to deploy in REM. Any idea how to solve this?

I'm also trying to forward the REQUEST SIP message to the same client, but I'm having problems, can you help me with an example?

Thanks a lot,
Nelson Cintra
skrueger

[Avatar]

Joined: 12/07/2011 10:08:05
Messages: 43
Location: Wellington, New Zealand
Offline

Hi Nelson,

currently we don't have a complete SIP project on offer with VSA. We are looking to provide this in a future release.

Regarding your Deploy Service issue, I need a little more info to reproduce the issue.

When you try to deploy from VSA, do you see any logs in the Rhino log?
Do you see any exceptions in the VSA log (VSA_HOME/workspace/.metadata/.log)?

What properties are you using for your Rhino SLEE Connection in VSA (Right-click on project -> VSA -> Rhino SLEE Connection)?
You should only need to configure the Client home directory, and all other properties should use defaults.

When you deploy the DU from REM everything works fine?

Regards, Sebastian.

Sebastian Krueger
Open Cloud
VSA - Developer
[Email]
mkrzeslawicki


Joined: 15/11/2011 06:20:57
Messages: 15
Offline

Hi Sebastian,

I try to implement that SIP service, which receives a SIP Notify and responds with a SIP Message. I think i do everything exactly the way you suggest it in the third post. 'Generate Java code' and 'Generate Java code and DUs' go well, also 'Deploy Service (with dependencies)' finishes successfully. However when I click 'SLEE' -> 'Activate Service' the following error appears:


Some activation operations did not complete successfully (see details)...
Exception performing SLEE management operations.
Exception occured performing SLEE operation.
com.opencloud.ui.vsa.common.actions.helper.ActivateServiceOperation.doOperation(Unknown Source)
com.opencloud.ui.vsa.common.actions.ActivateServiceAction.doServiceActivation(Unknown Source)
com.opencloud.ui.vsa.common.actions.ActivateServiceAction.access$2(Unknown Source)
com.opencloud.ui.vsa.common.actions.ActivateServiceAction$1.run(Unknown Source)
org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:69)
org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)


Can you please help me solve this problem? Also I want to ask, how can I see this SIP service working on Rhino?

Regards,
Maksymilian
skrueger

[Avatar]

Joined: 12/07/2011 10:08:05
Messages: 43
Location: Wellington, New Zealand
Offline

Hi.

Can you supply the error message from the Rhino log file please.

Regards, Sebastian.

Sebastian Krueger
Open Cloud
VSA - Developer
[Email]
mkrzeslawicki


Joined: 15/11/2011 06:20:57
Messages: 15
Offline

Hi Sebastian,

The log from the Rhino:


2011-11-23 15:45:09.734 WARN [rhino.management.service] <RMI TCP Connection(1)-192.168.0.101> Service activition failed: javax.slee.management.InvalidLinkNameBindingStateException: SBB SbbID [name=FSM1_Sbb,vendor=OpenCloud,version=0.1] requires a resource adaptor entity of the resource adaptor type 'ResourceAdaptorTypeID[name=JSIP,vendor=net.java.slee,version=1.2]' to be bound to the resource adaptor entity link name 'slee/resources/jsip/entity'. The link name is currently unbound.



Regards,
Maksymilian

This message was edited 1 time. Last update was at 24/11/2011 03:54:17

skrueger

[Avatar]

Joined: 12/07/2011 10:08:05
Messages: 43
Location: Wellington, New Zealand
Offline

Hi Maksymilian.

Looks like you don't have your SIP RA deployed/configured correctly.

Deploy SIP RA

To deploy the SIP RA correctly there are two options.

1. Run "ant deploysipra" in the <RHINO_HOME>/rhino-connectivity/sip-x.x.x.x directory. You'll have to do this before you deploy your VSA project, otherwise the build script will complain that JSIP is already deployed.
2. Add the <RHINO_HOME>/rhino-connectivity/sip-x.x.x.x/du/ocsip-xxxx.jar files to the VSA component repository and then right-click your VSA project -> SLEE -> Manage RA Deployment -> Select OC SIP -> Next and follow dialog instructions.

Create RA Entity

Once you have successfully deployed the SIP RA, you need to bind the RA in REM of the Rhino Console.

If you have deployed your SIP RA from VSA, then you will need to create an RA entity from either VSA or REM. The build.xml method creates one for you. Otherwise, in VSA, right-click your VSA project -> SLEE -> Create RA Entity.

Create RA Entity Link Name

To bind your entity link name to the RA Entity, you can use either the Rhino Console or REM. Create your entity link name as slee/resources/jsip/entity.

In Rhino Console the syntax is:
bindralinkname <entity-name> <link-name>

or in REM:
Management -> Resources -> Selecte SIP RA -> Select SIP Entity -> Click the bind link name link.

Regards, Sebastian.

Sebastian Krueger
Open Cloud
VSA - Developer
[Email]
mkrzeslawicki


Joined: 15/11/2011 06:20:57
Messages: 15
Offline

Thanks a lot Sebastian:)

Regards
Maksymilian
mkrzeslawicki


Joined: 15/11/2011 06:20:57
Messages: 15
Offline

Hi again,

It seems I still do something wrong. Despite that 'Activate Service' in VSA went successful, logs in Rhino suggest the opposite:




I tried to deploy the service in the following order:

1.I run Rhino - start-rhino
2.Deploy SIP RA- ant deploysipra
3.Create the scenario in VSA:
- Create a new VSA project.
- Add the JSIP Interface to your Scenario Digram and connect (ie. create a channel) it to the existing FSM1 FSM object in the Application box.
- Make sure you double click on the channel for VSA to update its endpoint selection.
- Open the FSM1 FSM and create a second state called 'SendSIPReply'.
- Create a Java action called sendSIPMessage in the Entry Action of the SendSIPReply state.
- Create a Transition between the StartState and the SendSIPReply state.
- Set the Transition Condition to ep.NOTIFY.
- Select the SendSIPReply state and right-click and make it the "Final State".
- Generate the VSA code. Right-click on project -> Generate VSA Artifacts -> Generate Java Code.

4.Next I insert the code to fill 'sendSIPMessageAction' in 'src/com.opencloud.ui.vsa.fsm1.FSM1ActionsImplementationEx.java class'
Here I met some unexpected errors:




Maybe here is the problem. What should I do next? I'm weak in programming, and intuitively i tried to repair the errors usnig quick fixes quide like 'Import'.

5.Next I create RA Entity in VSA: VSA project -> SLEE -> Create RA Entity ('MyEntity' as entity name)
6.I bind link name in Rhino console: bindralinkname MyEntity slee/resources/jsip/entity
7.Then in VSA:
Generate VSA artifacts -> Generate Java code and DUs
SLEE -> Deploy Service (with dependencies)
SLEE -> Activate Service

VSA says everything is OK, but Rhino logs protest, as i mentioned at the beginning.


Could you please, help me once again?
Thanks for your attention.

Regards,
Maksymilian

This message was edited 7 times. Last update was at 27/11/2011 04:34:41

oliver


Joined: 29/10/2008 09:36:04
Messages: 680
Location: Cambridge, UK
Offline

That is a failure to activate the SIP RA, not your service, and there will be earlier logs that give a more detailed reason for the failure.
[Email]
skrueger

[Avatar]

Joined: 12/07/2011 10:08:05
Messages: 43
Location: Wellington, New Zealand
Offline

Hi Maksymilian.

Did you get your issue resolved?

Regards, Sebastian.

Sebastian Krueger
Open Cloud
VSA - Developer
[Email]
ayushi1237


Joined: 01/05/2019 21:01:42
Messages: 1
Offline

Great post! I am actually getting ready to across this information, is very helpful my friend. Also great blog here with all of the valuable information you have. Keep up the good work you are doing here. Click Here
 
Forum Index » Visual Service Architect (VSA) Discussions
Go to:   
Powered by JForum 2.1.8 © JForum Team