[Serusers] forward_msg: no 2nd via found in reply

Zeus Ng zeus.ng at isquare.com.au
Thu Jul 15 02:39:22 CEST 2004


Not sure what's your problem is but there are several things need to change.

See below.

> Hi everybody,
> 
> I'm trying to use Asterisk as SUA and SER as SIP router. But 
> Asterisk doesn't 
> succeed to register the Asterisk user to SER... the standard 
> error output 
> tell me:
> "ERROR: forward_msg: no 2nd via found in reply"
> 
> the SIP message looks like:
> 
>  to 193.175.133.19:5060
> Retransmitting #5 (no NAT):
> REGISTER sip:potemkin.fokus.fraunhofer.de SIP/2.0
> Via: SIP/2.0/UDP 193.175.133.19:5060;branch=z9hG4bK625558ec
> From: <sip:cys at potemkin.fokus.fraunhofer.de>;tag=as238e1f29
> To: <sip:cys at potemkin.fokus.fraunhofer.de>
> Call-ID: 6b8b4567327b23c6643c986966334873 at 193.175.133.19
> CSeq: 102 REGISTER
> User-Agent: Asterisk PBX
> Expires: 120
> Contact: <sip:1234 at 193.175.133.19>
> Event: registration
> Content-Length: 0
> 
> and the configuration file is like:
> 
> ###main routing logic
> route{
>         # initial sanity checks -- messages with
>         # max_forwards==0, or excessively long requests
>         if (!mf_process_maxfwd_header("10")) {
>                 sl_send_reply("483","Too Many Hops");
>                 break;
>         };
>         if ( msg:len > max_len ) {
>                 sl_send_reply("513", "Message too big");
>                 break;
>         };
> 
>         record_route();
> 
>         # Do strict routing if pre-loaded route headers present
> 	loose_route();

You are trying to detect loose route but not processing it.
You should try

 if (loose_route()) {
    if (!t_relay()) {
      sl_reply_error();
    };
    break;
 };

> 
>         # message should be from 127.0.0.1 or
>         # from other listening address
> 
>         if (src_ip==127.0.0.1) {
>                 if (method=="REGISTER") {
>                         save("location");
>                         break;
>                 };
>                 if (uri == myself) {
>                         # native SIP destinations are handled 
> using our USRLOC 
> DB
>                         if (!lookup("location")) {
>                                 sl_send_reply("404", "Not Found");
>                                 break;
>                         };
>                 };
>                 # forward to current uri now
>                 if (!t_relay()) {
>                         sl_reply_error();
>                 };

Try to put a break after t_relay() if you do not need additional processing
of the message.


>         } else if (src_ip == myself) {
>                 # this is a request from local domain
>                 # but not from 127.0.0.1, must be from UA
>                 if (method=="REGISTER") {
>                         # register message, save it and forward to
>                         # security server
>                         save("location");
>                         forward (127.0.0.1, 4050);
>                         break;
>                };
>                 forward (127.0.0.1, 4050);
>                 break;
>         };
> }

It's strange to me that you are saving the UA location in ser but not doing
anything with it. If you want * to do all sip logic, there is no need to
save the UA location here. If not, your logic here seems problematic to me.

One thing that I recommend but not essential is not to use 127.0.0.1 or
localhost even both ser and * (or sems) are running on the same machine.
Even a small mistake in routing logic could end up UA or proxy sending
replies to themselves.

Zeus




More information about the sr-users mailing list