Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Accepting or Declining a Session Referral

After one participant in a signaling session sends a REFER request, the referred-to application can either accept or decline. The general programming patterns for accepting or declining a referral are described in this topic.

The referred-to application receives a REFER request if it has subscribed to the ReferReceived event on the SignalingSession object. The application can either accept or decline the REFER request in the implementation of the event handler. The decision to accept or decline a REFER request often involves some user interactions. The following code example illustrates this process.

The handler for the ReferReceived event accepts the REFER by calling Accept, and declines this message by calling Decline or DeclineWithResponse.

SignalingSession session = ...; // Assumed to be defined elsewhere

// Subscribe to ReferReceived events to receive REFER requests
session.ReferReceived += this.OnReferReceived;

// Handle a received REFER request
void OnReferReceived(object sender, ReferReceivedArgs e)
{
  SignalingSession s = sender as SignalingSession;
  RealTimeAddress referAddress = e.ReferTarget;
  String referMethod = e.Method; // Can be null. Retrieved from method= parameter of refer-to header.
  // 
  // Prompt the user about the Refer with referTo-Uri 
  //   and referFrom-Uri.
  // The prompt should return the result in fAccepted
  // 
  if( fAccepted )
  {
    // Accept REFER with null custom signaling headers.
    ReferNotifier notifier = e.Accept(null);

    // Send notifications to the remote endpoint
    notifier.SetState(ReferState.Trying);
  }   

  else
  {
    e.Decline(); 
    // OR
    // e.DeclineWithResponse(ResponseCode.BusyHere, null, null);
  }
}   
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.