Skip to content

Commit

Permalink
Fixed Buddy to use correct account during subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
sauwming committed Dec 20, 2024
1 parent cb85368 commit e741162
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions pjsip/include/pjsua-lib/pjsua_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ typedef struct pjsua_buddy
{
pj_pool_t *pool; /**< Pool for this buddy. */
unsigned index; /**< Buddy index. */
pjsua_acc_id acc_id; /**< Account index. */
void *user_data; /**< Application data. */
pj_str_t uri; /**< Buddy URI. */
pj_str_t contact; /**< Contact learned from subscrp. */
Expand Down
4 changes: 3 additions & 1 deletion pjsip/src/pjsua-lib/pjsua_pres.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ static void reset_buddy(pjsua_buddy_id id)
pj_bzero(&pjsua_var.buddy[id], sizeof(pjsua_var.buddy[id]));
pjsua_var.buddy[id].pool = pool;
pjsua_var.buddy[id].index = id;
pjsua_var.buddy[id].acc_id = PJSUA_INVALID_ID;
}


Expand Down Expand Up @@ -2013,7 +2014,8 @@ static void subscribe_buddy(pjsua_buddy_id buddy_id,
dlg_event_callback.on_rx_notify = &pjsua_evsub_on_rx_dlg_event_notify;

buddy = &pjsua_var.buddy[buddy_id];
acc_id = pjsua_acc_find_for_outgoing(&buddy->uri);
acc_id = (buddy->acc_id != PJSUA_INVALID_ID)? buddy->acc_id:
pjsua_acc_find_for_outgoing(&buddy->uri);

acc = &pjsua_var.acc[acc_id];

Expand Down
3 changes: 3 additions & 0 deletions pjsip/src/pjsua2/presence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
using namespace pj;
using namespace std;

#include <pjsua-lib/pjsua_internal.h>

#define THIS_FILE "presence.cpp"


Expand Down Expand Up @@ -141,6 +143,7 @@ void Buddy::create(Account &account, const BuddyConfig &cfg)
PJSUA2_CHECK_EXPR( pjsua_buddy_add(&pj_cfg, &id) );

account.addBuddy(this);
pjsua_var.buddy[id].acc_id = account.getId();
}

int Buddy::getId() const
Expand Down

0 comments on commit e741162

Please sign in to comment.