call gapk to send an RTP stream WIP
This commit is contained in:
parent
d2e3162c22
commit
227209fe93
|
@ -12,6 +12,7 @@
|
|||
import mncc
|
||||
import ctypes
|
||||
import pykka
|
||||
import subprocess
|
||||
|
||||
import logging as log
|
||||
|
||||
|
@ -339,6 +340,12 @@ class GsmCallConnector(pykka.ThreadingActor):
|
|||
self.call_a.tell({'type':'connect_rtp', 'rtp':self.rtp_b})
|
||||
self.call_b.tell({'type':'connect_rtp', 'rtp':self.rtp_a})
|
||||
|
||||
def send_rtp(self, rtp):
|
||||
cmd = ('osmo-gapk', '-i', '/docker/1frame.fr1', '-f', 'gsm', '-g', 'gsm', '-O', '%s/%s' % (rtp.ip_str(), rtp.port))
|
||||
log.info('Sending RTP: %s' % (' '.join(cmd)))
|
||||
p = subprocess.Popen(cmd)
|
||||
log.info('Process started: RTP: %s' % p.pid)
|
||||
|
||||
def bridge_legs(self):
|
||||
# bridge the voice channels of both call legs in the classic way
|
||||
if self.rtp_bridge:
|
||||
|
@ -359,6 +366,10 @@ class GsmCallConnector(pykka.ThreadingActor):
|
|||
log.info('Both A and B in state NULL -> Terminating')
|
||||
self.stop()
|
||||
|
||||
if self.state_a == 'ACTIVE' and self.state_b == 'ACTIVE':
|
||||
self.send_rtp(self.rtp_a)
|
||||
#self.send_rtp(self.rtp_b)
|
||||
|
||||
def on_receive(self, message):
|
||||
if message['type'] == 'call_state_change':
|
||||
self.call_state_change(message['called'], message['old_state'], message['new_state'])
|
||||
|
|
|
@ -67,9 +67,13 @@ class mncc_data_frame_msg(mncc.gsm_data_frame, mncc_msg_common):
|
|||
|
||||
class mncc_rtp_msg(mncc.gsm_mncc_rtp, mncc_msg_common):
|
||||
def __str__(self):
|
||||
return 'mncc_rtp_msg(type=0x%04x, callref=%u, ip=%x, port=%u)' % (self.msg_type, self.callref, self.ip, self.port)
|
||||
return 'mncc_rtp_msg(type=0x%04x, callref=%u, ip=%s, port=%u)' % (self.msg_type, self.callref, self.ip_str(), self.port)
|
||||
def __unicode__(self):
|
||||
return u'mncc_rtp_msg(type=0x%04x, callref=%u, ip=%x, port=%u)' % (self.msg_type, self.callref, self.ip, self.port)
|
||||
return u'mncc_rtp_msg(type=0x%04x, callref=%u, ip=%s, port=%u)' % (self.msg_type, self.callref, self.ip_str(), self.port)
|
||||
|
||||
def ip_str(self):
|
||||
numbers = reversed([str((self.ip >> (8*b)) & 0xff) for b in range(4)])
|
||||
return '.'.join(numbers)
|
||||
|
||||
class mncc_bridge_msg(mncc.gsm_mncc_bridge, mncc_msg_common):
|
||||
def __str__(self):
|
||||
|
|
Loading…
Reference in New Issue