Hi Mihai,
indeed sounds like this. :-) There is a drop call in your cfg in the path that is taken in
your sip trace. This will cause a drop of the message that is currently processed.
The default cfg is a bit larger with all the #!ifdef cases, and maybe a bit difficult to
understand. Have you tried this cfg:
https://kamailio.org/docs/modules/5.2.x/modules/dispatcher.html#dispatcher.…
This is just a simple kamailio dispatcher cfg (stateful forwarding and record routing).
Just add your asterisk server to a dispatcher.list file and it should work. This cfg will
block REGISTER and presence requests, but you can easily deactivate it.
Cheers,
Henning
Am 25.07.19 um 21:12 schrieb Mihai Cezar:
No, it dosen't forward it to the SIP provider, it basicaly loops, i am guessing that
my config its the problem...
On Thu, Jul 25, 2019 at 9:53 PM Henning Westerholt
<hw@skalatan.de<mailto:hw@skalatan.de>> wrote:
Hello Mihai,
your trace just shows the INVITE, 100, 183. There is no 200 OK, therefore also no ACK.
Is there some thing missing? Does the called side actually accept the call?
Cheers,
Henning
Am 25.07.19 um 19:23 schrieb Mihai Cezar:
Well, i've tried both opensips and kamailio but with kamailio i got the most far.
Bellow it's a trace of an outgoing call, the trace is from kamailio box.
Legend: 10.1.1.10 is the Asterisk Box, 10.1.1.4 is Kamailio.
2019/07/25 20:16:24.479179 10.1.1.10:5060<http://10.1.1.10:5060> ->
10.1.1.4:5060<http://10.1.1.4:5060>
INVITE sip:+40XXXXXXXXX@10.1.1.4<mailto:sip%3A%2B40XXXXXXXXX@10.1.1.4>;user=phone
SIP/2.0
Via: SIP/2.0/UDP 10.1.1.10:5060;branch=z9hG4bK3ecba174;rport
Max-Forwards: 70
From: "test"
<sip:+40YYYYYYYY@10.1.1.10<mailto:sip%3A%2B40YYYYYYYY@10.1.1.10>>;tag=as5ce97f3d
To:
<sip:+40XXXXXXXXX@10.1.1.4<mailto:sip%3A%2B40XXXXXXXXX@10.1.1.4>;user=phone>
Contact:
<sip:+40YYYYYYYY@10.1.1.10:5060<http://sip:+40YYYYYYYY@10.1.1.10:5060>>
Call-ID:
7c1169bf0b7a09472dd455d76b6c12bb@10.1.1.10<mailto:7c1169bf0b7a09472dd455d76b6c12bb@10.1.1.10>
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Date: Thu, 25 Jul 2019 17:16:09 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH,
MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 238
2019/07/25 20:16:24.482259 10.1.1.4:5060<http://10.1.1.4:5060> ->
10.1.1.10:5060<http://10.1.1.10:5060>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.1.1.10:5060;branch=z9hG4bK3ecba174;rport=5060;received=10.1.1.10
From: "test"
<sip:+40YYYYYYYY@10.1.1.10<mailto:sip%3A%2B40YYYYYYYY@10.1.1.10>>;tag=as5ce97f3d
To:
<sip:+40XXXXXXXXX@10.1.1.4<mailto:sip%3A%2B40XXXXXXXXX@10.1.1.4>;user=phone>
Call-ID:
7c1169bf0b7a09472dd455d76b6c12bb@10.1.1.10<mailto:7c1169bf0b7a09472dd455d76b6c12bb@10.1.1.10>
CSeq: 102 INVITE
Server: kamailio (5.2.3 (x86_64/linux))
Content-Length: 0
2019/07/25 20:16:24.482385 10.1.1.4:5060<http://10.1.1.4:5060> ->
10.1.1.10:5060<http://10.1.1.10:5060>
SIP/2.0 183 Outgoing session to Avoxi
Via: SIP/2.0/UDP 10.1.1.10:5060;branch=z9hG4bK3ecba174;rport=5060;received=10.1.1.10
From: "test"
<sip:+40YYYYYYYY@10.1.1.10<mailto:sip%3A%2B40YYYYYYYY@10.1.1.10>>;tag=as5ce97f3d
To:
<sip:+40XXXXXXXXX@10.1.1.4<mailto:sip%3A%2B40XXXXXXXXX@10.1.1.4>;user=phone>;tag=e68db714ad3ba80833ca2c670d982872.aebb
Call-ID:
7c1169bf0b7a09472dd455d76b6c12bb@10.1.1.10<mailto:7c1169bf0b7a09472dd455d76b6c12bb@10.1.1.10>
CSeq: 102 INVITE
Server: kamailio (5.2.3 (x86_64/linux))
Content-Length: 0
On Thu, Jul 25, 2019 at 7:53 PM Sergiu Pojoga
<pojogas@gmail.com<mailto:pojogas@gmail.com>> wrote:
Have you tried changing the trunk's name from opensips-trunk to kamailio-trunk?
On the serious side, a SIP trace would help.
On Thu, Jul 25, 2019 at 12:26 PM Mihai Cezar
<cezar@mokalife.ro<mailto:cezar@mokalife.ro>> wrote:
Hi all,
I've tried to create a reverse proxy to forward incoming request that came from SIP
provider to Asterisk PBX and forward the requests from asterisk to kamailio then sip
provider.
What i get is that I see the invite, but is like no ACK.
Thanks in advance.
M
kamailio.cfg:
#!KAMAILIO
#
####### Defined Values #########
# - flags
# FLT_ - per transaction (message) flags
# FLB_ - per branch flags
#!define FLT_ACC 1
#!define FLT_ACCMISSED 2
#!define FLT_ACCFAILED 3
#!define FLT_NATS 5
#!define FLB_NATB 6
#!define FLB_NATSIPPING 7
####### Global Parameters #########
### LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR
debug=3
log_stderror=yes
memdbg=5
memlog=5
log_facility=LOG_LOCAL0
log_prefix="{$mt $hdr(CSeq) $ci} "
children=1
server_id = 10
xavp_via_params = "via"
disable_tcp=yes
auto_aliases=no
listen=udp:0.0.0.0:5060<http://0.0.0.0:5060>
####### Modules Section ########
loadmodule "jsonrpcs.so"
loadmodule "kex.so"
loadmodule "corex.so"
loadmodule "tm.so"
loadmodule "tmx.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 "acc.so"
loadmodule "counters.so"
# ----------------- setting module-specific parameters ---------------
# ----- jsonrpcs params -----
modparam("jsonrpcs", "pretty_format", 1)
modparam("jsonrpcs", "fifo_name",
"/var/run/kamailio/kamailio_rpc.fifo")
modparam("jsonrpcs", "dgram_socket",
"/var/run/kamailio/kamailio_rpc.sock")
modparam("ctl", "binrpc",
"unix:/var/run/kamailio/kamailio_ctl")
# ----- tm params -----
modparam("tm", "failure_reply_mode", 3)
modparam("tm", "fr_timer", 30000)
modparam("tm", "fr_inv_timer", 120000)
modparam("rr", "enable_full_lr", 0)
modparam("rr", "append_fromtag", 0)
modparam("acc", "early_media", 0)
modparam("acc", "report_ack", 0)
modparam("acc", "report_cancels", 0)
modparam("acc", "detect_direction", 0)
modparam("acc", "log_flag", FLT_ACC)
modparam("acc", "log_missed_flag", FLT_ACCMISSED)
modparam("acc", "log_extra",
"src_user=$fU;src_domain=$fd;src_ip=$si;"
"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
####### Routing Logic ########
request_route {
# per request initial checks
route(REQINIT);
# CANCEL processing
if (is_method("CANCEL")) {
if (t_check_trans()) {
route(RELAY);
}
exit;
}
# handle retransmissions
if (!is_method("ACK")) {
if(t_precheck_trans()) {
t_check_trans();
exit;
}
t_check_trans();
}
# handle requests within SIP dialogs
route(WITHINDLG);
# record routing for dialog forming requests (in case they are routed)
remove_hf("Route");
if (is_method("INVITE|SUBSCRIBE|REFER")) {
record_route();
}
# account only INVITEs
if (is_method("INVITE")) {
setflag(FLT_ACC);
sl_send_reply("100","Trying");
if ($si == "172.16.16.1") {
sl_send_reply("183","Incoming session from Avoxi");
rewritehost("10.1.1.10");
#exit;
}
else if ($si == "10.1.1.10"){
# receiving response from client
sl_send_reply("183","Outgoing session to Avoxi");
#rewritehost("172.16.16.1");
drop;
exit;
}
else {
sl_send_reply("500","No configured IP!");
drop;
exit;
}
}
if ($rU==$null) {
sl_send_reply("484","Address Incomplete");
exit;
}
# received from main server - send to client and add via tokens for anycast handling
via_add_srvid("1");
$xavp(via=>node) = "10.1.1.4";
via_add_xavp_params("1");
route(RELAY);
exit;
}
# Wrapper for relaying requests
route[RELAY] {
# enable additional event routes for forwarded requests
# - serial forking, RTP relaying handling, a.s.o.
if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) {
if(!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH");
}
if (is_method("INVITE|SUBSCRIBE|UPDATE")) {
if(!t_is_set("onreply_route")) t_on_reply("MANAGE_REPLY");
}
if (is_method("INVITE")) {
if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE");
}
if (!t_relay()) {
sl_reply_error();
}
exit;
}
# Per SIP request initial checks
route[REQINIT] {
if($ua =~ "friendly-scanner|sipcli|VaxSIPUserAgent") {
# silent drop for scanners - uncomment next line if want to reply
sl_send_reply("200", "OK");
exit;
}
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}
if(is_method("OPTIONS") && uri==myself && $rU==$null) {
sl_send_reply("200","Keepalive");
exit;
}
if(!sanity_check("1511", "7")) {
xlog("Malformed SIP message from $si:$sp\n");
exit;
}
if ($si == "10.1.1.4") {
xlog("L_WARN", "$ci|end|dropping message");
exit;
}
}
# Handle requests within SIP dialogs
route[WITHINDLG] {
if (!has_totag()) return;
if (loose_route()) {
if (is_method("BYE")) {
setflag(FLT_ACC);
setflag(FLT_ACCFAILED);
} else if ( is_method("NOTIFY") ) {
record_route();
}
route(RELAY);
exit;
}
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
route(RELAY);
exit;
} else {
exit;
}
}
sl_send_reply("400","Loop detected");
exit;
}
# TM manage for outgoing branches
branch_route[MANAGE_BRANCH] {
xdbg("new branch [$T_branch_idx] to $ru\n");
}
# TM manage for incoming replies
onreply_route[MANAGE_REPLY] {
xdbg("incoming reply\n");
}
# TM manage for failure routing cases
failure_route[MANAGE_FAILURE] {
if (t_is_canceled()) exit;
}
asterisk - sip.conf
[opensips-trunk](sip-provider)
fromdomain=10.1.1.10
host=10.1.1.4
context=from-trunk
type=friend
insecure=invite,port
trunk=yes
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Henning Westerholt -
https://skalatan.de/blog/
Kamailio services -
https://skalatan.de/services
--
Henning Westerholt -
https://skalatan.de/blog/
Kamailio services -
https://skalatan.de/services