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

Friendly Automation (JIRA) noreply at issues.asterisk.org
Wed Feb 5 09:50:25 CST 2020


    [ https://issues.asterisk.org/jira/browse/ASTERISK-28713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=249671#comment-249671 ] 

Friendly Automation commented on ASTERISK-28713:
------------------------------------------------

Change 13708 merged by Friendly Automation:
res_stasis_playback: Prevent media_index from going out of bounds

[https://gerrit.asterisk.org/c/asterisk/+/13708|https://gerrit.asterisk.org/c/asterisk/+/13708]

> 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
>            Assignee: Sean Bright
>            Severity: Minor
>              Labels: patch
>         Attachments: 0001-res_stasis_playback-Prevent-media_index-from-going-o.patch, 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 some:thing on the channel, like this:
> {{POST http://asterisk:5039/ari/channels/1579822274.0/play?media=some%3Athing&playbackId=someid}}
> 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:
> {noformat}
> [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]
> {noformat}
> 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 :
> {noformat}
> playback->id == someid
> playback->media == some:thing
> AST_VECTOR_GET(&playback->medias, playback->media_index + 1) == (null)
> playback->target == channel:1579822274.0
> playback->language == en
> state_to_string(playback->state) == playing
> playback->media_index == 1
> AST_VECTOR_SIZE(&playback->medias) - 1 == 0
> {noformat}
> 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