aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/rtp/rtp_replay_sip.st
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-07-04 23:08:44 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-07-12 23:17:10 +0000
commit29b9206e804e8e5d5f6ea6f9d8c1f8af35332480 (patch)
tree77eed5bde035b276b63f92c0f23e944049e59897 /contrib/rtp/rtp_replay_sip.st
parent9e3c66b1814246f6c06a6f78975f54dfe9e2cf8c (diff)
move openbsc/* to repos root
This is the first step in creating this repository from the legacy openbsc.git. Like all other Osmocom repositories, keep the autoconf and automake files in the repository root. openbsc.git has been the sole exception, which ends now. Change-Id: I9c6f2a448d9cb1cc088cf1cf6918b69d7e69b4e7
Diffstat (limited to 'contrib/rtp/rtp_replay_sip.st')
-rw-r--r--contrib/rtp/rtp_replay_sip.st87
1 files changed, 87 insertions, 0 deletions
diff --git a/contrib/rtp/rtp_replay_sip.st b/contrib/rtp/rtp_replay_sip.st
new file mode 100644
index 000000000..5f844df1d
--- /dev/null
+++ b/contrib/rtp/rtp_replay_sip.st
@@ -0,0 +1,87 @@
+"""
+Create a SIP connection and then stream...
+"""
+
+PackageLoader
+ fileInPackage: #OsmoSIP.
+
+"Load for the replay code"
+FileStream fileIn: 'rtp_replay_shared.st'.
+
+
+Osmo.SIPCall subclass: StreamCall [
+ | sem stream |
+
+ createCall: aSDP [
+ | sdp |
+ stream := RTPReplay on: 'rtp_ssrc6976010.240.240.1_to_10.240.240.50.state'.
+ sdp := aSDP % {stream localPort}.
+ ^ super createCall: sdp.
+ ]
+
+ sem: aSemaphore [
+ sem := aSemaphore
+ ]
+
+ sessionNew [
+ | host port |
+ Transcript nextPutAll: 'The call has started'; nl.
+ Transcript nextPutAll: sdp_result; nl.
+
+ host := SDPUtils findHost: sdp_result.
+ port := SDPUtils findPort: sdp_result.
+
+ [
+ stream streamAudio: host port: port.
+ Transcript nextPutAll: 'Streaming has finished.'; nl.
+ ] fork.
+ ]
+
+ sessionFailed [
+ sem signal
+ ]
+
+ sessionEnd [
+ sem signal
+ ]
+]
+
+Eval [
+ | transport agent call sem sdp_fr sdp_amr |
+
+
+ sdp_fr := (WriteStream on: String new)
+ nextPutAll: 'v=0'; cr; nl;
+ nextPutAll: 'o=twinkle 1739517580 1043400482 IN IP4 127.0.0.1'; cr; nl;
+ nextPutAll: 's=-'; cr; nl;
+ nextPutAll: 'c=IN IP4 127.0.0.1'; cr; nl;
+ nextPutAll: 't=0 0'; cr; nl;
+ nextPutAll: 'm=audio %1 RTP/AVP 0 101'; cr; nl;
+ nextPutAll: 'a=rtpmap:0 PCMU/8000'; cr; nl;
+ nextPutAll: 'a=rtpmap:101 telephone-event/8000'; cr; nl;
+ nextPutAll: 'a=fmtp:101 0-15'; cr; nl;
+ nextPutAll: 'a=ptime:20'; cr; nl;
+ contents.
+
+ sem := Semaphore new.
+ transport := Osmo.SIPUdpTransport
+ startOn: '0.0.0.0' port: 5066.
+ agent := Osmo.SIPUserAgent createOn: transport.
+ transport start.
+
+ call := (StreamCall
+ fromUser: 'sip:1000@sip.zecke.osmocom.org'
+ host: '127.0.0.1'
+ port: 5060
+ to: 'sip:123456@127.0.0.1'
+ on: agent)
+ sem: sem; yourself.
+
+ call createCall: sdp_fr.
+
+
+ "Wait for the stream to have ended"
+ sem wait.
+
+ (Delay forSeconds: 4) wait.
+]