Hey Arseniy,
I had a similar thing so I tweaked the default config a little. Here is the kemi python bit I use.
if KSR.rr.loose_route() > 0:
if KSR.is_method_in("B"):
# do accounting ...
KSR.setflag(FLT_ACC)
# ... even if the transaction fails
KSR.setflag(FLT_ACCFAILED)
elif KSR.is_NOTIFY():
# Add Record-Route for in-dialog NOTIFY as per RFC 6665.
KSR.rr.record_route()
self.ksr_route_relay(msg)
else:
if KSR.is_ACK():
if KSR.tm.t_check_trans() > 0:
# no loose-route, but stateful ACK
# must be an ACK after a 487
# or e.g. 404 from upstream server
self.ksr_route_relay(msg)
else:
self.ksr_route_dispatch(msg) # Goes to my dispatcher logic
return -255
KSR.sl.sl_send_reply(404, "No request here")
return -255
I use dispatcher to route between destinations and use double rr params as I sit behind NAT and have private endpoints I route to.
I also describe the rr params as well as depending on direction (to do NAT traversal.)
So from PBX to Customer - KSR.rr.record_route_preset("PUB_IP" + ";r2=on", "PRIV_IP" + ";r2=on")
And from Customer to PBX - KSR.rr.record_route_preset("PRIV_IP" + ";r2=on", "PUB_IP" + ";r2=on")
Hope this helps you get it working.
John.