Hi There,
It's been a few years since I joind the group and I have watched and learnt and played but, I am stuck...
I have searched hi & low but I can't seem to find what I am looking for.
Is is do-able to have SIP Phones proxy through Kamailio/RTPengine and have the connection relayed to a freeswitch system where all the work is done.
I need to have Kamailio act as proxy ONLY - no need to do AUTH, and I need Kamilio to have the RTPEngine have the media but only as proxy.
I have FreeSWITCH doing all the IVR/VM/CONF/etc....
So:
1) The SIP Phone sends everything to the Kamailio system, the Kamailio system will relay everything to the FreeSWITCH system (requests and replies)
2) The FreeSWITCH system will send everything to the Kamailio system which will relay everything back to the SIP Phone (requests and replies)
3) The SIP phones are behind NAT
4) The Kamailio and FreeSWITCH systems are on the public internet with public IP addresses
I have found a few sample kamailio.cfg files but, I can get REG to make it through but no SUBCRIBE wont get NOTIFYs back, etc...
I seem to get parts but not all the way.
If this is doable, and I assume it is, is there a config file someone can share with me? or point me to?
Jerry
I know this works with an Asterisk configuration, not sure how Freeswitch is any different yet. Haven't needed to poke Freeswitch.
https://github.com/fredposner/scripts/blob/master/kamailio/kamailio-tls_srtp... Strip out the fun bits where Fred is re-writing the contact header.
Then in the route relay, add the following: record_route(); handle_ruri_alias(); add_contact_alias();
In some configs, onreply_route manage_reply needs a: add_contact_alias();
Lazy, yes. Works for me?, yes.
On Mon, 5 Sept 2022 at 14:16, Jerry Kendall Jerry.Kendall@bishophosting.com wrote:
Hi There,
It's been a few years since I joind the group and I have watched and learnt and played but, I am stuck...
I have searched hi & low but I can't seem to find what I am looking for.
Is is do-able to have SIP Phones proxy through Kamailio/RTPengine and have the connection relayed to a freeswitch system where all the work is done.
I need to have Kamailio act as proxy ONLY - no need to do AUTH, and I need Kamilio to have the RTPEngine have the media but only as proxy.
I have FreeSWITCH doing all the IVR/VM/CONF/etc....
So:
The SIP Phone sends everything to the Kamailio system, the Kamailio system will relay everything to the FreeSWITCH system (requests and replies)
The FreeSWITCH system will send everything to the Kamailio system which will relay everything back to the SIP Phone (requests and replies)
The SIP phones are behind NAT
The Kamailio and FreeSWITCH systems are on the public internet with public IP addresses
I have found a few sample kamailio.cfg files but, I can get REG to make it through but no SUBCRIBE wont get NOTIFYs back, etc...
I seem to get parts but not all the way.
If this is doable, and I assume it is, is there a config file someone can share with me? or point me to?
Jerry
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Thanks Richard for the pointer.
I tried all day but no luck.
I'll have another go at it in a few days.
Jerry
On 9/5/2022 3:39 AM, Richard Edmands wrote:
I know this works with an Asterisk configuration, not sure how Freeswitch is any different yet. Haven't needed to poke Freeswitch.
https://github.com/fredposner/scripts/blob/master/kamailio/kamailio-tls_srtp... Strip out the fun bits where Fred is re-writing the contact header.
Then in the route relay, add the following: record_route(); handle_ruri_alias(); add_contact_alias();
In some configs, onreply_route manage_reply needs a: add_contact_alias();
Lazy, yes. Works for me?, yes.
On Mon, 5 Sept 2022 at 14:16, Jerry Kendall Jerry.Kendall@bishophosting.com wrote:
Hi There,
It's been a few years since I joind the group and I have watched and learnt and played but, I am stuck...
I have searched hi & low but I can't seem to find what I am looking for.
Is is do-able to have SIP Phones proxy through Kamailio/RTPengine and have the connection relayed to a freeswitch system where all the work is done.
I need to have Kamailio act as proxy ONLY - no need to do AUTH, and I need Kamilio to have the RTPEngine have the media but only as proxy.
I have FreeSWITCH doing all the IVR/VM/CONF/etc....
So:
The SIP Phone sends everything to the Kamailio system, the Kamailio system will relay everything to the FreeSWITCH system (requests and replies)
The FreeSWITCH system will send everything to the Kamailio system which will relay everything back to the SIP Phone (requests and replies)
The SIP phones are behind NAT
The Kamailio and FreeSWITCH systems are on the public internet with public IP addresses
I have found a few sample kamailio.cfg files but, I can get REG to make it through but no SUBCRIBE wont get NOTIFYs back, etc...
I seem to get parts but not all the way.
If this is doable, and I assume it is, is there a config file someone can share with me? or point me to?
Jerry
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hi There....
Hope someone can point me in the right direction.
The config below allows the device to register and will send the 200 OK without issue
It also allows the SUBSCRIBES to get in and a 202 Accepted is returned properly.
It also allows the device to send OPTION keepalives and they get in/out OK
The issue I am having at the moment is the outbount NOTIFY ofr the SUBS and outbound OPTIONS for heartbeat.
Can someone please point me at what I need to change so the OUTBOUND messages get delivered.
The issue I see is NAT related as the devices are behind firewalls at location A.
The Kamailio system and the inner PBX are all on Public IP.
################
debug=3 memdbg=5 memlog=5
log_facility=LOG_LOCAL0
fork=yes children=4
listen=udp:192.168.1.3:8081 port=8081
#!define FLAG_FROM_SWITCH 1 #!define FLAG_FROM_DEVICE 2
mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/" loadmodule "tm.so" loadmodule "sl.so" loadmodule "pv.so" loadmodule "rr.so" loadmodule "textops.so" loadmodule "textopsx.so" loadmodule "usrloc.so" loadmodule "xlog.so" loadmodule "path.so" loadmodule "nathelper.so" loadmodule "siputils.so"
# ----- nathelper params ----- modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
####### Routing Logic ########
request_route {
route(CHECK_SOURCE_IP);
# CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) { route(RELAY); } exit; }
route(WITHINDLG);
t_check_trans();
if( is_method("OPTIONS") ) { t_relay(); }
if( is_method("REGISTER|SUBSCRIBE") ) { add_path(); }
if( is_method("INVITE|REFER") ) { record_route(); }
if( isflagset(FLAG_FROM_SWITCH) ) { t_on_reply("OUTBOUND_REPLY"); } else { $du = "sip:192.168.3.3:5060"; }
route(RELAY); }
# SIP dialogs route[WITHINDLG] {
if (has_totag()) { # sequential request withing a dialog should # take the path determined by record-routing if (loose_route()) { route(RELAY); } else { if (is_method("NOTIFY")) { route(RELAY); } if (is_method("SUBSCRIBE") && uri == myself) { # in-dialog subscribe requests exit; } if (is_method("ACK")) { if (t_check_trans()) { # no loose-route, but stateful ACK; # must be an ACK after a 487 # or e.g. 404 from upstream server t_relay(); exit; } else { # ACK without matching transaction ... ignore and discard #xlog("ACK without matching transaction ... ignore and discard"); exit; } } sl_send_reply("404","Not here"); } exit; } }
onreply_route[OUTBOUND_REPLY] { route(NAT_TEST_AND_CORRECT); }
route[NAT_TEST_AND_CORRECT] { if (nat_uac_test("3")) { if (is_method("REGISTER|SUBSCRIBE")) { fix_nated_register(); } else { fix_nated_contact(); } force_rport(); }
if (has_body("application/sdp") && nat_uac_test("8")) { fix_nated_sdp("10"); } }
route[RELAY] { if (!t_relay()) { sl_reply_error(); } exit; }
route[LOGIT] {
xlog("L_INFO", "LOGIT: $var(spot) - $rm");
if( $ft == $null ) xlog("L_INFO", "LOGIT: $var(spot) - From:$fU @ $fd - $fu"); else xlog("L_INFO", "LOGIT: $var(spot) - From:$fU @ $fd - $fu:$ft");
if( $tt == $null ) xlog("L_INFO", "LOGIT: $var(spot) - To:$tU @ $td - $tu"); else xlog("L_INFO", "LOGIT: $var(spot) - To:$tU @ $td - $tu:$tt");
xlog("L_INFO", "LOGIT: $var(spot) - REQ:$rm @ $ru"); xlog("L_INFO", "LOGIT: $var(spot) - ACT:$(rd{s.select,0,.})"); xlog("L_INFO", "LOGIT: $var(spot) - HST:$(rd{s.select,1,.})"); xlog("L_INFO", "LOGIT: $var(spot) - CNT:$ct"); xlog("L_INFO", "LOGIT: $var(spot) - UAC:$ua");
if( $du != $null ) xlog("L_INFO", "LOGIT: $var(spot) - DURI:$du"); }
route[CHECK_SOURCE_IP] { $var(spot) = 'CHECK_SOURCE_IP'; route(LOGIT);
switch($si) { case "192.168.3.2": setflag(FLAG_FROM_SWITCH); return; default: setflag(FLAG_FROM_DEVICE); return; } }
Maybe:
if (loose_route()) { route(DLGURI); if (is_method("BYE")) { setflag(FLT_ACC); # do accounting ... setflag(FLT_ACCFAILED); # ... even if the transaction fails } else if ( is_method("ACK") ) { # ACK is forwarded statelessly route(NATMANAGE); *} else if ( is_method("NOTIFY") ) {** ** # Add Record-Route for in-dialog NOTIFY as per RFC 6665.** ** record_route();** ** }* route(RELAY); exit; }
--- I'm SoCIaL, MayBe
El 7/09/2022 a las 12:01 a. m., Jerry Kendall escribió:
Hi There....
Hope someone can point me in the right direction.
The config below allows the device to register and will send the 200 OK without issue
It also allows the SUBSCRIBES to get in and a 202 Accepted is returned properly.
It also allows the device to send OPTION keepalives and they get in/out OK
The issue I am having at the moment is the outbount NOTIFY ofr the SUBS and outbound OPTIONS for heartbeat.
Can someone please point me at what I need to change so the OUTBOUND messages get delivered.
The issue I see is NAT related as the devices are behind firewalls at location A.
The Kamailio system and the inner PBX are all on Public IP.
################
debug=3 memdbg=5 memlog=5
log_facility=LOG_LOCAL0
fork=yes children=4
listen=udp:192.168.1.3:8081 port=8081
#!define FLAG_FROM_SWITCH 1 #!define FLAG_FROM_DEVICE 2
mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/" loadmodule "tm.so" loadmodule "sl.so" loadmodule "pv.so" loadmodule "rr.so" loadmodule "textops.so" loadmodule "textopsx.so" loadmodule "usrloc.so" loadmodule "xlog.so" loadmodule "path.so" loadmodule "nathelper.so" loadmodule "siputils.so"
# ----- nathelper params ----- modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
####### Routing Logic ########
request_route {
route(CHECK_SOURCE_IP);
# CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) { route(RELAY); } exit; }
route(WITHINDLG);
t_check_trans();
if( is_method("OPTIONS") ) { t_relay(); }
if( is_method("REGISTER|SUBSCRIBE") ) { add_path(); }
if( is_method("INVITE|REFER") ) { record_route(); }
if( isflagset(FLAG_FROM_SWITCH) ) { t_on_reply("OUTBOUND_REPLY"); } else { $du = "sip:192.168.3.3:5060"; }
route(RELAY); }
# SIP dialogs route[WITHINDLG] {
if (has_totag()) { # sequential request withing a dialog should # take the path determined by record-routing if (loose_route()) { route(RELAY); } else { if (is_method("NOTIFY")) { route(RELAY); } if (is_method("SUBSCRIBE") && uri == myself) { # in-dialog subscribe requests exit; } if (is_method("ACK")) { if (t_check_trans()) { # no loose-route, but stateful ACK; # must be an ACK after a 487 # or e.g. 404 from upstream server t_relay(); exit; } else { # ACK without matching transaction ... ignore and discard #xlog("ACK without matching transaction ... ignore and discard"); exit; } } sl_send_reply("404","Not here"); } exit; } }
onreply_route[OUTBOUND_REPLY] { route(NAT_TEST_AND_CORRECT); }
route[NAT_TEST_AND_CORRECT] { if (nat_uac_test("3")) { if (is_method("REGISTER|SUBSCRIBE")) { fix_nated_register(); } else { fix_nated_contact(); } force_rport(); }
if (has_body("application/sdp") && nat_uac_test("8")) { fix_nated_sdp("10"); } }
route[RELAY] { if (!t_relay()) { sl_reply_error(); } exit; }
route[LOGIT] {
xlog("L_INFO", "LOGIT: $var(spot) - $rm");
if( $ft == $null ) xlog("L_INFO", "LOGIT: $var(spot) - From:$fU @ $fd - $fu"); else xlog("L_INFO", "LOGIT: $var(spot) - From:$fU @ $fd - $fu:$ft");
if( $tt == $null ) xlog("L_INFO", "LOGIT: $var(spot) - To:$tU @ $td - $tu"); else xlog("L_INFO", "LOGIT: $var(spot) - To:$tU @ $td - $tu:$tt");
xlog("L_INFO", "LOGIT: $var(spot) - REQ:$rm @ $ru"); xlog("L_INFO", "LOGIT: $var(spot) - ACT:$(rd{s.select,0,.})"); xlog("L_INFO", "LOGIT: $var(spot) - HST:$(rd{s.select,1,.})"); xlog("L_INFO", "LOGIT: $var(spot) - CNT:$ct"); xlog("L_INFO", "LOGIT: $var(spot) - UAC:$ua");
if( $du != $null ) xlog("L_INFO", "LOGIT: $var(spot) - DURI:$du"); }
route[CHECK_SOURCE_IP] { $var(spot) = 'CHECK_SOURCE_IP'; route(LOGIT);
switch($si) { case "192.168.3.2": setflag(FLAG_FROM_SWITCH); return; default: setflag(FLAG_FROM_DEVICE); return; } }
Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hey there
In my efforts to get a full SIP Proxy going, I have found this:
https://fossies.org/linux/kamailio/misc/examples/kamailio/nathelper.cfg
One very nice thing about this config, it explains a LOT.
The good news it, the phones can register, subscribe, send OPTION keepalives and invites without and issues - audio works as well.
BLFs, Parking Lots, etc, all good as the phone initiates the dialogs....
The bad news, I need OPTIONS keepalives and INVITES to go out to the phone.
They are being send directly, from the FreeSWITCH PBX, to the externally visible IP address of the firewall which the phones are behind.
This, of course won't work as the firewall is expecting the packets to come from the Kamailio ip:port and not the FreeSWITCH system.
It seems, I need to tell FreeSWITCH to send all messages, for the given device, to the Kamailio Proxy but how?
So, can anyone guide me at what I need to change please???
Jerry
So what you'll want to look into is Freeswitches registration data for those users and then figure out how to have Kamailio re-write that in a way that Freeswitch will store and send back out using it. Perhaps your freeswitch config is still doing some NAT processing and coming up with incorrect results?
Still haven't found the motivation to run a Freeswitch box myself yet, maybe one day.
On Thu, 8 Sept 2022 at 14:59, Jerry Kendall Jerry.Kendall@bishophosting.com wrote:
Hey there
In my efforts to get a full SIP Proxy going, I have found this:
https://fossies.org/linux/kamailio/misc/examples/kamailio/nathelper.cfg
One very nice thing about this config, it explains a LOT.
The good news it, the phones can register, subscribe, send OPTION keepalives and invites without and issues - audio works as well.
BLFs, Parking Lots, etc, all good as the phone initiates the dialogs....
The bad news, I need OPTIONS keepalives and INVITES to go out to the phone.
They are being send directly, from the FreeSWITCH PBX, to the externally visible IP address of the firewall which the phones are behind.
This, of course won't work as the firewall is expecting the packets to come from the Kamailio ip:port and not the FreeSWITCH system.
It seems, I need to tell FreeSWITCH to send all messages, for the given device, to the Kamailio Proxy but how?
So, can anyone guide me at what I need to change please???
Jerry
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: