pjsua_acc_get_info bad info.state ?

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

 



On Mon, Jan 25, 2010 at 11:22 AM, Peter Lukac <p.lukac at emtest.sk> wrote:
> Hi
>
> I have following situation:
> I registered Call-Back for "change state registration" as:
>
> pjsua_config cfg;
> ...
> cfg.cb.on_reg_state = &on_registration_state;
> ...
> When calling unregister method as:
>
> pjsua_acc_set_registration( d->acc_id, PJ_FALSE );
>
> and Call-Back method on_registration_state occured i call inside
> method:
>
> pjsua_acc_get_info()
>
> but ?"pjsua_acc_info.status" is still 200. in documentation is:
>
> ***************************************************
> pjsip_status_code pjsua_acc_info::status
>
> Last registration status code. If status code is zero, the account is
> currently not registered. Any other value indicates the SIP status code of the
> registration.
> ***************************************************

The documentation is not wrong though. It says that when it is zero,
the account is not registered. It doesn't mean that when it is
non-zero the account will be registered, right? But I agree that the
documentation is probably not too clear in explaining this.

Anyway, for your situation, you could just check the "expires" field
to determine if the account is currently registered or not.

Cheers
 Benny

>
> I want handle event when user unregister his account and i want to make by
> variable "status" in "pjsua_acc_info" struct. but it seems there is a bug..or
> it's bad idea?
>
> code and logs:
>
> void Sip::on_registration_state( pjsua_acc_id acc_id )
> {
> ? ?pj_status_t status;
> ? ?pjsua_acc_info info ?;
> ? ?status = pjsua_acc_get_info(acc_id, &info);
> ? ?if (status == PJ_SUCCESS) {
>
> ? ? ? ?PJ_LOG(3,("Sip", "acc info id=%d", info.id));
> ? ? ? ?PJ_LOG(3,("Sip", "acc info uri=%s", info.acc_uri));
> ? ? ? ?PJ_LOG(3,("Sip", "acc info has_registration=%d",
> info.has_registration));
> ? ? ? ?PJ_LOG(3,("Sip", "acc info expires=%d", info.expires));
> ? ? ? ?PJ_LOG(3,("Sip", "acc info status=%d", info.status));
> ? ? ? ?PJ_LOG(3,("Sip", "acc info status_text=%s", info.status_text));
> ? ? ? ?PJ_LOG(3,("Sip", "acc info online_status=%d", info.online_status));
> ? ? ? ?PJ_LOG(3,("Sip", "acc info online_status_text=%s",
> info.online_status_text));
> ? ?}
>
> }
>
>
> register account
>
> ?11:54:19.468 ? ?pjsua_acc.c ?Account sip:pc4 at 192.168.10.123 added with id 0
> ?11:54:19.468 ? ?pjsua_acc.c ?Registration sent
> ?11:54:19.468 ? ?pjsua_acc.c ?sip:pc4 at 192.168.10.123: registration success,
> status=200 (OK), will re-register in 300 seconds
> ?11:54:19.468 ? ?pjsua_acc.c ?Keep-alive timer started for acc 0,
> destination:192.168.10.123:5060, interval:15s
> ?11:54:19.468 ? ? ? ? ? Sip ?acc info id=0
> ?11:54:19.468 ? ? ? ? ? Sip ?acc info uri=sip:pc4 at 192.168.10.123
> ?11:54:19.468 ? ? ? ? ? Sip ?acc info has_registration=1
> ?11:54:19.468 ? ? ? ? ? Sip ?acc info expires=295
> ?11:54:19.468 ? ? ? ? ? Sip ?acc info status=200
> ?11:54:19.468 ? ? ? ? ? Sip ?acc info status_text=OK
> ?11:54:19.468 ? ? ? ? ? Sip ?acc info online_status=0
> ?11:54:19.468 ? ? ? ? ? Sip ?acc info online_status_text=Offline
>
> unregister account
> ?11:54:35.390 ? ?pjsua_acc.c ?Unregistration sent
> ?11:54:35.390 ? ?pjsua_acc.c ?sip:pc4 at 192.168.10.123: unregistration success
> ?11:54:35.390 ? ? ? ? ? Sip ?acc info id=0
> ?11:54:35.390 ? ? ? ? ? Sip ?acc info uri=sip:pc4 at 192.168.10.123
> ?11:54:35.390 ? ? ? ? ? Sip ?acc info has_registration=1
> ?11:54:35.390 ? ? ? ? ? Sip ?acc info expires=-1
> ?11:54:35.390 ? ? ? ? ? Sip ?acc info status=200
> ?11:54:35.390 ? ? ? ? ? Sip ?acc info status_text=OK
> ?11:54:35.390 ? ? ? ? ? Sip ?acc info online_status=0
> ?11:54:35.390 ? ? ? ? ? Sip ?acc info online_status_text=Offline
>
> "Sip ?acc info status=200" is still 200.
>
>
> ...thanks
>



[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