Cant make post to create a new phone

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.web_rtc_user.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 web_rtc_user?

thanks in advance.

Looks like you didnot initate web_rtc_user 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

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