Legacy Dev Forum Posts

 View Only

Sign Up

Cant make post to create a new phone

  • 1.  Cant make post to create a new phone

    Posted 06-05-2025 18:09

    davinett | 2023-12-21 15:21:50 UTC | #1

    Hello,

    I am trying to create a new phone using python SDK and I am having problems with WebRtcUser.

    My code:

            api_instance = PureCloudPlatformClientV2.TelephonyProvidersEdgeApi()
            body = PureCloudPlatformClientV2.Phone()
    
            print(userid_gen,"body--", body)
            body.name = name
            body.site = PureCloudPlatformClientV2.Site()
            body.site.name = site_name
            body.site.id = site_id
            body.phone_base_settings = PureCloudPlatformClientV2.PhoneBaseSettings()
            body.phone_base_settings.name = phone_bs_name
            body.phone_base_settings.id = phone_bs_id_org
            **body.web_rtc_user.id = userid**
            try:
                if not module.check_mode:
                    api_instance.post_telephony_providers_edges_phones(body)
                webrtc_message = "Asign Phone to user"
                webrtc_messages.append(webrtc_message)
            except ApiException as e:
                error_message = f"Exception when calling TelephonyProvidersEdgeApi->post_telephony_providers_edges_phones: {e}"
                error_messages.append(error_message)

    The trouble is in this line: body.webrtcuser.id = userid It say me : NoneType object has no attribute 'id' So, I cant add de user id with the creation the Phone.

    Someone know how to add the userid with webrtcuser?

    thanks in advance.


    Hemanth | 2024-01-04 16:05:46 UTC | #2

    davinett, post:1, topic:23814
    web_rtc_user

    Looks like you didnot initate webrtcuser before setting its properties.

    You can look at https://github.com/MyPureCloud/platform-client-sdk-python/blob/master/build/PureCloudPlatformClientV2/models/phone.py

    and initiate webrtc just like you did for PhoneBaseSettings


    system | 2024-02-04 15:52:59 UTC | #3

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 23814