Opened 17 years ago
Closed 13 years ago
#539 closed enhancement (duplicate)
Create media transport dynamically in PJSUA-LIB
Reported by: | bennylp | Owned by: | bennylp |
---|---|---|---|
Priority: | normal | Milestone: | release-2.0-rc |
Component: | pjsua-lib | Version: | trunk |
Keywords: | Cc: | ||
Backport to 1.x milestone: | Backported: |
Description (last modified by bennylp)
Currently all media transports are pre-created in PJSUA-LIB according to the number of maximum calls to be supported. This decision was made to speed up call setup time and to simplify call state logic.
But there are few drawbacks with this approach:
- it requires STUN and TURN transport to be kept-alive, which means it needs to send periodic keep-alive packets, and this is not good for battery consumption in mobile devices.
- it requires TURN long-term allocation, which will fail if the NAT/mapped public IP address mapping has changed.
- even when TURN is not used it may still fail when normal UDP media transport (i.e. not ICE) is used and the IP address (STUN or not) changes.
- it allocates a lot of resources when the number of max_calls is large.
Because of these drawbacks, it's better to create the media transport on demand when a call is set up. To speed up call setup, we may employ caching mechanism where a transport is kept-alive for few seconds and may be reused for subsequent calls. And for flexibility, add a new callback to enable application to create a custom transport for a particular call.
Other benefits of creating transports dynamically are:
- allow different accounts to use different media settings (e.g. ICE, IPv6, etc.)
- dual stack media (to create IPv4 or IPv6 media transport depending on the transport type in the incoming call)
Attachments (1)
Change History (9)
comment:1 Changed 17 years ago by bennylp
- Priority changed from normal to major
comment:2 Changed 17 years ago by bennylp
- Milestone changed from release-0.9.0 to Known-Issues
comment:3 Changed 14 years ago by bennylp
- Milestone changed from Known-Issues-and-Ideas to release-2.0
comment:4 Changed 14 years ago by bennylp
- Description modified (diff)
comment:5 Changed 14 years ago by bennylp
- Description modified (diff)
comment:6 Changed 14 years ago by bennylp
- Milestone changed from release-2.0 to release-2.0-dev
- Priority changed from major to normal
- Version changed from trunk to 2.0-dev-branch
comment:7 Changed 14 years ago by bennylp
- Milestone changed from release-2.0-dev to release-2.0
- Version changed from 2.0-dev-branch to trunk
comment:8 Changed 13 years ago by bennylp
- Resolution set to duplicate
- Status changed from new to closed
The work was done in #1266
This ticket requires pretty major modifications to PJSUA-LIB. The problem is, because media transport creation may not complete immediately (e.g. for STUN and ICE), some actions need to be delayed, and this means we need to duplicate some parameters and save it somewhere for future processing.
For outgoing calls, the msg_data needs to be saved.
For incoming calls, and this is the major problem, the rdata needs to be saved, since we only call on_incoming_call() callback after the media transport is created, and this callback needs rdata parameter. This is a major problem since rdata is a huge object so duplicating it requires a lot of processing and a lot of memory.
Alternatively we could call on_incoming_call() before media channel is created, and delay sending 18x/2xx instead.
But nevertheless this is too much of modifications to do now.
So moving this ticket to Known-Issue for now.