Skip to content

Instantly share code, notes, and snippets.

@regner
Created Oct 16, 2017
Embed
What would you like to do?
Freeswitch unicast tests
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)
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