Actions

Routing Script Tutorial: Redirection

Revision as of 11:25, 3 April 2024 by Allyntree (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

In release 2.8 and above, redirection contacts are obtained from the routing engine in the following format:

 contacts = params[ :contacts ]
 contacts = {
     :index=>"3",
     :list=>[
        {:called_number=>"6660", :priority=>"1000", :is_number_ported=>"0", :sip_uri=>"", :raw_data=>"", :expiration=>"3600"},
        {:called_number=>"6661", :priority=>"1000", :is_number_ported=>"0", :sip_uri=>"sip:6661@192.168.215.127", :raw_data=>"<sip:6661@192.168.215.127>", :expiration=>"3600"}
        {:called_number=>"6662", :priority=>"1000", :is_number_ported=>"0", :sip_uri=>"sip:6662@192.168.215.128", :raw_data=>"<sip:6662@192.168.215.128>", :expiration=>"3600"},
        {:called_number=>"6663", :priority=>"1000", :is_number_ported=>"0", :sip_uri=>"sip:6663@192.168.215.129", :raw_data=>"<sip:6663@192.168.215.129>", :expiration=>"3600"},
        {:called_number=>"6664", :priority=>"1000", :is_number_ported=>"0", :sip_uri=>"sip:6664@192.168.215.150", :raw_data=>"<sip:6664@192.168.215.150>", :expiration=>"3600"}
     ],
     :source_indexes=>"nil,0,0,0,2"
 }
  • params[:contacts][:list] contains the contact log. Each contact within the list has the following fields:
    • :called_number - the called number
    • :is_number_ported - if the called number has been ported (for SIP: if the npdi parameter is present)
    • :ported_number - the called number that was ported (for SIP: the rn parameter value, if available)
    • :sip_uri - the SIP URI of the contact, without the contact-params section (without the expires and q contact parameters)
    • :raw_data - the raw data representing the contact in the signaling protocol. For SIP, this is the full SIP URI (including the expires and q contact parameters).
    • :priority - the priority of the contact [0-1000]
    • :expiration - the expiration time in seconds of the contact
  • params[:contacts][:index] contains the index of the contact that is currently being routed.
  • params[:contacts][:source_indexes] contains a comma-separated list of indexes from params[:contacts][:list]. Each index represents the contact from which the contact in the list was obtained from.


To get more information, see: