[Serusers] Forwarding to a LCS server

Mimmus dviggiani at tiscali.it
Tue Mar 29 19:43:23 CEST 2005


Hi,
I'm setting up SER to act as a proxy between Asterisk and Microsoft LCS (to 
enable TCP2UDP translation needed to speak with Microsoft LCS).
I'd like to keep configuration the simplest as possible.
Unfortunately, LCS refuses INVITE with a:
 <504: Server Timeout>
as you can see in following output from 'ngrep' (some security sanityzing 
performed):

#######
T xxx.yyy.64.118:32834 -> 10.99.1.9:5060 [AP]
INVITE sip:myuser at mydomain.it SIP/2.0.
Max-Forwards: 10.
Record-Route: 
<sip:myuser at xxx.yyy.64.118;transport=tcp;r2=on;ftag=as12c76469;l
r=on>.
Record-Route: <sip:myuser at xxx.yyy.64.118;r2=on;ftag=as12c76469;lr=on>.
Via: SIP/2.0/TCP xxx.yyy.64.118;branch=z9hG4bK1988.c780cdd1.0.
Via: SIP/2.0/UDP xxx.yyy.64.118:5061;branch=z9hG4bK184e7f66.
From: "01234564" <sip:01234564 at xxx.yyy.64.118:5061>;tag=as12c76469.
To: <sip:myuser at xxx.yyy.64.118>.
Contact: <sip:01234564 at xxx.yyy.64.118:5061>.
Call-ID: 3b3a9d59133196ef4dfa27836e47cea9 at xxx.yyy.64.118.
CSeq: 102 INVITE.
User-Agent: Asterisk PBX.
Date: Tue, 29 Mar 2005 17:34:32 GMT.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER.
Content-Type: application/sdp.
Content-Length: 267.
.
v=0.
o=root 14974 14974 IN IP4 xxx.yyy.64.118.
s=session.
c=IN IP4 xxx.yyy.64.118.
t=0 0.
m=audio 11980 RTP/AVP 8 3 0 101.
a=rtpmap:8 PCMA/8000.
a=rtpmap:3 GSM/8000.
a=rtpmap:0 PCMU/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-16.
a=silenceSupp:off - - - -.

#
T 10.99.1.9:5060 -> xxx.yyy.64.118:32834 [AP]
SIP/2.0 100 Trying.
Via: SIP/2.0/TCP 
xxx.yyy.64.118;branch=z9hG4bK1988.c780cdd1.0;ms-received-port=3
2834;ms-received-cid=1d00.
Via: SIP/2.0/UDP xxx.yyy.64.118:5061;branch=z9hG4bK184e7f66.
From: "01234564" <sip:01234564 at xxx.yyy.64.118:5061>;tag=as12c76469.
To: <sip:myuser at xxx.yyy.64.118>.
Call-ID: 3b3a9d59133196ef4dfa27836e47cea9 at xxx.yyy.64.118.
CSeq: 102 INVITE.
Content-Length: 0.
.

##
T 10.99.1.9:5060 -> xxx.yyy.64.118:32834 [AP]
SIP/2.0 504 Server time-out.
Via: SIP/2.0/TCP 
xxx.yyy.64.118;branch=z9hG4bK1988.c780cdd1.0;ms-received-port=3
2834;ms-received-cid=1d00.
Via: SIP/2.0/UDP xxx.yyy.64.118:5061;branch=z9hG4bK184e7f66.
From: "01234564" <sip:01234564 at xxx.yyy.64.118:5061>;tag=as12c76469.
To: <sip:myuser at xxx.yyy.64.118>;tag=9B5EAEFA3B5764273F459C938E732306.
Call-ID: 3b3a9d59133196ef4dfa27836e47cea9 at xxx.yyy.64.118.
CSeq: 102 INVITE.
Content-Length: 0.
.
#################################################################

Logs from LCS shows this message:

 Text: Unable to route the request
 Result-Code: 0xc3e91002
 SIP-Start-Line: INVITE sip:myuser at mydomain.it SIP/2.0
 SIP-Call-ID: 572410cc05c62bfe720cbc4c6cde6b0b at xxx.yyy.64.118
 SIP-CSeq: 102 INVITE
 Data: Non-trusted source sent an FQDN/IP that doesn't match a routing table 
rule
##################################################################

This is my ser.cfg:

debug=9         # debug level (cmd line: -dddddddddd)
log_stderror=yes        # (cmd line: -E)
check_via=no    # (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
listen=xxx.yyy.64.118
alias="mydomain.it"
alias="xxx.yyy.64.118"
fifo="/tmp/ser_fifo"
loadmodule "/usr/lib/ser/modules/sl.so"
loadmodule "/usr/lib/ser/modules/tm.so"
loadmodule "/usr/lib/ser/modules/rr.so"
loadmodule "/usr/lib/ser/modules/maxfwd.so"
loadmodule "/usr/lib/ser/modules/usrloc.so"
loadmodule "/usr/lib/ser/modules/registrar.so"
modparam("usrloc", "db_mode",   0)
modparam("rr", "enable_full_lr", 1)
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;
        };

        # we record-route all messages -- to make sure that
        # subsequent messages will go through our proxy; that's
        # particularly good if upstream and downstream entities
        # use different transport protocol
        record_route();
        # loose-route processing
        if (loose_route()) {
                t_relay();
                break;
        };
        # reject REGISTER attempts for now
        if (method=="REGISTER") {
                sl_send_reply( "503", "Registration Unavailable" );
                break;
        };
        # Forward to LCS if text usernames
        if (uri =~ "sip:[a-zA-Z\.\_]*@*") {
                log(1, "Forwarding to LCS\n");
                rewritehostport("mydomain.it");
                # forward to current uri now; use stateful forwarding; that
                # works reliably even if we forward from TCP to UDP
                if (!t_relay_to_tcp("eco.pitagora.it", "5060")) {
                        sl_reply_error();
                };
                break;
        }
        # Forward to Asterisk if numerical username
        if (method == "INVITE") {
                if (uri =~ "sip:9[0-9]{10}@*") {
                log(1, "Forwarding to Asterisk\n");
                rewriteport("5061");
                # forward to current uri now; use stateful forwarding; that
                # works reliably even if we forward from TCP to UDP
                if (!t_relay)) {
                        sl_reply_error();
                };
                break;
                }
        }
        sl_send_reply("404", "Not Found");
}
##############################################################

Any help?

Thanks in advance...

Domenico Viggiani 




More information about the sr-users mailing list