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.
branchis the identifier of theBYEtransaction. It MUST start withz9hG4bKand 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 thebranchparameter. In your case, Zoiper will calculate it.Most SIP headers may carry arbitrary parameters and here
ftaganddidare 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 theRouteheaders alone.For a
BYEthe important parts are theCall-IDand thetagparameters in theFromandToheaders. Get these wrong and you will get a481 Call/Transaction Does Not Existresponse.You’ll get 403 and 407 responses if your
Authorization(403) orProxy-Authorization(407) credentials aren’t correct.A 503 response indicates that your proxy’s too busy to process your request.