{"id":15674700,"url":"https://github.com/bkbilly/asterisk-assistant","last_synced_at":"2025-05-06T22:02:22.247Z","repository":{"id":115516355,"uuid":"429551040","full_name":"bkbilly/asterisk-assistant","owner":"bkbilly","description":"📞 AGI interface with python for speech recognition","archived":false,"fork":false,"pushed_at":"2024-02-19T21:24:10.000Z","size":15,"stargazers_count":26,"open_issues_count":0,"forks_count":11,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-19T15:34:07.230Z","etag":null,"topics":["agi","asterisk","home-assistant","speech-recognition"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bkbilly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-18T19:16:32.000Z","updated_at":"2025-03-27T14:22:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"98da4c9c-b8ab-481f-b9de-ed33655eceec","html_url":"https://github.com/bkbilly/asterisk-assistant","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkbilly%2Fasterisk-assistant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkbilly%2Fasterisk-assistant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkbilly%2Fasterisk-assistant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkbilly%2Fasterisk-assistant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bkbilly","download_url":"https://codeload.github.com/bkbilly/asterisk-assistant/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252776573,"owners_count":21802467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agi","asterisk","home-assistant","speech-recognition"],"created_at":"2024-10-03T15:49:31.675Z","updated_at":"2025-05-06T22:02:22.127Z","avatar_url":"https://github.com/bkbilly.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Asterisk Asssistant\nHave a voice assistant on Asterisk PBX Server using Google for Speach recognition and for Text-to-Speech. It can integrate with Home Assistant by recognizing the intention of the speaker.\n\n## How it works\nThere are three parts on the recognition (Speech Recognition, Text-to-Speech, Intent) on three seperate files:\n\n### Speech Recognition (`sr.py`)\nRecords the speaker to a file as a wav and sends it to the recognizer to get the output text. This is stored in a variable called `${recognition}`.\n\n### Text-to-Speech (`tts.py`)\nTakes as a text argument and uploads it to google to get the audio file which is saved as an mp3. The audio file is then streamed to the listener.\n\n### Text-to-Speech for Home Assistant (`tts_hass.py`)\nIt works similar as `tts.py`, but it connects to home assistant to use the piper speech recognition, though you could change.\n\n### Intent (`hass.py`)\nThis finds the closest sentence that matches the sentences provided on the `actions` variable. It can support multiple sentences for the same event like you can see at the example provided on hass.py file.\nThere are some options that are needed for each action type so that they can communicate succesfully with Home assistant.\n\n## Example of `extensions.conf`\nWhith this example when you dial 45 it will direct you to the voiceassistant.\nThis is responsible for calling all the AGI scripts and repeat itself after each successfull recognition.\nThere are 3 ways to stop the excecution:\n  - You Hang Up\n  - You don't say anything (endvoice is triggered)\n  - You say Goodbye which will trigger the end action type\n\n```\n[dialplan]\nexten =\u003e 45,1,Gosub(voiceassistant,${EXTEN},1)\n\n[voiceassistant]\nexten =\u003e _X.,1,Answer()\nexten =\u003e _X.,n,Set(VOLUME(TX)=15)\nexten =\u003e _X.,n(startvoice),NoOP(Started voice assistant)\nexten =\u003e _X.,n,agi(sr.py)\nexten =\u003e _X.,n,GotoIf($[\"${recognition}\" == \"\"]?endvoice)\nexten =\u003e _X.,n,agi(hass.py,${recognition})\nexten =\u003e _X.,n,agi(tts.py,${hass_text})\nexten =\u003e _X.,n,agi(tts_hass.py,${hass_text},\"en_US\",\"en-us-amy-low\")\nexten =\u003e _X.,n,Goto(startvoice)\nexten =\u003e _X.,n(endvoice),Hangup()\n```\n\n## Install\nYou might want to edit the init section to meet your needs, like **language**, **hass_url**, **hass_token** and the **actions**:\n```bash\nsudo apt install ffmpeg\nsudo pip install -r requirements.txt\nsudo cp sr.py /var/lib/asterisk/agi-bin/\nsudo cp tts.py /var/lib/asterisk/agi-bin/\nsudo cp hass.py /var/lib/asterisk/agi-bin/\nsudo chown asterisk:asterisk /var/lib/asterisk/agi-bin/*.py\nsudo chmod +x /var/lib/asterisk/agi-bin/*.py\n```\n\n## What does this help me achieve...\n - Use NLP to make conversations\n - Connect with my home assistant to control appliances\n - Keep a text transcript of a conversation.\n - Many more that I haven't thought yet...\n\n\n## Insipration\nThis is inspired by the [asterisk-speech-recog](https://github.com/zaf/asterisk-speech-recog) project which seems to be outdated.\n\n## Video Preview\n[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/pNg3k7Uutpk/0.jpg)](https://youtu.be/pNg3k7Uutpk?t=110)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkbilly%2Fasterisk-assistant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbkbilly%2Fasterisk-assistant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkbilly%2Fasterisk-assistant/lists"}