Re: bug in pjsua2 Endpoint pjsua2 crash on incoming

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Gabriel,

Thank you for your post.
I've got same issue on Android with pjsip 2.5,
then I confirmed your temporal workaround is also effective.

crash at:
F libc    : ../src/pjsip-ua/sip_inv.c:2321: pjsip_inv_answer:
assertion "inv->last_answer" failed

my handler is ...
class MyAccount extends Account {
    public void onIncomingCall(OnIncomingCallParam prm)
    {
      MyCall call = new MyCall(this, prm.getCallId());
      CallOpParam new_prm = new CallOpParam();
      new_prm.setStatusCode(pjsip_status_code.PJSIP_SC_OK);
      call.answer(new_prm);
    }

Thanks,
minoruta

> Date: Mon, 16 May 2016 11:54:31 +0200
> From: gabriel@xxxxxxxxxxx
> To: pjsip list <pjsip@xxxxxxxxxxxxxxx>
> Subject: Re:  bug in pjsua2 Endpoint pjsua2 crash on incoming
>         call
> Message-ID: <b1296f929196391e33ec1b165af1f304@xxxxxxxxxxx>
> Content-Type: text/plain; charset="us-ascii"
>
>
>
> > 17:28:38.112 pjsua_call.c .Incoming Request msg INVITE/cseq=19 (rdata0x7f5778009268)
> > 17:28:38.112 pjsua_media.c ..Call 0: initializing media..
> > 17:28:38.113 pjsua_media.c ...RTP socket reachable at 192.168.1.8:4000
> > 17:28:38.113 pjsua_media.c ...RTCP socket reachable at 192.168.1.8:4001
> > 17:28:38.113 pjsua_media.c ...Media index 0 selected for audio call 0
> > *** Incoming Call: "Telefon" <sip:...> [NULL]
> > 17:28:38.113 pjsua_call.c ...Answering call 0: code=200 a.out:
> > ../src/pjsip-ua/sip_inv.c:2321: pjsip_inv_answer: Assertion
> > `inv->last_answer' failed. [1] 19792 abort (core dumped) ./a.out
>
> I managed to track it down a little more. It seems to be a bug in
> pj::Endpoint. The first answer to a call has to be made by
> 'pjsip_inv_initial_answer()' function, which is done by pjsua
> automatically before calling the 'on_incoming_call' callback of
> pj::Endpoint. Before this happens, the media is being initialized (see
> log above) by 'pj::Endpoint::on_create_media_transport()' (line 1233).
> In version 2.5 this method calls on it's own 'on_incoming_call', but the
> call isn't ready to be answered "normally" yet, so we get the crash.
>
> Below the code of on_create_media_transport. Commenting out like shown
> solves the problem for me, but I don't know why the code has been added,
> so it might not the best solution:
>
> -------------- pjsua2/Endpoint.cpp:1233+ -------------------------
> pjmedia_transport*
> Endpoint::on_create_media_transport(pjsua_call_id call_id,
>                                     unsigned media_idx,
>                                     pjmedia_transport *base_tp,
>                                     unsigned flags)
> {
>     Call *call = Call::lookup(call_id);
>     if (!call) {
>     //pjsua_call *in_call = &pjsua_var.calls[call_id];
>     //if (in_call->incoming_data) {
>         /* This can happen when there is an incoming call but the
>          * on_incoming_call() callback hasn't been called. So we need to
>
>          * call the callback here.
>          */
>         //on_incoming_call(in_call->acc_id, call_id,
> in_call->incoming_data);
>
>         //[> New call should already be created by app. <]
>         //call = Call::lookup(call_id);
>         //if (!call) {
>         //return base_tp;
>         //}
>     //} else {
>         return base_tp;
>     //}
>     }
> ----------- [...] -----------------------------------
>
> regards
> Gabriel

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux