Opensips + Mediaproxy as SBC problem

Ben
2010-05-03
2013-05-09
  • Ben

    Ben - 2010-05-03

    Hello,

    I'd like to use Opensips as a SBC combined with mediaproxy but it seems I have a problem in the SDP. Here is the global architecture :

    PHONE with IP 1.1.1.1  <-------> OPENSIPS with IPs 1.1.1.2 and 2.2.2.2 <-------> B2BUA with IP 2.2.2.1

    1.1.1.1 can see 1.1.1.2 (same public network) but 1.1.1.1 can not see 2.2.2.0/24 (the reason why I want to use opensips).

    I'd like to make a phone call from my phone to the global telephon network connected to my B2BUA, eveything seems OK except the SDP and record_route() which are not OK.

    Here is my opensips.cfg :

    _modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")

    modparam("nat_traversal", "keepalive_interval", 90)
    modparam("nat_traversal", "keepalive_method", "OPTIONS")
    modparam("nat_traversal", "keepalive_from", "sip:keepalive@mydomain.com")

    modparam("nathelper", "natping_interval", 60)
    modparam("nathelper", "ping_nated_only", 1)
    modparam("nathelper", "sipping_bflag", 7)
    modparam("nathelper", "received_avp", "$avp(i:801)")
    modparam("nathelper", "sipping_from", "sip:pinger@mydomain.com")

    modparam("mediaproxy", "mediaproxy_socket", "/var/run/mediaproxy/dispatcher.sock")
    modparam("mediaproxy", "mediaproxy_timeout", 500)
    modparam("mediaproxy", "signaling_ip_avp", "$avp(s:nat_ip)")
    modparam("mediaproxy", "media_relay_avp", "$avp(s:media_relay)")

    modparam("usrloc", "nat_bflag", 3)

    # --- rr params ---
    # add value to ;lr param to cope with most of the UAs
    modparam("rr", "enable_full_lr", 1)
    # do not append from tag to the RR (no need for this script)
    modparam("rr", "append_fromtag", 1)
    # -----------------  request routing logic -------------

    # main routing logic

    route{
            if (!mf_process_maxfwd_header("10")) {
                    sl_send_reply("483","Too Many Hops");
                    exit;
            };

            if ( msg:len > max_len ) {
                    sl_send_reply("513", "Message too big");
                    exit;
            };

            if (method=="INVITE") {
                    record_route();
                    use_media_proxy();
                    xlog("open media");
            };

            if (method=="BYE") {
                    xlog("close media");
                    end_media_session();
            };

            if (status=~"(3|4)0") {
                    xlog("close media");
                    end_media_session();
            };

            if (loose_route()) {
                    t_relay();
                    exit;
            };

            if (!is_method("REGISTER|MESSAGE")) {
                    xlog("record route");
                    record_route();
            };

           if (uri==myself) {

                    if (method=="REGISTER") {
                            save("location");
                            exit;
                    };

                    # native SIP destinations are handled using our USRLOC DB
                    if (!lookup("location")) {

                            if (uri=~"^sip:*@*") and ( !((src_ip==1.1.1.2) and (src_port==5060)) or !((src_ip==2.2.2.2) and (src_port==5060)) ) {
                                    forward("2.2.2.1:5060");
                                    return;
                            }
                            else {
                                    sl_send_reply("404", "Not Found");
                                    return;
                            };

                    };
            };

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

    }_

    1/ The record_route header from the opensips to the B2BUA is OK (Record-Route : <sip:2.2.2.2> but the record_route from the opensips server to my phone is still 2.2.2.2 instead of 1.1.1.2

    2/ The connection information from the opensips server to the B2BUA is not OK (1.1.1.2 instead of 2.2.2.2) and from the opensips server to the phone neither (2.2.2.2 = the B2BUA instead of 1.1.1.2)

    So there is no media and the BYE from my phone to the opensips server is not received and the call not closed (if I send the BYE from the B2BUA, no problem).

    Any Idea ?

    Thank you very much for eveything ! It works well for calls on the same network and so the same network interface with the same script.

    Regards,

    Ben

     
  • Ben

    Ben - 2010-05-03

    The mediaproxy seems NOK in his logs :

    May  3 15:57:49 proxysip media-relay: debug: Got traffic information for stream: (audio) 1.1.1.1:49222 (RTP: Unknown, RTCP: Unknown) <-> 1.1.1.2:50096 <-> 1.1.1.2:50098 <-> Unknown (RTP: 2.2.2.1:30336, RTCP: Unknown)

     
  • Ben

    Ben - 2010-05-07

    Any idea someone ? I still don't know how to force the sdp and the record_route() header.

     
  • Ben

    Ben - 2010-05-10

    Hmmm, am I the only one having the problem ? I bought the book "building telephony systems" but no answer in it. So there is no way to set the record-route header to a value on one side and another on the other side ?
    And to modify the sdp for the mediaproxy ?

     
  • Ben

    Ben - 2010-06-25

    Ok … No answer, I guess I will find another open source solution.

    Tnanks anyway

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks