mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-07 22:02:12 +08:00
agent: Add logging to (agent) and examples
Change-Id: I39c2bca72f8b6feb1578aecf32f97738eadfd235
This commit is contained in:

committed by
Adrien Béraud

parent
7a71ff44b2
commit
490384875e
@ -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))
|
||||
|
Reference in New Issue
Block a user