[Serusers] Asterisk+mediaproxy+loose_route

Ah khng akhng999 at gmail.com
Mon Jun 20 05:43:44 CEST 2005


Hi,

I'm using the mediaproxy configuration example from onsip.org and
asterisk as PSTN gateway. However, when loose routing, stream was pass
through the mediaproxy which i want asterisk to handles NAT for the RTP
packet itself. I have made an inelegant change to check for uri and
source ip of the asterisk, but how to implement when LCR is being used?

If i'm wrong please correct me.

        # -----------------------------------------------------------------
        # Loose Route Section
        # -----------------------------------------------------------------
        if (loose_route()) {
                #xlog("L_INFO", "loose_route(): Looking up %rm URI %ru
from %is\n");
                #lookup("location");
                xlog("L_INFO", "loose_route(): t_relay() %rm to URI %ru\n");
                                                                                                                            

                if (has_totag() && (method=="INVITE" || method=="ACK")) {
                        if (client_nat_test("3") ||
search("^Route:.*;nat=yes")) {
                                setflag(6);
                                if (!(src_ip==A.B.C.D ||
uri=~"^sip:.*@A.B.C.D")) {  #A.B.C.D => asterisk ip
                                        use_media_proxy();
                                        xlog("L_INFO", "loose_route():
use mediaproxy for %rm to URI %ru\n");
                                };
                        };
                };
                                                                                                                            

                route(1);
                break;
        };


cheer
seong




More information about the sr-users mailing list