Handling Options Requests

From reSIProcate
Jump to navigation Jump to search

Note: The current implementation for handling of OPTIONS requests, treats all options requests as out-of-dialog requests.

DUM and Profile Setup[edit]

  • Add OPTIONS as a supported method: masterProfile.addSupportedMethod(OPTIONS);
  • Add application/sdp as a supported mime type: masterProfile.addSupportedMimeType(OPTIONS, Mime("application", "sdp"));
  • Add an OutOfDialogHandler to DUM: dum.addOutOfDialogHandler(OPTIONS, handler); // Note: handler pointer should be a class that inherits from OutOfDialogHandler

Initiating Out-of-Dialog OPTIONS Requests[edit]

Use the DialogUsageManager::makeOutOfDialogRequest(referTo) API. You can optionally add SDP info to the request before you send it.

SharedPtr<SipMessage> optionsMsg = dum.makeOutOfDialogRequest(toUri, OPTIONS);
// Add sdp
SdpContents sdp;
...code to fill in sdp...

Handling OPTIONS Requests[edit]

The application should implement the onReceivedRequest callback from the OutOfDialogHandler registered with dum. Sample Code:

virtual void onReceivedRequest(ServerOutOfDialogReqHandle ood, const SipMessage& request)
   case OPTIONS:
      SharedPtr<SipMessage> resp = ood->answerOptions();
      SdpContents sdp;
      ...code to fill in sdp...