Pekka Pessi ha scritto:
> There is a bare-bones stateful proxy implementation in
> <libsofia-sip-ua/nua/test_proxy.c>. Have a peek in it?

Peeked ;-) I can forward the message but no one of my callbacks is 
invoked when the other side answer me with a 401.

To forward INVITE from A to B i did this:

                 case sip_method_invite: {
                         printf( CONSOLE_TODO "got a INVITE message in 
leg_process ...\n" );
                         msg_t *msg = NULL;
                         msg = nta_incoming_getrequest(irq);
                         sip_request_t *rq = NULL;
                         rq = sip_request_create(
                                 msg_home(msg),
                                 sip->sip_request->rq_method,
                                 sip->sip_request->rq_method_name,
                                 URL_STRING_MAKE("sip:127.0.0.1:5062"),
                                 NULL
                         );
                         msg_header_insert(msg, (msg_pub_t *)sip, 
(msg_header_t *)rq);
                        //TODO: add Record-Router OR lr= here
                         nta_outgoing_mcreate(
                                 registrar_agent,
                                 proxy_process,
                                 NULL,
                                 NULL,
                                 msg_ref_create(msg),
                                 /*NTATAG_TPORT(1),*/
                                 NTATAG_STATELESS(1),
                                 TAG_END()
                         );
                         return 0;

The INVITE is sent to asterisk at 127.0.0.1:5062 that reply with 401.
Sofia-Sip automatically ACK it but that's not what i want.
Isn't me supposed to route the 401 message to the original phones that 
started the INVITE?
    ------------------------------------------------------------------------
nta: sent INVITE (1) to */127.0.0.1:5062
recv 568 bytes from udp/[192.168.1.8]:5062 at 14:43:49.771905: 
------------------------------------------------------------------------
    SIP/2.0 401 Unauthorized
    v: SIP/2.0/UDP 
192.168.1.8;branch=z9hG4bKv1Syay1a1vr6B;received=192.168.1.8;rport=5060,SIP/2.0/UDP
 
192.168.1.13:5061;branch=z9hG4bK-d8754z-142d3206369672a8-1---d8754z-;rport=5061
    f: "130"<sip:[EMAIL PROTECTED]>;transport=UDP;tag=24471603
    t: <sip:[EMAIL PROTECTED]>;tag=as7b007691
    i: ZDM3NmY5Yjk1M2QyNzVlZTgzOWZiMmFjYzIxZjMzM2Y.
    CSeq: 1 INVITE
    User-Agent: Asterisk
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
    k: replaces
    WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", 
nonce="399b0734"
    l: 0
    ------------------------------------------------------------------------
nta: received 401 Unauthorized for INVITE (1)
nta: 401 Unauthorized going to a transaction
nta_outgoing: RTT is 2.531 ms
send 273 bytes to udp/[127.0.0.1]:5062 at 14:43:49.772637:
    ------------------------------------------------------------------------
    ACK sip:127.0.0.1:5062 SIP/2.0
    v:SIP/2.0/UDP 192.168.1.8;rport;branch=z9hG4bKv1Syay1a1vr6B
    Max-Forwards:10
    f:"130"<sip:[EMAIL PROTECTED]>;transport=UDP;tag=24471603
    t:<sip:[EMAIL PROTECTED]>;tag=as7b007691
    i:ZDM3NmY5Yjk1M2QyNzVlZTgzOWZiMmFjYzIxZjMzM2Y.
    CSeq:1 ACK
    l:0

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to