~noskcaj/ubuntu/saucy/sflphone/merge-1.2.3-2

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject/pjsip/docs/TRANSPORT-PROBLEMS.TXT

  • Committer: Jackson Doak
  • Date: 2013-07-10 21:04:46 UTC
  • mfrom: (20.1.3 sid)
  • Revision ID: noskcaj@ubuntu.com-20130710210446-y8f587vza807icr9
Properly merged from upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Dialog's Contact Address Problems
2
 
 
3
 
 
4
 
Background
5
 
 
6
 
When creating a dialog (UAC or UAS dialog), application needs to specify local address to be put in the Contact header generated by the dialog. This address normally is derived from the transport address created by the application.
7
 
 
8
 
This can be a complicated thing to do, because application needs to select the appropriate address based on the transport being used to contact remote peer, and it's not so easy especially when multiple transports are created, or when multiple interfaces are present in the host (multihoming).
9
 
 
10
 
(Note: also similarly for client registration).
11
 
 
12
 
So a change is being/to be made to allow the dialog to automate this process. If application specify NULL as the value of the local contact when creating a dialog, then the dialog should choose the best transport address according to the following rules.
13
 
 
14
 
 
15
 
1a. UAC
16
 
 
17
 
UAC SHOULD select the Contact address based on the transport to be used to send initial request to target (this can be deduced by the ";transport" param in the target URI).  For example, if initial transport is UDP, then the Contact SHOULD specify the appropriate UDP transport address.
18
 
 
19
 
When there are multiple transports available to reach the destination (such as multiple UDP transports, although this is not really tested/supported), then which transport to use follows the policy used by the transport manager.
20
 
 
21
 
Note that target can be the URI in the request URI, or the first route in the route set. Because initial route set is specified AFTER dialog is created, the Contact header generation is done when the initial request is created/sent.
22
 
 
23
 
Unsolved problem(s):
24
 
 - what if the remote Contact header in the 2xx response indicates different transport? Ideally the local Contact needs to be updated too, but this is quite a complicated problem, because if we change the local Contact, then remote may change its Contact too, and this can result in an endles loop.
25
 
 
26
 
 
27
 
1b. UAS
28
 
 
29
 
UAS MUST select the Contact address based on the value of Contact header and the Record-Route set in the incoming request.
30
 
 
31
 
 
32
 
 
33
 
 
34
 
2. Multihoming
35
 
 
36
 
Problem:
37
 
If application does not specify the address to be used when creating SIP transport, then transport address is calculated based on the primary IP address of the local host. Sometimes this is not the correct IP to be used by the dialog, especially when there are multiple interfaces in the host. If this "incorrect" address is specified in the Contact, then remote would not be able to send request to local host.
38
 
 
39
 
 
40
 
Workaround:
41
 
Change the behavior of determining local IP. Instead of calling gethostbyname() for local host, the local interface IP is determined by creating an UDP socket, do UDP connect() to some public host, and get the local IP address of the socket.
42
 
 
43
 
Although this does not fully solve the problem, hopefully it solves many problems in typical desktop systems, where an "unwanted" adapter takes precendence over the "wanted" adapter on the host/address resolution.
44
 
 
45
 
A fully working solution would probably involve having a table to track which interface to use based on the destination, or to query the host's routing table.
46