-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
requests example for 2.0.0a3 #217
Comments
@BRIDGE-AI It looks like you are doing things correctly. Here is the documentation on this feature. Looking at this error it seems like there is a problem with the authentication function which has changed since 1.6. I'll see if I can diagnose the issue, but a packet capture would be very helpful. If you put the following at the beginning of your code it should make it fairly easy: import pyVoIP
pyVoIP.DEBUG = True |
Thank you, @tayler6000 I used the example code. # https://pyvoip.readthedocs.io/en/development/Examples.html#ivr-phone-menus
import pyVoIP; pyVoIP.DEBUG = True
from pyVoIP.credentials import CredentialsManager
from pyVoIP.VoIP.call import VoIPCall
from pyVoIP.VoIP.error import InvalidStateError
from pyVoIP.VoIP.phone import VoIPPhone, VoIPPhoneParameter
import time
import wave
class Call(VoIPCall):
def ringing(self, invite_request):
try:
f = wave.open('announcment.wav', 'rb')
frames = f.getnframes()
data = f.readframes(frames)
f.close()
call.answer()
call.write_audio(data) # This writes the audio data to the transmit buffer, this must be bytes.
stop = time.time() + (frames / 8000) # frames/8000 is the length of the audio in seconds. 8000 is the hertz of PCMU.
while time.time() <= stop and call.state == CallState.ANSWERED:
time.sleep(0.1)
call.hangup()
except InvalidStateError:
pass
except:
call.hangup()
if __name__ == "__main__":
server_ip = "211.233.26.247"
port = 5060
username = "07076830783"
password = ""
localip = "0.0.0.0"
cm = CredentialsManager()
#cm.add(<SIP server username>, <SIP server password>)
cm.add(username, password)
#params = VoIPPhoneParameter(<SIP server IP>, <SIP server port>, <SIP server user>, cm, bind_ip=<Your computer's local IP>, call_class=Call)
params = VoIPPhoneParameter(server_ip, port, username, cm, bind_ip=localip, call_class=Call)
phone = VoIPPhone(params)
phone.start()
input('Press enter to disable the phone')
phone.stop() And I've got below logs right after run the code.
Can you check this out? |
Yes, this is exactly what I needed, and this should be an easy error to fix. Thank you. |
This is now be fixed in 2.0.0a4 |
Hi @tayler6000 I hope you're doing good. I also need your help with same issue. My code was working with stable version which is 1.6.8 but I want to use call transfer feature so I upgraded to version 2.0.0a4. But I am not able to make it work. old code (1.6.8)
new code (2.0.0a4)
|
Hello,
I'm trying to adapting 2.0.0a3 for the new feature 'transfer' from 1.6.6. #207
First of all, I've upgraded python to 3.8 from 3.7.
But it has quietly different interface like below.
import
create phone
but still I has some errors
This server works fine on 1.6.6.
Is this right implementation? or does I missed some reference or document?
In conclusion,
may I ask you a new example code for 2.0 please? especially for transfer feature.
Thank you, always.
The text was updated successfully, but these errors were encountered: