pyVoIP icon indicating copy to clipboard operation
pyVoIP copied to clipboard

how can i call a number with out

Open devlop7 opened this issue 3 years ago • 14 comments

hello i use the. example code to connect with the sip

from pyVoIP.VoIP import VoIPPhone, InvalidStateError

def answer(call): # This will be your callback function for when you receive a phone call.
    try:
      call.answer()
      call.hangup()
    except InvalidStateError:
      pass
  

domain = 'sip.com'
user_name = 'myuser'
Password = 'mupass'
Port = 5090
if __name__ == "__main__":
    phone=VoIPPhone(domain,Port, user_name,Password, callCallback=answer, myIP='192.168.43.82')
    phone.start()
    input('Press enter to disable the phone')
    phone.stop()

it's work and registed

the question how can i make a call with out a voice just call number and get ringing in the other side the one who i'm calling him

devlop7 avatar Oct 18 '22 08:10 devlop7

If you're trying to make a call, simply do phone.call(number) after phone.start()

tayler6000 avatar Oct 18 '22 11:10 tayler6000

it dosen't work

devlop7 avatar Oct 18 '22 22:10 devlop7

Are you getting a traceback? If so, can you post it here?

tayler6000 avatar Oct 18 '22 23:10 tayler6000

Invited

devlop7 avatar Oct 18 '22 23:10 devlop7

import time
import wave
from pyVoIP.VoIP import VoIPPhone, InvalidStateError,CallState

def answer(call): # This will be your callback function for when you receive a phone call.
    try:
      call.answer()
      call.hangup()
    except InvalidStateError:
      pass



domain = 'prod.tncp.textnow.com'
user_name = '13043620939_nQmBqJVCWgX3IozpPnIeddbgNlfOBkCXX4O6lbxOB98t'
Password = '98e2c39a48e72f2d3f54eef0a791e8ec'

Port = 5090
if __name__ == "__main__":
    try:
        phone=VoIPPhone(domain,Port, user_name,Password, callCallback=answer)
        phone.start()
        phone.call('+19704321329')
        input('Press enter to disable the phone')
        phone.stop()
    except Exception as e:
      print(e)

devlop7 avatar Oct 18 '22 23:10 devlop7

Well, I don't know about TextNow, but for Flowroute you're not supposed to put the plus, so that could be your issue.

Try the following:

import time
import wave
from pyVoIP.VoIP import VoIPPhone, InvalidStateError,CallState

# For extra debug remove the following quotes around this code.
"""
import pyVoIP
pyVoIP.DEBUG = True
"""

def answer(call): # This will be your callback function for when you receive a phone call.
    try:
      call.answer()
      call.hangup()
    except InvalidStateError:
      pass



domain = 'prod.tncp.textnow.com'
user_name = '13043620939_nQmBqJVCWgX3IozpPnIeddbgNlfOBkCXX4O6lbxOB98t'
Password = '98e2c39a48e72f2d3f54eef0a791e8ec'

Port = 5090
if __name__ == "__main__":
    try:
        phone=VoIPPhone(domain,Port, user_name,Password, callCallback=answer)
        phone.start()
        call = phone.call('19704321329')
        print("Dailing...", end="")
        while call.state == CallState.DIALING:
            print(".", end="")
        print()
        if call.state == CallState.ANSWERED:
            # Do things
            call.hangup()
        input('Press enter to disable the phone')
        phone.stop()
    except Exception as e:
      print(e)

tayler6000 avatar Oct 18 '22 23:10 tayler6000

Did this work for you @devlop7 ?

tayler6000 avatar Oct 19 '22 23:10 tayler6000

it doesn't work even when i put this data in voip app or software it regist and i can make a call from it so i don't know exactly when it doesn't work and other things the TCP protocol is not there in the lib some sip line use it so u should add it if u figer out a way to make it ringing call tell me domain = 'prod.tncp.textnow.com' user_name = '13043620939_nQmBqJVCWgX3IozpPnIeddbgNlfOBkCXX4O6lbxOB98t' Password = '98e2c39a48e72f2d3f54eef0a791e8ec'

devlop7 avatar Oct 20 '22 04:10 devlop7

I've ran the code as well and got the same result as you, I can't seem to find any documentation for textnow's VoIP server, I do see that they use a proxy server to receive calls which pyVoIP does not support, however, I don't seem to be getting that error. I'm wondering if it's tied to #76 as I'm not actually receiving a response to the INVITE according to Wireshark, but I am receiving a response to register requests so I'm unsure.

tayler6000 avatar Oct 20 '22 15:10 tayler6000

i can recive the call normally when i call the sip to your lib

but i can not make a call .........

i can recive a call normal it's work but to make a call it dosen't

devlop7 avatar Oct 20 '22 16:10 devlop7

Can you give me the VoIP documentation for text now?

tayler6000 avatar Oct 23 '22 11:10 tayler6000

it dosen't has one i use wireshare to get data

devlop7 avatar Oct 27 '22 01:10 devlop7

If you're trying to make a call, simply do phone.call(number) after phone.start()

Worked great in my case to make calls, but I was having random issues when connecting to Grandstream UCM6202V1.5A 1.0.20.38 Then I noticed the Grandstream was returning code 491 (Request Pending) and this was incorrectly raising InvalidAccountInfoError. As a workaround I changed the line 1769 of SIP.py to if response.status == SIPStatus.OK or response.status == SIPStatus.REQUEST_PENDING:

guijusto avatar Oct 30 '22 01:10 guijusto

@guijusto it dosen’t works

devlop7 avatar Oct 31 '22 05:10 devlop7