当前位置: 首页 > 工具软件 > SIP Router > 使用案例 >

SIP 路由

蒯卓君
2023-12-01

##SIP 路由
路由有关的SIP消息头的简单小结

<scenario name="Basic Sipstone UAS">
  <recv request="SUBSCRIBE" rrs="true">
    <action>
      <ereg regexp="sip[!-=?-}]*" search_in="hdr" header="Contact: " assign_to="12"/>
      <ereg regexp=".*" search_in="hdr" header="From: " assign_to="22"/>
      <ereg regexp=".*" search_in="hdr" header="To: " assign_to="23"/>
      <ereg regexp=".*" search_in="hdr" header="Record-Route: " assign_to="13"/>
    </action>
  </recv>

  <send>
    <![CDATA[
      SIP/2.0 200 OK
      [last_Via:]
      [last_From:]
      [last_To:];tag=cscf-[call_number]
      [last_Call-ID:]
      [last_CSeq:]
      Expires: 3600
      Contact: <sip:[local_ip]:[local_port]>
      P-Charging-Vector: icid-value=255.307.1073741823-1362455302.18;term-ioi=12345
      Content-Length:0
    ]]>
  </send>
  <send>
    <![CDATA[
      NOTIFY [$12] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]   
      Max-Forwards: 70
      Route: [$13]                                                                       
      From: [$23];tag=cscf-[call_number]                                                             
      To: [$22] 
      [last_Call-ID:]
      CSeq: 1001 NOTIFY
      Event: reg
      Subscription-State: active;expires=3600
      Contact: <sip:[local_ip]:[local_port]>
      Content-Type: application/reginfo+xml
      Content-Length: [len]
      Content-Disposition: session

      <?xml version="1.0" encoding="UTF-8"?>
      <reginfo xmlns="urn:ietf:params:xml:ns:reginfo" xmlns:gr="urn:ietf:params:xml:ns:gruuinfo" version="0" state="full">
       <registration aor="sip:12345678@abc.com" id="1232409" state="active">
         <contact state="active" event="registered" expires="3600" id="602210">
           <uri>sip:12345678@abc.com</uri>      
         </contact>   
       </registration> 
      </reginfo>
    ]]>
  </send>

Recorde-Route:
如果SUBSCRIBE里面带了Record-Route头,sipp需要保存下来,给后续的NOTIFY使用,如本例中的

 <ereg regexp=".*" search_in="hdr" header="Record-Route: " assign_to="13"/>

后续的NOTIFY里面用Route头把存下来的Record-Route带上,不然的话可能会给NOTIFY回复
SIP/2.0 481 Call Leg/Transaction Does Not Exist

 类似资料: