I have founded solution.

For send message (as http://tools.ietf.org/id/draft-ietf-sip-outbound)
through an existing connection it is only needed save tport transport of
new connection through function
 nta_incoming_transport (nta_agent, irq, nta_incoming_getrequest(irq)

(on leg_default_callback) and save pointer to a global struct.
When you want send message through this open connection you must create
message and send with
        nta_outgoing_mcreate function with tags
                NTATAG_TPORT (tport_saved)

Thanks and good work.

Ge@@ru

On Wed, 2007-10-10 at 15:28 +0200, Ge@@ru wrote:
> Thanks for your help.
> Well, as you said and as i see, in linux it isn't possible use a port
> (or same socket) for connect that it is on listening status. :'(
> 
> So, now, my problem is another (sorry if i'm been clear on previous
> email/message, my english isn't so perfect!), not if i can force a
> dedicated source port for do a connect, but if i can use a tport that is
> already used... let me try to explain my scenario:
> 1. -------------------------
> Peer A:   Listen on port 5060.
> Peer B:   Listen on port 5060
> 2. -------------------------
> Peer A:   Do a connect (not from source port 5060 because it isn't
> possible :'( but from port 10000 for example) to Peer B:5060 for a
> register sip call.
> Peer B:   Accept connect from Peer A and begin a transaction.
> 3. --------------------------
> Peer A: Send a SIP Register message through NTA calls
> Peer B: Manage register message
> ....
> n. --------------------------------
> Peer B: Want send INVITE (sip message) to Peer A (normally this is done
> by NTA module through a ephimeral port. While i want use same tport
> transaction (some socket:port) used on previous communication beetween
> Peer A and B. So, Peer B send INVITE sip message from port 5060 to Peer
> A (port 10000) through socket (tport) obtained on accept of connection
> from Peer A.
> 
> It is this possible? In little words i want use outbounding features
> describe on this draft
> http://tools.ietf.org/id/draft-ietf-sip-outbound with NTA and tport
> modules?
> I must use nta_incoming_transport function for recover tport_t of
> accepted connection?
> 
> Still, thanks.
> 
> Ge@@ru
> 
> On Wed, 2007-10-10 at 15:28 +0300, Pekka Pessi wrote:
> > 2007/10/8, Ge@@ru <[EMAIL PROTECTED]>:
> > >  i have some questions about use of outbound mode.
> > > Usually when an user agent send a register message open an ephemeral
> > > port and send message to port 5060. With sofia-sip library it is
> > > possible use port 5060 (as source port) to send message?
> > 
> > As I mentioned in IRC that it is not possible to do that currently but
> > you have to modify the tport module (and then re-compile the library).
> > 
> > You can try to modify the function tport_tcp_init_secondary() in
> > tport_type_tcp.c, the function is called after the socket used to make
> > the connection is created but before connect() is called. So, you
> > check that accepted is zero and then call bind() with suitable port
> > number. (Or you can just not to zero susa.su_port before bind in
> > tport_base_connect() in tport.c, and see what happens)..
> > 
> > The problem here is that the socket implementations vary on different
> > platforms, so many simply won't let you bind() a socket to same port
> > that you are listen()ing.
> > 
> > > Still, to enable outbound traffic i must use NUTAG_OUTBOUND tag of
> > > nua_register function?
> > 
> > ???
> > 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to