signalling/client.py: Rename to session-client.py

Also fix CALL -> SESSION naming
This commit is contained in:
Nirbheek Chauhan 2017-10-28 19:00:03 +05:30
parent e9b0656bad
commit c2961305e3

View file

@ -51,27 +51,29 @@ async def hello():
# Initiate call if requested # Initiate call if requested
if CALLEE_ID: if CALLEE_ID:
await ws.send('CALL {}'.format(CALLEE_ID)) await ws.send('SESSION {}'.format(CALLEE_ID))
# Receive messages # Receive messages
sent_sdp = False
while True: while True:
msg = await ws.recv() msg = await ws.recv()
if msg.startswith('ERROR'): if msg.startswith('ERROR'):
# On error, we bring down the webrtc pipeline, etc # On error, we bring down the webrtc pipeline, etc
print('{!r}, exiting'.format(msg)) print('{!r}, exiting'.format(msg))
return return
if sent_sdp:
print('Got reply sdp: ' + msg)
return # Done
if CALLEE_ID: if CALLEE_ID:
if msg == 'CALL_OK': if msg == 'SESSION_OK':
await ws.send(send_sdp_ice()) await ws.send(send_sdp_ice())
# Return so we don't have an infinite loop sent_sdp = True
return
else: else:
print('Unknown reply: {!r}, exiting'.format(msg)) print('Unknown reply: {!r}, exiting'.format(msg))
return return
else: else:
await ws.send(reply_sdp_ice(msg)) await ws.send(reply_sdp_ice(msg))
# Return so we don't have an infinite loop return # Done
return
print('Our uid is {!r}'.format(PEER_ID)) print('Our uid is {!r}'.format(PEER_ID))