Hi, team
# Testing the Kamailio Outbound Module
Kamailio version: 6.0.5
OS: Debian 12
Kamailio IP: 192.168.149.18, Port: 5060
FreeSWITCH (REGISTRAR) IP: 192.168.149.18, Port: 6666
MicroSIP IP: 192.168.149.35, transport protocol: TCP
## Signaling Flows MicroSIP => REGISTER => Kamailio => FreeSWITCH, this is OK MicroSIP => INVITE => Kamailio => FreeSWITCH, this is OK also
However, executing `fs_cli -x 'show registrations as xml'` on FreeSWITCH returns the following:
```xml <result row_count="1"> <row row_id="1"> <reg_user>1001</reg_user> <realm>192.168.149.18</realm> <token>992b228842f841fda057da1883e5317a</token> <url>sofia/internal/sip:1001@192.168.149.35:49676;transport=TCP;ob;fs_path=%3Csip%3A192.168.149.18%3Blr%3E</url> <expires>1769678856</expires> <network_ip>192.168.149.18</network_ip> <network_port>5060</network_port> <network_proto>tcp</network_proto> <hostname>debian</hostname> <metadata></metadata> </row> </result> ```
Command executed: `fs_cli -x 'originate user/1001 &park'`
The INVITE message is as follows:
``` INVITE sip:1001@192.168.149.35:59527;transport=TCP;ob SIP/2.0 Via: SIP/2.0/UDP 192.168.149.18:6666;rport;branch=z9hG4bK0mU9ryZD57S0p Route: sip:192.168.149.18;lr Max-Forwards: 70 From: sip:0000000000@192.168.149.18;tag=97mDae4gQHXFa To: sip:1001@192.168.149.35:59527;transport=TCP;ob Call-ID: a59d2625-7790-123f-979c-0800279269e8 CSeq: 110284145 INVITE Contact: sip:mod_sofia@192.168.149.18:6666 Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE Supported: outbound, path, replaces Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer Content-Type: application/sdp Content-Disposition: session Content-Length: 764 X-FS-Support: update_display,send_info Remote-Party-ID: sip:0000000000@192.168.149.18;party=calling;screen=yes;privacy=off ``` ...
However, the log shows "client to registrar" instead of "registrar to client".
What is the reason for this?
The contents of kamailio.cfg are as follows:
``` #!KAMAILIO # # Edge proxy configuration #
listen=tcp:192.168.149.18:5060 listen=udp:192.168.149.18:5060
#!subst "/REGISTRAR_IP/192.168.149.18/" #!subst "/REGISTRAR_PORT/6666/" #!substdef "/FLOW_TIMER/20/"
####### Global Parameters #########
auto_aliases=no
debug=2 log_stderror=no log_facility=LOG_LOCAL0 log_prefix="{$mt $hdr(CSeq) $ci} " fork=yes children=4 alias="example.com" #mpath="/usr/lib64/kamailio/modules" tcp_connection_lifetime=30 # FLOW_TIMER + 10 force_rport=yes
####### Modules Section ########
loadmodule "tm.so" loadmodule "sl.so" loadmodule "outbound.so" loadmodule "rr.so" loadmodule "path.so" loadmodule "pv.so" loadmodule "maxfwd.so" loadmodule "xlog.so" loadmodule "sanity.so" loadmodule "ctl.so" loadmodule "textops.so" loadmodule "siputils.so" loadmodule "stun.so"
# ----------------- setting module-specific parameters ---------------
# ----- tm params ----- modparam("tm", "failure_reply_mode", 3)
# ----- rr params ----- modparam("rr", "append_fromtag", 0)
####### Routing Logic ########
request_route { route(REQINIT);
if (is_method("CANCEL")) { if (t_check_trans()) { route(RELAY); } exit; }
route(WITHINDLG);
t_check_trans();
if (is_method("REGISTER")) { remove_hf("Route"); add_path(); $du = "sip:REGISTRAR_IP:REGISTRAR_PORT"; } else { if (is_method("INVITE|SUBSCRIBE")) record_route();
if (@via[2] == "") { # From client so route to registrar... xinfo("client to registrar\n"); if ($rU == $null) { sl_send_reply("484", "Address Incomplete"); exit; } remove_hf("Route"); $du = "sip:REGISTRAR_IP:REGISTRAR_PORT"; } else { # From registrar so route using "Route:" headers... xinfo("registrar to client\n"); if (!loose_route()) { switch($rc) { case -2: sl_send_reply("403", "Forbidden"); exit; default: xlog("L_ERR", "in request_route\n"); sl_reply_error(); exit; } }
t_on_failure("FAIL_OUTBOUND"); } }
route(RELAY); }
route[RELAY] { if (!t_relay()) { sl_reply_error(); } exit; }
route[REQINIT] { if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; }
if(!sanity_check("1511", "7")) { xlog("Malformed SIP message from $si:$sp\n"); exit; } }
route[WITHINDLG] { if (has_totag()) { if (!loose_route()) { switch($rc) { case -2: sl_send_reply("403", "Forbidden"); exit; default: if (is_method("ACK")) { if ( t_check_trans() ) { route(RELAY); exit; } else { exit; } } sl_send_reply("404","Not Found"); } } else { if (is_method("NOTIFY")) { record_route(); } route(RELAY); } exit; } }
onreply_route { if (!t_check_trans()) { drop; }
if ($rm == "REGISTER" && $rs >= 200 && $rs <= 299) { remove_hf("Flow-Timer"); if ($(hdr(Require)[*])=~"outbound") insert_hf("Flow-Timer: FLOW_TIMER\r\n", "Call-ID"); } }
failure_route[FAIL_OUTBOUND] { if (t_branch_timeout() && !t_branch_replied()) { send_reply("430", "Flow Failed"); } } ```