<Refer>

The <Refer> verb transfers a SIP call in SignalWire to a transfer target using the SIP REFER method. This verb returns upon completion of transfer, on failure of transfer, on hangup, or on time out while waiting for NOTIFY. SignalWire will not hang up after <Refer> until all verbs have been processed.

Verb Attributes

Attribute
action optionalThe action attribute takes an absolute or relative URL. On completion of the transfer, a request to this URL is made. If action is not provided, SignalWire will continue reading the next verb in the document. See below for specified request parameters.
method optionalSpecifies whether the action is a GET or a POST. Default value is POST.

Request parameters for the action URL

The action request contains the Standard Request Parameters as well as:

Parameter
ReferCallStatus stringThe result of the transfer based on the reply to the SIP REFER method and the SIP NOTIFY events received afterwards. This parameter will not be reported if no SIP NOTIFY events are received. See below for all possible values.
ReferSipResponseCode stringThe code received in response to the SIP REFER method. 202 when accepted.
NotifySipResponseCode stringThe last response code reported by the SIP NOTIFY events. This is the code sent by the transfer target in response to the SIP INVITE method. This parameter will not reported if no SIP NOTIFY events are received.

Values for the ReferCallStatus parameter

The parameter ReferCallStatus has the following values:

Value
in-progressSIP REFER accepted and SignalWire received 200 via SIP NOTIFY.
busySIP REFER accepted and SignalWire received 486 or 600 via SIP NOTIFY.
no-answerSIP REFER accepted and SignalWire received 487 via SIP NOTIFY.
canceledSIP REFER accepted, however the call ended before the transfer completed.
failedAn error occurred through the <Refer> verb, an error received in response to SIP REFER, or a 4xx/5xx/6xx error was received via SIP NOTIFY.

Nouns

The noun of a LaML verb is nested within the verb upon which the verb acts. <Refer> has the following nouns:

Noun
<Sip>The SIP URI to which to transfer this call.

Nesting

No other verbs can be nested within <Refer> and you cannot nest <Refer> within any other verbs.

Examples

Transfer to SIP URI

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Refer action="https://example.com/refer-completed.xml" method="GET"><Sip>sip:[email protected]</Sip></Refer>
</Response>
const { RestClient } = require('@signalwire/node')
const response = new RestClient.LaML.VoiceResponse()

const refer = response.refer({ action: 'https://example.com/refer-completed.xml', method: 'GET' })
refer.sip('sip:[email protected]')
console.log(response.toString())
<?php
  use SignalWire\LaML;
  $response = new LaML;

  $refer = $response->refer(['action' => 'https://example.com/refer-completed.xml', 'method' => 'GET']);
  $refer->sip('sip:[email protected]');
  echo $response;
?>
using Twilio.TwiML;
using System;


class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        var refer = response.Refer(action: new Uri("https://example.com/refer-completed.xml"), method: Twilio.Http.HttpMethod.Get);
        refer.sip(new Uri("sip:[email protected]"));
        response.append(refer);
        Console.WriteLine(response.ToString());
    }
}
from signalwire.voice_response import VoiceResponse, Refer

response = VoiceResponse()
refer = response.refer(action='https://example.com/refer-completed.xml', method='GET')
refer.sip('sip:[email protected]')
response.append(refer)

print(response)
require 'signalwire/sdk'

response = Signalwire::Sdk::VoiceResponse.new do |response|
  refer = response.refer(action: 'https://example.com/refer-completed.xml', method: 'GET') do |refer|
    refer.sip('sip:[email protected]')
  end
end

puts response.to_s