Telcobridges - Session Border Controllers
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Modifying calling_sip_host Parameter in Routing Script

2 posters

Go down

Modifying calling_sip_host Parameter in Routing Script Empty Modifying calling_sip_host Parameter in Routing Script

Post by k.papadopoulos Thu Apr 25, 2024 8:57 am

Hello everyone,

I hope this message finds you well.

I'm currently facing an issue with modifying the "calling_sip_host" parameter in the routing script. Despite following the documentation and attempting various approaches, I have been unable to achieve the desired result.

I've noticed that other parameters, such as "calling_display," are functioning correctly within the script (e.g., call = params[:call], call[:calling_display] = "xxxxxxxxx").

I'm utilizing the after_filter :method approach.

Could someone provide some guidance or suggestions on how to successfully modify the "calling_sip_host" parameter?

Your assistance in resolving this matter would be greatly appreciated.

Thank you in advance for your help.


k.papadopoulos

Number of Messages : 1
Point : 3
Registration Date : 2024-04-12

Back to top Go down

Modifying calling_sip_host Parameter in Routing Script Empty Re: Modifying calling_sip_host Parameter in Routing Script

Post by Admin Wed Aug 14, 2024 8:54 am

Please check the example below:

Code:
module ManipulateOnRegisteredRoute

  def init_extract_calling_sip_host params
  end
 
  def extract_calling_sip_host params
   
      #log_trace 3, "call=" + params[:call].inspect
      #log_trace 1, "naps=" + params[:naps].inspect
      #log_trace 1, "out_calls=" + params[:out_calls].inspect
      #log_trace 4, "Orignal_ROUTES=" + params[:routes].inspect
      #log_trace 4, "original called number:" + params[:call][:called]

      call = params[:call]
      #out_calls = params[:out_calls]
      routes = params[:routes]
      calling_sip_host = call [:calling_sip_host]
      calling_number = call [:calling]


      log_trace 4, "calling_sip_host =:  " + calling_sip_host
      log_trace 4, "calling_number =:  " + calling_number

      if !(calling_sip_host.nil?) && !(calling_number.nil?)       

                routes = []
                params[:routes].each do | route |
                  #log_trace 4, "check if it is registered user " + "#{route[:route_type]}"
                  if( route[:route_type] == :dynamic )
                    log_trace 4, "it's registered user"
                    reampped_calling = "sip:#{calling_number}@#{calling_sip_host} SIP/2.0"

                    route[:remapped_calling]   = reampped_calling
                        log_trace 4, "Route remapped calling:" + route[:remapped_calling].inspect
                    routes << route

                  else
                    log_trace 4, "normal route"
                    # This is a 'normal' route
                    routes << route
                end # if else
              end # do
       
                params[:routes] = routes
           
            end #if !(calling_sip_host.nil?)
                return params
 
  end #def
 
end #module

Admin
Admin

Number of Messages : 516
Point : 1211
Registration Date : 2017-11-27

https://freesbc.yetkinforum.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum