1

I am trying to understand how my softphone issues BYEs to hangup so I can recreate it elsewhere. Below is a the packet that ZoIPer sends to the server that runs SIP signaling software.

I am trying to build this string and successfully hangup on someone, but I invariably get 400, 403, 407, 481 and 503 errors. The problem is that I cannot determine where the value of "did" in the Route header comes from, and also do not know where the "branch" value comes from in the Via header. Every other parameter is exposed by Asterisk for my consumption, just not these two.

How do I determine "did" and "branch"?

Also, this example uses Proxy-Authorization, but for short calls, this line is omitted by ZoIPer.

BYE sip:user1@astHost SIP/2.0
Via: SIP/2.0/UDP 192.168.1.183:5060;branch=z9hGda4bK-d8754z-678f2d4d1e5-1---d8754z-
Max-Forwards: 70
Route: <sip:sipHost;lr;ftag=733a98721;did=c0f.22438545>
Contact: <sip:user2@192.168.1.183:5060;transport=UDP>
To: <sip:user1@mydomain;transport=UDP>;tag=as4f57c9b8a
From: <sip:user2@mydomain;transport=UDP>;tag=733a98721
Call-ID: Nzg1ZTEyYTg4NasdlkSZLK3j10.
CSeq: 3 BYE
Proxy-Authorization: Digest username="bobby",realm="TomTest.voip.snohio.net",nonce="4e8a1b1700005997e6b1d8732be4b4c01f56d27a6d2dd80b",uri="sip:103@74.115.42.220:5060",response="3dbb0f4cbb0000c7786975cf043e6898",algorithm=MD5
User-Agent: Zoiper rev.11137
Content-Length: 0

Thanks.

kmarks2
  • 4,755
  • 10
  • 48
  • 77

1 Answers1

1

branch is the identifier of the BYE transaction. It MUST start with z9hG4bK and be globally unique, but otherwise its precise format is left up to the implementor's discretion. In a request, whatever user agent sends the request adds the branch parameter. In your case, Zoiper will calculate it.

Most SIP headers may carry arbitrary parameters and here ftag and did are examples of such parameters. They're not part of any SIP RFC, according to the IANA registry, so might mean anything. It looks to be something internal to Asterisk. Your best bet is to leave the Route headers alone.

For a BYE the important parts are the Call-ID and the tag parameters in the From and To headers. Get these wrong and you will get a 481 Call/Transaction Does Not Exist response.

You'll get 403 and 407 responses if your Authorization (403) or Proxy-Authorization (407) credentials aren't correct.

A 503 response indicates that your proxy's too busy to process your request.

Frank Shearar
  • 17,012
  • 8
  • 67
  • 94
  • Thanks. Yeah I found the Magic Cookie prefix in the RFC eventually. Also I just dropped the did tag and things started working...a little bit. If I set my buy up correctly I seem to only be terminating one leg of my call, meaning the outbound leg _appears_ live to the other user, but the line is dead. – kmarks2 Oct 06 '11 at 18:30