private void OnMessageReceived(object sender, MessageReceivedEventArgs e)
 {
     this.LockAndExecuteOotyCallback(delegate
     {
         try
         {
             this.DebugTrace("Inside BaseUMconnectivityTester OnMessageReceived", new object[0]);
             this.HandleMessageReceived(e);
         }
         finally
         {
             e.SendResponse(200);
         }
     });
 }
示例#2
0
            private void OnDefaultRoutingEndpointMessageReceived(object sender, MessageReceivedEventArgs args)
            {
                //First verify the origin to see whether it is a legitimate source (i.e. Contact Center WCF Service)
                List <SignalingHeader> listOfHeaders = new List <SignalingHeader>(args.RequestData.SignalingHeaders);

                listOfHeaders.ForEach(header =>
                {
                    if (header.Name.Equals("Contact", StringComparison.OrdinalIgnoreCase))
                    {
                        // check whether the contact address is a trusted GRUU and thus a legitimate source
                        if (_acdPlatform._platform.TopologyConfiguration.IsTrusted(args.Participant.ContactUri))
                        {
                            //check that the verb and content-type of the incoming request
                            if (args.MessageType == MessageType.Service &&
                                args.ContentType != null &&
                                args.ContentType.Equals(this.DiscoveryContentType))
                            {
                                // this is a legitimate request, let's return the list of portals to the requestor.
                                // the information needed consists of a collection of token representing the portal and its SIP URI
                                _acdPlatform._wcfAnonymousSubscriberUri = args.Participant.Uri;

                                _acdPlatform.UpdateAcdPlatformAnonymousSubscriberUri(_acdPlatform._wcfAnonymousSubscriberUri);

                                try
                                {
                                    // construct the list of Portals that need to be sent back.
                                    queueUriMappingListType contactCenterDiscoveryInfo = new queueUriMappingListType();

                                    contactCenterDiscoveryInfo.queueUriMapping = new queueUriMappingType[_acdPlatform._configuration.PortalConfigurations.Count];

                                    int i = 0;

                                    _acdPlatform._configuration.PortalConfigurations.ForEach(portalConfig =>
                                    {
                                        queueUriMappingType portalDiscoveryInfo = new queueUriMappingType();
                                        portalDiscoveryInfo.queueName           = portalConfig.Token;
                                        portalDiscoveryInfo.uriValue            = portalConfig.Uri;

                                        contactCenterDiscoveryInfo.queueUriMapping[i++] = portalDiscoveryInfo;
                                    });


                                    //Serialize using XmlSerializer.

                                    XmlSerializer serializer = new XmlSerializer(typeof(queueUriMappingListType));
                                    string discoveryResponse = SerializerHelper.SerializeObjectFragment(contactCenterDiscoveryInfo, serializer);


                                    args.SendResponse(ResponseCode.Success,
                                                      new ContentType("application/ContactCenterDiscovery+xml"),
                                                      discoveryResponse,
                                                      null);
                                }


                                catch (XmlException xe)
                                {
                                    _acdPlatform._logger.Log("AcdPlatform experienced an issue serializing the Contact Center discovery info", xe);
                                }
                                catch (InvalidOperationException ivoex)
                                {
                                    _acdPlatform._logger.Log("AcdPlatform failed to respond to a portal discovery request", ivoex);
                                }
                                catch (RealTimeException rtex)
                                {
                                    _acdPlatform._logger.Log("AcdPlatform failed to respond to a portal discovery request", rtex);
                                }
                            }
                        }
                    }
                });
            }