Skip to content

Commit

Permalink
Remove some dead proxy code
Browse files Browse the repository at this point in the history
  • Loading branch information
ovv committed Apr 25, 2018
1 parent b51ad8e commit 90ce81a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 52 deletions.
11 changes: 0 additions & 11 deletions aiosip/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,6 @@ async def start_unreliable_transaction(self, msg, method=None):
self.transactions[method or msg.method][msg.cseq] = transaction
return await transaction.start()

async def start_proxy_transaction(self, msg, timeout=5):
if msg.cseq not in self.transactions[msg.method]:
transaction = ProxyTransaction(dialog=self, original_msg=msg, loop=self.app.loop, timeout=timeout)
self.transactions[msg.method][msg.cseq] = transaction
async for response in transaction.start():
yield response
else:
LOG.debug('Message already transmitted: %s %s, %s', msg.cseq, msg.method, msg.headers['Call-ID'])
self.transactions[msg.method][msg.cseq].retransmit()
return

def end_transaction(self, transaction):
to_delete = list()
for method, values in self.transactions.items():
Expand Down
40 changes: 0 additions & 40 deletions aiosip/peers.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,46 +127,6 @@ async def invite(self, dialog_factory=InviteDialog, **kwargs):
await dialog.start()
return dialog

async def proxy_request(self, dialog, msg, timeout=5):
if msg.method == 'ACK':
self.send_message(msg)
return

proxy_dialog = self._app._dialogs.get(dialog.call_id)
if not proxy_dialog:
proxy_dialog = self._create_dialog(
method=msg.method,
from_details=dialog.from_details,
to_details=dialog.to_details,
call_id=dialog.call_id
)
elif msg.cseq in proxy_dialog.transactions[msg.method]:
proxy_dialog.transactions[msg.method][msg.cseq].retransmit()
return

if isinstance(msg.headers['Via'], str):
msg.headers['Via'] = [msg.headers['Via']]

host, port = self.local_addr
if self._app.defaults['override_contact_host']:
host = self._app.defaults['override_contact_host']

msg.headers['Via'].insert(0, 'SIP/2.0/%(protocol)s {host}:{port};branch={branch}'.format(
host=host,
port=port,
branch=utils.gen_branch(10)
)
)

async for response in proxy_dialog.start_proxy_transaction(msg, timeout=timeout):
yield response

proxy_dialog._maybe_close(msg)

def proxy_response(self, msg):
msg.headers['Via'].pop(0)
return self.send_message(msg)

@property
def protocol(self):
return type(self._protocol)
Expand Down
1 change: 0 additions & 1 deletion tests/test_sip_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class ServerDialplan(aiosip.BaseDialplan):

async def resolve(self, *args, **kwargs):
await super().resolve(*args, **kwargs)

return self.subscribe

async def subscribe(self, request, message):
Expand Down

0 comments on commit 90ce81a

Please sign in to comment.