Bug in pjproject 2.9 (SDP attribute count)

SF
Skale Franz
Fri, Nov 22, 2019 7:59 AM

Hi,

i didn't find any way to report a bug, so the last resort is the mailing list !

Found a bug when it comes to SDP attribute count.

The count is alway 0  ! (e.g. on_incoming_call rdata).

Parser broken ?

Callback on_incoming_call snippet:

/* Callback called by the library upon receiving incoming call */
static void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id,
pjsip_rx_data *rdata)
{
PJ_UNUSED_ARG(acc_id);
pjsua_call_info ci;
pjsip_rdata_sdp_info *sdp_info = pj_pool_alloc(rdata->tp_info.pool, 4096);
char *sdp_print = pj_pool_alloc(rdata->tp_info.pool, 4096);
pj_size_t size = 2048;
int sdp_size;

sdp_info = (pjsip_rdata_sdp_info*)pjsip_rdata_get_sdp_info(rdata);
if (sdp_info) {
  PJ_LOG(3,(THIS_FILE, "Received SDP"));
  unsigned attr_cnt = sdp_info->sdp->attr_count;
  PJ_LOG(3,(THIS_FILE, "SDP Attrribute count: %d", attr_cnt));
  sdp_size = pjmedia_sdp_print(sdp_info->sdp, sdp_print, size);
  if ( sdp_size == -1)
    PJ_LOG(3,(THIS_FILE, "Cannot allocate SDP print buffer memory"));
  else {
    PJ_LOG(3,(THIS_FILE, "SDP buffer allocated: %d", sdp_size));
    fprintf(stderr, "SDP BUFFER:\n%s\n", sdp_print);
  }
}

The count should be 9 not 0 !

Reference:

08:50:33.465                    APP  ..SDP Attrribute count: 0
08:50:33.465                    APP  ..SDP buffer allocated: 294
SDP BUFFER:
v=0
o=- 268531272 32581 IN IP4 xxx.xxx.xxx.xxx
s=-
c=IN IP4 xxx.xxx.xxx.xxx
t=0 0
m=audio 39316 RTP/AVP 8 0 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=direction:both
a=sendrecv
a=rtcp:39317
a=ptime:20

Best regards

Franz Skale
Rechenzentrum-Services

[https://www.citycom-austria.com/rel2018/wp-content/themes/citycom/assets/img/citycom_logo.png]

Citycom Telekommunikation GmbH
Gadollaplatz 1
8010 Graz | Austria

Hi, i didn't find any way to report a bug, so the last resort is the mailing list ! Found a bug when it comes to SDP attribute count. The count is alway 0 ! (e.g. on_incoming_call rdata). Parser broken ? Callback on_incoming_call snippet: /* Callback called by the library upon receiving incoming call */ static void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id, pjsip_rx_data *rdata) { PJ_UNUSED_ARG(acc_id); pjsua_call_info ci; pjsip_rdata_sdp_info *sdp_info = pj_pool_alloc(rdata->tp_info.pool, 4096); char *sdp_print = pj_pool_alloc(rdata->tp_info.pool, 4096); pj_size_t size = 2048; int sdp_size; sdp_info = (pjsip_rdata_sdp_info*)pjsip_rdata_get_sdp_info(rdata); if (sdp_info) { PJ_LOG(3,(THIS_FILE, "Received SDP")); unsigned attr_cnt = sdp_info->sdp->attr_count; PJ_LOG(3,(THIS_FILE, "SDP Attrribute count: %d", attr_cnt)); sdp_size = pjmedia_sdp_print(sdp_info->sdp, sdp_print, size); if ( sdp_size == -1) PJ_LOG(3,(THIS_FILE, "Cannot allocate SDP print buffer memory")); else { PJ_LOG(3,(THIS_FILE, "SDP buffer allocated: %d", sdp_size)); fprintf(stderr, "SDP BUFFER:\n%s\n", sdp_print); } } The count should be 9 not 0 ! Reference: 08:50:33.465 APP ..SDP Attrribute count: 0 08:50:33.465 APP ..SDP buffer allocated: 294 SDP BUFFER: v=0 o=- 268531272 32581 IN IP4 xxx.xxx.xxx.xxx s=- c=IN IP4 xxx.xxx.xxx.xxx t=0 0 m=audio 39316 RTP/AVP 8 0 18 101 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:18 G729/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=direction:both a=sendrecv a=rtcp:39317 a=ptime:20 Best regards Franz Skale Rechenzentrum-Services [https://www.citycom-austria.com/rel2018/wp-content/themes/citycom/assets/img/citycom_logo.png] Citycom Telekommunikation GmbH Gadollaplatz 1 8010 Graz | Austria
AW
Andreas Wehrmann
Fri, Nov 22, 2019 1:21 PM

On 22/11/2019 08:59, Skale Franz wrote:

The count should be 9 not 0 !

Reference:

08:50:33.465                    APP  ..SDP Attrribute count: 0
08:50:33.465                    APP  ..SDP buffer allocated: 294
SDP BUFFER:
v=0
o=- 268531272 32581 IN IP4 xxx.xxx.xxx.xxx
s=-
c=IN IP4 xxx.xxx.xxx.xxx
t=0 0
m=audio 39316 RTP/AVP 8 0 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=direction:both
a=sendrecv
a=rtcp:39317
a=ptime:20

Best regards

Franz Skale
Rechenzentrum-Services

Hey there,

you're looking at session level attributes while you actually want to
look at media level attributes.
Try this:

sdp_info->media[ 0 ]->attr_count

Best regards,
Andreas

On 22/11/2019 08:59, Skale Franz wrote: > > > The count should be 9 not 0 ! > > > Reference: > > 08:50:33.465                    APP  ..SDP Attrribute count: 0 > 08:50:33.465                    APP  ..SDP buffer allocated: 294 > SDP BUFFER: > v=0 > o=- 268531272 32581 IN IP4 xxx.xxx.xxx.xxx > s=- > c=IN IP4 xxx.xxx.xxx.xxx > t=0 0 > m=audio 39316 RTP/AVP 8 0 18 101 > a=rtpmap:8 PCMA/8000 > a=rtpmap:0 PCMU/8000 > a=rtpmap:18 G729/8000 > a=rtpmap:101 telephone-event/8000 > a=fmtp:101 0-16 > a=direction:both > a=sendrecv > a=rtcp:39317 > a=ptime:20 > > > Best regards > > > *Franz Skale* > Rechenzentrum-Services > > Hey there, you're looking at session level attributes while you actually want to look at media level attributes. Try this: sdp_info->media[ 0 ]->attr_count Best regards, Andreas
SF
Skale Franz
Fri, Nov 22, 2019 1:37 PM

Hi Andreas,
thanks for the hint, works now !
Still learning ;-)
To be precise, the right way:
unsigned attr_cnt = sdp_info->sdp->media[0]->attr_count;

Best regards
Franz

Citycom Telekommunikation GmbH
Gadollaplatz 1
8010 Graz | Austria

T: +43(316)887-6264
M: +43(664)88275444
E: franz.skale@citycom-austria.com
www.citycom-austria.com

FN 165640p, Landes- als Firmenbuchgericht Graz
UID-Nr.: ATU 61241999
Ein Unternehmen der Holding Graz


Von: pjsip pjsip-bounces@lists.pjsip.org im Auftrag von Andreas Wehrmann a.wehrmann@yandex.com
Gesendet: Freitag, 22. November 2019 14:21
An: pjsip@lists.pjsip.org
Betreff: POSSIBLE SPAM Re: [pjsip] Bug in pjproject 2.9 (SDP attribute count)

On 22/11/2019 08:59, Skale Franz wrote:

The count should be 9 not 0 !

Reference:

08:50:33.465                    APP  ..SDP Attrribute count: 0
08:50:33.465                    APP  ..SDP buffer allocated: 294
SDP BUFFER:
v=0
o=- 268531272 32581 IN IP4 xxx.xxx.xxx.xxx
s=-
c=IN IP4 xxx.xxx.xxx.xxx
t=0 0
m=audio 39316 RTP/AVP 8 0 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=direction:both
a=sendrecv
a=rtcp:39317
a=ptime:20

Best regards

Franz Skale
Rechenzentrum-Services

Hey there,

you're looking at session level attributes while you actually want to
look at media level attributes.
Try this:

sdp_info->media[ 0 ]->attr_count

Best regards,
Andreas


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi Andreas, thanks for the hint, works now ! Still learning ;-) To be precise, the right way: unsigned attr_cnt = sdp_info->sdp->media[0]->attr_count; Best regards Franz Citycom Telekommunikation GmbH Gadollaplatz 1 8010 Graz | Austria T: +43(316)887-6264 M: +43(664)88275444 E: franz.skale@citycom-austria.com www.citycom-austria.com FN 165640p, Landes- als Firmenbuchgericht Graz UID-Nr.: ATU 61241999 Ein Unternehmen der Holding Graz ________________________________________ Von: pjsip <pjsip-bounces@lists.pjsip.org> im Auftrag von Andreas Wehrmann <a.wehrmann@yandex.com> Gesendet: Freitag, 22. November 2019 14:21 An: pjsip@lists.pjsip.org Betreff: *****POSSIBLE SPAM***** Re: [pjsip] Bug in pjproject 2.9 (SDP attribute count) On 22/11/2019 08:59, Skale Franz wrote: > > > The count should be 9 not 0 ! > > > Reference: > > 08:50:33.465 APP ..SDP Attrribute count: 0 > 08:50:33.465 APP ..SDP buffer allocated: 294 > SDP BUFFER: > v=0 > o=- 268531272 32581 IN IP4 xxx.xxx.xxx.xxx > s=- > c=IN IP4 xxx.xxx.xxx.xxx > t=0 0 > m=audio 39316 RTP/AVP 8 0 18 101 > a=rtpmap:8 PCMA/8000 > a=rtpmap:0 PCMU/8000 > a=rtpmap:18 G729/8000 > a=rtpmap:101 telephone-event/8000 > a=fmtp:101 0-16 > a=direction:both > a=sendrecv > a=rtcp:39317 > a=ptime:20 > > > Best regards > > > *Franz Skale* > Rechenzentrum-Services > > Hey there, you're looking at session level attributes while you actually want to look at media level attributes. Try this: sdp_info->media[ 0 ]->attr_count Best regards, Andreas _______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@lists.pjsip.org http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org