Skip to content
Snippets Groups Projects
Commit 49038487 authored by Olivier Dion's avatar Olivier Dion Committed by Adrien Béraud
Browse files

agent: Add logging to (agent) and examples

Change-Id: I39c2bca72f8b6feb1578aecf32f97738eadfd235
parent 7a71ff44
Branches
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@
(define-module (agent)
#:use-module (ice-9 threads)
#:use-module ((jami logger) #:prefix jami:)
#:use-module ((jami account) #:prefix account:)
#:use-module ((jami call) #:prefix call:)
#:use-module ((jami signal) #:prefix jami:)
......@@ -53,6 +54,7 @@
(fluid-set! peer-id (assoc-ref details "Account.username"))))
(define* (ensure-account #:key (wait-for-announcement? #t))
(jami:info "Ensure account")
(ensure-account% (fluid-ref account-id) '(("Account.type" . "RING")
("Account.displayName" . "AGENT")
("Account.alias" . "AGENT")
......@@ -62,6 +64,7 @@
wait-for-announcement?))
(define* (ensure-account-from-archive path #:key (wait-for-announcement? #t))
(jami:info "Ensure account from archive ~a" path)
(ensure-account% (fluid-ref account-id) `(("Account.type" . "RING")
("Account.displayName" . "AGENT")
("Account.alias" . "AGENT")
......
......@@ -8,9 +8,11 @@
((agent) #:prefix agent:)
((jami account) #:prefix account:)
((jami signal) #:prefix jami:)
((jami call) #:prefix call:))
((jami call) #:prefix call:)
((jami logger) #:prefix jami:))
(define (make-a-call from to)
(jami:info "Placing call from:~a to:~a" from to)
(let ((mtx (make-mutex))
(cnd (make-condition-variable))
(this-call-id "")
......@@ -53,7 +55,9 @@
(while #t
(begin
(make-a-call agent:account-id "bcebc2f134fc15eb06c64366c1882de2e0f1e54f")
(jami:info "Disabling account")
(account:send-register agent:account-id #f)
(sleep 30)
(jami:info "Enabling account")
(account:send-register agent:account-id #t)
(sleep 30)))
......@@ -5,15 +5,16 @@
(use-modules ((agent) #:prefix agent:)
((jami signal) #:prefix jami:)
((jami call) #:prefix call:))
((jami call) #:prefix call:)
((jami logger) #:prefix jami:))
(agent:ensure-account)
(jami:on-signal 'incomming-call
(lambda (account-id call-id peer-display-name media-list)
(when (string= account-id agent:account-id)
(format #t
"Incoming [call:~a] from peer ~a~%"
call-id peer-display-name)
(jami:info
"Incoming [call:~a] from peer ~a~%"
call-id peer-display-name)
(call:accept call-id media-list))
#t))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment