Thanks Jocke for clearing that up .
Actually here is my reason for trying also to manipulate the headers : 1. First of all since in State machine I am jumping from one state to another based on some logic and in next state I need some modified header , so to speed up and not call Java code in another memory space I want to do the processing of headers also via state machine , Any help how can I do it will be of great help . 2. Since after some time I need to use commons-sipxml with C++ code that why I also want to do header parsing subsitution in state machine otherwise it will be a heavy overhead of JNI calls. Thanks & Regards Saurabh On Tue, Feb 3, 2009 at 9:37 PM, jocke eriksson <[email protected]> wrote: > I' m sorry for taken some time but had some issues that i had to clear up > first. > Well I don't think you should use Commons-scxml to manipulate headers. > SCXML > should be used to control > logic and flow. You should not pass the sipmessages to the statemachine you > should fire events on it > and let it decide what to do next. Like this > > <scxml:transition event="connection.alerting" > > <cc:accept /> > </scxml:transition> > <scxml:transition event="connection.connected"> > <scxml:assign name="callerID" expr="_eventdata.connectionid" /> > </scxml:transition> > > The first event is fired upon the machine when the first invite comes in. > This will cause the custom action accept to get called. > > ------INVITE-------> fire event connection.alerting > <accept /> > <---OK------------- > --------ACK---------> fire event connection.connected > <createcall /> > -------INVITE----> and so on. > > Hope this helps. > > Regards jocke. > > 2009/2/3 Saurabh Agarwal <[email protected]> > > > Thanks all for all the help and guidance . > > > > This is what I have understood and achieved ( a pretty big word just a > > hello > > world :) ) and need you help in the following: > > > > > > 1. I made a SIP servlet and in doInvite method I am Calling StopClock ( I > > am > > using the default example ) and starting its state machine using > > stopClock.fireEvent . > > > > So I was able to start and stop the state machine based on some SIP > mesages > > ( So integration of SIP and commons-scxml is done to an extent ) . > > > > > > Now I want to do the following and need your help in moving forward ( I > > know > > I can read and expirnent more about it but actually I have pretty strict > > deadline for the prototyping so need some urgent inputs , Thanks for the > > patience and help ). > > > > 1. I want to pass the SIP message to the state machine: > > As far as I can understand I have to use Context to pass the SIP > message > > to the State machine , Am I correct on that or I have some better option > . > > > > 2. I want to do a good amount of SIP Mesage change like removing some > > headers , adding some etc , How can I do that . > > As far as I understand I can use JEXL etc for it , what will be my > best > > option . > > How can I access the SIP message in the SCXML . > > > > Any code pointers will help a lot . > > > > > > > > Thanks a lot > > > > Thanks & Regards > > Saurabh > > On Tue, Feb 3, 2009 at 1:33 PM, Saurabh Agarwal <[email protected] > > >wrote: > > > > > Thanks Jocke for taking the pain :) > > > > > > Actually I am not clear how my java code will be called when the state > > > machine executes , Can you please show some code snippet for that . > > > > > > I use netbeans for development . > > > > > > Thanks & Regards > > > Saurabh > > > > > > > > > On Tue, Feb 3, 2009 at 1:23 PM, jocke eriksson <[email protected]> > > wrote: > > > > > >> Well the task that you describing is a bit big to handle over the > E-mail > > >> list. But I will try to make a sample application that you could look > > at, > > >> but it will take some time though. But the basic idé is that you > create > > a > > >> statemachine with your custom events when you get an INVITE then you > > start > > >> fire events that ocurre as your script progress. Pleas look at the > CCXML > > >> spec to get a grip of the custom actions that this script use. > > >> > > >> This script contains the custom actions accept createcall and join, > And > > >> could be a good start for your project. Pleas stay tuned . > > >> > > >> <?xml version="1.0" encoding="UTF-8"?> > > >> > > >> <scxml:scxml xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' > > >> xmlns:scxml='http://www.w3.org/2005/07/scxml' > > >> xmlns:cc='http://www.w3.org/2002/09/ccxml' > > >> xsi:schemaLocation='http://www.w3.org/2005/07/scxml scxml.xsd > > >> http://www.w3.org/2002/09/ccxml ccxml.xsd' initialstate="start"> > > >> > > >> <scxml:datamodel> > > >> <scxml:data name="callerId"/> > > >> </scxml:datamodel> > > >> > > >> <scxml:state id="start" > > > >> <scxml:onentry> > > >> <scxml:log label="joinTest" expr="'Entering state: start'" > /> > > >> </scxml:onentry> > > >> > > >> <scxml:transition event="ccxml.loaded"> > > >> <scxml:log label="joinTest" expr="'The doc was loaded'" /> > > >> </scxml:transition> > > >> > > >> <scxml:transition event="connection.alerting" > > > >> <scxml:log label="joinTest" expr="'call is alerting'" /> > > >> <scxml:assign name="callerId" > expr="_eventdata.connectionid" > > /> > > >> <cc:accept /> > > >> </scxml:transition> > > >> > > >> <scxml:transition event="connection.connected"> > > >> <scxml:log label="joinTest" expr="'connection is > connected'" > > /> > > >> <cc:createcall connectionid="'calleeId'" > > >> callerid="sip:cc...@localhost" dest="sip:s...@localhost" /> > > >> </scxml:transition> > > >> > > >> <scxml:transition event="connection.progressing" target="join"> > > >> <scxml:log label="joinTest" expr="'connection is > > progressing'" > > >> /> > > >> <scxml:log label="joinTest" expr="'CalleeId: ' + calleeId" > /> > > >> <scxml:log label="joinTest" expr="'CallerId: ' + callerId" > /> > > >> </scxml:transition> > > >> </scxml:state> > > >> > > >> <scxml:state id="join"> > > >> <scxml:onentry> > > >> <scxml:log label="joinTest" expr="'Entering state: join'" > /> > > >> </scxml:onentry> > > >> > > >> <scxml:transition event="connection.connected"> > > >> <scxml:log label="joinTest" expr="'connected'" /> > > >> <cc:join id1="callerId" id2="calleeId" /> > > >> </scxml:transition> > > >> > > >> <scxml:transition event="conference.joined"> > > >> <scxml:log label="joinTest" expr="'Conference joined - test > > >> succesfull!'" /> > > >> </scxml:transition> > > >> > > >> <scxml:transition event="connection.disconnected"> > > >> <scxml:log label="joinTest" expr="'Disconnected'" /> > > >> > > >> </scxml:transition> > > >> </scxml:state> > > >> </scxml:scxml> > > >> > > >> PS: are you a maven user or netbeans user? > > >> > > >> 2009/2/3 Saurabh Agarwal <[email protected]> > > >> > > >> > Thanks Jocke, > > >> > > > >> > As of now I want to make a simple application that will recieve > INVITE > > >> do > > >> > some pattern matching like see for text named search in uri and > search > > >> the > > >> > user in database and send INVITE to it ,if there are multiple users > > then > > >> > fork INVITES. > > >> > > > >> > Since I am new to commons-xml can you please help me in > understanding > > >> when > > >> > an INVITE comes on sailfin, "doInvite" of my servlet gets called . > > >> > > > >> > Can you please tell me how to integrate commons-scxml from there so > > that > > >> > the > > >> > SIP request goes to the SCXML state machine and using that I can put > > >> some > > >> > pattern matching in the state machine and do some processing like > > >> forking > > >> > INVITES etc . > > >> > > > >> > Any code snippet will be really helpful. > > >> > > > >> > Thanks a lot . > > >> > > > >> > Saurabh > > >> > > > >> > > > >> > > > >> > On Mon, Feb 2, 2009 at 11:20 PM, jocke eriksson <[email protected]> > > >> wrote: > > >> > > > >> > > Well I have one implementation based on Sailfin and Commons SCXML > > and > > >> it > > >> > > works great. If you could be a bit more specific about what you > want > > >> to > > >> > do > > >> > > then pleas let me know and I will help. Our implementation is > close > > to > > >> > > CCXML. > > >> > > > > >> > > Regards Jocke. > > >> > > > > >> > > 2009/2/2 Saurabh Agarwal <[email protected]> > > >> > > > > >> > > > Thanks Rahul, > > >> > > > > > >> > > > Sorry for posting on dev list but I would request you to please > > end > > >> my > > >> > > > discussion on this list from any subsequent post I will use user > > >> list > > >> > ,I > > >> > > > just dont want to loose context , Hope you will understand. > > >> > > > > > >> > > > > > >> > > > > > >> > > > I have one more simple question is anybody aware of any SCXML > > >> editors ( > > >> > > if > > >> > > > possible free or open source ) , Rahut are you aware wich > software > > >> is > > >> > > used > > >> > > > in the slides you mailed me . > > >> > > > > > >> > > > Thanks & Regards > > >> > > > Saurabhj > > >> > > > > > >> > > > On Mon, Feb 2, 2009 at 10:05 PM, Rahul Akolkar < > > >> > [email protected] > > >> > > > >wrote: > > >> > > > > > >> > > > > I've responded below, but if there are subsequent posts, > please > > >> > > > > continue this discussion on the user list, which suits this > > topic > > >> > > > > better. If you change the email subject, please prefix with > > >> [SCXML]. > > >> > > > > > > >> > > > > With respect to SIP and SCXML, I'm aware there have been > > >> integration > > >> > > > > efforts, though there isn't any code I can point you to. As a > > >> brief > > >> > > > > conceptual example, see slides 20 and 21 from this WWW07 > > >> > presentation: > > >> > > > > > > >> > > > > http://www.w3.org/2007/Talks/www2007-SCXML.pdf > > >> > > > > > > >> > > > > More inline ... > > >> > > > > > > >> > > > > On Mon, Feb 2, 2009 at 10:42 AM, Saurabh Agarwal < > > >> > > [email protected] > > >> > > > > > > >> > > > > wrote: > > >> > > > > > Thanks Siegfried , > > >> > > > > > Yes I am aware that in Sip Servlet spec SIP messgages are > > >> treated > > >> > as > > >> > > > > Java > > >> > > > > > Classes etc . > > >> > > > > > > > >> > > > > > What I intended to ask that how can I use Commons-SCXML with > > SIP > > >> , > > >> > > > > Actually > > >> > > > > > this is waht i want to do . > > >> > > > > > > > >> > > > > > 1. I want to make a SIP application server that will recieve > > >> some > > >> > SIP > > >> > > > > > messages ( INVITE , REFER etc ) and do some processing etc > on > > it > > >> > like > > >> > > > > check > > >> > > > > > some headers , fork SIP messages etc . > > >> > > > > > > > >> > > > > > I want to do this with the help of Sailfin and SIP Servelts > . > > >> > > > > > > > >> > > > > > 2. Now what I want now is also use SCXML as my state machine > > may > > >> > > change > > >> > > > > very > > >> > > > > > dynamically as per client requirments so I want to use SCXML > > so > > >> > that > > >> > > we > > >> > > > > dont > > >> > > > > > have to go on changing code frequenly and can concentrate on > > >> > buisness > > >> > > > > logic. > > >> > > > > > > > >> > > > > <snip/> > > >> > > > > > > >> > > > > Sounds similar to the example I point out above. > > >> > > > > > > >> > > > > > > >> > > > > > Can anybody help me the following: > > >> > > > > > > > >> > > > > > 1. How can I integrate SIP servlet ( running inside sailfin > ) > > >> with > > >> > > > > > commons-scxml. > > >> > > > > <snap/> > > >> > > > > > > >> > > > > There isn't anything special about sailfin in the client > > >> environment > > >> > > > > for Commons SCXML sense. > > >> > > > > > > >> > > > > > > >> > > > > > 2. How can I pass the SIP message to the state machine > defined > > >> in > > >> > > SCXML > > >> > > > > and > > >> > > > > > is it possible to easily modify headers in it . > > >> > > > > > > > >> > > > > <snip/> > > >> > > > > > > >> > > > > The basic idea in most use cases is to convert incoming > requests > > >> or > > >> > > > > messages (here, SIP related) to events that get fired on the > > state > > >> > > > > machine. The state machine context needs to be populated with > > all > > >> the > > >> > > > > information needed for the state machine to make the necessary > > >> > > > > transitions and thereby, execute the necessary actions (the > > >> context > > >> > > > > can be programmatically populated, or payloads can be attached > > to > > >> > > > > events as might make sense for a particular usecase). Client > > >> specific > > >> > > > > interactions (clients of Commons SCXML) are carried out with > > >> custom > > >> > > > > actions or using the external communications module. > > >> > > > > > > >> > > > > I'd say give the SCXML spec a quick read if you haven't > already. > > >> Then > > >> > > > > check out the Commons SCXML user guide [1], particularly the > > items > > >> on > > >> > > > > contexts [2], event payloads [3] and custom actions [4]. > > >> > > > > > > >> > > > > -Rahul > > >> > > > > > > >> > > > > [1] http://commons.apache.org/scxml/guide.html > > >> > > > > [2] > > >> http://commons.apache.org/scxml/guide/contexts-evaluators.html > > >> > > > > [3] http://commons.apache.org/scxml/guide/core-events.html > > >> > > > > [4] http://commons.apache.org/scxml/guide/custom-actions.html > > >> > > > > > > >> > > > > > > >> > > > > > > > >> > > > > > Any help is highly appreciated . > > >> > > > > > > > >> > > > > > Thanks > > >> > > > > > Saurabh > > >> > > > > > > > >> > > > > > On Mon, Feb 2, 2009 at 7:09 PM, Siegfried Goeschl < > > >> > > > > > [email protected]> wrote: > > >> > > > > > > > >> > > > > >> Hi, > > >> > > > > >> > > >> > > > > >> I don't know SCXML but worked with SIP > > >> > > > > >> > > >> > > > > >> +) a SIP message is not a ASCII message but a Java data > > >> structure > > >> > > very > > >> > > > > >> similiar to ServletRequest and ServletResponce (afaik > > >> > > > SipServletRequest > > >> > > > > >> and SipServletResponse) > > >> > > > > >> +) depending on your requirements you have to parse the > SDP's > > >> > > > > >> > > >> > > > > >> Cheers > > >> > > > > >> > > >> > > > > >> Siegfried Goeschl > > >> > > > > >> > > >> > > > > >> > > >> > > > > >> Saurabh Agarwal wrote: > > >> > > > > >> > Hi All, > > >> > > > > >> > > > >> > > > > >> > I am new to commons-SCXML and I am trying to make SIP > > >> > application > > >> > > > > using > > >> > > > > >> > sailfin ( Leveraging SIP Servlets ). > > >> > > > > >> > > > >> > > > > >> > I came across SCXML and thought it can be of great use , > As > > >> far > > >> > as > > >> > > I > > >> > > > > had > > >> > > > > >> > understood I can write the state machines iusing scxml > and > > >> dont > > >> > > have > > >> > > > > >> > to write much java code except some helper functions. > > >> > > > > >> > > > >> > > > > >> > I have couple of questions which I am not able to > > understand > > >> yet > > >> > : > > >> > > > > >> > > > >> > > > > >> > 1. How to integrate SIP Servlet and Commons-scxml ( I > tried > > >> to > > >> > > > > understand > > >> > > > > >> > shale but unable to do so ). > > >> > > > > >> > 2. Can Commons-scxml parse and do some logic on a SIP > > message > > >> ( > > >> > > > Ascii > > >> > > > > >> messge > > >> > > > > >> > ) and give me results. > > >> > > > > >> > > > >> > > > > >> > Any pointers are highly appreciated. > > >> > > > > >> > > > >> > > > > >> > Please help > > >> > > > > >> > > > >> > > > > >> > Thanks > > >> > > > > >> > Saurabh Agarwal > > >> > > > > >> > > > >> > > > > >> > > > >> > > > > > > > >> > > > > > > > >> > > > > > -- > > >> > > > > > > > >> > > > > > "Successful people make more mistakes because they do more " > > >> > > > > > Thanks > > >> > > > > > Saurabh Agarwal > > >> > > > > > > > >> > > > > > > >> > > > > > > >> --------------------------------------------------------------------- > > >> > > > > To unsubscribe, e-mail: [email protected] > > >> > > > > For additional commands, e-mail: [email protected] > > >> > > > > > > >> > > > > > > >> > > > > > >> > > > > > >> > > > -- > > >> > > > > > >> > > > "Successful people make more mistakes because they do more " > > >> > > > Thanks > > >> > > > Saurabh Agarwal > > >> > > > > > >> > > > > >> > > > >> > > > >> > > > >> > -- > > >> > > > >> > "Successful people make more mistakes because they do more " > > >> > Thanks > > >> > Saurabh Agarwal > > >> > > > >> > > > > > > > > > > > > -- > > > > > > "Successful people make more mistakes because they do more " > > > Thanks > > > Saurabh Agarwal > > > > > > > > > > > -- > > > > "Successful people make more mistakes because they do more " > > Thanks > > Saurabh Agarwal > > > -- "Successful people make more mistakes because they do more " Thanks Saurabh Agarwal
