In my last post (about getting Skype and Asterisk to play nice) I said I'd look into getting it to tear down the call correctly if an incoming call from Skype is cancelled before the SIP call is answered.
After some debugging... it turns out that mjsip was trying to CANCEL
the call, but instead of cancelling it, Asterisk was returning 503 Server Error
, which wasn't helpful.
After digging about on the net as to why Asterisk would do such a thing - CSeq numbers of the CANCEL
request not being correct.
I made a quick and dirty fix... that once again may not exactly be the most elegant way of doing it... (so unelegant and possibly broken it could be embarrassing...)
I've simply changed mjsip_1.6/src/org/zoolu/sip/message/BaseMessageFactory.java
as follows...
The line that reads...
return createRequest(SipMethods.CANCEL,request_uri, to.getNameAddress(),from.getNameAddress(), contact,proto,host_addr,host_port, rport, method.getCallIdHeader().getCallId(), method.getCSeqHeader().getSequenceNumber(), from.getParameter("tag"),to.getParameter("tag"), branch,"");
to
return createRequest(SipMethods.CANCEL, request_uri,to.getNameAddress(), from.getNameAddress(), contact, proto,host_addr, host_port,rport, method.getCallIdHeader().getCallId(), method.getCSeqHeader().getSequenceNumber()+1, from.getParameter("tag"), to.getParameter("tag"),branch,"");
I have no idea if that breaks anything though! Maybe I should read RFC3261 ?