Phone being always 486 Busy when it has incoming call
I3ootman opened this issue · comments
I tried making basic phone (my own, not taken from example). Two phones then connect via Asterisk server. If Phone 2 calls Phone 1 it always gets 486 Busy. I dug into code of VoIP file and found that upon recieving sip.INVITE VoIPPhone.callback()
calls _callback_MSG_Invite()
where it recieves this INVITE message and should call _createCall()
.
But if you inspect _callback_MSG_Invite()
closely you can see these lines:
if self.callCallback is None: message = self.sip.gen_busy(request) self.sip.out.sendto( message.encode("utf8"), (self.server, self.port) )
[line 564-568]
If self.callCallback
is None then it calls sip.gen_busy()
but the problem is self.callCallback
is always None
as i can see cuz callback()
does not return anything.
On the other hand there is a note in documentation that says:
"This function [callback()
] then creates a VoIPCall
or terminates it respectively. When a VoIPCall
is created, it will then pass it to the callCallback
function as an argument. If callCallback
is set to None
, this function replies as BUSY."
That means that VoIPCall
object should be created before this check but it actually created after the None check in code. @tayler6000 explain please how do i handle this situation or is it a kinda bug?
I opened VoIP file in my project and commented this check on line 564. After that call actually got accepted.