Skip to content

[BUG] Using actual boolean instead of json string in boolean parameter causes bxml error #248

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

Open
5 tasks done
stephenreddek opened this issue Apr 23, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@stephenreddek
Copy link

stephenreddek commented Apr 23, 2025

Checklist

  • Have you provided a description of the bug?
  • Have you provided your Environment information?
  • Have you provided a sample code snippet?
  • Have you provided a stack trace?
  • Have you outlined the expected behavior?

Description

When receiving an initiate and responding with BXML to start a mult_channel recording, following the types results in a BXML failure on the bandwidth side. The error sends a call status event with cause invalid-bxml. The issue is setting mutli_channel to True instead of "true".

Environment Information

  • OS Version: Mac OS 15.4
  • SDK Version: 18.1.3
  • Environment: 3.11.10

Sample Code Snippet

       response = Response()

        response.add_verb(
            StartRecording(
                multi_channel=True, # this fails. To get this to work, I have to set it to `"true"`
                file_format="mp3",
            )
        )

        response.add_verb(Ring(duration=5))

        status_webhook_url = "ws://our-url"

        start_stream = StartStream(
            destination=f"wss://{ws_base_url}/ws/bandwidth/",
            stream_event_url=status_webhook_url,
            mode="bidirectional",
        )
        start_stream.add_verb(StreamParam(name="hotel_uuid", value=str(hotel.uuid)))
        start_stream.add_verb(StreamParam(name="canary_call_uuid", value=str(call.uuid)))

        response.add_verb(start_stream)
        response.add_verb(
            Pause(duration=86400) # hack to keep the call alive
        )

        logger.info("bandwidth_initiate_call.response", response=response.to_bxml())

        return HttpResponse(content=response.to_bxml(), status=200, content_type="application/xml")

Stack Trace

None

Expected Behavior

I would expect to be able to pass a native boolean instead of a string version to multi_channel

Suggested Fix

@stephenreddek stephenreddek added the bug Something isn't working label Apr 23, 2025
@ckoegel
Copy link
Contributor

ckoegel commented Apr 24, 2025

Hey @stephenreddek!

We've done some digging into this and it's actually an issue with the underlying Voice service. When passing a native boolean to the verb in the SDK, the BXML serializes to "True", as opposed to your solution which serializes to "true". The service that handles this BXML is actually case sensitive for this field, which is what causes the invalid-bxml error.

We're going to begin working on a backwards compatible fix for this that should accept both True and true. For now, could you please leave your workaround in your code? I'm happy to notify you here when the fix is released so you can use a true boolean. Thanks for bringing this to our attention!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants