Re: Check state of call

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

 



PJSIP_INV_STATE_INCOMING and PJSIP_INV_STATE_CALLING are set for a short time. Then the state switches to PJSIP_INV_STATE_EARLY. And you can determine the state by the role and state of the media. Well, or display your flags in onCallState or other callback.

I think this option will be even more reliable:
    @property
    def incoming (self):
        return not self.call.hasMedia () and \
                (self.role == PJ.PJSIP_ROLE_UAS \
                or self.role == PJ.PJSIP_UAS_ROLE)
    # incoming

    @property
    def calling (self):
        return not self.call.hasMedia () and \
                (self.role == PJ.PJSIP_ROLE_UAC \
                or self.role == PJ.PJSIP_UAC_ROLE)
    # calling

    @property
    def talking (self):
        return self.call.hasMedia ()
    #talking

Is it possible to add a check for:
self.state != PJ.PJSIP_INV_STATE_NULL

or self.call.isActive()

> 
> Hi.
> ?
> It think it?s right. But I always check call state without hasMedia and roles.
> I?ve faced with the issue that I couldn?t get PJ.PJSIP_INV_STATE_INCOMING for incoming calls. So I had to set flag for the?incoming call in the callback function onIncomingCall. It?s workaround I could come up with.
> ? 

_______________________________________________
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