REFER Block Setup

In this article we will show you how the REFER block can be used in routing.

The REFER Block makes it possible to return a call to your PBX, if it has been sent to TENIOS via SIP Trunk. It sends a SIP REFER message with the configured phone number back to the SIP trunk and ends the call.

 

The REFER block may only be used, if the call came in via registered SIP Trunk. If the block is accidentally used outside of the Trunk Routing, the call will be hung up immediately.

 

SIP REFER: How it works

 

  1. The call is incoming on the customer’s PBX via SIP trunk.
  2. The request “SIP INVITE” is transmitted from the Customer PBX to TENIOS. The RTP / Media transfer is activated now.
  3. Once the connection to TENIOS is established, the routing plan stored in the customer portal is processed.
  4. When the “REFER-block” is reached, TENIOS sends the request “SIP REFER” and the RTP / Media transmission between TENIOS and the customer’s PBX is disconnected. From this point on the call is no longer connected to the TENIOS system.
  5. Now the customer can use internal or external forwardings to connect the call to its destination.

 

 

 

Example REFER messageResponse ACCEPTED message

REFER sip: mod_sofia@192.168.168.3:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.168.76:5065;branch=z9hG4bK__7539073431157335561_9
To: “NONAME” <sip:19415551212@192.168.168.3>;tag=BagvZeKSrj7yH
From: <sip:9412848354@192.168.168.76:5065;transport=udp>;tag=203332153_1430350929_10
Call-ID: e505f332-65de-122d-d183-eb12ad0ec1ac
CSeq: 2 REFER
Max-Forwards: 70
Refer-To: <sip:6463959906@192.168.168.3>
Contact: <sip:ssp@192.168.168.76:5065;transport=udp>
Content-Length: 0

SIP/2.0 202 Accepted
Via: SIP/2.0/UDP 192.168.168.76:5065;branch=z9hG4bK__7539073431157335561_9
From: <sip:9412848354@192.168.168.76:5065;transport=udp>;tag=203332153_1430350929_10
To: “NONAME” <sip:9415551212@192.168.168.3>;tag=BagvZeKSrj7yH
Call-ID: e505f332-65de-122d-d183-eb12ad0ec1ac
CSeq: 2 REFER
Contact: <sip:mod_sofia@192.168.168.3:5060>
User-Agent: FreeSWITCH
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, NOTIFY, REFER, UPDATE, REGISTER, INFO
Supported: precondition, path, replaces
Allow-Events: talk, refer
Content-Length: 0

 

Configuration Guide (Example)

 

For this scenario we will use the VoiceBot block that connects a call to Dialogflow.

Requirements:

1. Configure individual routing for the SIP trunk.

 

More about SIP Trunk Configuration can be found hier.

2. Include VoiceBot in Routing

  1. Select “VoiceBot” Block within the dropdown menu.
  2. Select the preconfigured VoiceBot and fill in the mandatory fields.
  3. Define action parameters (e.g. “REFER to Sales”)

 

REFER blocks cannot be called up directly via an action, the have to be wrapped in a Named Routingplan.

3. Create a routing plan with REFER block

  • In the Settings for action parameters, select the block “Routingplan” from the dropdown menu.
  • Now you can choose an existing routing plan or create a new one and add the block “REFER”.
  • Afterwards you can enter the phone number to which the call should be routed.

 

 

4. Asterisk Configuration

To send calls via the SIP trunk, you have to add the following entries in the configuration file extensions.conf  of your Asterisk server:

Configuration file:extensions.conf 

[public]

exten => _+49.,1,Dial(SIP/${EXTEN}@mySipTrunki,30)

[inbound]

exten => +4922155400300,1,Log(NOTICE, Call referred from tenios)
exten => +4922155400300,n,Playback(support)

exten => +4922155400340,1,Log(NOTICE, Call referred from tenios)
exten => +4922155400340,n,Playback(sales)
  • In the example dial plan, all calls which start with +49 are sent to the SIP trunk which is registered with the username „mySipTrunk“ at TENIOS.
  • When calls are transferred back by the REFER block, they are processed in the context Inbound matching the phone number that was specified
TOP