[Serusers] RTP Proxy help

Stephen Miles SMiles at callplus.co.nz
Wed Nov 19 01:00:45 CET 2003


Hi Jiri,

We got it working both ways now.

We changed the forward to the PSTN gateway so it rewrites the hostport to gateway_ip:5060, that way the trans matches.

Thanks for your help.

-----Original Message-----
From: Jiri Kuthan [mailto:jiri at iptel.org]
Sent: Wednesday, 19 November 2003 11:46 a.m.
To: Stephen Miles; serusers at lists.iptel.org
Subject: Re: [Serusers] RTP Proxy help


At 11:33 PM 11/18/2003, Stephen Miles wrote:
>Hello all,
>
>I am having a bit of a problem with getting RTP Proxy to work the way I need it to with PSTN gateway calling.
>
>When I call from the PSTN gateway to the softphone it uses the rtp ptoxy both ways, from ser to the gateway and from ser to the softphone. When I call from the softphone to the PSTN how ever it only proxys from the gateway to ser and not from ser to the softphone.
>
>I have tried all sorts of things to force_rtp_proxy for both ends of the call but so far it's a no go.
>
>Any help would be great.
>
>One thing I did notice is that when I call from the PSTN to the softphone it matches a transaction and the rtp proxy works for both ends, but when calling from the softphone to the PSTN is says failed to match transaction and the rtp proxy only works for one end of the call.

Can you send the network dumps and the logs in question too -- that may be the reason. 
If a reply is constructed in a way that mismatches with original request, no changes 
to rtprpoxy will be applied.

Also, make sure that you are using latest CVS version from HEAD, some of the
features in the script are based on it.

-jiri




>Thanks in advance,
>
>Stephen
>
># 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;
>        };
>
>        # !! Nathelper
>        # Special handling for NATed clients; first, NAT test is
>        # executed: it looks for via!=received and RFC1918 addresses
>        # in Contact (may fail if line-folding is used); also,
>        # the received test should, if completed, should check all
>        # vias for rpesence of received
>        #if (nat_uac_test("3")) {
>                # Allow RR-ed requests, as these may indicate that
>                # a NAT-enabled proxy takes care of it; unless it is
>                # a REGISTER
>
>                if (method == "REGISTER" || ! search("^Record-Route:")) {
>                    log("LOG: Someone trying to register from private IP, rewriting\n");
>
>                    # This will work only for user agents that support symmetric
>                    # communication. We tested quite many of them and majority is
>                    # smart enough to be symmetric. In some phones it takes a configuration
>                    # option. With Cisco 7960, it is called NAT_Enable=Yes, with kphone it is
>                    # called "symmetric media" and "symmetric signalling".
>
>                    fix_nated_contact(); # Rewrite contact with source IP of signalling
>                    force_rport(); # Add rport parameter to topmost Via
>                    setflag(6);    # Mark as NATed
>                };
>        #};
>
>        if (method == "INVITE") {
>           fix_nated_sdp("1"); # Add direction=active to SDP
>           log("Arse: forcing rtpproxy in invite");
>           force_rtp_proxy();
>           log("Arse: fix_nated_sdp being run");
>        };
>        # 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
>        #if (!method=="REGISTER") record_route();
>
>        # subsequent messages withing a dialog should take the
>        # path determined by record-routing
>        if (loose_route()) {
>                # mark routing logic in request
>                append_hf("P-hint: rr-enforced\r\n");
>                route(1);
>                break;
>        };
>
>        if (!uri==myself) {
>                # mark routing logic in request
>                append_hf("P-hint: outbound\r\n");
>                route(1);
>                break;
>        };
>
>        # if the request is for other domain use UsrLoc
>        # (in case, it does not work, use the following command
>        # with proper names and addresses in it)
>        if (uri=~"202.180.83.12") {
>          rewritehostport("sipsrv2.tranzpeer.net:5060");
>        };
>        if (uri=~"sipsrv2.tranzpeer.net") {
>
>                if (method=="REGISTER") {
>
># Uncomment this if you want to use digest authentication
>                        if (!www_authorize("sipsrv2.tranzpeer.net", "subscriber")) {
>                                www_challenge("sipsrv2.tranzpeer.net", "0");
>                                break;
>                        };
>
>                        save("location");
>                        break;
>                };
>
>                lookup("aliases");
>                if (!uri==myself) {
>                        append_hf("P-hint: outbound alias\r\n");
>                        route(1);
>                        break;
>                };
>
>                # native SIP destinations are handled using our USRLOC DB
>                if (!lookup("location")) {
>                        forward(202.180.125.200,5060);
>#                       sl_send_reply("404", "Not Found");
>                        break;
>                };
>        };
>        append_hf("P-hint: usrloc applied\r\n");
>        route(1);
>}
>
>route[1]
>{
>        # !! Nathelper
>        if (uri=~"[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" && !search("^Route:")){
>            sl_send_reply("479", "We don't forward to private IP addresses");
>            break;
>        };
>
>        # if client or server know to be behind a NAT, enable relay
>        if (isflagset(6)) {
>            log("Arse: force_rtp_proxy\n");
>            force_rtp_proxy();
>        };
>
>        # NAT processing of replies; apply to all transactions (for example,
>        # re-INVITEs from public to private UA are hard to identify as
>        # NATed at the moment of request processing); look at replies
>        t_on_reply("1");
>
>        # send it out now; use stateful forwarding as it works reliably
>        # even for UDP2TCP
>        if (!t_relay()) {
>                sl_reply_error();
>        };
>}
>
># !! Nathelper
>onreply_route[1] {
>    # NATed transaction ?
>    if (isflagset(6) && status =~ "(183)|2[0-9][0-9]") {
>        fix_nated_contact();
>        force_rtp_proxy();
>    # otherwise, is it a transaction behind a NAT and we did not
>    # know at time of request processing ? (RFC1918 contacts)
>    } else if (nat_uac_test("1")) {
>        fix_nated_contact();
>    };
>}
>
>
>-----------------------------------------------------------------------------------------------
>This message and any attachments contain privileged and confidential information. If you are not the intended recipient of this message, you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited.  If you have received this message in error please notify the sender immediately via email and then destroy this message and any attachments.
>
>_______________________________________________
>Serusers mailing list
>serusers at lists.iptel.org
>http://lists.iptel.org/mailman/listinfo/serusers

--
Jiri Kuthan            http://iptel.org/~jiri/ 




More information about the sr-users mailing list