[SR-Users] (Kamailio/RTPproyx) Public -> LAN -> Asterisk (1, 2, .., n)

SamyGo govoiper at gmail.com
Tue Aug 6 13:15:10 CEST 2013


Ok thanks,

All fine except the rtpproxy_manage function is just out in the open and
since you're in bridging mode you need to realize that your kamailio may
receive calls from the WAN Interface or from the Asterisks on LAN
interface. So if you're to bridge the RTPs at the proxy then how can
Kamailio detect that which combination of flags to use in rtpproxy_manage()
function?

As an example if you replace your   rtpproxy_manage(); with
rtpproxy_manage("ei"); and make a call from SIP user to 777 in asterisk
dialplan where 777 is echo()

exten => 777,1,Answer()
same => n,Echo()

Take a sip trace now and see that you get the desired LAN IP of kamailio
coming in on Asterisk ? revert the "ei" to "ie" if not.
This simple test should get you a two way audio established for any call
from Internet to the Asterisk via Kamailio.

The Next step is to figure out that your call is coming from Asterisk and
wants to go out from kamailio's WAN interface. use inverse flag combination
here and let the call go out.

I hope it works for you now.

--
Sammy




On Tue, Aug 6, 2013 at 4:06 AM, Alexandr Usov <blessendor at gmail.com> wrote:

> ps -ef | grep rtpproxy
> kamailio 15853     1  0 12:41 ?        00:00:01 /usr/sbin/rtpproxy -u
> kamailio -l 1.1.1.1 2.2.2.2 -s unix:/var/run/rtpproxy.sock
>
> netstat -pln|grep rtpproxy
> unix  2      [ ACC ]     STREAM     LISTENING     238561268
> 15853/rtpproxy      /var/run/rtpproxy.sock
>
> I'm trying rtpproxy_manage("ei"); rtpproxy_manage("ie");
> rtpproxy_manage(); - the same if rtpproxy in bridged mode.
>
> Config cuts:
>
>
>
> #!define WITH_NAT
> ...
> #!ifdef WITH_NAT
> # ----- rtpproxy params -----
> # modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:12221")
> modparam("rtpproxy", "rtpproxy_sock", "unix:/var/run/rtpproxy.sock")
>
> # ----- nathelper params -----
> modparam("nathelper", "natping_interval", 30)
> modparam("nathelper", "ping_nated_only", 1)
> modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)
> modparam("nathelper", "sipping_from", "sip:pinger at sip.myrealhostdomain.com
> ")
>
> # params needed for NAT traversal in other modules
> modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
> modparam("usrloc", "nat_bflag", FLB_NATB)
> #!endif
>
>
> ....
>
> # Handle SIP registrations
> route[REGISTRAR] {
>     if (is_method("REGISTER"))
>     {
>         if(isflagset(FLT_NATS))
>         {
>             setbflag(FLB_NATB);
>             # uncomment next line to do SIP NAT pinging
>             setbflag(FLB_NATSIPPING);
>         }
>         if (!save("location"))
>             sl_reply_error();
>
>         exit;
>     }
> }
>
> ...
>
> # Caller NAT detection route
> route[NATDETECT] {
> #!ifdef WITH_NAT
>     force_rport();
>     if (nat_uac_test("19")) {
>         if (is_method("REGISTER")) {
>             fix_nated_register();
>         } else {
>             fix_nated_contact();
>         }
>         setflag(FLT_NATS);
>     }
> #!endif
>     return;
>
> }
>
> # RTPProxy control
> route[NATMANAGE] {
> #!ifdef WITH_NAT
>     if (is_request()) {
>         if(has_totag()) {
>             if(check_route_param("nat=yes")) {
>                 setbflag(FLB_NATB);
>
>             }
>         }
>     }
>     if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB)))
>         return;
>
>         rtpproxy_manage();
>
>     if (is_request()) {
>         if (!has_totag()) {
>             add_rr_param(";nat=yes");
>         }
>     }
>     if (is_reply()) {
>         if(isbflagset(FLB_NATB)) {
>             fix_nated_contact();
>         }
>     }
> #!endif
>     return;
> }
>
>
>
> 2013/8/6 SamyGo <govoiper at gmail.com>
>
>> Please check the rtpproxy function and paste the way it is written in
>> your configuration file. Share the output of "ps -ef | grep rtpproxy" and
>> "netstat -pln|grep rtpproxy"
>>
>> --
>> Sammy
>>
>>
>> On Tue, Aug 6, 2013 at 3:55 AM, Alexandr Usov <blessendor at gmail.com>wrote:
>>
>>>
>>>
>>> Note:
>>> Asrterisk LAN IP real 192.168.144.101 but must be 2.2.2.101 in this
>>> described network  (I am missed to change before copy-pasting here).
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>> sr-users at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130806/99eb56ed/attachment-0001.html>


More information about the sr-users mailing list