< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate] Passing Status Code to main application


Hi David,

Thanks for your reply. Yes, I think it's pretty much a B2B type of application except I need to build in a bit more flexibility. The SIP stack is going to control the call flow for an RTP stack in some application installments and telephony board in other installations. The telephony board has an IP Side and a PSTN side. So in some cases I have to take a call in SIP and do a transfer on the board to the PSTN side (no SIP on the outgoing) or vice-versa. So I was trying to make the SIP Stack it's own self contained library that gets linked into the telephony and the RTP stack. In this way I have created an object that provides a set of API's for making outgoing calls, sending provisional messages etc. I create a transactional user agent which I register as both a UAC and a UAS. When I make an outgoing call, I do it at the application level. I call the MakeOutgoingCall API on my object which sends an invite to resiprocate with a subclassed AppDialogSet. On a "onNewSession" event, I add the ClientSessionHandle to the dialogSet object which allows me to have access to the ClientSessionHandle at the application level.

Furthermore, on a received invite I get the SessionInviteHandle and store it in my custom AppDialogSet object and pass that to my main application thread through an event for which the application can subscribe. From there I can make an invite and send out a call to form a second call leg. And then monitor the call through my client and server AppDialogSets. The only problem with this is that there doesn't seem to be anything on the Session Handles which lets me know that a new message has come in for that session (i.e. a 180 message, or 486 etc). To handle this I added a Status Code and State Value to my subclassed AppDialogSet which is updated by the UserAgent when a new message comes in. From my application I can poll the value to see if it has changed. I'm not sure whether this approach is going to be error proned or not so I was just curious how some others were doing it.

If you have some sample code of how you did yours that would be fantastic. I can also send you some sample code of what I'm doing if what I describe doesn't make sense.

Thanks a lot,

Teryl

----- Original Message ----- From: "David Thompson" <mrdatman@xxxxxxxxx>
To: "Teryl Taylor" <terylt@xxxxxxxxxxxxxx>
Cc: <resiprocate-devel@xxxxxxxxxxxxxxxxxxxx>
Sent: Sunday, September 30, 2007 3:05 PM
Subject: Re: [reSIProcate] Passing Status Code to main application


Teryl, It looks like you are building a classic B2B type of application.

This can be done a couple different ways. One way is to like Scott says here
is to register InviteSessionHandler to your main application class.

You then create a hash map (based on callid or callid + tags) that can
uniquely identify your different "legs". Each callback to your main
application is then delegated to the appropriate agent. Your UAS is then
responsible for creating the corresponding UAC and registering it with your
hashmap. Your UAS and UAC of course have pointers to each other and can
easily coordinate the state of the call (ie receive an 180 on UAC, tell the
matching UAS to pass the 180 on with SDP etc)

A drawback to the above approach is you will be required to clean up your
own memory of your agents as they depend on your apps dependence on DUM but
that are not cleaned up by DUM itself.

There may be a more elegant way to do this but that was my first stab at a
b2bua. Since then, the requirements of my app forced me to step outside of
DUM for my b2bUA as I needed more precise control of the state machines.

If you want code samples of my first app using DUM, let me know......


On 9/27/07, Teryl Taylor <terylt@xxxxxxxxxxxxxx> wrote:

Hi Scott,

I am using a UserAgent and used those examples to build it. But I want to
pass the information from the events that I get in from the UserAgent up
to
the main application thread so I can forward them on to the other call
leg.

Thanks,

Teryl
----- Original Message -----
From: "Scott Godin" <slgodin@xxxxxxxxxxxx>
To: "Teryl Taylor" <terylt@xxxxxxxxxxxxxx>;
<resiprocate-devel@xxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, September 27, 2007 4:08 PM
Subject: RE: [reSIProcate] Passing Status Code to main application


You should register an InviteSessionHandler - you will get callbacks on
this that contain the entire SIP message.  You can get info like status
codes from these messages.  Check out dum/test/UserAgent.cxx and
dum/test/BasicCall.cxx for examples.

Scott

> -----Original Message-----
> From: resiprocate-devel-bounces@xxxxxxxxxxxxxxx [mailto:resiprocate-
> devel-bounces@xxxxxxxxxxxxxxx] On Behalf Of Teryl Taylor
> Sent: Thursday, September 27, 2007 3:02 PM
> To: resiprocate-devel@xxxxxxxxxxxxxxxxxxxx
> Subject: [reSIProcate] Passing Status Code to main application
>
> Hi everyone,
>
> I'm currently using resiprocate and DUM to develop a combination UAS
> and UAC
> SIP stack.  I want the sip stack to be able to receive an invite and
> alert
> the main application that an invite has arrived so that the
application
> can
> take the incoming invite and forward it on - hence creating 2 call
legs
> (incoming and outgoing).  Then, forward each response message from the
> first
> call leg to the other (similar to a proxy).   The application is able
> to
> keep track of the client and the server side sessions because it
> receives
> both a client and a server object which contain the
> ClientInviteSessionHandle, the ServerInviteSessionHandle and an
> application
> specific DialogSet object.
>
> My question is, what is the best way to pass the SIP message codes up
> to the
> application main thread?  (i.e. how would I pass the 180 message I
> receive
> from the second call leg up to the application so it could forward it
> on to
> the first call leg?).    I was thinking of maybe sticking a Status
Code
> variable in the application's subclass of the AppDialogSet object and
> changing that in the SIP events that are received through DUM.  But I
> think
> that might be error proned if 2 messages come in back to back.  Is
> there any
> way to get the message status code through the invite session handle?
>
> Thanks,
>
> Teryl
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel@xxxxxxxxxxxxxxx
> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel


_______________________________________________
resiprocate-devel mailing list
resiprocate-devel@xxxxxxxxxxxxxxx
https://list.resiprocate.org/mailman/listinfo/resiprocate-devel