Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

White noise when sending audio #288

Open
SMPEJake opened this issue Nov 29, 2024 · 0 comments
Open

White noise when sending audio #288

SMPEJake opened this issue Nov 29, 2024 · 0 comments

Comments

@SMPEJake
Copy link

Hey all!

When i try to write audio to the call, all i get is white noise.

This is my answer function

def answer(call): # This will be your callback function for when you receive a phone call.
    try:
        sound = AudioSegment.from_mp3("onyx_welcome_2.mp3")
        call.answer()
        call.write_audio(sound._data)  # This writes the audio data to the transmit buffer, this must be bytes.

        stop = time.time() + sound.duration_seconds

        while time.time() <= stop and call.state == CallState.ANSWERED:
            time.sleep(0.1)
        call.hangup()
    except InvalidStateError:
      pass

and this is the terminal output

DEBUG:httpx:load_ssl_context verify=True cert=None trust_env=True http2=False
DEBUG:httpx:load_verify_locations cafile='C:\\Users\\jturner\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\certifi\\cacert.pem'
Press enter to disable the phonesys:1: UserWarning: RTP Payload type opus not found.
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\VoIP\VoIP.py:173: DeprecationWarning: createRTPClients is deprecated due to PEP8 compliance. Use create_rtp_clients instead.
  self.createRTPClients(
DEBUG:pydub.converter:subprocess.call(['ffmpeg', '-y', '-f', 'mp3', '-i', 'onyx_welcome_2.mp3', '-acodec', 'pcm_s16le', '-vn', '-f', 'wav', '-'])
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\VoIP\VoIP.py:301: DeprecationWarning: genMs is deprecated due to PEP8 compliance. Use gen_ms instead.
  m = self.genMs()
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\VoIP\VoIP.py:302: DeprecationWarning: genAnswer is deprecated due to PEP8 compliance. Use gen_answer instead.
  message = self.sip.genAnswer(
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\RTP.py:472: DeprecationWarning: encodePCMU is deprecated due to PEP8 compliance. Use encode_pcmu instead.
  return self.encodePCMU(payload)
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\RTP.py:374: DeprecationWarning: parsePacket is deprecated due to PEP8 compliance. Use parse_packet instead.
  self.parsePacket(packet)
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\RTP.py:451: DeprecationWarning: parsePCMU is deprecated due to PEP8 compliance. Use parse_pcmu instead.
  self.parsePCMU(msg)
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\SIP.py:390: DeprecationWarning: parseSIPMessage is deprecated due to PEP8 compliance. Use parse_sip_message instead.
  self.parseSIPMessage(data)
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\SIP.py:749: DeprecationWarning: parseHeader is deprecated due to PEP8 compliance. Use parse_header instead.
  handle(key, val)
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\SIP.py:876: DeprecationWarning: parseMessage is deprecated due to PEP8 compliance. Use parse_message instead.
  self.parseMessage(message)
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\SIP.py:940: DeprecationWarning: genOk is deprecated due to PEP8 compliance. Use gen_ok instead.
  response = self.genOk(message)
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\SIP.py:1339: DeprecationWarning: genTag is deprecated due to PEP8 compliance. Use gen_tag instead.
  f"To: {request.headers['To']['raw']};tag=" + f"{self.genTag()}\r\n"
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\SIP.py:1814: DeprecationWarning: genFirstResponse is deprecated due to PEP8 compliance. Use gen_first_response instead.
  firstRequest = self.genFirstRequest()
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\SIP.py:1152: DeprecationWarning: genBranch is deprecated due to PEP8 compliance. Use gen_branch instead.
  + f"branch={self.genBranch()};rport\r\n"
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\SIP.py:1163: DeprecationWarning: genCallID is deprecated due to PEP8 compliance. Use gen_call_id instead.
  regRequest += f"Call-ID: {self.genCallID()}\r\n"
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\SIP.py:387: DeprecationWarning: parseSIPResponse is deprecated due to PEP8 compliance. Use parse_sip_response instead.
  self.parseSIPResponse(data)
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\SIP.py:1840: DeprecationWarning: genRegister is deprecated due to PEP8 compliance. Use gen_register instead.
  regRequest = self.genRegister(response)
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\SIP.py:1235: DeprecationWarning: genAuthorization is deprecated due to PEP8 compliance. Use gen_authorization instead.
  response = str(self.genAuthorization(request), "utf8")
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\SIP.py:1248: DeprecationWarning: genBranch is deprecated due to PEP8 compliance. Use gen_branch instead.
  + f"{self.genBranch()};rport\r\n"
C:\Users\jturner\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyVoIP\SIP.py:1892: DeprecationWarning: parseMessage is deprecated due to PEP8 compliance. Use parse_message instead.
  self.parseMessage(response)

The only thing on there which stands out to me is the message

UserWarning: RTP Payload type opus not found.

We are using a 3CX server and i am using the key2peace:ProxyAuth branch

Any help is apreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant