VoIP - mwicat/personal GitHub Wiki
Freeswitch
Debugging
freeswitch -nf -core -nc
Test dialplan:
originate loopback/1902/skinny-patterns hangup inline
Remote
sudo fs_cli -r -l info
Asterisk
Debugging
asterisk -f -v -g
RTP
Tools
http://www.cs.columbia.edu/irt/software/rtptools/
Receive
vlc rtp://localhost:32162
Send
Convert to wav
sox -t ul tetris.dat tetris.wav
Convert anything to mulaw
sox mp3/dwa.mp3 -r 8000 -c 1 -b 8 -t al alaw/dwa.alaw
sox something.wav something.raw -t ul channels 1 rate 64k
ffmpeg -i something.wav -ar 8000 -ac 1 -ab 64000 -f mulaw something.raw
ffmpeg -i ans.wav -ar 8000 -ac 1 -ab 64000 -acodec pcm_mulaw ans_raw.wav
gst-launch filesrc location=file.mp3 ! decodebin2 ! audioconvert ! audioresample ! mulawenc ! audio/x-mulaw,rate=8000,channels=1 ! filesink location=file.raw
Play
vlc -vvv tetris.wav --sout '#rtp{dst=192.168.0.2,port-audio=24590}'
ffmpeg -ab 64000 -acodec copy -ar 8000 -re -f mulaw -i tetris.dat -ar 8000 -ac 1 -ab 64000 -f rtp rtp://192.168.0.2:24598
Transcode
vlc -vvv tetris.au --sout '#transcode{acodec=ulaw,ab=64,scale=1,channels=1,ar=8000}:rtp{dst=192.168.0.2,port-audio=10000}'
Transcode mp3 to alaw on air
echo 'elo elo co tam cześć' | python ivona.py | sox -t mp3 /dev/stdin -r 8000 -c 1 -b 8 -t al /dev/stdout
Inject
sudo nmap -v -p 16384-32767 -sU 192.168.0.2 | awk '/open/{print $1}' | awk -F/ '{print "192.168.0.2/"$1}' | xargs ./samplicate -p 7654
Port range
16384-32767
GStreamer
Get pipe properties
gst-inspect rtppcmupay
Stream sound to phone
gst-launch audiotestsrc ! audioconvert ! audioresample ! mulawenc ! rtppcmupay max-ptime=20000000 ! udpsink host=10.19.0.77 port=6788
gst-launch filesrc location=bozenka.mp3 ! mad ! audioconvert ! audioresample ! mulawenc ! rtppcmupay max-ptime=20000000 ! udpsink host=10.19.0.77 port=6788
gst-launch filesrc location=test.ulaw ! rtppcmupay max-ptime=20000000 pt=0 ! udpsink host=10.19.0.77 port=6788
Stream sound to multiple phones
gst-launch filesrc location=bozenka.ulaw ! rtppcmupay max-ptime=20000000 pt=0 ! tee name=tee ! udpsink host=10.19.0.77 port=6788 tee. ! queue ! udpsink host=10.19.0.70 port=6788
Stream flv to mp3
sudo apt-get install gstreamer0.10-plugins-ugly-multiverse
gst-launch souphttpsrc location="http://o-o.preferred.dialog-waw1.v12.lscache4.c.youtube.com/videoplayback?upn=e88svMx5I3o&sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cid%2Cip%2Cipbits%2Citag%2Csource%2Cupn%2Cexpire&fexp=900147%2C907217%2C907335%2C921602%2C919306%2C922600%2C919316%2C920704%2C924500%2C924700%2C913542%2C919324%2C920706%2C907344%2C912706%2C902518&mt=1341930977&ms=au&algorithm=throttle-factor&itag=35&ip=78.0.0.0&burst=40&sver=3&signature=983BEC5EE13EF007E69AA6193119969409C86163.D8C0E35B268EB5E7B4744619E52CDAB6567DE277&source=youtube&expire=1341953626&key=yt1&ipbits=8&factor=1.25&cp=U0hTRllQUV9HUENOM19RSlVHOmVYaFEzUkJaaHVt&id=1871d2568893c118" ! decodebin ! audioconvert ! lamemp3enc ! filesink location=file.mp3
gst-launch souphttpsrc location="http://o-o.preferred.dialog-waw1.v12.lscache4.c.youtube.com/videoplayback?upn=e88svMx5I3o&sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cid%2Cip%2Cipbits%2Citag%2Csource%2Cupn%2Cexpire&fexp=900147%2C907217%2C907335%2C921602%2C919306%2C922600%2C919316%2C920704%2C924500%2C924700%2C913542%2C919324%2C920706%2C907344%2C912706%2C902518&mt=1341930977&ms=au&algorithm=throttle-factor&itag=35&ip=78.0.0.0&burst=40&sver=3&signature=983BEC5EE13EF007E69AA6193119969409C86163.D8C0E35B268EB5E7B4744619E52CDAB6567DE277&source=youtube&expire=1341953626&key=yt1&ipbits=8&factor=1.25&cp=U0hTRllQUV9HUENOM19RSlVHOmVYaFEzUkJaaHVt&id=1871d2568893c118" ! decodebin ! audioconvert ! alsasink