question

Fausto Chepil avatar image
Fausto Chepil asked Fausto Chepil published

fax attachment not being faxed -Python SDK

This is code snippet communicating with RC API that attempts to send a pdf doc for faxing.


rcsdk = SDK(RINGCENTRAL_CLIENTID,
RINGCENTRAL_CLIENTSECRET, RINGCENTRAL_SERVER)


platform = rcsdk.platform()
platform.login(RINGCENTRAL_USERNAME,
RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD)


# platform.login(jwt=RC_JWT)
builder = rcsdk.create_multipart_builder()
builder.set_body({
  
'to': [{'phoneNumber': recipient}],
'faxResolution': "High",
'coverPageText': "Clinic Name \n" + str(sender)
})


with open(faxdoc, encoding="utf8", errors='ignore') as f:
 content = f.read()
 attachment = (faxdoc, content)


builder.add(attachment)


request = builder.request('/account/~/extension/~/fax')


resp = platform.send_request(request)


Everything looks good and this is output in terminal:

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): platform.devtest.ringcentral.com:443

DEBUG:urllib3.connectionpool:https://platform.devtest.ringcentral.com:443 "POST /restapi/oauth/token HTTP/1.1" 200 574

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): platform.devtest.ringcentral.com:443

DEBUG:urllib3.connectionpool:https://platform.devtest.ringcentral.com:443 "POST /restapi/v1.0/account/~/extension/~/fax HTTP/1.1" 200 None

INFO:root:E:\pyfaxrc\apps\response\12047861522__E:\pyfaxrc\apps\outbound\test.pdf


The fax that is received is 2 pages, a cover page and a 2nd page that has a watermark saying "test fax using ring central developer account"

The Sandbox Console shows the service as having a successful transmission, even though the attachment was not sent.

if I test with a jpeg attachment, I do not receive any fax and the event logs are identical as the pdf, with exception of the filename and extension.

(The code snippet that opens the file was changed per RC community advisement as I was receiving errors when using the original code sample.)

Any advisement appreciated.

fax
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Phong Vu avatar image
Phong Vu answered

This is a known issue that fax attachment is not supported in sandbox environment. If you could call the API successfully and receive the cover pages, then your code is good to go on production.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys