Re: [Sofia-sip-devel] One more question about cloned task

2010-08-10 Thread Pekka Pessi
Hi Pete,
Hi Pete,

2010/8/7 Pete Kay :
>> Do you have multiple nta_agent_t instances running, or how do you
>> handle the UAS side? What kind of task you plan to implement in the
>> cloned task, some kind of db lookup?

> Yes, I am using DB to store routing information.

Have you considered using su_msg_send() and su_msg_reply() to talk
with the DB thread instead of multi-threaded agent?
Please note that while nta functions are thread-safe, the nta objects are not.

>> If you want to see later messages from UAC, you need to insert a
>> Record-Route header into the request which you forward towards the
>> UAS.
>
> I am looking at
> http://sofia-sip.sourceforge.net/refdocs/sip/group__sip__record__route.html
> which shows how to creat a record_route structure.  How do I add it to
> the outgoing sip message?  Which api should I use?

That depends on how you plan to do the forwarding. E.g.,

sip_record_route_t *rr = sip_record_route_format(msg_home(msg), ...);
msg_header_insert(mg, NULL, (msg_header_t *)rr);

> Also, should I store both UAC-related RR and UAS-related RR in the
> RR-URI's user part?

User part is easiest, I think.

> In the hash table you suggested, should I use an UUID to represent
> each leg ( one for UAC and the other one for UAS) and then store the
> leg corrspond to each UUID?

I would not use legs: if you process same request twice (say, one of
your users forwards his calls to another user) the legs cannot make
difference between loops. I'd process each incoming request either
statelessly or with default leg, and look for the UUID from the
topmost route.

> Also, I don't understand why it matter whether I am using one or two
> nta_agent_t.  I still need two UUID ( one for each leg ) regardless of
> whether I use one or two nta_agent_t right?  Or am I missing
> something?

Well, in principle you could do with one UUID and RR if you used one agent.

>> You have to remove the resulting Route headers when processing the
>> later messages, too.
>
> Which API can I use to remove the Route header and when you say later
> messages, what are you referring to?  When should the Route header be
> removed?

The RFC 3216 sections 16.4 and 16.12 describes how the Route header
should be processed. Basically, when you receive a request with Route
header, you should forward request based on topmost Route instead of
request-URI. If topmost Route URI belongs to your proxy, you remove
it.

The lr URI parameter complicates matters, however.

-- 
Pekka.Pessi mail at nokia.com

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


Re: [Sofia-sip-devel] One more question about cloned task

2010-08-07 Thread Pete Kay
Hi Pekka,

Thank you for replying to my email.

>
> Do you have multiple nta_agent_t instances running, or how do you
> handle the UAS side? What kind of task you plan to implement in the
> cloned task, some kind of db lookup?
>
Yes, I am using DB to store routing information.


> If you want to see later messages from UAC, you need to insert a
> Record-Route header into the request which you forward towards the
> UAS.

I am looking at
http://sofia-sip.sourceforge.net/refdocs/sip/group__sip__record__route.html
which shows how to creat a record_route structure.  How do I add it to
the outgoing sip message?  Which api should I use?

Also, should I store both UAC-related RR and UAS-related RR in the
RR-URI's user part?

In the hash table you suggested, should I use an UUID to represent
each leg ( one for UAC and the other one for UAS) and then store the
leg corrspond to each UUID?

Also, I don't understand why it matter whether I am using one or two
nta_agent_t.  I still need two UUID ( one for each leg ) regardless of
whether I use one or two nta_agent_t right?  Or am I missing
something?

>
> You have to remove the resulting Route headers when processing the
> later messages, too.

Which API can I use to remove the Route header and when you say later
messages, what are you referring to?  When should the Route header be
removed?



I have learn a lot from all those emails you posted in the mailing
list.  Thanks alot for all your help.

P

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


Re: [Sofia-sip-devel] One more question about cloned task

2010-08-06 Thread Pekka Pessi
Hi Pete,

2010/7/30 Pete Kay :
> In my request_handler, I am creating a new cloned_task upon receiving
> of INVITE from uac.  I am using this cloned_task to create a leg to
> talk to the uas and forward the INVITE to the uas.

Do you have multiple nta_agent_t instances running, or how do you
handle the UAS side? What kind of task you plan to implement in the
cloned task, some kind of db lookup?

> When I get another message from uac, such as ACK, how can I reuse the
> same cloned task and the same leg that was previously created or I
> should recreate it for ACK as well?

If you want to see later messages from UAC, you need to insert a
Record-Route header into the request which you forward towards the
UAS.

> Where can I store the cloned task and the nta_leg_t object and have it
> be reused for the next message received from the same UAC?

The problem with legs is that you have no control on Call-ID and
From/To tags, they are chosen by UAC/AUS. Also, a dialog may loop
through your proxy multiple times. It is better to insert a
Record-Route URL that you can use to lookup the dialog and the
associated state from some kind of hash table. (E.g., insert a hashed
identifier of your dialog in user-part of the RR URI, use that to
lookup from the hash table). If the RR points to different nta_agent_t
instances, you need to insert two Record-Route headers, one used by
UAC, another by UAS. With two Record-Route headers you can also easily
make difference between requests sent by original UAC and UAS.

You have to remove the resulting Route headers when processing the
later messages, too.

-- 
Pekka.Pessi mail at nokia.com

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel


[Sofia-sip-devel] One more question about cloned task

2010-07-30 Thread Pete Kay
Hi,

Sorry for one more post to the group.

In my request_handler, I am creating a new cloned_task upon receiving
of INVITE from uac.  I am using this cloned_task to create a leg to
talk to the uas and forward the INVITE to the uas.

When I get another message from uac, such as ACK, how can I reuse the
same cloned task and the same leg that was previously created or I
should recreate it for ACK as well?

Where can I store the cloned task and the nta_leg_t object and have it
be reused for the next message received from the same UAC?

Any help and suggestion will be greatly appreciated.

Thanks,
P

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
___
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel