Skip to main content

SIMPLE RA

15 replies [Last post]
mlaporta
Offline
Joined: 2007-04-02

Hi All,
I'm Michele La Porta.I'm new to SIP and mobicents.For our
project prototype we will need to code a SIMPLE Resource Adaptor and
some sbbs/services.Let's focus on RA.I think SIP RA is our
starting point.
Should we extend that module?
if so should we just need to add SIMPLE related
events/messages as defined in rfc 3428?

Create a new module SIMPLE RA from scratch using SIPRA as
template?

Thanks

Michele

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
eduardomartins
Offline
Joined: 2005-10-10

Why not provide both interfaces, that's one of the JAIN SLEE strengths, it's not a SIP only Application Server :-)

One of the core concepts in JAIN SLEE is the Activity Context (AC), which is an abstract concept for a sequence of events. You can, and usually you do that, define a mapping from the AC where the related events are fired to SBBs entities (instances), and in those entities you can persist instance data in CMPs. You can also define a SBB Activity Context Interface to bind data to ACs, and through this you can share data between SBB entities. I recommend you a reading of the JAIN SLEE specs, which are the most valuable document for a JAIN SLEE developer.

lucaf
Offline
Joined: 2007-02-07

Hi Eduardo,

I agree with you, and that's exactly what I was trying to do - the problem I see with SIP/SIMPLE is the following:

suppose I'm using the sip-wake-up example,
if end user is using 3CX, the message the SBB gets is "10 Wakeup!"
but if the client is Xten the SBB gets "<FONT face=Arial size=2>10 Wakeup!</FONT>"
using other clients... I have no idea! :-)

Furthermore, I did some debugging, and I noticed that from time to time Xten sends messages such as:

xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
active
goober
60

I found in a RFC that this kind of "state messages" are part of SIMPLE, but the problem is, again, that different SIP clients sends different messages
How am I suppose to handle the parsing of the message if the format differs based on the client being in use? can you see my point?

luca

P.S.: slowly I'm going through the spec :-)

eduardomartins
Offline
Joined: 2005-10-10

I've never tried to get those messages [b]into[/b] JAIN SLEE, but perphaps you can filter/adapt the message from the MESSAGE Request headers and/or, if it's xml, from the namespaces declared.

As an example, you already found that you can forget about messages that are XML documents with root element named isComposing, and have a default namespace that is urn:ietf:params:xml:ns:im-iscomposing ;-)

That is SIMPLE extension to indicate that the sender is typing, XMPP also have something similar.

Anyway, don't think everything works in the XMPP world too, since some clients still do not support all JEP extensions, others simply ignore those and focus on the IETF standard, and others still use some things from the old Jabber.

Welcome to the nasty world of IM and Presence.

eduardomartins
Offline
Joined: 2005-10-10

Usually when a softphone shows an XML message it means it doesn't know how to handle its content, even if specs says to drop those "unknown" XML documents/elements.

Soo ... it's easy to write an SBB that works with all clients if the standards (including extensions) and clients are mature, such as XMPP. Regarding SIMPLE, imho clients are still prototypes, and the standards are evolving a lot.

lucaf
Offline
Joined: 2007-02-07

Hi all,

so if I understood correctly, if you had to provide a service through instant messaging to a broad audience, you would rather provide an XMPP interface instead of a SIP/SIMPLE?

A thought that came up in my mind in the last few days: I might need to have a Session for IM, the way we have a Session in the http/servlet world - I mean, a way to relate the message the client is currently sending to my SBB with messages sent before.
Does it make any sense? The idea is to have my SBB acting like a state-machine and going from a state to another one upon receiving a message... therefore I need to store somewhere a state and link it to the user who is sending the messages.

What would be the best way to develop that in SLEE? hashtable or something else?

Thanks for your time
luca

ivelin
Offline
Joined: 2003-07-13

for the XMPP route, take a look at the Google Talk Bot example
http://wiki.java.net/bin/view/Communications/MobicentsExamplesGoogleTalkBot

lucaf
Offline
Joined: 2007-02-07

Hi Ivelin,

I already did - it's a great example and Eduardo helped me a lot explaining to me some of the points which I had not fully understood at first

As a matter of fact I already built a simple demo XMPP service (openmeteo@gmail.com) - unfortunately it's only in italian at the moment :-)

talk to you soon
luca

eduardomartins
Offline
Joined: 2005-10-10

SIP Resource Adaptor already supports the request methods used in SIMPLE, which are PUBLISH, SUBSCRIBE AND NOTIFY.

What do you really want to do, a presence server?

mlaporta
Offline
Joined: 2007-04-02

We need to send/receive instant messaging so I think the sip operation method is MESSAGE.
Our prototype should be able to send/receive SIP/SIMPLE message, convert to SMPP format and viceversa.

ivelin
Offline
Joined: 2003-07-13

SIP MESSAGE is also supported by the JSIP RA.
http://wiki.java.net/bin/view/Communications/DialogExtensionMemo

Looks like what you need fits as a JSLEE Service acting as a gateway, using both the SIP and SMPP RAs.

Ivelin

mlaporta
Offline
Joined: 2007-04-02

Hi again,
yes is exctly what we need. I wrote a simple SIP/SIMPLE client based on
https://jain-sip.dev.java.net/source/browse/jain-sip/src/examples/ims/

The resulting mobicents output is:

11:39:31,875 INFO [SipResourceAdaptor]
Resource adaptor lookingup event:
Event:
Name:javax.sip.message.Request.MESSAGE
Vendor: javax.sip
Version: 1.1

======== [b]EVENT IS NOT GOING TO BE RECEIVED, DROPING[/b] ========
================ ACTIVITIES ============
z9hG4bKfd0e8b87bfe6b9134ae05bedd365ea26_MESSAGE == [TransactionW WRAPPED[gov.nis
t.javax.sip.stack.SIPServerTransaction@61892dfb] BRANCHID[z9hG4bKfd0e8b87bfe6b91
........

11:39:32,671 INFO [STDOUT] from="127.0.0.1:5060"
to="10.4.201.123:5060"
time="1176889172656"
isSender="false"
transactionId="z9hg4bke600b171b0ed45623d4078cc6546d0b3"
callId="8d24e9c2a0b3df60a82e19dacfd4738d@127.0.0.1"
firstLine="MESSAGE sip:fmoggia@nist.gov SIP/2.0"
>
Call-ID: 8d24e9c2a0b3df60a82e19dacfd4738d@127.0.0.1
CSeq: 1 MESSAGE
From: "Michele" ;tag=12345
To: "FMoggia"
Via: SIP/2.0/UDP 127.0.0.1:5060;branch=z9hG4bKe600b171b0ed45623d4078cc6546d0b3
Max-Forwards: 70
Content-Type: text/plain
Content-Length: 11

]]>

Looking at SipResourceAdaptor/Mobicents source code I understand that javax.sip.dialog.Request.MESSAGE is already declared on SIPRA descriptor:

event-jar.xml (event-definition)
resource-adaptor-type-jar.xml (event-type-ref)

From mobicents logs I see during SIPRA installation:
EventTypeID[javax.sip.dialog.Request.MESSAGE#net.java#1.2], #40
================SIP METHODS====================
[...,MESSAGE, ...]

but it seems Request.MESSAGE is not managed on SipResourceAdaptor or Mobicents

on line 653 of SipResourceAdaptor there's an event filtering on
org.mobicents.slee.resource.EventTypeID

on line 964 of SipResourceAdaptor there's a drop for not registered events.

My ideas are still not very clear about this topic.How can I register this events?Any advice?

Thanks

Michele

baranowb
Offline
Joined: 2006-01-09

Events are registered to RA (its akward to say so) during service installation process.
Slee Container goes throuh installed service sbb descriptors and extracts informamtion:

RAImplID->EventsReceivedBySbbs->ResourceOptionsForEvents (more or less)
and passes that information to RAs.
I think for now only sip and xmpp ra have this function. To simply say ras have list of services subsribed for events ra fires.

So if ra is about to fire some events it checks if that list lenght is greater than zero, if it is, it fires this event, otherwise it doesnt (sip ra prints that information "EVENT IS NOT GOING TO BE RECEIVED, DROPING).

SIP METHODS and list following shows only which methods are handled as events. For instance if You declare some method of Yours it will be considered as EXTENSION (another SIP method to handle everything that is unknown).

So the cause may be:
So possibly your sbb doesnt declare RA Link in its sbb-jar.xml
[code]


jain-sip
javax.sip
1.1

slee/resources/jainsip/1.1/acifactory

slee/resources/jainsip/1.1/provider
SipRA


[/code]

However is this client of Yours deployed as a service in mobicents (better to ask stupid questions :))

mlaporta
Offline
Joined: 2007-04-02

Hi All,
I found a working SIP/SIMPLE softphone at
http://www.3cx.com/VOIP/voip-phone-manual.html

I did some changes on SIPRA/SIP-SERVICE

[b]org.mobicents.slee.services.sip.proxy.BaseProxySbb[/b]

add
[i]
public void onMessageEvent(RequestEvent event, ActivityContextInterface ac) {
getDefaultSbbUsageParameterSet().incrementNumberOfMessage(1);
trace(Level.INFO, "Received MESSAGE request");
try {
Request request = event.getRequest();
ServerTransaction serverTransaction = event.getServerTransaction();
processRequest(serverTransaction, request, ac);
this.setTimeStarted(System.currentTimeMillis());
} catch (Exception e) {
trace(Level.WARNING, "Exception during onMessageEvent", e);
}
}
[/i]

[b]org.mobicents.slee.services.sip.proxy.ProxySbbUsage[/b]
add
[i]
public abstract void incrementNumberOfMessage(long value);
[/i]

[b]sipra/sip-services/src/org/mobicents/slee/services/sip/proxy/META-INF/sbb-jar.xml[/b]
add
[i]

MessageEvent

javax.sip.message.Request.MESSAGE
javax.sip
1.1

callIDSelect

[/i]

With these changes I can send/receive message.What i see is on mobicents logs:

----------------- CREATED NEW STx ---------------------
BRANCH: z9hG4bK0009406c89eddb118ce8000476f51559
-------------------------------------------------------
2007-04-20 10:47:24,484 5255094 INFO [org.mobicents.slee.resource.sip.SipResourceAdaptor] (EventScannerThread:)
-------------------------
REQUEST:
-------------------------
MESSAGE sip:ivelin@nist.gov SIP/2.0
Via: SIP/2.0/UDP 10.4.201.123:3575;branch=z9hG4bK0009406c89eddb118ce8000476f51559
From: "michele@nist.gov" ;tag=20675
To:
Call-ID: 0009406C-89ED-DB11-8CE7-000476F51559@10.4.201.123
CSeq: 13 MESSAGE
Contact:
Max-Forwards: 70
Date: Fri, 20 Apr 2007 08:47:22 GMT
User-Agent: SIPPER for 3CX Phone
Content-Type: text/plain
Content-Length: 13

hello world

-------------------------
2007-04-20 10:47:24,484 5255094 DEBUG [org.mobicents.slee.resource.sip.SipResourceAdaptor] (EventScannerThread:) Server Transaction: [TransactionW WRAPPED[gov.nist.javax.sip.stack.SIPServerTransaction@cd6d8d47] BRANCHID[z9hG4bK0009406c89eddb118ce8000476f51559] STATE[Trying Transaction] DIALOG{ null } ]
2007-04-20 10:47:24,484 5255094 DEBUG [org.mobicents.slee.resource.sip.SipResourceAdaptor] (EventScannerThread:)
=============== LOOKING COMPONENTKEY FOR METHOD ==================
PASSED: MESSAGE
LOCAL: MESSAGE
===================================
2007-04-20 10:47:24,484 5255094 INFO [org.mobicents.slee.resource.sip.SipResourceAdaptor] (EventScannerThread:)
================================
Resource adaptor lookingup event:

Event:
Name:javax.sip.message.Request.MESSAGE
Vendor: javax.sip
Version: 1.1
================================
2007-04-20 10:47:24,484 5255094 INFO [org.mobicents.slee.resource.sip.SipResourceAdaptor] (EventScannerThread:)
================================
Resource adaptor delivering event:
EventID: 26
Event desc:javax.sip.message.Request.MESSAGE#javax.sip#1.1
ActivityID: z9hG4bK0009406c89eddb118ce8000476f51559_MESSAGE
================================
2007-04-20 10:47:24,484 5255094 DEBUG [org.mobicents.slee.resource.SleeEndpointImpl] (EventScannerThread:) fireEvent 26
2007-04-20 10:47:24,484 5255094 DEBUG [org.mobicents.slee.runtime.EventRouterImpl] (EventScannerThread:) Routing event: EventTypeID[javax.sip.message.Request.MESSAGE#javax.sip#1.1], #26 activity z9hG4bK0009406c89eddb118ce8000476f51559_MESSAGE activity class org.mobicents.slee.resource.SleeActivityHandle address SIP: "michele@nist.gov"
2007-04-20 10:47:24,484 5255094 DEBUG [org.mobicents.slee.runtime.EventRouterImpl] (EventScannerThread:) getExecutor(): adding Executorz9hG4bK0009406c89eddb118ce8000476f51559_MESSAGE executor EDU.oswego.cs.dl.util.concurrent.QueuedExecutor@ff2c4e
2007-04-20 10:47:24,484 5255094 DEBUG [org.mobicents.slee.runtime.EventRouterImpl] (EventScannerThread:) FINISHED routeEvent EventTypeID[javax.sip.message.Request.MESSAGE#javax.sip#1.1], #26
2007-04-20 10:47:24,484 5255094 DEBUG [org.mobicents.slee.resource.SleeEndpointImpl] (EventScannerThread:) fireEvent Done! 26

On mobicents management console I see number of message are incremented

Services -> Usage Parameters -> Parameters Sets -> NumberOfMessages

lucaf
Offline
Joined: 2007-02-07

I find the 3CX softphone quite good as well, at least it was the only one I could use to run some examples I wrote based on the SIP-RA.

One thing I wonder is: since the 4-5 softphones I downloaded should all support SIP, how come they behave so differently?!
I mean: using 3CX the SBB was receiving the message in clear text, using another (e.g. X-ten) the message was in xml format, with some others I didn't even manage to send the message to the SBB (even if the configuration steps were pretty much the same).

Is it so difficult to write SBBs which are able to provide services to any SIP client? with XMPP, IMHO, it looks easier to serve different clients (of course all of them supporting Jabber) - am I wrong?

bye
luca

baranowb
Offline
Joined: 2006-01-09

Differences in impl?
Someone needs some features and embeds msg body in xml along with some properites.

See this - this is branch id from invite and cancel TX - shoudl be the same, but bol sipphone doesnt care:
3d587952680244b08d58b91521bbe0c4:fa6ee0b5ddb04c00b76299795d620055@127.0.0.1:1:cancel:127.0.0.1:4871cancel
3d587952680244b08d58b91521bbe0c4:fa6ee0b5ddb04c00b76299795d620055@127.0.0.1:1:invite:127.0.0.1:4871
I dont have any idea why we lack those lines, it should be there...