[asterisk-bugs] [JIRA] (ASTERISK-27342) ARI: Error building JSON for PRI calls with Calling Party Subaddress Type NSAP

Richard Mudgett (JIRA) noreply at issues.asterisk.org
Mon Oct 23 08:01:21 CDT 2017


     [ https://issues.asterisk.org/jira/browse/ASTERISK-27342?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Mudgett updated ASTERISK-27342:
---------------------------------------

    Status: Waiting for Feedback  (was: Waiting for Feedback)

> ARI: Error building JSON for PRI calls with Calling Party Subaddress Type NSAP
> ------------------------------------------------------------------------------
>
>                 Key: ASTERISK-27342
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27342
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_stasis
>    Affects Versions: 13.11.2
>         Environment: Debian 8
>            Reporter: Marin Odrljin
>            Assignee: Richard Mudgett
>         Attachments: debug_log_subaddr-nok.txt
>
>
> There is a problem with starting Stasis application for incoming calls via PRI interface when there is Subaddress IE in Q.931 SETUP message.
> I'm not sure if the problem is in libpri, dahdi or asterisk source.
> I have attached a debug log 'debug_log_subaddr-nok.txt'.
> Please, check rows 19 and 20 where is 'Calling Party Subaddress'. If you check Q.931 specification [Q.931|https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-Q.931-199805-I!!PDF-E&type=items] page 71-72 (4.5.11), you'll see how octet 4 should be decoded. Spec says if type of subaddress (octet 3) is NSAP ITU-T X.213 and ISO/IEC 8348, address shall be formatted as specified by octet 4 which contains Authority and Format Identifier (AFI). When you check octet 3 from my debug log [6d 0c 01 83 30 37 38 36 31 34 34 33 34 31] it is 01 what means it is NSAP type so octet 4 must be skipped in address information (or better to say treated differently), but unfortunately this is not a case in provided example. You can see that byte 83 is taken into subaddress information and result is decoded address 'ƒ0786144341'. I believe this is the root of errors that are happening later in code when building JSON in stasis_channels.c, json.c, res_stasis.c and other classes. The error message is quite logical 'Error building JSON from {s: ...} Invalid UTF-8 string'. Since JSON can't be created and it is needed for Stasis application, call never goes there (row 60-64 from debug log: 'res_stasis.c:159 stasis_start_to_json: Failed to pack JSON for StasisStart message') and it is disconnected after. 
> The same problem probably exists with SETUP IE 'Called Party Subaddress' (Q.931 spec 4.5.9, page 68-69) and also in CONNECT IE 'Connected Subaddress'.
> I have checked class [q931.c|https://github.com/asterisk/libpri/blob/master/q931.c] in libpri and saw that in the function 'receive_subaddr_helper' which is called by 'receive_calling_party_subaddr' and 2 others, all bytes from octet 4 are always copied into q931_subbaddres->data. It would be easy to skip octet 4 if type is NSAP, but I'm not sure that this is correct place to make changes because this one byte is then lost in structure and in the case of transmitting to other channel it will bring problems. Maybe this can be prevented if we add new field  'char afi' into 'q931_party_subaddress' struct and when type is NSAP to remove first byte from 'data' into it.
> If this is not the solution, then this byte must be removed when data is copied into asterisk objects when building json for Stasis, but I have no idea where is this and that's why not sure where the correction should be done, in libpri or somehere in asterisk.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list