[SR-Users] Kamailio as a SBC

Guillaume tetram100 at hotmail.fr
Wed Dec 16 17:03:39 CET 2015


Hi everyone,

I'm trying to make kamailio works as a SBC in front of Asterisk. I have read the tutorial http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb and it is close to what I'm looking for but still a little different. I want don't want kamailio to do auth and I want it to be a media gateway. The media and SIP path have to look like that:

Phone 1 ----- kamailio -----Asterisk ---- Kamailio ---- Phone 2


First I have add an outboundproxy field in the Asterisk configuration to make all SIP messages from Asterisk passe through Kamailio. Then I started a minimal conf for Kamailio and it works at least for the SIP part. Call can be established perfectly. 

However the RTP proxy part is a mess. Kamailio changes the IP address in the sdp part only for INVITE messages and not for the 200 OK responses, so there is only one side of the media passing through Kamailio, the other side is sent directly to asterisk. But even for the half part rtpproxy craches with a segfault and Kamailio doesn't transmit this media.

I have been searching some helps on google but nothing so far :/ I hope that someone here could help me.

-----------------------------------------------
#!KAMAILIO

####### Defined Values #########


#!define ASTERISK 192.168.51.43

####### Global Parameters #########

#!ifdef WITH_DEBUG
debug=4
log_stderror=no
#!else
debug=2
log_stderror=no
#!endif

memdbg=5
memlog=5

log_facility=LOG_LOCAL0

fork=yes
children=2

auto_aliases=no

# to avoid simple attacks, use unconventional port
port=5060




####### Modules Section ########

mpath="/usr/local/lib/kamailio/modules"

loadmodule "db_text.so"

loadmodule "mi_fifo.so"
loadmodule "kex.so"
loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "ctl.so"
loadmodule "cfg_rpc.so"
loadmodule "mi_rpc.so"
loadmodule "path.so"
loadmodule "rtpproxy.so"


#!ifdef WITH_DEBUG
loadmodule "debugger.so"
#!endif

# ----------------- setting module-specific parameters ---------------


modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")


# 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", 0)


modparam("path", "use_received", 1)

modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:7722")


#!ifdef WITH_DEBUG
# ----- debugger params -----
modparam("debugger", "cfgtrace", 1)
#!endif

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


route {
    xlog("L-ALERT", "new message !!!!!!!!!!!!!!!");
    if (!sanity_check()) {
        exit;
    }

    if ( !mf_process_maxfwd_header("10") )
    {
        sl_send_reply("483","To Many Hops");
        xlog("L_NOTICE", "$si $rm $ru -- too many hops\n");
        exit;
    }

    if (af==INET)
    {
        force_rport();

        if (src_ip != ASTERISK)
        {
            $du = "sip:192.168.51.43:5060";
            add_path_received();
            route(RTPPROXY);
            record_route();
        }
        else
        {
            loose_route();
            route(RTPPROXY);
            record_route();
        }
    }

    forward();
}


route[RTPPROXY] {

        rtpproxy_manage("cwei");

}

onreply_route {

    if (af==INET)
    {
        rtpproxy_manage("cwei");
    }

    return(1);
}

---------------------------------------------


Guillaume
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20151216/c1910dd2/attachment.html>


More information about the sr-users mailing list