[pjsip] Registration status and contact information

Benny Prijono bennylp at pjsip.org
Mon Apr 28 14:45:27 EDT 2008


On Mon, Apr 28, 2008 at 6:10 PM, Ramzi Touma <rtt00 at aub.edu.lb> wrote:
>
>
>
>
> Hi,
>
> I am trying to grab the registration status of an account. I need to see
> whether the registration request was accepted by the server for that
> specific account or was it rejected due to wrong credentials or some other
> reason. In trying to do so I am using the "pjsua_acc_get_info(g_current_acc,
> &info);" to see the registration status of "g_current_account" after calling
> the "pjsua_acc_add(&cfg, PJ_TRUE, &g_current_acc); " function. And Yes, I
> have registration and publish enabled. Now the thing is I am getting the
> same text for info.status_text.ptr (In Progress) and info.status ( 100) for
> two different registration cases. That is I am getting the same value (In
> progess, and 100 respectively) for those two variables when I register with
> the correct credentials and when I try registering with wrong credentials.
> The server (I am using openser 1.2.2 as proxy) replies with the appropriate
> msg for each case. And when using the windows XP version of pjsip, I see
> registration error: Credential failed to authenticate
> (PJSIP_EFAILEDCREDENTIAL) [status=171100] when registering with wrong
> credentials and a success msg otherwise. Now how could I grab such a such a
> status variable in my main program to inform myself whether my credentials
> were accepted or not?
>

You need to call pjsua_acc_get_info() in on_reg_state() callback. If
you call it right after pjsua_acc_add(), then you'll always get 100
status.

>
> Oh and one other question, If I am using SIP Proxy, I noticed that NOTIFY
> packets contain in the contact header the IP of the proxy server itself
> only. So an "info.contact.ptr" would be empty on a buddy state change and
> only the info.uri.ptr gives me contact information about the buddy with a
> presence state change. Is there a way I could grab the buddy's contact? i.e

Yeah, the remote UA is free to put anything in its Contact header.

> is there a way I could grab the XYZ solely from XYZ at sip-proxy instead of
> getting the whole  XYZ at sip-proxy string through info.uri.ptr ?
>

Use pjsip_uri_parse()?

Cheers
 Benny


>
> Thanks
>
>
>
> Ramzi T. Touma
>
> Electrical and Computer Engineering
>
> American University of Beirut
>
> P.O. Box 11-0236/ 5555
>
> Riad el Solh Square 1107 - 2020
>
> Email: rtt00 at aub.edu.lb
>
>
> _______________________________________________
>  Visit our blog: http://blog.pjsip.org
>
>  pjsip mailing list
>  pjsip at lists.pjsip.org
>  http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>




More information about the pjsip mailing list