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
hi!
for reply, to pass rtpproxy_manage, look in this function (in your config it is not used, and onreply_route is not passed for replies) http://kamailio.org/docs/modules/4.2.x/modules/tm#tm.f.t_on_reply
about segfaults - provide more info
also can suggest, try using rtpengine instead of rtpproxy
cheers
-- View this message in context: http://sip-router.1086192.n5.nabble.com/Kamailio-as-a-SBC-tp144010p144022.ht... Sent from the Users mailing list archive at Nabble.com.
Thanks a lot ! :D A followed your advices and now everything work pretty well and I have the expected behavior from kamailio !
I use rtpengine instead of rtpproxy and I have not segfault anymore (I think there were some because of my bad conf that made rtpproxy enter in bad states).
Here is my new conf in case someone would be interested by it:
------------------------------------------------------
#!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 "tm.so" 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 "rtpengine.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("rtpengine", "rtpengine_sock", "udp:127.0.0.1:12221")
#!ifdef WITH_DEBUG # ----- debugger params ----- modparam("debugger", "cfgtrace", 1) #!endif
####### Routing Logic ########
route { 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; }
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(); }
t_relay(); }
route[RTPPROXY] { t_on_reply("1"); rtpengine_manage(); }
onreply_route[1] { rtpengine_manage(); }
-------------------------------------------------
Guillaume
Date: Thu, 17 Dec 2015 01:30:55 -0700 From: vasiliy.ganchev@wildix.com To: sr-users@lists.sip-router.org Subject: Re: [SR-Users] Kamailio as a SBC
hi!
for reply, to pass rtpproxy_manage, look in this function (in your config it is not used, and onreply_route is not passed for replies) http://kamailio.org/docs/modules/4.2.x/modules/tm#tm.f.t_on_reply
about segfaults - provide more info
also can suggest, try using rtpengine instead of rtpproxy
cheers
-- View this message in context: http://sip-router.1086192.n5.nabble.com/Kamailio-as-a-SBC-tp144010p144022.ht... Sent from the Users mailing list archive at Nabble.com.
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-user