d82k
d82k

Reputation: 379

PJSIP/PJSUA - Python - Check registration status

Following registration.py and call.py examples here 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)...

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 the 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

Upvotes: 0

Views: 2568

Answers (1)

riaz hasan
riaz hasan

Reputation: 1155

By default pjsip sends re-registration request after every 600s.I mean the keep-alive timeout is 600s by default.So you can change it as you want.Change it for a different value.Here is a sample...

acc_cfg.ka_interval =30;

Upvotes: 2

Related Questions