[asterisk-bugs] [JIRA] (ASTERISK-28713) res_stasis_playback: Error building JSON

Sébastien Duthil (JIRA) noreply at issues.asterisk.org
Fri Jan 24 16:41:25 CST 2020


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

Sébastien Duthil updated ASTERISK-28713:
----------------------------------------

    Attachment: ari-playback.py

Here is a reproduction script using ari-py. The script requires a channel inside a Stasis application. It will then repeatedly play a non-existing sound file on the channel.

> res_stasis_playback: Error building JSON
> ----------------------------------------
>
>                 Key: ASTERISK-28713
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28713
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_stasis_playback
>    Affects Versions: 16.7.0
>         Environment: Asterisk 16.7.0, Debian 10 Buster
>            Reporter: Sébastien Duthil
>            Severity: Minor
>         Attachments: ari-playback.py
>
>
> Given I have a channel in Stasis (not in a Bridge)
> When I answer the channel
> When I try to play a non-existing sound file with a wrong scheme unknown:foo on the channel, like this:
> POST http://asterisk:5039/ari/channels/1579822274.0/play?media=unknown%3Afoo'
> When I get the playback info like this: GET http://asterisk:5039/ari/playbacks/someid
> Then I sometimes get a status code 500 with the following error message:
> ```
> [2020-01-24 17:27:52.8439] ERROR[25681][C-00000001]: res_stasis_playback.c:365 play_on_channel: Attempted to play URI 'some:thing' on channel 'PJSIP/lm4w1w87-00000000' but scheme is unsupported
> [2020-01-24 17:27:52.8443] ERROR[25696]: json.c:607 ast_json_vpack: Error building JSON from '{s: s, s: s, s: s, s: s, s: s, s: s}': NULL string.
> [2020-01-24 17:27:52.8458] ERROR[25696]:   Got 14 backtrace records
> # 0: /usr/sbin/asterisk(ast_json_vpack+0xca) [0x511fe4]
> # 1: /usr/sbin/asterisk(ast_json_pack+0x36) [0x511efe]
> # 2: /usr/lib/asterisk/modules/res_stasis_playback.so(stasis_app_playback_to_json+0x14f) [0xb272361a]
> # 3: /usr/lib/asterisk/modules/res_ari_playbacks.so(+0x16b7) [0xb270d6b7]
> # 4: /usr/lib/asterisk/modules/res_ari_playbacks.so(+0x12cf) [0xb270d2cf]
> # 5: /usr/lib/asterisk/modules/res_ari.so(ast_ari_invoke+0x736) [0xb28800f9]
> # 6: /usr/lib/asterisk/modules/res_ari.so(+0x5601) [0xb2881601]
> # 7: /usr/sbin/asterisk(+0x210ded) [0x618ded]
> # 8: /usr/sbin/asterisk(+0x211f38) [0x619f38]
> # 9: /usr/sbin/asterisk(+0x212287) [0x61a287]
> #10: /usr/sbin/asterisk(+0x1b906d) [0x5c106d]
> #11: /usr/sbin/asterisk(+0x1ca9cc) [0x5d29cc]
> #12: /lib/i386-linux-gnu/libpthread.so.0(+0x6fd2) [0xb759efd2]
> #13: /lib/i386-linux-gnu/libc.so.6(clone+0x66) [0xb71de6d6]
> ```
> Expected: I get a status code 200 or 404
> Reproduction: This issue only happens occasionnally. Attached is a small Python script that tries many times to reproduce the issue. I can reproduce 9/10 times with this script.
> Technical investigation: Debug logs do not give any more useful information. When reproducing, in `res_stasis_playback`, in the function `stasis_app_playback_to_json`, I have the following values :
> playback->id: someid
> playback->media: some:thing
> AST_VECTOR_GET(&playback->medias, playback->media_index + 1): (null)
> playback->target: channel:1579903639.0
> playback->language: en
> state_to_string(playback->state): playing
> playback->media_index: 1
> AST_VECTOR_SIZE(&playback->medias) - 1: 0
> The `media_index > AST_VECTOR_SIZE(&playback->medias) - 1` seems to be the cause of the wrong branch condition causing the JSON to be packed with a NULL string.



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



More information about the asterisk-bugs mailing list