Re: bug in pjsua2 Endpoint pjsua2 crash on incoming call

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

 




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