2020年3月7日 星期六

kamailio tm module

tm (transaction module) 為有些應用需要,提供 t_relay() 建立 SIP transaction 狀態,依據 destination set 全部一起轉送。會吸收上游的重傳,產生下游的重傳,會需要較多記憶體及處理器處理,延遲也較長。

destination set 項目可以來自:
  • configuration file
  • user location database
  • seturi
  • sethost
  • append_branch
  • exec_dset()
destination set 內有多個時,會全部一起轉送 (forward in parallel)。也可以依 Q 的優先權循序轉送 (forward in serial),先用 t_load_contacts() 將全部 destination set 載到變數,並依照 Q 排序。t_next_contacts() 將最高優先權取出作為 destination set,t_on_failure() 設定收到失敗或 timeout 要執行的函數,然後執行 t_relay() 轉送。如果收到失敗回應或 timeout,會執行 t_on_failure() 設定的函數,這個函式內容應該是 t_next_contacts() 看有沒有下一個優先權,有的話的一樣 t_on_failure() 設定函數和 t_relay() 轉送。

參數

函數
  • t_relay([ host, port ]), t_relay_to_xxx:stateful 版本的 forward() (自動建立 transaction state?)
  • t_on_failure(failure_route):
  • t_on_branch_failure(branch_failure_route):
  • t_on_reply(onreply_route)
  • t_on_branch(branch_route)
  • t_newtran():用在 UAS
  • t_reply(code, reason_phrase):
  • t_lookup_request()
  • t_retransmit_reply()
  • t_release():timeout 後結束 state
  • t_forward_nonack([ip, port]), t_forward_nonack_xxx
  • t_set_fr(fr_inv_timeout [, fr_timeout]), t_reset_fr()
  • t_set_max_lifetime(inv_lifetime, noninv_lifetime), t_reset_max_lifetime()
  • t_set_retr(retr_t1_interval, retr_t2_interval), t_reset_retr()
  • t_set_auto_inv_100(0|1)
  • t_branch_timeout()
  • t_branch_replied()
  • t_any_timeout()
  • t_any_replied()
  • t_grep_status("code")
  • t_is_canceled()
  • t_is_expired()
  • t_relay_cancel()
  • t_lookup_cancel([1])
  • t_drop_replies([mode])
  • t_save_lumps()
  • t_load_contacts()
  • t_next_contacts()
  • t_next_contact_flow()
  • t_check_status(re)
  • t_check_trans()
  • t_set_disable_6xx(0|1)
  • t_set_disable_failover(0|1)
  • t_set_disable_internal_reply(0|1)
  • t_replicate([params])
  • t_relay_to(proxy, flags)
  • t_set_no_e2e_cancel_reason(0|1)
  • t_is_set(target)
  • t_use_uac_headers()

to_replicate
to_relay_to

佈署 UAS
t_newtran()
t_reply()

t_check_trans()
參考來源:
  1. http://kamailio.org/docs/modules/stable/modules/tm.html

沒有留言:

張貼留言

SIP header Via

所有 SIP 訊息 都要有 Via,縮寫 v。一開始的 UAC 和後續途經的每個 proxy 都會疊加一個 Via 放傳送的位址,依序作為回應的路徑。 格式 sent-protocol sent-by [ ;branch= branch ][ ; 參數 ...] s...