Out of Dialog Requests

From reSIProcate
Jump to navigation Jump to search

Sending An Out-of-Dialog Request[edit]

  • Ensure you install an OutOfDialogHandler. ie: mDum->addOutOfDialogHandler(REFER, mUA);
  • Implement the OutOfDialogHandlers. ie:
// OutOfDialogHandler //////////////////////////////////////////////////////////
virtual void onSuccess(resip::ClientOutOfDialogReqHandle, const resip::SipMessage& response);
virtual void onFailure(resip::ClientOutOfDialogReqHandle, const resip::SipMessage& response);
virtual void onReceivedRequest(resip::ServerOutOfDialogReqHandle, const resip::SipMessage& request);
  • If you are only sending a request, then all you need to fill in is the onSuccess and onFailure methods. This is where you place your logic to handle a successful or failed OOD request.
  • There are two methods on DialogUsageManager class for creating OOD requests. See DialogUsageManager::makeOutOfDialogRequest. One takes a user profile. The other will use the installed MasterProfile.
  • You can provide an AppDialogSet to the methods, if you want to store application specific data that you can access later in the onSuccess and onFailure callbacks.
  • Call DialogUsageManager::makeOutOfDialogRequest with something like: makeOutOfDialogRequest(toAor, userProfile, REFER, MyAppDialogSet) This will create a REFER message and pass it back to you in a SharedPtr.
  • You can add modify headers on the returned message. ie: for an OOD REFER you will probably want to add a ReferTo and/or ReferredBy headers to the returned message.
  • Use DialogUsageManager::send when you are happy with the message to send it out. See dum/test/BasicCall main line 725 for a really basic example of sending an OOD OPTIONs message.
  • Expect to receive either an onSuccess or onFailure callback.


Receiving an Out-of-Dialog Request[edit]

  • Ensure you install an OutOfDialogHandler. ie: mDum->addOutOfDialogHandler(REFER, mUA);
  • Implement the OutOfDialogHandlers. ie:
// OutOfDialogHandler //////////////////////////////////////////////////////////
virtual void onSuccess(resip::ClientOutOfDialogReqHandle, const resip::SipMessage& response);
virtual void onFailure(resip::ClientOutOfDialogReqHandle, const resip::SipMessage& response);
virtual void onReceivedRequest(resip::ServerOutOfDialogReqHandle, const resip::SipMessage& request);
  • In particular you must implement the onReceivedRequest callback to handle inbound OOD requests.
  • If you are handling an OOD options request, there is a convenient answerOptions API on the ServerOutOfDialogReq class this is accessible from the ServerOutOfDialogReqHandle parameter of the onReceivedRequest callback. This builds a response for you can pass you the message back.
  • Alternatively you can use the ServerOutOfDialogReq accept or reject methods to have a generic success or failure response made for you.
  • Alter the response in anyway you like, then use ServerOutOfDialgRequest::send method to send the response. For example a quick way to generate and send an OPTIONS response is the following: ood->send(ood->answerOptions());
  • Custom AppDialogSet assignment can be done, via the normal AppDialogSetFactory::createAppDialogSet callback.
  • User Profile assignment can be done, the same way as any request, via the AppDialogSet::selectUASUserProfile callback.