pjsip-android
pjsip-android copied to clipboard
No broadcast event receive when callee hang up call
Hi,
when successed make call, when callee hang up call, no broadcast event received ?
=> onCallState not called with pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED ?
Thanks!
In my case it's called PJSIP_INV_STATE_DISCONNECTED
can you share your code of call hang up?
private fun testCall(phoneNumber: String){
try{
SipServiceCommand.makeCall(this, mAccountId, phoneNumber, false, false, false)
} catch (e:Exception){
e.printStackTrace()
Toast.makeText(this, "Account error", Toast.LENGTH_SHORT).show()
}
}
private fun testHangUpCall(){
Log.i("MainActivity", "hangUpCall => mAccountId: $mAccountId, mCallId: $mCallId")
mAccountId?.let { account ->
mCallId?.let {
SipServiceCommand.hangUpCall(this, mAccountId, it)
}
}
}
private var mReceiver: BroadcastEventReceiver = object : BroadcastEventReceiver() {
override fun onCallState(accountID: String?, callID: Int, callStateCode: Int, callStatusCode: Int, connectTimestamp: Long) {
super.onCallState(accountID, callID, callStateCode, callStatusCode, connectTimestamp)
Log.i("MainActivity", "onCallState => accountID: $accountID")
Log.i("MainActivity", "onCallState => callID: $callID")
when(callStateCode){
pjsip_inv_state.PJSIP_INV_STATE_CALLING-> {
Log.i("MainActivity", "onCallState => PJSIP_INV_STATE_CALLING")
mCallId = callID
}
pjsip_inv_state.PJSIP_INV_STATE_INCOMING-> {
Log.i("MainActivity", "onCallState => PJSIP_INV_STATE_INCOMING")
}
pjsip_inv_state.PJSIP_INV_STATE_EARLY-> {
Log.i("MainActivity", "onCallState => PJSIP_INV_STATE_EARLY")
}
pjsip_inv_state.PJSIP_INV_STATE_CONNECTING-> {
Log.i("MainActivity", "onCallState => PJSIP_INV_STATE_CONNECTING")
}
pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED-> {
Log.i("MainActivity", "onCallState => PJSIP_INV_STATE_CONFIRMED")
}
pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED-> {
Log.i("MainActivity", "onCallState => PJSIP_INV_STATE_DISCONNECTED")
mCallId = null
}
else -> {
Log.i("MainActivity", "onCallState => $callStateCode")
}
}
}
}
-
When call
testHangUpCall: OK, BroadcastEventReceiver -> onCallState -> pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED receive. -
When callee hang up call : KO not receive DISCONNECTED
Thanks
Try this to hangup the call var prm = sipController.getCallOptionalParameter() prm.statusCode = pjsip_status_code.PJSIP_SC_DECLINE sipController.getCurrentCall().hangup(prm)
Can you share the code of deinitialize sip connection? My app crash on poor internet connection
Hi,
Is not my problem, when i'm hang up the call, no problem DISCONNECTED was called
Try this to hangup the call
var prm = sipController.getCallOptionalParameter()
prm.statusCode = pjsip_status_code.PJSIP_SC_DECLINE
sipController.getCurrentCall().hangup(prm)
But, when the callee hang up call, , i'm not receive DISCONNECTED from onCallState.
Here, how I deinitialize sip connection :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
mReceiver.register(this)
mAccount = SipAccountData()
mAccount.host = sipServer
mAccount.realm = sipServer
mAccount.port =sipPort
mAccount.username = userName
mAccount.password = userPwd
mAccountId = SipServiceCommand.setAccount(this, mAccount)
}
override fun onDestroy() {
super.onDestroy()
mReceiver.unregister(this)
mAccountId?.let { SipServiceCommand.removeAccount(this, it) }
}
Sorry I think you have a problem on your side related to hangup call
Can you give me your mail or something so we can communicate privately..!!
Hi, any updates on this issue please?
No i think pjsip has no strong community to ans pjsip queries
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Mohammed Al-Hafidh @.> Sent: Wednesday, May 25, 2022 11:57:47 PM To: VoiSmart/pjsip-android @.> Cc: Waheed khAn @.>; Comment @.> Subject: Re: [VoiSmart/pjsip-android] No broadcast event receive when callee hang up call (Issue #152)
Hi, any updates on this issue please?
— Reply to this email directly, view it on GitHubhttps://github.com/VoiSmart/pjsip-android/issues/152#issuecomment-1137726683, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANFMC2MELROK4MISEQQDBMTVLZZ2XANCNFSM5KNMTWXA. You are receiving this because you commented.Message ID: @.***>
to try to find te root cause you should look a te sip messages exchanged with the server, e.g.: sniff all the messages and see if the BYE sent by server/remote side is sent to some other address/port.
If remote asterik server is let's say custom_forwarding your call. It treats that as a second call and declines it. This was my case. I had to store the call id separately and on disconnect match it with the stored value. Try debugging or explain the issue more
Sorry I think you have a problem on your side related to hangup call
Hi, I am having a similar issue with hang up call. Do you know if there is a resolution?
Hi, I also have a similar problem on hang up call. My code seems fine from what I compare with the documentation and other snippets shared in examples. But still no solution. Any help is deeply appreciated.
Can you give me your mail or something so we can communicate privately..!!
Hi. I'm having a similar issue. I don't mind a private conversation if you're interested. thank you.
@aenonGit
if a call is less than 15 seconds long, and the other person hangs up, I receive the BYE packet with no problem.
If the call is more than 45 seconds long, and the other person hangs up, I don't receive the BYE packet at all, so the call shows as still in progress. Wireshark doesn't catch the packet either. I checked with the backend and it's definitely sending the packet, I'm just not receiving it on my end.
I'm using UDP
Any ideas?
Issue is actually with the call id. This project is not able to track the call sometimes as the call id changes. I have tested it and fixed it too. I have the fixed project as private on github as it as clients data too. I will try to make it public by Sunday.
@ashishsecrets Great thanks, it will great help for me
@kukadiyaAni Here is the sample project as promised. Let me know if you have any difficulty https://github.com/ashishsecrets/pjsip-android-sample-proj/tree/master
@ashishsecrets Thanks, I checked out your repo it's great, just one thing need to know for my case onCallState not called from PJSIP, what did you do for that?
Actually I already customized my repo for react-native so, if I get what exactly cause so, I can add that solution
Thanks again for your repo
@kukadiyaAni I don't remember fully all the changes but if you look in my repo and open the sip service(which is the voismart pjsip main project) you will see I have modified the call ids from number to string at some places also how I'm using the call id in the main activity and tracking it please check that logic. That's all really.
@ashishsecrets Thanks for your support, I think our issue is different, the local broadcast working fine, in my case below method not called from PJSIP when call ends after 1 minute
public void onCallState(OnCallStateParam prm) {
Log.e( "onCallState: ", getInfo().getState());
if (getClass() == Call.class) pjsua2JNI.Call_onCallState(swigCPtr, this, OnCallStateParam.getCPtr(prm), prm); else pjsua2JNI.Call_onCallStateSwigExplicitCall(swigCPtr, this, OnCallStateParam.getCPtr(prm), prm);
}