HTTPS SSH

README

Sipgate.IO is an event dispatcher library for the sipgate.io API.

Installation

If you downloaded a prebuilt copy, the library should run on recent Unix- or Windows-based .NET 4.0 environments. It has been developed for and tested on Linux with Mono 4.0.

To build Sipgate.IO from source you will need an F# 3.0 compiler and .NET development environment. The .fsproj and .sln files in the source directory should be understood by command line tools like Microsoft's msbuild or Mono's xbuild as well as IDEs such as MonoDevelop or VisualStudio.

Usage

Sipgate.IO relies on the simple System.Net.HttpListener for HTTP transport of events and exposes a standard CLI event interface through Sipgate.IO.CallEventDispatcher.

In the simplest use case you construct an HTTP listener and an event dispatcher and run a synchronous main loop to handle incoming events:

open System.Net
open Sipgate.IO

use listener = new HttpListener(IgnoreWriteExceptions = true)
listener.Prefixes.Add("http://localhost:8080/")

let dispatch = CallEventDispatcher()
dispatch.CallEvent.Add(fun evt ->
  printfn "call %s" evt.CallId)

listener.Start()
dispatch.Run(listener)

If Sipgate.IO can identify the type of event, it will dispatch a subclass of Sipgate.IO.CallEventArgs. For example you can react to all incoming new calls like this:

dispatch.CallEvent.Add(function
  | :? NewCallEventArgs as evt when evt.IsIncoming ->
    printfn "incoming call %s from %s to %s" evt.CallId evt.Source evt.Target
  | _ ->
    ())

To request events when a call is answered or hung up, use the RequestEvents method of a Sipgate.IO.NewCallEvent. To request some action in response to an event, set the Action property of any Sipgate.IO.CallEvent.