Skip to content

Handling Options Requests

Scott Godin edited this page Mar 5, 2021 · 1 revision

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

DUM and Profile Setup

  • 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

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...
 optionsMsg->setContents(&sdp);
 dum.send(optionsMsg);

Handling OPTIONS Requests

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

 virtual void onReceivedRequest(ServerOutOfDialogReqHandle ood, const SipMessage& request)
 {
    switch(request.header(h_CSeq).method())
    {
    case OPTIONS:
    {
       SharedPtr<SipMessage> resp = ood->answerOptions();
       SdpContents sdp;
       ...code to fill in sdp...
       resp->setContents(&sdp);
       ood->send(resp);
       break;
    }
    ...
 }
Clone this wiki locally