HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
Working with the Transport Layer 289
Persistent Connection Handling
Since a transaction detaches from a connection only before termination, an
INVITE message and its ACK sharing the same addresses will be sent on the
same connection (when the response is not 2xx).
T
RANSACTION USER
PERSISTENCY
A Transaction User (TU) is an object that uses transactions for sending requests.
A call-leg, a subscription and a register-client are all Transaction Users. When
the SIP Stack is configured to use the Transaction User persistency level, the
following two rules apply:
SIP Stack transactions behave as defined in the transaction
persistency level.
A TU tries to use the same connection for all outgoing requests
(sent by different client transactions).
A TU that sends a request queries the client transaction for the connection that
was used. The TU then attaches to this connection and becomes the connection
owner. At this stage, both the TU and the transaction itself are the connection
owners. This guarantees that the connection will not disconnect when the
transaction terminates and detaches from it. When trying to send the next
request, the TU constructs a new client transaction and supplies the transaction
with the connection. If this connection fits, the transaction will use it. If not, a
new connection will be created and the TU will detach from the previous
connection and attach to the new one. It will then use this new connection for
further requests in the same matter.
P
ERSISTENCY LEVEL
C
ONFIGURATION
The persistency level of the SIP Stack objects is determined upon initialization.
However, you can change the persistency level of specific objects using a
dedicated API.
By default, the SIP Stack is initialized to use the “Undefined persistency” level.
To change the persistency level, you should set the ePersistencyLevel parameter
of the RvSipStackCfg configuration structure.
The following lines of code demonstrates how to initialize the SIP Stack with a
“Transaction persistency” level:
/*==========================================================================*/
RvSipStackHandle hStack;
RvSipStackCfg stackCfg;
RvSipStackInitCfg(sizeof(stackCfg),&stackCfg);
stackCfg.tcpEnabled = RV_TRUE;
stackCfg.ePersistencyLevel = RVSIP_TRANSPORT_PERSISTENCY_LEVEL_TRANSC;
RvSipStackConstruct(sizeof(stackCfg),&stackCfg,&hStackMgr);