Integrating with Epic
This article details the process of integrating your application with Epic using Vidyo SDK. This integration enables launching video calls directly from the Epic workflow. A critical component is the proper handling of Epic's context data (extData) to ensure seamless data flow. 
Prerequisites
- Connector SDK integrated into your application. 
- Access to an Epic environment configured on your VidyoPortal 
Integration Steps
Obtain Epic data from VidyoPortal
At this step you acquire the room key and display name by making an https request to the VidyoPortal, passing it the Epic encrypted data.
NSString *url = [NSString stringWithFormat:@"%@/join/?extDataType=1&extData=%@", [portal text], [encryptedData text]];
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]
                                                             cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
                                                             timeoutInterval:10];
[urlRequest setHTTPMethod: @"GET"];
...String requestUrl = String.format("%1$s/join/?extDataType=1&extData=%2$s", portal, epicData);
URL url = new URL(strings[0]);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestProperty("User-Agent", "...");- portal: The base URL of the video conferencing service.
- extDataType=1: A parameter indicating the type of external data (should be- 1).
- extData: The encrypted data received from Epic (crucially included in the request).
Now you parse the response to construct the protocol handler URL, get actual room key and your display name for connecting.
NSRange r1 = [urlResponseStr rangeOfString:@"vidyo://join?"];
NSString *substr = [urlResponseStr substringFromIndex:r1.location];
NSRange r2 = [substr rangeOfString:@"\";"];
NSString *protocolHandlerURL = [substr substringToIndex:r2.location];
NSURLComponents *urlComponents = [NSURLComponents componentsWithString:protocolHandlerURL];
NSArray *queryItems = urlComponents.queryItems;
NSString *portal = [self valueForKey:@"portal" fromQueryItems:queryItems];
NSString *roomKey = [self valueForKey:@"roomKey" fromQueryItems:queryItems];
NSString *displayName = [self valueForKey:@"dispName" fromQueryItems:queryItems];
NSString *extData = [self valueForKey:@"extData" fromQueryItems:queryItems]; // Extract extDataint index_of_protocol_handler = response.indexOf(vidyoSubString);
if (index_of_protocol_handler != -1) {
  int index_of_end_protocol_handler = response.indexOf("\"", index_of_protocol_handler);
  protocolHandler = response.substring(index_of_protocol_handler, index_of_end_protocol_handler);
}
Map<String, String> params = splitQuery(protocolHandler);
String portal = params.get("portal");
String roomKey = params.get("roomKey");
String displayName = params.get("dispName");
String extData = params.get("extData"); // Extract extDataParameters being extracted:
- portal: The VidyoPortal service URL.
- roomKey: The unique identifier for the video call.
- displayName: The name of the user joining the call.
- extData: Epic's context data.
Set Epic context into Connector SDK
Before connecting to the call, use the setAdvancedOptions() API of the Video Conferencing SDK to provide the extData. This step is essential for the Epic integration, as it passes context about the patient into the call.
NSString *advancedOptions = [NSString stringWithFormat:@"{ \"extDataType\": \"1\", \"extData\": \"%@\" }", [encryptedData text]]; // Use original Epic encryptedData
[vc setAdvancedOptions:[advancedOptions UTF8String]];String advancedOptions = String.format("{ \"extDataType\": \"1\", \"extData\": \"%1$s\" }", extData); // Use extracted extData
mVidyoConnector.setAdvancedOptions(advancedOptions);Connect to the Call
Finally, use the connectToRoomAsGuest() API of the Connector SDK to establish the video call connection using the extracted parameters.
[vc connectToRoomAsGuest:[[portal text] UTF8String]
                        DisplayName:[[displayName text] UTF8String]
                            RoomKey:[[roomKey text] UTF8String]
                            RoomPin:@""
                  ConnectorIConnect:self];mVidyoConnector.connectToRoomAsGuest(
          portal,
          displayName.trim(),
          roomKey,
          roomPin,
          this);Last updated
