Genesys Cloud integration with SIP external IVR, transfer back to Genesys
In the previous post we configured a BYOC SIP Trunk on Genesys Cloud and transferred a call from a Genesys flow to an external IVR. Here we will see how to return the call back to the Genesys after connected it with the external IVR.
In summary, we have a user who is connected with an Architect voice flow in Genesys Cloud, the user is transferred via SIP to an external IVR and from there he is transferred back into Genesys Cloud, on the same flow or on any other flow.
Configuring the Trunk to accept REFER method
To enable backward call transfer, we need to ensure that you have enabled Take Back and Transfer on your SIP Trunk configuration.
In this way the system is able to accept the REFER from the external IVR and resume management of the call.
Call Flow
The destination of the transfer is indicated in the Refer-To header of the REFER and must correspond the Destination Number of the Architect flow to which we want to return the call. The flow can be the same one from which the call was originally accepted and then transferred to the IVR, or it can be any other.
The IVR can also send data to the Genesys flow by adding the User-To-User information on the Refer-To header (this data is encoded, refer to the [Genesys documentation](https://help.mypurecloud.com /articles/about-user-to-user-information-uui/) for details).
REFER sip:xxxxxxxxxxxxxxxxxx@10.72.233.134:6060;did=c56.0f4ccd85 SIP/2.0
Via: SIP/2.0/UDP yyyyyyyyyyyyy:5060;branch=z9hG4bK096.49c30b9dd6d37ee9854849d71e92460d.0
Via: SIP/2.0/UDP aaaaaaaaaaaaa:5064;rport=5064;branch=z9hG4bK1216858875
Route: <sip:18.197.177.95:5060;r2=on;transport=udp;ftag=xGPQ-Ds;lr>
Route: <sip:10.72.11.204:5060;r2=on;transport=udp;ftag=xGPQ-Ds;lr>
From: "ShortNumberToPMB" <sip:200221@bbbbbbbbbbbbbbbbbb>;tag=365441247
To: "Roberto Lucchetti" <sip:xxxxxxxxxxxxxxxxxx@18.197.177.95>;tag=xGPQ-Ds
Call-ID: f6e43cfb-4d57-4f2f-bccf-b8e16f3a36af
CSeq: 2 REFER
Contact: <sip:200221@aaaaaaaaaaaaa:5064>
Max-Forwards: 69
User-Agent: imsip ccm/7.8.0.
Refer-to: <sip:+391001234@18.197.177.95?User-to-User=0054686973206973206d792064617461;encoding=hex>
Content-Length: 0
Get the call back to Genesys
When the call comes back to Genesys, it will trigger an Architect flow from the start, so the question is how we could resume a flow where we left it when the call was transferred to the external IVR.
One idea could be to evaluate the presence of UUI data on the REFER. In an Architect flow, UUI data is available on the Call.UUIData variable already decoded, therefore we could test the presence of the UUI data in general or of a particular UUI value, and decide whether the flow should start from the beginning or from another point.