From 562f8c8a560aee793038009cbca9bcb98ae8d12f Mon Sep 17 00:00:00 2001 From: Olivier Dion <olivier.dion@savoirfairelinux.com> Date: Fri, 5 Nov 2021 14:24:49 -0400 Subject: [PATCH] agent/examples: Fix examples Change-Id: Idf54e78391eb77c7964c6650b6f70df71b8eac3a --- test/agent/examples/active-agent.scm | 26 ++++++++++++++++---------- test/agent/examples/passive-agent.scm | 18 ++++++++++-------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/test/agent/examples/active-agent.scm b/test/agent/examples/active-agent.scm index 35a02a105f..9b1e550301 100644 --- a/test/agent/examples/active-agent.scm +++ b/test/agent/examples/active-agent.scm @@ -19,7 +19,7 @@ (success #f) (over #f)) - (jami:on-signal 'call-state-changed + (jami:on-signal 'state-changed (lambda (call-id state code) (with-mutex mtx (let ((ret (cond @@ -52,12 +52,18 @@ (agent:ensure-account) -(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))) +(let ((account (fluid-ref agent:account-id)) + (peer "FIXME")) + + (when (string= peer "FIXME") + (throw 'bad-peer + "Peer was not set! Please set variable `peer` to a valid Jami's ID")) + (while #t + (begin + (make-a-call account peer) + (jami:info "Disabling account") + (account:send-register account #f) + (sleep 30) + (jami:info "Enabling account") + (account:send-register account #t) + (sleep 30)))) diff --git a/test/agent/examples/passive-agent.scm b/test/agent/examples/passive-agent.scm index cd7dc9ab24..d5124a8a41 100644 --- a/test/agent/examples/passive-agent.scm +++ b/test/agent/examples/passive-agent.scm @@ -10,11 +10,13 @@ (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) - (jami:info - "Incoming [call:~a] from peer ~a~%" - call-id peer-display-name) - (call:accept call-id media-list)) - #t)) +(jami:info "Agent peer-id: ~a" (fluid-ref agent:peer-id)) + +(let ((account (fluid-ref agent:account-id))) + (jami:on-signal 'incoming-call/media + (lambda (account-id call-id peer media-lst) + (when (string= account-id account) + (jami:info "Incoming [call:~a] from peer ~a~%" call-id peer) + (call:accept call-id media-lst)) + #t))) +(while #t (pause)) -- GitLab