[pjsip] py_pjsua error when registering an account

Benny Prijono bennylp at pjsip.org
Mon Sep 17 11:46:12 EDT 2007


Gideon Klompje wrote:
> Hi,
> 
> It seems there’s a problem when adding a new SIP account.  The code 
> snippet (from “pjsua_app.py”, which is pretty much what I use as a 
> template for registration purposes) is:
> 
> # Configure account configuration
> acc_cfg = py_pjsua.acc_config_default()
> acc_cfg.id = "sip:" + acc_username + "@" + acc_domain
> acc_cfg.reg_uri = "sip:" + acc_domain
> acc_cfg.cred_count = 1
> 
>  
> 
> This gives the following error:
> 
>             AttributeError: 'py_pjsua.Acc_Config' object has no 
> attribute 'cred_count'
> 
> My code follows pretty much the same layout as “pjsua_app.py”, which 
> gives the above error.  Is this a bug in the “py_pjsua” module, or does 
> “pjsua_app.py” just not reflect some change in the source?


It's kind of both; I did made major change to the Python module to
make it more Python-ish, but I've got to admit I didn't do that much
QA (hey, I didn't know anybody is interested with it!).

Anyway, it's fixed now in r1438. So now most of the "xx_count"
fields are gone, since that's sooo not Python. The way to add
credential to account config is by using something like this:

	cred_info = py_pjsua.Pjsip_Cred_Info()
	cred_info.realm = "*"
	cred_info.scheme = "digest"
	cred_info.username = acc_username
	cred_info.data_type = 0
	cred_info.data = acc_passwd

	acc_cfg.cred_info.append(1)
	acc_cfg.cred_info[0] = cred_info

Sorry again.

  -benny








More information about the pjsip mailing list