Fwd: Buddy presence issue

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

 



Why don't you use this code I have attached, just try it(attach the code as
written on my comment line) I haven't worked with this buddy thing. I
presume it may work.

/* below the header file */
enum{
ONLINE, IDLE, AWAY, OFFLINE};
struct presence_status{
int id;
char *name;
}
opts[]={
{ ONLINE, "Online"},
{ IDLE, "Idle"},
{ AWAY, "Away"},
{ OFFLINE, "Offline"}
};


/* insert after your account registration */
int dll_setStatus(int accId, int presence_state)
{
pj_status_t online_status;
pj_bool_t is_online = PJ_FALSE;
pjrpid_element elem;

pj_bzero(&elem, sizeof(elem));
elem.type = PJRPID_ELEMENT_TYPE_PERSON;

online_status = PJ_TRUE;

switch(presence_state){
case ONLINE:
break;
case IDLE:
elem.activity = PJRPID_ACTIVITY_UNKNOWN;
elem.note = pj_str("Idle");
break;

case AWAY:
elem.activity = PJRPID_ACTIVITY_AWAY;
elem.note = pj_str("Away");
break;

case OFFLINE:
online_status = PJ_TRUE;
break
}
pj_status_t status = pjsua_acc_set_online_status2(accId, online_status,
&elem);
return status;
}

If above code works, there are chances of getting error for that pj_bzero
thing. Hope it's useful for you.

Regards
Rachel



On Mon, Sep 21, 2009 at 12:30 PM, Yuvaraj R <yuvaraj at ongobiz.com> wrote:

> Thanks for reply
>
> if use pointer application is crashing while accessing activity
>
> please help me how do i fix this issue ?
>
>
> Thanks
>
> Yuvaraj R
>
> On Mon, Sep 21, 2009 at 9:22 PM, Rachel Baskaran <rachelbaskaran at gmail.com
> > wrote:
>
>> I felt the pjrpid_element is a pointer. If only you define a pointer you
>> could use *&elem* in
>> pjsua_acc_set_online_status2(acc_id,online_status,&elem);
>>
>> Try:
>> pjrpid_element *elem;
>>
>> This might be one of reason for your crash.
>>
>> On Mon, Sep 21, 2009 at 10:18 AM, Yuvaraj R <yuvaraj at ongobiz.com> wrote:
>>
>>>
>>>
>>
>>> ---------- Forwarded message ----------
>>> From: Yuvaraj R <yuvaraj@xxxxxxxxxxx>
>>> Date: Mon, Sep 21, 2009 at 7:47 PM
>>> Subject: Buddy presence issue
>>> To: pjsip at list.pjsip.org
>>>
>>>
>>> Hi All
>>>
>>> I am  have trouble with  buddy presence
>>>
>>> I want to set following status for buddy
>>>
>>> 1) Online
>>>
>>> 2)offline
>>>
>>> 3) Away
>>>
>>> 4) ideal
>>>
>>>
>>> *Code :*
>>> bool *ok;
>>>
>>> pj_status_t status;
>>>
>>> pj_bool_t online_status;
>>>
>>> pjrpid_element elem;
>>>
>>> enum status
>>>
>>> {
>>>
>>> Online,
>>>
>>> Offline,
>>>
>>> Busy,
>>>
>>> Idle,
>>>
>>> Away,
>>>
>>> };
>>>
>>> QMessageBox::information(0,"",QString("1"));
>>>
>>> if(sipOn)
>>>
>>> {
>>>
>>> QMessageBox::information(0,"",QString("2"));
>>>
>>> switch(text.toInt(ok,10))
>>>
>>> {
>>>
>>> case Online:
>>>
>>> elem.activity = PJRPID_ACTIVITY_BUSY;
>>>
>>> elem.note = pj_str("Busy");
>>>
>>> online_status =PJ_TRUE;
>>>
>>> break;
>>>
>>> case Offline:
>>>
>>> online_status =PJ_FALSE;
>>>
>>> break;
>>>
>>> case Idle:
>>>
>>> elem.activity = PJRPID_ACTIVITY_UNKNOWN;
>>>
>>> elem.note = pj_str("Idle");
>>>
>>> online_status =PJ_TRUE;
>>>
>>> break;
>>>
>>> case Away:
>>>
>>> elem.activity = PJRPID_ACTIVITY_AWAY;
>>>
>>> elem.note = pj_str("Away");
>>>
>>> break;
>>>
>>> }
>>>
>>> QMessageBox::information(0,"",QString("3"));
>>>
>>> pjsua_acc_set_online_status2(acc_id, online_status, &elem);
>>>
>>> QMessageBox::information(0,"",QString("4"));
>>>
>>> }
>>>
>>> Here QmessageBox is  Qt realated to verify the code (such as printf
>>> statements).
>>>
>>> When i am calling the pjsua_acc_set_online_status2(acc_id,
>>> online_status, &elem); My application is crashing..
>>>
>>>
>>> Can anybody say what is the reason.
>>>
>>> Please help me.
>>>
>>>
>>> Thanks
>>>
>>> Yuvaraj R
>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>
>> _______________________________________________
>> 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
>>
>>
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090921/a3385818/attachment.html>


[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