Skip to content

Instantly share code, notes, and snippets.

@regner
Created October 16, 2017 18:04
Show Gist options
  • Save regner/1585b8155879c6fe71a5ece69e71e5ea to your computer and use it in GitHub Desktop.
Save regner/1585b8155879c6fe71a5ece69e71e5ea to your computer and use it in GitHub Desktop.
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