Below a file accounts.properties with two account inside, to map twilio secret parameters that the application needs to exchange with Twilio to confirm its authenticity

  1. TWILIO SID

  2. TWILIO TOKEN

  3. TWILIO NUMBER

  4. TWILIO APPLICATION SID

twilio.accounts=default,primo
# default account
account.default.twilioSid=1111
account.default.twilioToken=222
account.default.twilioNumber=333
account.default.applicationSid=444
#due account
account.primo.twilioSid=5555
account.primo.twilioToken=666
account.primo.twilioNumber=777
account.primo.applicationSid=888

When you inject some twiliofaces doers (like Caller, Sender), you should declare the account name inside the annotation @TwilioAccount(accountName = "primo"):

@Inject
@TwilioAccount(accountName = "primo")
Caller caller;

If you inject some twiliofaces doers only unsing @TwilioAccount or without qualifier :

@Inject
@TwilioAccount
Caller caller;

or:

@Inject
Caller caller;

The caontainer will inject you the default account.

If you have a dynamic association between the account to use and some java controller, you can resolve the account name with:

@Inject
@TwilioAccount(accountName = "#{user.inSession()}")
Caller caller;
comments powered by Disqus

Contact

Do you want collaborate with us?
Do you like this project?
Questions?
Please send me an email!

fiorenzo.pizza@gmail.com

Github code

Fork the twiliofaces repository on GitHub
and clone it to your local PC.

Get Started

Copy the Twiliofaces JAR file into your /WEB-INF/lib directory, or include all required Maven dependencies in your pom.xml!