コード例 #1
0
        public static void Stop(HttpListenerRequest req, HttpListenerResponse res)
        {
            string     command, mcu_jid;
            int        mcu_cid;
            XmlElement node;

            string body_b64 = Utility.BodyFromStream.read(req.InputStream, req.ContentLength64, Encoding.ASCII);
            string body     = Encoding.UTF8.GetString(Convert.FromBase64String(body_b64));

            if (body == null)
            {
                Console.WriteLine("Record.Start: Net broken!");
                return;
            }

            Log.log("Record_Stop: xml=" + body);

            if (Utility.BodyParser.parse(body, out command, out node, out mcu_jid, out mcu_cid))
            {
                /** node 格式为:
                 *      <cmd command="record_stop">
                 *      </cmd>
                 */
                lock (RecordingTasks)
                {
                    if (RecordingTasks.ContainsKey(mcu_cid))
                    {
                        RecordingTasks[mcu_cid].Close();
                        RecordingTasks.Remove(mcu_cid);
                        done(res, "");
                    }
                    else
                    {
                        no_matched_recording(res, mcu_cid);
                    }
                }
            }
            else
            {
                format_error(res);
            }
        }