Receiving transaction termination notifications

From reSIProcate
Jump to navigation Jump to search

A TU (transaction user) can register to be notified of transaction terminations. To enable it, call SipStack::registerForTransactionTermination() on your SipStack object.

When transactions terminate, the SipStack will pass a TransactionTerminated TransactionMessage up to the TU through the TUfifo. This is retrieved by the TU through a call to SipStack::receiveAny(). The message indicates if the transaction is client or server and also provides the associated transaction id.

class TransactionTerminated : public TransactionMessage
{
  public:
     RESIP_HeapCount(TransactionTerminated);
     TransactionTerminated(const Data& tid, bool isClient, TransactionUser* tu) : 
        mTransactionId(tid), 
        mIsClient(isClient)
     {
        setTransactionUser(tu);         
     }
     virtual const Data& getTransactionId() const { return mTransactionId; }
     virtual bool isClientTransaction() const { return mIsClient; }
     virtual std::ostream& encode(std::ostream& strm) const { return encodeBrief(strm); }
     virtual std::ostream& encodeBrief(std::ostream& str) const;
     
     Data mTransactionId;
     bool mIsClient;
};