在某种异常情况下,pjsip客户端会出现重注册失败,此时如果注册失败的该用户呼叫,就会出现错误:operation=make_call(), error=Too many objects of the specified type (PJ_ETOOMANY)
解决办法:
pjsua提供一种方法:
class AccountInfo:
"""This describes Account info. Application retrives account info
with Account.info().
。。。。。。。。
reg_status -- the registration status. If the value is less than
700, it specifies SIP status code. Value greater than
。。。。。。。。
所以只要在呼叫之前判定主被叫注册状态即可,具体实例如下(python):
class MyAccountCallback(pj.AccountCallback):
。。。。。。。。
def on_reg_state(self):
global iRegStatus
if self.sem:
iRegStatus = self.account.info().reg_status
if self.account.info().reg_status >= 200:
self.sem.release()
。。。。。。。。
accCaller = lib.create_account(pj.AccountConfig(SipUser.Domain,”3001“,”111111“),True,None)
acc_cbCaller = MyAccountCallback(accCaller)
accCaller.set_callback(acc_cbCaller)
acc_cbCaller.wait()
accCaller.on_reg_state()
if iRegStatus == 200:
bRegStatus = True
本文介绍了一种处理pjsip客户端重注册失败的方法,通过检查账户注册状态避免呼叫时出现TooManyObjectsOfTheSpecifiedType错误。使用Python实现了一个自定义的账户回调类来监控注册状态。
5052

被折叠的 条评论
为什么被折叠?



