{"id":26337131,"url":"https://github.com/truewinter/twiliocallrouter","last_synced_at":"2025-03-16T02:17:47.719Z","repository":{"id":39623452,"uuid":"500220130","full_name":"TrueWinter/TwilioCallRouter","owner":"TrueWinter","description":"TwilioCallRouter allows users using Twilio for SIP phones to route their calls to another number depending on prefix rules.","archived":false,"fork":false,"pushed_at":"2022-07-18T18:12:23.000Z","size":109,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-02T02:58:06.671Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TrueWinter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-05T21:52:15.000Z","updated_at":"2024-05-02T02:58:06.672Z","dependencies_parsed_at":"2022-07-10T14:00:28.910Z","dependency_job_id":null,"html_url":"https://github.com/TrueWinter/TwilioCallRouter","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueWinter%2FTwilioCallRouter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueWinter%2FTwilioCallRouter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueWinter%2FTwilioCallRouter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueWinter%2FTwilioCallRouter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TrueWinter","download_url":"https://codeload.github.com/TrueWinter/TwilioCallRouter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814895,"owners_count":20352038,"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":[],"created_at":"2025-03-16T02:17:46.090Z","updated_at":"2025-03-16T02:17:47.711Z","avatar_url":"https://github.com/TrueWinter.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TwilioCallRouter\n\nTwilioCallRouter allows users using Twilio for SIP phones to route their calls to another number depending on prefix rules.\n\n## Configuration\n\nThe first time you run TwilioCallRouter, it will generate a config file. Edit the config file as needed, and restart TwilioCallRouter.\n\nBy default, TwilioCallRouter will run on port 8500.\n```yaml\nport: 8500\n```\n\nTo configure Basic Auth, change the below settings as needed. Ensure that your auth details are URL-safe, sticking with alphanumeric characters is recommended.\n```yaml\nauth: true\nusername: twilio\npassword: callrouter\n```\n\nYou can specify the voice and language to pass to Twilio when using the `\u003cSay\u003e` verb. Check the comments in the config file for more information.\n```yaml\nvoice: ALICE\nlanguage: EN_GB\n```\n\nIf you would like to transfer calls to another SIP user, you can enable SIP REFERs. See the comments in the config file for more information.\n```yaml\nenable_refer: true\nrefer_force_https: false\n```\n\n### Directional Config\n\nBoth `inbound` and `outbound` support the following options:\n```yaml\ntimeout: 20\nanswerOnBridge: true\ndefault: '+17185550123'\n```\n\nIf you use the call forwarding feature, please ensure that the inbound timeout is set low enough that the outbound timeout of other providers don't cause the call to be ended too soon.\n\nAdditionally, both directions support the same config format for `block_prefixes`. For each prefix, one of the following can be used:\n- `say: 'some text here'`: This will instruct Twilio to say the string using the voice and language configured, before ending the call with `\u003cHangup\u003e`.\n- `say: false`: This will end the call using the `\u003cReject\u003e` verb.\n- `play: 'url to audio file'`: This will play an audio file before ending the call using `\u003cHangup\u003e`. Ensure it is in a [supported format](https://www.twilio.com/docs/voice/twiml/play#supported-audio-file-types).\n- `twiml: '\u003cResponse\u003e...\u003c/Response\u003e'`: This will respond with custom TwiML.\n\nYou can also specify custom handlers for both directions. The `custom_handlers` section is split into two parts: `exact` and `prefix`. For each number, you will need to specify the URL (which must serve valid TwiML) that Twilio will connect to, and the HTTP method (either `GET` or `POST`).\n\n#### Inbound\n\nIn addition to the above, `inbound` allows for the default number to be a SIP URI. To use a SIP URI, set the `sip` setting to `true` and configure the `default` setting to be a SIP URI.\n\nThe routed config for `inbound` looks like this:\n```yaml\nrouted:\n  '+1':\n    sip: false\n    number: '+17185550123'\n```\n\nThe above config means that any calls coming from a number starting with `+1` will be forwarded to `+17185550123`.\n\nYou can also forward incoming calls if the default number does not answer.\n```yaml\nforward_on_no_answer:\n  enabled: true\n  sip: true\n  number: sip:503@example.sip.twilio.com\n```\n\nThe same call forwarding configuration (leaving out the `enabled` option) can be used for routed prefixes. To disable call forwarding for a routed prefix, you must remove the `forward_on_no_answer` section for that prefix. Please note that call forwards for routed prefixes will only work if default call forwarding is enabled.\n\n#### Outbound\n\nYou will also need to configure the `default_country_code` setting for outbound calls. If a called number is in a local format (not starting with `+` or `00`), the leading `0`, if it exists, will be dropped and the number will be prepended with `default_country_code`.\n\nThe routed config for `outbound` looks like this:\n```yaml\nrouted:\n  '+1': '+17185550123'\n```\n\n## Usage\n\nAfter buying a number, configure it to use a webhook when a call is received. Set the webhook to TwilioCallRouter's `/inbound` route, using the POST method.\n\n![Incoming Config](.github/img/firefox_Jqy3wEXfQV.png)\n\nYou will also need to create a SIP domain, configuring it to use a webhook. Set the webhook to TwilioCallRouter's `/outbound` route, using the POST method.\n\nInstalling TwilioCallRouter behind a reverse proxy, such as Nginx, and configuring SSL is recommended. If using REFERs, please ensure that your proxy passes the protocol to TwilioCallRouter, or enable `refer_force_https`. Also ensure that the correct host header is passed.\n\n## Plugins\n\nTwilioCallRouter supports user-made plugins. See the [api/PLUGINS.md](api/PLUGINS.md) file for more information.\n\n## Important Information\n\nDue to complexities with extracting E.164 numbers from SIP URIs, calls to certain numbers are currently unsupported.\n\n### Toll-free Numbers (+1)\n\nFor toll-free numbers using the +1 country code, you must dial the number in international format or without the leading `1`.\n\n**Do not** call 18004444444, **instead** call 0018004444444 or 8004444444. A fix for this is planned for future releases.\n\n### Short Numbers\n\nShort numbers (such as emergency numbers) are not supported at all at this time. Please ensure you have another way of contacting emergency services in an emergency. Please note that calls to the following numbers are routed directly to the appropriate call center by Twilio and will not get sent to TwilioCallRouter: 112, 999, 911, 933.\n\n### International Calling\n\nAll numbers are converted to E.164 numbers, which may have a different format to your country's usual international calling prefix. To call internationally, drop the leading `0` (if it exists) and prepend the number with `+` or `00` and then the country code. `00` will automatically be replaced with `+` before calling.\n\nFor example, if calling the UK number `02079460123`, call `00442079460123`.\n\n### Cost\n\nCertain configurations of TwilioCallRouter will incur an additional cost. While I have tried to document this wherever possible, it is your responsibility to review and understand Twilio's pricing before using TwilioCallRouter.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruewinter%2Ftwiliocallrouter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftruewinter%2Ftwiliocallrouter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruewinter%2Ftwiliocallrouter/lists"}