[OpenSIPS-Users] SIPREC.

johan johan at democon.be
Fri Jun 25 09:52:54 EST 2021


hmmnm,

Core was generated by `/data/opensips/sbin/opensips -P
/var/run/opensips/opensips.pid -m 64 -M 4 -u ro'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f1677a72fda in notification_listener_process (rank=0) at
notification_process.c:345
345        *rtpp_notify_process_no = process_no;
(gdb) bt full
#0  0x00007f1677a72fda in notification_listener_process (rank=0) at
notification_process.c:345
        saddr_un = {sun_family = 54088,
          sun_path =
"(x\026\177\000\000\000\000\000\000\000\000\000\000PF\000\000\000\000\000\000\060\v\036\001\223U\000\000\020\370{$\376\177\000\000l{(\001\223U\000\000`\370{$g\245\370 at LO%\001\223U\000\000PF\000\000\000\000\000\000\220\341P|\026\177\000\000\036\000\000\000\000\000\000\000\021\353#\001\223U\000\000p\370{$\376\177\000\000\000\000\000\000\000"}
        saddr_in = {sin_family = 0, sin_port = 0, sin_addr = {s_addr =
4294967294}, sin_zero = "\310\004\356{\026\177\000"}
        p = 0x5500011e0b30 <error: Cannot access memory at address
0x5500011e0b30>
        id = {s = 0x0, len = 20658503}
        port = 0
        saddr = 0x101287cce
        len = 32766
        n = 0
        optval = 1
        socket_fd = 612104256
        __FUNCTION__ = "notification_listener_process"
#1  0x0000559301288b4d in start_module_procs () at sr_module.c:847
        m = 0x7f167bedfc78
        n = 0
        l = 0
        flags = 12
        x = 0
        __FUNCTION__ = "start_module_procs"
#2  0x0000559301280df9 in main_loop () at main.c:206
        chd_rank = 0
        startup_done = 0x0
        last_check = 0
        rc = 0
        __FUNCTION__ = "main_loop"
#3  0x00005593012845f6 in main (argc=15, argv=0x7ffe247bfa48) at main.c:916
        cfg_log_stderr = 1
        c = -1
        r = 0
        tmp = 0x7ffe247c0f16 ""
        tmp_len = 0
--Type <RET> for more, q to quit, c to continue without paging--
        port = 1
        proto = 32766
        protos_no = 1
        options = 0x5593013afb28
"f:cCm:M:b:l:n:N:rRvdDFEVhw:t:u:g:p:P:G:W:o:a:k:s:"
        ret = -1
        seed = 2724266361
        rfd = 3
        __FUNCTION__ = "main"


config file in attach.



On 25/06/2021 11:25, Răzvan Crainea wrote:
> No, SIPREC can not currently work with rtpengine due to the fact that
> RTPEngine cannot fork the media stream to a new destination, at least
> not as RTP. AFAIK, only RTPProxy can do this now.
>
> Best regards,
>
> Răzvan Crainea
> OpenSIPS Core Developer
> http://www.opensips-solutions.com
>
> On 6/25/21 11:44 AM, johan wrote:
>> Hi,
>>
>>
>> can the opensips configuration for siprec work with rtpengine ?
>>
>> To me it seems that it is dependant on rtpproxy.    So how can I combine
>> siprec with rtpengine for a script in which rtpengine is always in the
>> middle.
>>
>>
>> wkr,
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
####### Global Parameters #########

/* uncomment the following lines to enable debugging */
#debug_mode=yes

log_level=1
log_stderror=no
log_facility=LOG_LOCAL0

udp_workers=4

/* uncomment the next line to enable the auto temporary blacklisting of 
   not available destinations (default disabled) */
#disable_dns_blacklist=no

/* uncomment the next line to enable IPv6 lookup after IPv4 dns 
   lookup failures (default disabled) */
#dns_try_ipv6=yes

socket=udp:*:5060

####### Modules Section ########
#set module path
mpath="/data/opensips/lib64/opensips/modules/"

#### SIGNALING module
loadmodule "signaling.so"

#### UAC module
loadmodule "uac.so"

#### StateLess module
loadmodule "sl.so"

#### Transaction Module
loadmodule "tm.so"
modparam("tm", "fr_timeout", 5)
modparam("tm", "fr_inv_timeout", 30)
modparam("tm", "restart_fr_on_each_reply", 0)
modparam("tm", "onreply_avp_mode", 1)

#### Record Route Module
loadmodule "rr.so"

#### MAX ForWarD module
loadmodule "maxfwd.so"

#### SIP MSG OPerationS module
loadmodule "sipmsgops.so"

#### FIFO Management Interface
loadmodule "mi_fifo.so"
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
modparam("mi_fifo", "fifo_mode", 0666)

#### USeR LOCation module
loadmodule "usrloc.so"
modparam("usrloc", "nat_bflag", "NAT")
modparam("usrloc", "working_mode_preset", "single-instance-no-db")

#### REGISTRAR module
loadmodule "registrar.so"
modparam("registrar", "tcp_persistent_flag", "TCP_PERSISTENT")
/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)

#### ACCounting module
loadmodule "acc.so"
/* what special events should be accounted ? */
modparam("acc", "early_media", 0)
modparam("acc", "report_cancels", 0)
/* by default we do not adjust the direct of the sequential requests.
   if you enable this parameter, be sure to enable "append_fromtag"
   in "rr" module */
modparam("acc", "detect_direction", 0)

#### rtpengine module
loadmodule "rtpengine.so"
modparam("rtpengine", "rtpengine_sock", "udp:127.0.0.1:60000")

loadmodule "proto_udp.so"

#### Call API modules
loadmodule "dialog.so"
loadmodule "callops.so"
loadmodule "mi_datagram.so"
loadmodule "event_datagram.so"
modparam("mi_datagram", "socket_name", "udp:127.0.0.1:8080")

#### cfgutils
loadmodule "cfgutils.so"

#### siprec
loadmodule "rtpproxy.so"
modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:9000")
loadmodule "uac_auth.so"
loadmodule "b2b_entities.so"
loadmodule "siprec.so"

####### Routing Logic ########

# main request routing logic

route
{
    if (!mf_process_maxfwd_header(10)) 
    {
        send_reply(483,"Too Many Hops");
        exit;
    }
    if (has_totag()) 
    {
        # handle hop-by-hop ACK (no routing required)
        if ( is_method("ACK") && t_check_trans() ) {
            t_relay();
            exit;
        }
        # sequential request within a dialog should
        # take the path determined by record-routing
        if ( !loose_route() ) 
        {
            # we do record-routing for all our traffic, so we should not
            # receive any sequential requests without Route hdr.
            send_reply(404,"Not here");
            exit;
        }
        if (is_method("BYE")) 
        {
            # do accounting even if the transaction fails
            do_accounting("log","failed");
        }
        #### Call API notify logic
        if (is_method("NOTIFY") && $hdr(Event) == "refer") {
            call_transfer_notify();
            exit;
        }
        # route it out to whatever destination was set by loose_route()
        # in $du (destination URI).
        route(relay);
        exit;
    }
    # CANCEL processing
    if (is_method("CANCEL")) {
        if (t_check_trans())
            t_relay();
        exit;
    }

    # absorb retransmissions, but do not create transaction
    t_check_trans();

    if ( !(is_method("REGISTER")  ) )
    {        
        if (is_myself("$fd")) 
        {                    
        } 
        else 
        {
            # if caller is not local, then called number must be local    
            if (!is_myself("$rd")) {
                send_reply(403,"Relay Forbidden");
                exit;
            }
        }

    }

    # preloaded route checking
    if (loose_route()) 
    {
        xlog("L_ERR",
            "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
        if (!is_method("ACK"))
            send_reply(403,"Preload Route denied");
        exit;
    }

    # record routing
    if (!is_method("REGISTER|MESSAGE"))
    {
        record_route();
    }
    # account only INVITEs
    if (is_method("INVITE")) 
    {    
        do_accounting("log");
        create_dialog();
    }
    
    if (!is_myself("$rd")) 
    {
        append_hf("P-hint: outbound\r\n");    
        route(relay);
    }

    # requests for my domain    
    if (is_method("PUBLISH|SUBSCRIBE"))
    {
        send_reply(503, "Service Unavailable");
        exit;
    }

    if (is_method("REGISTER")) 
    {           
        if (!save("location"))
            sl_reply_error();

        exit;
    }
    if ($rU==NULL) 
    {
        # request with no Username in RURI
        send_reply(484,"Address Incomplete");
        exit;
    }

    # do lookup with method filtering
    if (!(is_present_hf("P-hint")))
    {
        if (!lookup("location","m")) 
        {
            t_reply(404, "Not Found");
            exit;
        }
    }

    # when routing via usrloc, log the missed calls also
    do_accounting("log","missed");
    route(relay);
}


route[relay] 
{
    # for INVITEs enable some additional helper routes
    xlog("route realy ft [$ft] tt [$tt] mb [$mb]");
    if (is_method("INVITE")) 
    {
        t_on_branch("per_branch_ops");
        t_on_reply("handle_nat");
        t_on_failure("missed_call");
        route(rtpengine);
    }
    
    if (is_present_hf("P-hint")) 
    {
        xlog("route relay: P-hint is present =>  b2bua"); 
        remove_hf("P-hint");
        #sethostport("192.168.68.116:5060")
        #uac_replace_to("","sip:$tu");
        #if (is_present_hf("Refer-To"))
        #{
        #    $avp(refer)=$rt;
        #    remove_hf("Refer-To");
        #    append_hf("Refer-To: <sip:$avp(refer)>\r\n");
        #}
        if (!t_relay(,"udp:192.168.68.116:5060"))
        {
            send_reply(500,"Internal Error");
            xlog("route relay: routing to b2bua failed");
        }
        else 
        {
            xlog("route relay: routing to b2bua succeeded");
        }
    }
    else
    {
        xlog("route relay: P-hint not present =>  normal call flow "); 
        if (!t_relay())
        {
            send_reply(500,"Internal Error");
        }
    }
    exit;
}


branch_route[per_branch_ops] 
{
    xlog("new branch at $ru\n");
}



onreply_route[handle_nat] 
{
    xlog("callid=$ci: Onreply_route[handle_nat]: incoming reply mb [$mb]\n");      
    $var(rtpengine_flags) = "RTP/AVP in-iface=internal out-iface=internal replace-zero-address replace-origin replace-session-connection ICE=remove codec-strip-telephone-event codec-strip-PCMA codec-strip-PCMU codec-mask-all codec-transcode-PCMA codec-transcode-PCMU codec-offer-telephone-event";
    if($avp(nat)=="normal")
    {
        if(has_body("application/sdp"))
        {
            xlog("callid=$ci: Onreply_route[handle_nat]:rtpengine_answer as avp(nat) $avp(nat)=normal");
            rtpengine_answer("$var(rtpengine_flags)");
        }
    }
    else
    {
        if(has_body("application/sdp"))
        {
            xlog("callid=$ci: Onreply_route[handle_nat]:rtpengine_offer as avp(nat) $avp(nat)!=normal");
            rtpengine_offer("$var(rtpengine_flags)");    
        }
    }
    exit;
}


failure_route[missed_call] 
{
    xlog("failure route ft [$ft] tt [$tt]");

    if (t_was_cancelled()) 
    {
        exit;
    }
}

route[rtpengine]
{
    $var(rtpengine_flags) = "RTP/AVP in-iface=internal out-iface=internal replace-zero-address replace-origin replace-session-connection ICE=remove codec-strip-telephone-event codec-strip-PCMA codec-strip-PCMU codec-mask-all codec-transcode-PCMA codec-transcode-PCMU codec-offer-telephone-event";
    if(is_method("INVITE"))
    {
        if(has_body("application/sdp"))
        {
            if(rtpengine_offer("$var(rtpengine_flags)"))
            {
                $avp(nat)="normal";
                xlog("callid=$ci: route[rtpengine]: INVITE has SDP -> rtpengine_offered and successfull, avp(nat) $avp(nat)");                 
            }
        }    
        else
        {
            $avp(nat)="sdponack";
            xlog("callid=$ci: route[rtpengine]: INVITE has SDP -> rtpengine_offer no, avp(nat) $avp(nat)"); 
        }
    }

    if (is_method("ACK") && has_body("application/sdp"))
    {
        xlog("callid=$ci: route[rtpengine]: ACK has SDP -> rtpengine_answer"); 
        rtpengine_answer("$var(rtpengine_flags)");
    }   
    xlog("callid=$ci: route[rtpengine]: engage siprec");
    siprec_start_recording("sip:8.8.8.8:5060");
    if (is_method("BYE")||is_method("CANCEL"))
    {
        xlog("callid=$ci: route[rtpengine]: method == BYE || CANCEL -> rtpengine_delete"); 
        rtpengine_delete(); 
    }
}




local_route
{
    xlog("callid=$ci: local_route: received message $mb");
    xlog("callid=$ci: local_route: what ever comes from local goes to b2bua");
    append_hf("P-hint: local\r\n");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xD7D896F7DDA70EC3.asc
Type: application/pgp-keys
Size: 2450 bytes
Desc: OpenPGP public key
URL: <http://lists.opensips.org/pipermail/users/attachments/20210625/2a959c4b/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 665 bytes
Desc: OpenPGP digital signature
URL: <http://lists.opensips.org/pipermail/users/attachments/20210625/2a959c4b/attachment-0001.sig>


More information about the Users mailing list