Question

SMS - error: phone number doesn't belong to extension

  • 23 June 2020
  • 2 replies
  • 1527 views

Hello,

We are trying to use the javascript sdk to send SMS messages.

We use the main extension to login to the sdk, and pass a users RingCentral number as the from parameter. We receive the error "error: phone number doesn't belong to extension" as a response.


Here is some code we are using to test.


async function send() {
    const sdk = new SDK(config.ringCentral)
    await sdk.platform().login({
        username: config.ringCentral.user,
        extension: config.ringCentral.mainExt,
        password: config.ringCentral.pw
    })

    const message = {
        from: { phoneNumber: '1<Ring Central number>' },
        to: [{ phoneNumber: '1<my cell number>' }],
        text: 'this is a test message'
    }

    const res = await sdk.platform().post('/restapi/v1.0/account/~/extension/~/sms', message)
    console.log(res.data)
}


Any assistance you can provide is appreciated.




2 replies

The error is self explanatory. It indicate that the phone Number does not belong to the extension (or user) who logged in to run the application. You need to use the direct number assigned to that user (extension).

Hi . Greetings.

I am currently working on sandbox environment, and my phone number is associated to my account. But when I try to test sms api, it returns an error "Phone number doesn't belong to extension"

{ "to": [{"phoneNumber": "+171xxxxxxxx "}], "from": {"phoneNumber": "+147xxxxxxxx}"}, "text": "Test SMS message from Platform server"}


What's wrong?

Please let me know your thoughts.

Thanks.

Reply