Created
October 16, 2017 18:04
-
-
Save regner/1585b8155879c6fe71a5ece69e71e5ea to your computer and use it in GitHub Desktop.
Freeswitch unicast tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
sock.bind(('0.0.0.0', 9002)) | |
while True: | |
payload, client_address = sock.recvfrom(1024) | |
if payload: | |
len(payload) | |
sock.sendto(payload, client_address) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
path = 'recording.raw' | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
sock.bind(('0.0.0.0', 9002)) | |
f = open(path) | |
data = f.read(160) | |
while True: | |
payload, client_address = sock.recvfrom(1024) | |
if data: | |
sock.sendto(data, client_address) | |
data = f.read(160) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment