Skip to content
Snippets Groups Projects
Commit aadc8690 authored by Olivier Dion's avatar Olivier Dion Committed by Sébastien Blin
Browse files

agent: Add commentaries to examples and peer-monitor scenario

Change-Id: I3aae03770f302bfe043f7bf6070a99a0d56fcebc
parent ce1995d1
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env -S ./agent.exe -s #!/usr/bin/env -S ./agent.exe -s
!# !#
;;; Commentary:
;;;
;;; This is an example of an active agent. ;;; This is an example of an active agent.
;;; ;;;
;;; The active agent ensure that an account is created and then call its peer ;;; The active agent ensure that an account is created and then call its peer
;;; every minute. ;;; every minute.
;;;
;;; Code:
;;; We import here Jami's primitives. ;;; We import here Jami's primitives.
(use-modules (use-modules
...@@ -48,22 +52,29 @@ hang up after MEDIA-FLOW seconds and #t is returned. ...@@ -48,22 +52,29 @@ hang up after MEDIA-FLOW seconds and #t is returned.
(set! continue #f) (set! continue #f)
success)))) success))))
;;; Change FIXME for the peer id you want to contact.
(define peer "FIXME") (define peer "FIXME")
;;; This will create your agent and wait for its announcement on the DHT (see
;;; (agent)).
(define agent (make-agent "bfbfbfbfbfbfbfbf")) (define agent (make-agent "bfbfbfbfbfbfbfbf"))
;;; This will make you friend with the other peer. You need to accept the trust
;;; request within a certain amount of time (see (agent)).
(make-friend agent peer) (make-friend agent peer)
;;; You can change the value of MEDIA-FLOW and GRACE-PERIOD.
(let loop ([account (account-id agent)] (let loop ([account (account-id agent)]
[media-flow 7] [media-flow 7]
[grace-period 30]) [grace-period 30])
(make-a-call account peer #:media-flow media-flow) (make-a-call account peer #:media-flow media-flow)
;; Disabling our account for GRACE-PERIOD.
(jami:info "Disabling account") (jami:info "Disabling account")
(account:send-register account #f) (account:send-register account #f)
(sleep grace-period) (sleep grace-period)
;; Renabling our account and wait GRACE-PERIOD.
(jami:info "Enabling account") (jami:info "Enabling account")
(account:send-register account #t) (account:send-register account #t)
(sleep grace-period) (sleep grace-period)
......
#!/usr/bin/env -S ./agent.exe -s #!/usr/bin/env -S ./agent.exe -s
!# !#
;;; Commentary:
;;;
;;; This is an example of a passive agent. ;;; This is an example of a passive agent.
;;; ;;;
;;; The passive agent ensure that an account is created and accept all trust ;;; The passive agent ensure that an account is created and accept all trust
;;; requests and incoming calls. ;;; requests and incoming calls.
;;;
;;; Code:
(use-modules (agent) (use-modules (agent)
((jami account) #:prefix account:) ((jami account) #:prefix account:)
......
#!/usr/bin/env -S ./agent.exe --debug -e main -s #!/usr/bin/env -S ./agent.exe --debug -e main -s
!# !#
;;; Commentary:
;;;
;;; This scenario is testing connectivity between two peers. An active peer and
;;; a passive peer. The passive peer accepts all incoming trust request and
;;; incoming calls. The active peer will call the passive peer every minute,
;;; disabling and re-enabling its account in between to force a new connection.
;;;
;;; Every peers in this scenario will synchronize at midnight UTC±00:00. When
;;; synchronizing, peers will have a grace period of one hour to change their
;;; account' details. After that, the scenario is resumed.
;;;
;;; The active peer also keep statistics about success rate and failure rate of
;;; calls made during the day. After synchronization, the active peer flush the
;;; statistics of the day to the file `stats.scm`, which can be further analyze
;;; using Guile. The rates are then reset to zero for the next day.
;;;
;;; Code:
(use-modules (use-modules
(ice-9 match) (ice-9 match)
(ice-9 threads) (ice-9 threads)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment