<div dir="auto">I will suggest you to use Python 3 and change the code accordingly and try. <div dir="auto"><br></div><div dir="auto">As I was boto3 in other process project to upload recording to S3 and had same random issue. After shifting to Python 3, never had any problem.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 21 Nov 2021, 4:05 am Danish Daud, <<a href="mailto:dajanjua@gmail.com">dajanjua@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div style="font-size:12.8px" dir="auto"><div style="width:328px;margin:16px 0px"><div><div><p><font face="Calibri">Hi Users,<br><br>We have a scenario, in which we are uploading recording file on "S3" (AWS) after completion of a call through python script.<br>We encountered error in uploading recording file on S3 for some calls and for some it worked fine. After debugging the issue we have this scenario:<br>Currently when the calls hangup after being answered (before we get the below mentioned logs in fs_cli), the script returns us an error (logs attached). But if we get the below mentioned [Debug] logs and call hangup after these, no error occurs and script successfully upload the file to s3.<br>We have not encountered that issue before.<br><br>[Debug Logs]<br>2021-11-19 02:58:08.748629 [DEBUG] switch_ivr_async.c:1427 Record session sample rate: 8000 -> 8000<br>2021-11-19 02:58:08.748629 [DEBUG] switch_core_media_bug.c:970 Attaching BUG to sofia/external/+18162394364<br>2021-11-19 02:58:08.768629 [DEBUG] switch_ivr_async.c:1717 No silence detection configured; assuming start of speech<br>2021-11-19 02:58:09.588628 [DEBUG] switch_rtp.c:7793 Correct audio ip/port confirmed.<br>2021-11-19 02:58:09.588628 [DEBUG] switch_core_io.c:448 Setting BUG Codec PCMU:0<br>2021-11-19 02:59:02.468628 [DEBUG] sofia.c:7406 Channel <a href="mailto:sofia/internal/3175520010@3.210.46.94:12000" style="text-decoration-line:none;color:rgb(66,133,244)" rel="noreferrer noreferrer" target="_blank">sofia/internal/3175520010@3.210.46.94:12000</a> entering state [calling][0]<br>2021-11-19 02:59:02.928627 [DEBUG] sofia.c:7406 Channel <a href="mailto:sofia/internal/3175520010@3.210.46.94:12000" style="text-decoration-line:none;color:rgb(66,133,244)" rel="noreferrer noreferrer" target="_blank">sofia/internal/3175520010@3.210.46.94:12000</a> entering state [ready][200]<br>2021-11-19 02:59:02.928627 [DEBUG] sofia.c:7416 Remote SDP:<br>v=0<br>o=Z 0 2 IN IP4 44.227.145.86<br>s=Z<br>c=IN IP4 44.227.145.86<br>t=0 0<br>m=audio 57578 RTP/AVP 0 106 9 8 3 101 98<br>a=rtpmap:106 opus/48000/2<br>a=fmtp:106 sprop-maxcapturerate=16000; minptime=20; useinbandfec=1<br>a=rtpmap:101 telephone-event/8000<br>a=fmtp:101 0-16<br>a=rtpmap:98 telephone-event/48000<br>a=fmtp:98 0-16<br><br>2021-11-19 02:59:02.928627 [DEBUG] switch_core_media.c:5601 Audio Codec Compare [PCMU:0:8000:20:64000:1]/[PCMU:0:8000:20:64000:1]<br>2021-11-19 02:59:02.928627 [DEBUG] switch_core_media.c:5656 Audio Codec Compare [PCMU:0:8000:20:64000:1] ++++ is saved as a match<br>2021-11-19 02:59:02.928627 [DEBUG] switch_core_media.c:5601 Audio Codec Compare [opus:106:48000:20:0:2]/[PCMU:0:8000:20:64000:1]<br>2021-11-19 02:59:02.928627 [DEBUG] switch_core_media.c:5601 Audio Codec Compare [G722:9:8000:20:64000:1]/[PCMU:0:8000:20:64000:1]<br>2021-11-19 02:59:02.928627 [DEBUG] switch_core_media.c:5601 Audio Codec Compare [PCMA:8:8000:20:64000:1]/[PCMU:0:8000:20:64000:1]<br>2021-11-19 02:59:02.928627 [DEBUG] switch_core_media.c:5601 Audio Codec Compare [GSM:3:8000:20:13200:1]/[PCMU:0:8000:20:64000:1]<br>2021-11-19 02:59:02.928627 [DEBUG] switch_core_media.c:5517 Set telephone-event payload to 101@8000<br>2021-11-19 02:59:02.928627 [DEBUG] switch_core_media.c:5860 Set telephone-event payload to 101@8000<br>2021-11-19 02:59:02.928627 [DEBUG] switch_core_media.c:5918 <a href="mailto:sofia/internal/3175520010@3.210.46.94:12000" style="text-decoration-line:none;color:rgb(66,133,244)" rel="noreferrer noreferrer" target="_blank">sofia/internal/3175520010@3.210.46.94:12000</a> Set 2833 dtmf send payload to 101 recv payload to 101<br>2021-11-19 02:59:02.928627 [DEBUG] sofia.c:8427 Processing updated SDP<br>2021-11-19 02:59:02.928627 [DEBUG] switch_core_media.c:8657 Audio params are unchanged for <a href="mailto:sofia/internal/3175520010@3.210.46.94:12000" style="text-decoration-line:none;color:rgb(66,133,244)" rel="noreferrer noreferrer" target="_blank">sofia/internal/3175520010@3.210.46.94:12000</a>.<br>------------------------------------------------------------------------------------------------------------------------------------------<br><br>[Upload Error logs]<br><br>2021-11-19 02:47:03.348630 [ERR] mod_python.c:317 Error calling python script<br>2021-11-19 02:47:03.348630 [ERR] mod_python.c:165 Python Error by calling script "s3_upload": <class 'boto3.exceptions.S3UploadFailedError'><br>Message: Failed to upload /tmp/3175520010_12028997788_fa1b6644-9779-42bb-a830-6bf51381484f.wav to <a href="http://storage.rvm.sas2.co/3175520010_12028997788_fa1b6644-9779-42bb-a830-6bf51381484f.wav" style="text-decoration-line:none;color:rgb(66,133,244)" rel="noreferrer noreferrer" target="_blank">storage.rvm.sas2.co/3175520010_12028997788_fa1b6644-9779-42bb-a830-6bf51381484f.wav</a>: An error occurred (BadDigest) when calling the PutObject operation (reached max retries: 4): The Content-MD5 you specified did not match what we received.<br>Exception: None<br><br>Traceback (most recent call last)<br>        File: "/usr/local/freeswitch/scripts/s3_upload.py", line 22, in fsapi<br>        File: "/usr/local/lib/python2.7/dist-packages/boto3/s3/inject.py", line 131, in upload_file<br>        File: "/usr/local/lib/python2.7/dist-packages/boto3/s3/transfer.py", line 287, in upload_file<br>------------------------------------------------------------------------------------------------------------------------------------<br><br>Any help in this regard is highly appreciated.<br><br>Regards,<br>Danish Daud</font><br></p></div></div></div></div></div>
_________________________________________________________________________<br>
<br>
The FreeSWITCH project is sponsored by SignalWire <a href="https://signalwire.com" rel="noreferrer noreferrer" target="_blank">https://signalwire.com</a><br>
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.<br>
Build your next product on our scalable cloud platform.<br>
<br>
Join our online community to chat in real time <a href="https://signalwire.community" rel="noreferrer noreferrer" target="_blank">https://signalwire.community</a><br>
<br>
Professional FreeSWITCH Services<br>
<a href="mailto:sales@freeswitch.com" target="_blank" rel="noreferrer">sales@freeswitch.com</a><br>
<a href="https://freeswitch.com" rel="noreferrer noreferrer" target="_blank">https://freeswitch.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="https://freeswitch.com/oss" rel="noreferrer noreferrer" target="_blank">https://freeswitch.com/oss</a><br>
<a href="https://freeswitch.org/confluence" rel="noreferrer noreferrer" target="_blank">https://freeswitch.org/confluence</a><br>
<a href="https://cluecon.com" rel="noreferrer noreferrer" target="_blank">https://cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank" rel="noreferrer">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="https://freeswitch.com" rel="noreferrer noreferrer" target="_blank">https://freeswitch.com</a></blockquote></div>