pythonboto3asteriskagiamazon-polly

Asterisk AGI AWS "ProfileNotFound: The config profile (foo) could not be found"


To give you some background I have a bash script being launched from Asterisk via a Python AGI that runs against Amazon Polly and generates a .sln file. I have this working on a CentOS server but am attempting to migrate it to a Debian Server.

This is the line item of code that is giving me problems

aws polly synthesize-speech --output-format pcm --debug --region us-east-2 --profile asterisk --voice-id $voice --text "$1" --sample-rate 8000 $filename.sln >/dev/null

I keep getting this error

ProfileNotFound: The config profile (foo) could not be found

This is an example of my /root/.aws/config

[default]
region = us-east-2
output = json

[profile asterisk]
region = us-east-2
output = json

[asterisk]
region = us-east-2
output = json

The /root/.aws/credentials looks similar but with the keys in them. I've even tried storing all this data in environment variables and going with default so as to get past this, but then I have the issue where it throws unable to locate credentials, or must define region (got past that by defining the region inline). It's almost like, Asterisk is somehow running this out of some isolated session that I can't get the credentials or config/credentials file to. Which from research and how I set it up it is currently running as Root so that should not be an issue.

Any help is much appreciated, thanks!


Solution

  • Asterisk should be runned under asterisk user for security.

    Likly on your prevous install it was under root, so all was working.

    Please ensure you have setuped AWS Polly for asterisk user or create sudo entry and use sudo.

    If you use System command it also have no shell(bash), so you have start it via bash script and setup PATH and other required variables yourself.