Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contact/SIP URI overhaul #107

Open
vodik opened this issue Apr 20, 2018 · 2 comments
Open

Contact/SIP URI overhaul #107

vodik opened this issue Apr 20, 2018 · 2 comments

Comments

@vodik
Copy link
Contributor

vodik commented Apr 20, 2018

Hey, so my team, specifically my coworker @dtkerr, has put together a yarl-like like library for SIP URIs: ursine

I'd like to integrate it into aiosip as it will solve a lot of problems:

  • We've had bugs in the part with mutability (e.g. passing from_details into a function which adds a tag, and suddenly having tags propagate everywhere inappropriately)

  • Building to_uri/from_uri/contact_uri can be very tedious:

to_details=Contact.from_header(f"<sip:{user}@{host}:{port};transport={transport}")
from_details=...
contact_details=...
  • Its tedious properly handling contact details. Say I'm handling an inbound REGISTER to then later route out calls:
contact_addr = (msg.contact_details['uri']['host'],
                msg.contact_details['uri']['port'])
                
peer = await app.connect(contact_addr, aiosip.UDP,
                         local_addr=("0.0.0.0", 5060))

Not to mention this ignores transport - which can be mixed. I've just been assuming this whole time I'll be using UDP only because its easiest and I'll revisit other transports later. I do have a need to support sips:... eventually.

What I'd really like to see:

to_uri=URI.build(scheme="sip", user=user, host=host, port=port)
from_uri=...
contact_uri=...

This can also help with #63 and we can create the URI with to_uri.with_user(None)

And I think we should support making connections with SIP uris directly:

peer = await app.connect(msg.contact_uri, local_addr=("0.0.0.0", 5060))

Its a small library with no other external dependencies, which we've done separately intentionally so we can use it in a few other projects that do SIP stuff but don't use aiosip, but I'm open to merging it as well.

@ovv
Copy link
Contributor

ovv commented Apr 20, 2018

Big thumbs up for that 👍

Changing contact / uri handling was always on my mind as it was quite complicated. That looks like it will solve quite a few problems so I'm all for it

@ludovic-gasc
Copy link
Contributor

Ok for me also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants