public string FireEvent(string eStatus, string eDirection, string callingNum, string tenfoldExt, string pbxID) { string responseText = null; try { /* - "Inbound" - */ /* '{{"status": "{0}", "direction": "{1}", "number": "{2}", "extension": "{3}", "pbxCallId": "{4}"}}' */ string jbuff = this.eventTemplate.xFormat(eStatus, eDirection, callingNum, tenfoldExt, pbxID); byte[] bytes = jbuff.xToBytes(); string eventurl = this.eventSinkUrl.xFormat(this.orgID); WebRequest webRequest = (HttpWebRequest)WebRequest.Create(eventurl); webRequest.Method = "post"; webRequest.ContentType = "application/json"; webRequest.ContentLength = bytes.LongLength; webRequest.GetRequestStream().Write(bytes, 0, bytes.Length); //webRequest.GetRequestStream().Flush(); webRequest.GetRequestStream().Close(); HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); responseText = new StreamReader(webResponse.GetResponseStream()).ReadToEnd(); webResponse.Close(); } catch (Exception x) { AppLogger.Save(x); responseText = "ERROR"; } /* - - */ return(responseText); }
public void Run() { try { /* attach to skype */ this.lyncClient = mslm.LyncClient.GetClient(); this.lyncClient.ConversationManager.ConversationAdded += this.IncomingConversationAdded; } catch (Exception x) { AppLogger.Save(x); } }