SIPp:在200之前取消场景487

时间:2015-10-13 12:49:02

标签: sip

我正在尝试模拟如何处理487在取消情景中的200之前。但我得到“在发送时中止对Call-Id的意外消息的呼叫(索引5),收到'ACK sip:service@192.168.1.20:5060 SIP / 2.0”错误。 这是我的服务器。     

<scenario name="Basic UAS responder">

<recv request="INVITE" crlf="true">
</recv>
<send>
<![CDATA[

    SIP/2.0 100 Trying
    [last_Via:]
    [last_From:]
    [last_To:]
    [last_Call-ID:]
    [last_CSeq:]
    Contact: <sip:[local_ip]:[local_port];transport=[transport]>
    Content-Length: [len]

]]>
</send>
<send>
<![CDATA[

    SIP/2.0 180 Ringing
    [last_Via:]
    [last_From:]
    [last_To:];tag=[call_number]
    [last_Call-ID:]
    [last_CSeq:]
    Contact: <sip:[local_ip]:[local_port];transport=[transport]>
    Content-Length: [len]

]]>
</send>

<recv request="CANCEL">
</recv>
<send>
<![CDATA[

    SIP/2.0 487 Request Terminated
    [last_Via:]
    [last_From:]
    [last_To:]
    [last_Call-ID:]
    CSeq: [cseq] INVITE
    Contact: <sip:[local_ip]:[local_port];transport=[transport]>
    Content-Length: [len]

]]>
</send>

<send>
<![CDATA[

    SIP/2.0 200 OK
    [last_Via:]
    [last_From:]
    [last_To:]
    [last_Call-ID:]
    [last_CSeq:]
    Contact: <sip:[local_ip]:[local_port];transport=[transport]>
    Content-Length: [len]

]]>
</send>





<!--pause milliseconds="4000"/-->
<recv request="ACK"
crlf="true">
</recv>


</scenario>

这是我的客户

    

<scenario name="UAC Cancel">

<send retrans="500">

<![CDATA[

    INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
    Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
    To: <sip:[service]@[remote_ip]:[remote_port]>
    From: <sip:sipp@[local_ip]:[local_port]; tag=[call_number]
    Call-ID: [call_id]
    CSeq: [cseq] INVITE
    Contact: sip:sipp@[local_ip]:[local_port]
    Max-Forwards: 70
    Content-Length: [len]

]]>
</send>

<recv response="100" optional="true">
</recv>

<recv response="180">
</recv>

<pause milliseconds="4000"/>

<send>
<![CDATA[

    CANCEL sip:[service]@[remote_ip]:[remote_port] SIP/2.0
    [last_Via:]
    To: sip:[service]@[local_ip]:[local_port]>[peer_tag_param]
    From: sip:sipp@[local_ip]:[local_port];tag=[call_number]
    Call-ID: [call_id]
    [last_CSeq:]
    Contact: sip:sipp@[local_ip]:[local_port]
    Max-Forwards: 70
    Content-length: [len]

]]>
</send>

<recv response="200" optional="true">
</recv>

<recv response="487" next="cancelACK">
</recv>

<label id="cancelACK"/>
<send>
<![CDATA[
    ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
    [last_Via:]
    To: <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
    From: <sip:sipp@[local_ip]:[local_port];tag=[call_number]
    Call-ID: [call_id]
    CSeq: [cseq] ACK
    Contact: sip:sipp@[local_ip]:[local_port]
    Max-Forwards: 70
    Content-Length: [len]
]]>
</send>
<pause milliseconds="3000"/>

</scenario>

1 个答案:

答案 0 :(得分:1)

在我看来,你使用[last_Via:]的方式会有问题。

来自UAC的CANCEL请求应该在其Via头中有一个新的分支参数,因为它是一个新事务。

对UAS生成的INVITE请求的OK响应也将使用CANCEL请求中的Via头。

由于Via标头对于SIP事务匹配至关重要,因此sipp在无法正确匹配时抱怨是可以理解的。