Пример #1
0
        /// <summary>
        /// Sends the connect command to FreeSwitch, populating the <see cref="ChannelData"/> property on reply.
        /// </summary>
        public async Task <ChannelEvent> Connect()
        {
            var response = await SendCommand("connect").ConfigureAwait(false);

            ChannelData = new ChannelEvent(response);

            var socketMode  = ChannelData.GetHeader("Socket-Mode");
            var controlMode = ChannelData.GetHeader("Control");

            if (socketMode == "static")
            {
                Log.LogWarning("This socket is not using 'async' mode - certain dialplan applications may bock control flow");
            }

            if (controlMode != "full")
            {
                Log.LogDebug("This socket is not using 'full' control mode - FreeSwitch will not let you execute certain commands.");
            }

            Messages.FirstAsync(m => m.ContentType == ContentTypes.DisconnectNotice)
            .Subscribe(dn => Log.LogTrace("Channel {0} Disconnect Notice {1} received.".Fmt(ChannelData.UUID, dn.BodyText)));

            return(ChannelData);
        }
Пример #2
0
 public string GetHeader(string headerName)
 {
     return(lastEvent.GetHeader(headerName));
 }