{"id":20365844,"url":"https://github.com/cycoresystems/dispatchers","last_synced_at":"2025-07-17T02:33:07.801Z","repository":{"id":57509927,"uuid":"69751520","full_name":"CyCoreSystems/dispatchers","owner":"CyCoreSystems","description":"dispatcher management for kamailio and kubernetes; related tools","archived":false,"fork":false,"pushed_at":"2022-10-05T21:53:41.000Z","size":92,"stargazers_count":21,"open_issues_count":0,"forks_count":14,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-05T17:12:50.173Z","etag":null,"topics":["go","golang","kamailio","kubernetes","voip"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CyCoreSystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2016-10-01T17:05:07.000Z","updated_at":"2025-03-20T12:49:17.000Z","dependencies_parsed_at":"2023-01-19T06:00:25.588Z","dependency_job_id":null,"html_url":"https://github.com/CyCoreSystems/dispatchers","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyCoreSystems%2Fdispatchers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyCoreSystems%2Fdispatchers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyCoreSystems%2Fdispatchers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyCoreSystems%2Fdispatchers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CyCoreSystems","download_url":"https://codeload.github.com/CyCoreSystems/dispatchers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248519473,"owners_count":21117757,"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":["go","golang","kamailio","kubernetes","voip"],"created_at":"2024-11-15T00:20:33.441Z","updated_at":"2025-04-12T04:51:12.304Z","avatar_url":"https://github.com/CyCoreSystems.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dispatchers\n[![Go Reference](https://pkg.go.dev/badge/github.com/CyCoreSystems/dispatchers/v2.svg)](https://pkg.go.dev/github.com/CyCoreSystems/dispatchers/v2)\n![master](https://github.com/CyCoreSystems/dispatchers/actions/workflows/go.yml/badge.svg?branch=master)\n\ndispatcher management for kamailio running inside kubernetes\n\nThis tool can be used as a library, with the `Controller` as a common base,\nplugging your own `Notifier` and/or `Exporter` into place.\n\nIt can also be used directly with the included daemon, which will keep a\n`dispatchers.list` file in sync with sets of Endpoints of Kubernetes Services.\nEach Service is mapped to a single dispatcher set ID for the Kamailio\n`dispatcher` module.\n\nWhen the `dispatchers.list` file is updated, the tool connects to kamailio over\nits binrpc service and tells it to reload the file.\n\nThe following documentation describes the default usage with the reference\ndaemon.\n\n## Usage\n\nIn general, `dispatchers` is meant to run as a container within the same Pod as\nthe kamailio container.\n\nHere is an example kamailio Pod definition with a `disaptchers` container which\nwill populate dispatcher set 1 using the Endpoints from the `asterisk` service\nin the same namespace as the kamailio Pod:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: kamailio\nspec:\n  volumes:\n    - name: config\n  containers:\n    - name: kamailio\n      image: cycoresystems/astricon-2016-kamailio\n      volumeMounts:\n        - name: config\n          mountPath: /data/kamailio\n    - name: dispatchers\n      image: cycoresystems/dispatchers\n      env:\n         - name: POD_NAMESPACE\n           valueFrom:\n             fieldRef:\n               fieldPath: metadata.namespace\n      args:\n        - \"-set\"\n        - asterisk=1\n      volumeMounts:\n        - name: config\n          mountPath: /data/kamailio\n```\n\nThe image may also be pulled directly:\n\n```sh\n  docker pull cycoresystems/dispatchers\n```\n\n## Options\n\nCommand-line options are available to customize and configure the operation of\n`dispatchers`:\n\n- `-kubecfg \u003cstring\u003e`: allows specification of a kubecfg, if not running inside kubernetes\n- `-o \u003cstring\u003e`: specifies the output filename for the dispatcher list.  It defaults to `/data/kamailio/dispatcher.list`.\n- `-p \u003cstring\u003e`: specifies the port on which kamailio is running its binrpc service.  It defaults to `9998`.\n- `-set [namespace:]\u003cservice-name\u003e=\u003cindex\u003e[:port]`: Specifies a dispatcher set.  This may be passed multiple times for multiple dispatcher sets.  Namespace and port are optional.  If not specified, namespace is `default` or the value of `POD_NAMESPACE` and port is `5060`.\n- `-static \u003cindex\u003e=\u003chost\u003e[:port][,\u003chost\u003e[:port]]...`: Specifies a static dispatcher set.  This is usually used to define a dispatcher set composed on external resources, such as an external trunk.  Multiple host:port pairs may be passed for multiple contacts in the same dispatcher set.  The option may be declared any number of times for defining any number of unique dispatcher sets.  If not specified, the port will be assigned as `5060`.\n\nFor simple systems where the monitored services are in the same namespace as\n`dispatchers`, you can set the `POD_NAMESPACE` environment variable to\nautomatically use the same namespace in which `dispatcher` runs.\n\n## RBAC\n\nWhen role-based access control (RBAC) is enabled in kubernetes, `dispatchers`\nwill need to run under a service account with access to the `endpointsices` resource\nfor the namespace(s) in which your dispatcher services exist.\n\nExample RBAC Role for services in the `sip` namespace:\n\n```yaml\n\nkind: ServiceAccount\napiVersion: v1\nmetadata:\n  name: dispatchers\n  namespace: sip\n\n--\n\nkind: ClusterRole\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: endpointslice-reader\nrules:\n  - apiGroups: [\"discovery.k8s.io\"]\n    resources: [\"endpointslices\"]\n    verbs: [\"get\", \"watch\", \"list\"]\n\n--\n\nkind: ClusterRoleBinding\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n  name: dispatchers\nsubjects:\n  - kind: ServiceAccount\n    name: dispatchers\n    namespace: sip\nroleRef:\n  kind: ClusterRole\n  name: endpointslice-reader\n```\n\nOne `RoleBinding` should be added for each namespace `dispatchers` should have\naccess to, changing `metadata.namespace` as appropriate.\n\nOnce added, make sure that the Pod in which the `dispatchers` container is\nrunning is assigned to the ServiceAccount you created using the\n`spec.serviceAccountName` parameter.  For instance:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: my-pod\nspec:\n  serviceAccountName: dispatchers\n  ...\n```\n\nYou can also bind the namespace-default ServiceAccount to make things easier, if\nyou have a simple setup:  `system:serviceaccount:\u003cnamespace\u003e:default`.\n\n## Breaking changes\n\nWith v2, we now use the more efficient EndpointSlices instead of Endpoints.\nWhile this will generally be an invisible change, your RBACs will likely need to\nbe updated from v1.\nIn particular, you will need access to the `endpointslices` resource in the `discovery.k8s.io` API Group.\n\nThere is an option to retain the old behaviour:  `-legacy-endpoints`.  This will\nallow `dispatchers` to continue to work with older versions of Kuvbernetes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycoresystems%2Fdispatchers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcycoresystems%2Fdispatchers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycoresystems%2Fdispatchers/lists"}