Skip to content

SIP Cancel request is not received by the intended client #160

@p-akshay

Description

@p-akshay

I am working on a simple scenario where after call initiation Cacnel request is sent.

There are 2 client, UserA and UserB who are connected to the sip server. The SIP Server is based on sipgo whereas the clients are based on SIPjs.

Scenario:
UserA calls UserB via SIP Server. Then UserA initiates the CANCEL Request. A similar CANCEL Request is required to be generated by SIP Server towards UserB.

In this case, the Cancel request is sent back to UserA instead of UserB.

Code snippet to generate Cancel Request:
`cancelReq := sip.NewRequest(sip.CANCEL, outDlg.InviteRequest.Recipient)
cancelReq.AppendHeader(sip.HeaderClone(outDlg.InviteRequest.Via())) // Cancel request must match invite TOP via and only have that Via
cancelReq.AppendHeader(sip.HeaderClone(outDlg.InviteRequest.From()))
cancelReq.AppendHeader(sip.HeaderClone(outDlg.InviteRequest.To()))
cancelReq.AppendHeader(sip.HeaderClone(outDlg.InviteRequest.CallID()))

cancelReq.SetSource(outDlg.InviteRequest.Source())
cancelReq.SetDestination(outDlg.InviteRequest.Destination())`

Extra Observation:
If I remove the line in the above code that copies the Via header, then UserB will correctly receive the Request. However, the client rejects the request because, according to RFC 3261, the Cancel must have the same Via as the original INVITE.

Please advise about the same. If you need more detailed traces, let me know, and I can provide them.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions