Changes between Version 2 and Version 3 of Using_SIP_TCP
- Timestamp:
- Apr 16, 2012 4:05:06 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Using_SIP_TCP
v2 v3 14 14 == Enabling TCP support == #enable 15 15 16 TCP support must be enabled in the build by setting '''{{{PJ_HAS_TCP}}}''' to non-zero (it is enabled by default). You must then instantiate SIP TCP transport in your application, e.g.:16 TCP support must be enabled in the build by setting '''{{{PJ_HAS_TCP}}}''' to non-zero. This is enabled by default, hence normally there's no specific step to do to enable this. You must then instantiate SIP TCP transport in your application, e.g.: 17 17 18 18 {{{ … … 29 29 == Sending Initial Requests == #initial 30 30 31 According to SIP spec, a request is sent to the URI in the ''Route'' header if it is present, or to the request URI if not. PJSIP only sends the request with TCP if the destination URI contains ''";transport=tcp"'' parameter. Hence sending a request with TCPcan be accomplished in two ways:31 According to SIP spec, a request is sent to the address in the destination URI, which is the URI in the ''Route'' header if it is present, or to the request URI if there is no Route header. PJSIP only sends the request with TCP if the destination URI contains ''";transport=tcp"'' parameter. Hence to send request with TCP, the destination URI must contain this parameter. This can be accomplished in two ways: 32 32 33 1. the most convenient way is to add a route-set entry (with proxy or outbound proxy setting in the account config) containing URI with TCP transport. This way all '''initial''' requests will be sent with TCP via the proxy, and we don't need to change the URI for the registrar and all buddies in the buddy list. Sample code:33 1. The most convenient way is to add a route-set entry (with proxy or outbound proxy setting in the account config) containing URI with TCP transport. This way all '''initial''' requests will be sent with TCP via the proxy, and we don't need to change the URI for the registrar and all buddies in the buddy list. Sample code: 34 34 {{{ 35 35 pjsua_acc_config acc_cfg; … … 39 39 40 40 }}} 41 2. if you don't want to configure route set entry, then you must add ''";transport=tcp"'' parameter to all outgoing URIs (the registrar URI, the buddy URI, the target URI when making calls, the target URI when sending MESSAGE, etc.). For example, to make outgoing call with TCP: 41 If the destination doesn't like the additional ''Route'' header, you can hide this Route header by adding ''";hide"'' parameter to the route URI, for example: 42 {{{ 43 "sip:proxy.example.com;transport=tcp;hide" 44 }}} 45 This way PJSIP will process the request as if the Route header is present, but the header itself will not actually put in the transmission. 46 47 2. If you don't want to configure route set entry, then you must add ''";transport=tcp"'' parameter to all outgoing URIs (the registrar URI, the buddy URI, the target URI when making calls, the target URI when sending MESSAGE, etc.). For example, to make outgoing call with TCP: 42 48 {{{ 43 49 pj_str_t dst = pj_str("sip:alice@example.net;transport=tcp");