Question

fax attachment not being faxed -Python SDK

  • 18 November 2022
  • 1 reply
  • 3394 views

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 
" + 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:pyfaxrcapps esponse12047861522__E:pyfaxrcappsoutbound est.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.


1 reply

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.

Reply