Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No appropriate way to use pjsip_dlg_event_get_status #4213

Closed
half-left opened this issue Dec 12, 2024 · 0 comments · Fixed by #4214
Closed

No appropriate way to use pjsip_dlg_event_get_status #4213

half-left opened this issue Dec 12, 2024 · 0 comments · Fixed by #4214

Comments

@half-left
Copy link
Contributor

half-left commented Dec 12, 2024

Describe the bug

pjsip_dlg_event_get_status returns value of type pjsip_dlg_event_status where info_cnt field value is always 0

Steps to reproduce

1 register callback on_buddy_evsub_dlg_event_state

static void
    on_buddy_evsub_dlg_event_state(pjsua_buddy_id buddy_id, pjsip_evsub* sub, pjsip_event* event) {
        (void) event;

        pjsua_buddy_info info;
        pjsua_buddy_get_info(buddy_id, &info);
        PJ_LOG(1, (THIS_FILE, "on_buddy_evsub_dlg_event_state %.*s", (int)info.uri.slen, info.uri.ptr));

        pjsip_dlg_event_status pres_status;
        pj_status_t status = pjsip_dlg_event_get_status(sub, &pres_status);
        if(status != PJ_SUCCESS) {
            PJ_LOG(1, (THIS_FILE, "pjsip_dlg_event_get_status failed"));
            return;
        }
        if(!pres_status.info_cnt) {
            PJ_LOG(1, (THIS_FILE, "info_cnt of dialog event status is 0"));
            return;
        }

        PJ_LOG(1, (THIS_FILE, "dialog state %.*s", pres_status.info[0].dialog_state.slen, pres_status.info[0].dialog_state.ptr));
    }

2 add dialog-event buddy

pjsua_buddy_config_default(&buddy_cfg);
pj_cstr(&buddy_cfg.uri, "sip:931@192.168.2.222");
buddy_cfg.subscribe_dlg_event = PJ_TRUE;
pjsua_buddy_add(&buddy_cfg, &pj_id);

3 establish call by uri of the buddy
4 buddy will send notify request with dialog-info body, callback on_buddy_evsub_dlg_event_state will be called, but info_cnt in pjsip_dlg_event_status is always 0

PJSIP version

ae3874c

Context

debian 11

Log, call stack, etc

10:58:21.364           pjsua_core.c  .RX 691 bytes Request msg NOTIFY/cseq=103 (rdata0x7f5ac0002e48) from UDP 192.168.2.222:5060:
NOTIFY sip:939@192.168.2.30:5060;ob SIP/2.0
Via: SIP/2.0/UDP 192.168.2.222:5060;branch=z9hG4bK3f837186;rport
Max-Forwards: 70
From: sip:931@192.168.2.222;tag=as54eae7f8
To: sip:939@192.168.2.222;tag=aeac7bfe-2bd9-4c2c-a279-d16a3837a408
Contact: <sip:931@192.168.2.222:5060>
Call-ID: 733a7b1f-b54a-4e5f-8182-705e550f8cec
CSeq: 103 NOTIFY
User-Agent: FPBX-2.11.0(11.20.0)
Subscription-State: active
Event: dialog
Content-Type: application/dialog-info+xml
Content-Length: 203

<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="1" state="full" entity="sip:931@192.168.2.222">
<dialog id="931">
<state>confirmed</state>
</dialog>
</dialog-info>

--end msg--
10:58:21.364           pjsua_core.c  .......TX 513 bytes Response msg 200/NOTIFY/cseq=103 (tdta0x7f5ac001dc08) to UDP 192.168.2.222:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.2.222:5060;rport=5060;received=192.168.2.222;branch=z9hG4bK3f837186
Call-ID: 733a7b1f-b54a-4e5f-8182-705e550f8cec
From: <sip:931@192.168.2.222>;tag=as54eae7f8
To: <sip:939@192.168.2.222>;tag=aeac7bfe-2bd9-4c2c-a279-d16a3837a408
CSeq: 103 NOTIFY
Contact: <sip:939@192.168.2.30:5060;ob>
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub, trickle-ice
Content-Length:  0


--end msg--
10:58:21.364         evsub0x45ff0c8  .....Subscription state changed ACTIVE --> ACTIVE
10:58:21.364           pjsua_pres.c  ......Dialog event subscription to sip:931@192.168.2.222 is ACTIVE
10:58:21.364          UserAgent.cpp  .......on_buddy_evsub_dlg_event_state sip:931@192.168.2.222
10:58:21.364          UserAgent.cpp  .......info_cnt of dialog event status is 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant