diff --git a/categories/index.html b/categories/index.html index b8d2500..5a61098 100644 --- a/categories/index.html +++ b/categories/index.html @@ -167,23 +167,50 @@ hx-text-gray-500 hover:hx-bg-gray-100 hover:hx-text-gray-900 contrast-more:hx-border contrast-more:hx-border-transparent contrast-more:hx-text-gray-900 contrast-more:hover:hx-border-gray-900 dark:hx-text-neutral-400 dark:hover:hx-bg-primary-100/5 dark:hover:hx-text-gray-50 contrast-more:dark:hx-text-gray-50 contrast-more:dark:hover:hx-border-gray-50" href="/diago/docs/" - >My Docs + >Docs
diff --git a/docs/examples/getting_started/index.html b/docs/examples/getting_started/index.html new file mode 100644 index 0000000..9d1e867 --- /dev/null +++ b/docs/examples/getting_started/index.html @@ -0,0 +1,526 @@ + + + + + + + + + + + + + + Diago + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+
+ +
+
+ My Docs +
+
+ Examples +
Getting Started
+
+ +
+

+

Getting started

diago acts as UAS(User Agent Server) and UAC(User Agent Client). For now it keeps abstractions only where it needs. +Therefore it distincts your dialog control by:

+
    +
  • It receives DialogServerSession for serving incoming sessions(Call leg)
  • +
  • It creates DialogClientSession when it Dials outgoing session(Call leg)
  • +
+

Further it is explicit which media stack it uses

+
    +
  • Answer -> RTP/UDP
  • +
  • AnswerWebrtc -> Webrtc stack SRTP/DTLS
  • +
+

Setup diago: +

+ + +
ua, _ := sipgo.NewUA()
+transportUDP := diago.Transport{
+	Transport: "udp",
+	BindHost:  "127.0.0.1",
+	BindPort:  5060,
+}
+
+transportTCP := diago.Transport{
+	Transport: "tcp",
+	BindHost:  "127.0.0.1",
+	BindPort:  5060,
+}
+
+d := diago.NewDiago(ua,
+	diago.WithTransport(transportUDP),
+	diago.WithTransport(transportTCP),
+)
+ +
+ + +
+

Incoming call +

+ + +
d.Serve(ctx, func(inDialog *diago.DialogServerSession) {
+	// - Do your call routing.
+	switch inDialog.ToUser() {
+		case "answer":
+		case "123456"
+	}
+})
+ +
+ + +
+

Outgoing +

+ + +
dialog, err := d.Dial(ctx, recipient sip.Uri, bridge *Bridge, opts sipgo.AnswerOptions)
+dialog.Hangup()
+ +
+ + +
+

Answering call +

+ + +
func Answer(inDialog *diago.DialogServerSession) {
+	inDialog.Progress() // Progress -> 100 Trying
+	inDialog.Ringing()  // Ringing -> 180 Response
+
+	if err := inDialog.Answer(); err != nil {
+		fmt.Println("Failed to answer", err)
+		return
+	}
+
+	ctx := inDialog.Context()
+	select {
+	case <-ctx.Done():
+	case <-time.After(1 * time.Minute):
+	}
+}
+ +
+ + +
+

Playing file with Playback +

Playing file is done by playback.

+

Supported formats:

+
    +
  • wav (PCM)
  • +
+
+ + +
func Playback(inDialog *diago.DialogServerSession) {
+	inDialog.Ringing()
+
+	playfile, err := os.Open("demo-instruct.wav")
+	if err != nil {
+		fmt.Println("Failed to open file", err)
+		return
+	}
+
+	pb, err := inDialog.PlaybackCreate()
+	if err != nil {
+		fmt.Println("Failed to create playback", err)
+		return
+	}
+
+	if err := inDialog.Answer(); err != nil {
+		fmt.Println("Failed to answer", err)
+		return
+	}
+
+	if err := pb.Play(playfile, "audio/wav"); err != nil {
+		fmt.Println("Playing failed", err)
+	}
+}
+ +
+ + +
+ +
+
+ + +
+
+
+ + + + + + + + + + + + diff --git a/docs/examples/ha/index.html b/docs/examples/ha/index.html new file mode 100644 index 0000000..628b8c9 --- /dev/null +++ b/docs/examples/ha/index.html @@ -0,0 +1,324 @@ + + + + + + + + + + + + + + Diago + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+
+ +
+
+ My Docs +
+
+ Examples +
Ha
+
+ +
+

+

High availability

+
+
+ + +
+
+
+ + + + + + + + + + + + diff --git a/docs/examples/index.html b/docs/examples/index.html new file mode 100644 index 0000000..890a394 --- /dev/null +++ b/docs/examples/index.html @@ -0,0 +1,419 @@ + + + + + + + + + + + + + + Examples – Diago + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + +
+
+ +
+
+ Docs +
Examples
+
+ +
+

Examples

+

CLI Softphone for testing +

For testing below scenarios, gophone as CLI softphone is used. Visit the page and install:

+

https://github.com/emiago/gophone

+

Audio playback +

Download: download

+
+ + +
./example
+ +
+ + +
+
+ + +
gophone dial sip:112@127.0.0.1
+ +
+ + +
+

Bridge media +

TODO

+

+

+
+
+ + +
+
+
+ + + + + + + + + + + + diff --git a/docs/examples/index.xml b/docs/examples/index.xml new file mode 100644 index 0000000..14665d5 --- /dev/null +++ b/docs/examples/index.xml @@ -0,0 +1,18 @@ + + + Diago – Examples + https://emiago.github.io/diago/docs/examples/ + Recent content in Examples on Diago + Hugo -- gohugo.io + en-us + + + + + + + + + + + diff --git a/docs/getting_started/index.html b/docs/getting_started/index.html index ec95e67..361e449 100644 --- a/docs/getting_started/index.html +++ b/docs/getting_started/index.html @@ -12,9 +12,9 @@ Diago - + @@ -23,9 +23,9 @@ - + @@ -33,15 +33,15 @@ - - + + - + @@ -180,17 +180,36 @@ hx-text-gray-500 hover:hx-bg-gray-100 hover:hx-text-gray-900 contrast-more:hx-border contrast-more:hx-border-transparent contrast-more:hx-text-gray-900 contrast-more:hover:hx-border-gray-900 dark:hx-text-neutral-400 dark:hover:hx-bg-primary-100/5 dark:hover:hx-text-gray-50 contrast-more:dark:hx-text-gray-50 contrast-more:dark:hover:hx-border-gray-50" href="/diago/docs/" - >My Docs + >Docs
@@ -229,16 +256,42 @@
  • Guide -
  • + >Guides + +
    + +
  • Getting Started +
  • +
  • Examples
  • @@ -295,23 +348,25 @@
    Getting Started

    -

    Getting started

    diago acts as UAS(User Agent Server) and UAC(User Agent Client). For now it keeps abstractions only where it needs. -Therefore it distincts your dialog control by:

    +

    Getting started

    diago can act as UAS(User Agent Server) and UAC(User Agent Client), and on top it adds bridging to build B2BUA services.

    +

    To keep abstractions low it intentionally distincts dialog received (Acting as server) and dialog created (Acting as client) +Therefore it distincts your dialog/session control with this structs:

    Further it is explicit which media stack it uses

    +

    NOTE: webrtc stack is experimental and not on full focus currently

    Setup diago:

    diff --git a/docs/guide-copy/index.html b/docs/guide-copy/index.html new file mode 100644 index 0000000..86bc0a3 --- /dev/null +++ b/docs/guide-copy/index.html @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + Guide – Diago + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + +
    +
    + +
    +
    + My Docs +
    Guide
    +
    + +
    +

    Guide

    + +
    +
    + + +
    +
    +
    + + + + + + + + + + + + diff --git a/docs/guide-copy/index.xml b/docs/guide-copy/index.xml new file mode 100644 index 0000000..16ad7ea --- /dev/null +++ b/docs/guide-copy/index.xml @@ -0,0 +1,18 @@ + + + Diago – Guide + http://localhost:1313/diago/docs/guide-copy/ + Recent content in Guide on Diago + Hugo -- gohugo.io + en-us + + + + + + + + + + + diff --git a/docs/guide/call_cancel.mermaid b/docs/guide/call_cancel.mermaid new file mode 100644 index 0000000..0694ec6 --- /dev/null +++ b/docs/guide/call_cancel.mermaid @@ -0,0 +1,6 @@ +sequenceDiagram + Alice->>+Bob: INVITE + Bob->>+Alice: 100 Progress + Bob->>Alice: 180 Ringing + Alice->>+Bob: CANCEL + Bob->>Alice: 200 OK \ No newline at end of file diff --git a/docs/guide/call_provisional_seq.mermaid b/docs/guide/call_provisional_seq.mermaid new file mode 100644 index 0000000..2964972 --- /dev/null +++ b/docs/guide/call_provisional_seq.mermaid @@ -0,0 +1,8 @@ +sequenceDiagram + Alice-->>+Bob: INVITE + Bob->>+Alice: 100 Progress + Bob->>+Alice: 180 Ringing + Bob-->>Alice: 200 OK + Alice-->>+Bob: ACK + Alice-->>Bob: BYE + Bob-->>Alice: 200 OK \ No newline at end of file diff --git a/docs/guide/call_seq.mermaid b/docs/guide/call_seq.mermaid new file mode 100644 index 0000000..62a4d76 --- /dev/null +++ b/docs/guide/call_seq.mermaid @@ -0,0 +1,6 @@ +sequenceDiagram + Alice->>+Bob: INVITE + Bob->>+Alice: 200 OK + Alice->>+Bob: ACK + Alice->>Bob: BYE + Bob->>+Alice: 200 OK \ No newline at end of file diff --git a/docs/guide/call_with_media_seq.mermaid b/docs/guide/call_with_media_seq.mermaid new file mode 100644 index 0000000..f7a4831 --- /dev/null +++ b/docs/guide/call_with_media_seq.mermaid @@ -0,0 +1,7 @@ +sequenceDiagram + Alice->>+Bob: INVITE (SDP codec:0,8 IP:1.1.1.1) + Bob->>+Alice: 100 Progress + Bob->>Alice: 200 (SDP codec:8 IP:2.2.2.2) + Alice->>+Bob: ACK + Bob->>Alice: BYE + Alice->>Bob: 200 OK \ No newline at end of file diff --git a/docs/guide/index.html b/docs/guide/index.html index 4f7e4f6..9629525 100644 --- a/docs/guide/index.html +++ b/docs/guide/index.html @@ -1,8 +1,8 @@ - + - + @@ -12,10 +12,12 @@ Guide – Diago - + - + @@ -23,19 +25,25 @@ - + + + + - - + - + @@ -170,14 +178,21 @@ >My Docs @@ -224,8 +276,40 @@