PJSUA - Python - Check registration status in real time

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

 



Dear all,

Following registration.py and call.py examples here (http://trac.pjsip.org/repos/browser/pjproject/trunk/pjsip-apps/src/python/samples?rev=2171) I have developed my SIP client that works quite well.
Unfortunately, if the SIP server restarts the client thinks it is still registered, the server doesn't have it registered anymore and therefore the client does not receive calls.
I tried checking in a while loop the acc.info().reg_status but it always report "200" (OK) which as I understood it doesn't update if something is wrong with the server.
How would you make the client continuously check if it is actually registered and if not run the registration again?

Thank you,
dk


This is my registration code:


# Register to SIP server
acc = lib.create_account(pj.AccountConfig(sip_server, sip_user, sip_password))
acc_cb = MyAccountCallback(acc)
acc.set_callback(acc_cb)
acc_cb.wait()
print "Registration complete [server: %s, user: %s]: status: %s (%s)" % (sip_server, sip_user, acc.info().reg_status, acc.info().reg_reason)
my_sip_uri = "sip:" + transport.info().host + ":" + str(transport.info().port)
print my_sip_uri

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20151211/531a22d4/attachment.html>


[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