Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ovv committed May 7, 2018
1 parent 8a2a81e commit 29e15fa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
15 changes: 15 additions & 0 deletions aiosip/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@ async def prepare(self, status_code, *args, **kwargs):

return dialog

async def unauthorized(self, msg):
dialog = self._create_dialog()
await dialog.unauthorized(msg)
return dialog

def validate_auth(self, msg, password):
dialog = self._create_dialog()
if msg.auth and msg.auth.validate(password, dialog._nonce):
dialog._nonce = None
return True
elif msg.method == 'CANCEL':
return True
else:
return False

request = Request()
await route(request, msg)

Expand Down
2 changes: 1 addition & 1 deletion aiosip/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def dialog_id(self):
def _receive_response(self, msg):

if 'tag' not in self.to_details['params']:
del self.app._dialogs[self.dialog_id]
# del self.app._dialogs[self.dialog_id]
self.to_details['params']['tag'] = msg.to_details['params']['tag']
self.app._dialogs[self.dialog_id] = self

Expand Down
3 changes: 3 additions & 0 deletions aiosip/peers.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def _create_dialog(self, method, from_details, to_details, contact_details=None,

LOG.debug('Creating: %s', dialog)
self._app._dialogs[dialog.dialog_id] = dialog
self._app._dialogs[
frozenset((dialog.original_msg.to_details['params'].get('tag'), None, dialog.call_id))
] = dialog
return dialog

This comment has been minimized.

Copy link
@ovv

ovv May 7, 2018

Author Contributor

@vodik It seems #112 doesn't track correctly all dialogs. In my case when dealing with authentication my client comes back without the To header tag in the authenticated request.

Big hack to bypass that for now (see dialog.py:67 too)

This comment has been minimized.

Copy link
@ovv

ovv May 7, 2018

Author Contributor

I had the time to make a PR about that #118


async def request(self, method, from_details, to_details, contact_details=None, password=None, call_id=None,
Expand Down

0 comments on commit 29e15fa

Please sign in to comment.