[SR-Users] Kamailio routing BYE back to originator

Andrew White andrew at uconnected.com.au
Sun Jun 23 09:39:44 CEST 2019


Hi team!

I’ve recently found an issue in my Kamailio setup. It appears when the trunk replies to call in progress with a BYE, we relay it immediately back to them:

https://i.imgur.com/h5fusau.png <https://i.imgur.com/h5fusau.png>

The only differences in the second BYE is the Route header is removed and replaced with a Via header referencing the Kamailio machine, and the From URI is rewritten to show the Kamailio hostname.


I’m unsure what steps I can take here, as all of my out of dialog messages (180, 200, ACK) are forwarded along with no issue. It seems only the in dialog are having this issue.

Here’s my WITHINDLG and RELAY:

  def ksr_route_relay()
    if KSR.is_method_in("IBSU") then
      if KSR::TM.t_is_set("branch_route") < 0 then
        KSR::TM.t_on_branch("ksr_branch_manage")
      end
    end
    if KSR.is_method_in("ISU") then
      if KSR::TM.t_is_set("onreply_route") < 0 then
        KSR::TM.t_on_reply("ksr_onreply_manage")
      end
      #KSR.info("Onreply route: #{KSR::TM.t_is_set("onreply_route")}")
    end 
  
    if KSR.is_INVITE() then
      if KSR::TM.t_is_set("failure_route") < 0 then
        KSR::TM.t_on_failure("ksr_failure_manage")
      end
    end
  
    if KSR::TM.t_relay() < 0 then
      KSR::SL.sl_reply_error()
    end
    exit
  end

  def ksr_route_withindlg()
    return if KSR::SIPUTILS.has_totag() < 0

    if KSR::RR.loose_route() > 0 then
      ksr_route_dlguri()
      if KSR.is_BYE() then
        #KSR.setflag($myenv['FLT_ACC'].to_i)
        #KSR.setflag($myenv['FLT_ACCFAILED'].to_i)
      elsif KSR.is_ACK() then
        ksr_route_natmanage()
      elsif KSR.is_NOTIFY() then
        KSR::RR.record_route()
      end
      ksr_route_relay()
      exit
    end

    if KSR.is_ACK() then
      #KSR.info("Handling an ACK within dialog")
      if KSR::TM.t_check_trans() > 0 then
        ksr_route_relay()
        exit
      else
        exit
      end
    end
    #KSR.info("404ing within dialog")
    KSR::SL.sl_send_reply(404, "Not here");
    exit
end

I suspect I must be sending this to the wrong branch somehow, but I’m unsure how to correct this. The call gets originally initiated from Kamailio writing a custom RURI and To header before calling t_relay(). I’m wondering if I’m somehow initiating the dialog incorrectly and as such the BYE doesn’t know where to go.

Thanks!

Andrew

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20190623/375914fc/attachment.html>


More information about the sr-users mailing list