EVENT_SQS module
Admin Guide
Section titled “Admin Guide”Overview
Section titled “Overview”The event_sqs module is an implementation of an Amazon SQS producer. It serves as a transport backend for the Event Interface and also provides a stand-alone connector to be used from the OpenSIPS script in order to publish messages to SQS queues. https://aws.amazon.com/sqs/
Dependencies
Section titled “Dependencies”OpenSIPS Modules
Section titled “OpenSIPS Modules”There is no need to load any module before this module.
External Libraries or Applications
Section titled “External Libraries or Applications”The following libraries or applications must be installed before running OpenSIPS with this module loaded:
- AWS SDK for C++: By following these steps, you’ll have the AWS SDK for C++ installed and configured on your Linux system, allowing you to integrate with SQS: AWS SDK for C++ Installation Guide Additional instructions for installation can be found at: AWS SDK for C++ GitHub Repository
Deploying Amazon SQS locally on your computer
Section titled “Deploying Amazon SQS locally on your computer”For testing purposes, you can run SQS locally. To achieve this, you start localstack on your computer:
pip install localstacklocalstack startDon’t forget to set the necessary environment variables for testing, for example:
export AWS_ACCESS_KEY_ID=testexport AWS_SECRET_ACCESS_KEY=testexport AWS_DEFAULT_REGION=us-east-1Here you can find some cli commands such as create-queue, send/receive-message, etc.: https://docs.aws.amazon.com/cli/latest/reference/sqs/
Exported Parameters
Section titled “Exported Parameters”queue_url (string)
Section titled “queue_url (string)”This parameter specifies the configuration for an SQS queue that can be used to publish messages directly from the script, using the sqs_publish_message() function or to send messages using raise_event function.
The format of the parameter is: [ID]sqs_url, where ID is an identifier for this SQS queue instance and sqs_url is the full url of the queue.
The queue_url contains:
- endpoint
- region
This parameter can be set multiple times.
...
modparam("event_sqs", "queue_url", "[q1]https://sqs.us-west-2.amazonaws.com/123456789012/Queue1")
modparam("event_sqs", "queue_url", "[q2]http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/Queue2")
...Exported Functions
Section titled “Exported Functions”sqs_publish_message(queue_id, message)
Section titled “sqs_publish_message(queue_id, message)”Publishes a message to an SQS queue. As the actual send operation is done asynchronously, this function does not block and returns immediately after queuing the message for sending.
This function can be used from any route.
The function has the following parameters:
- queue_id (string) The ID of the SQS queue. Must be one of the IDs defined through the
queue_urlmodparam. - message (string) - The payload of the message to publish.
...
$var(msg) = "Hello, this is a message to SQS!";sqs_publish_message("q1", $var(msg));
...Examples
Section titled “Examples”Event-Driven Messaging with Event Interface
Section titled “Event-Driven Messaging with Event Interface”OpenSIPS’ event interface can be utilized to send messages to SQS by subscribing to an event and raising it when needed.
Steps:
-
Event Subscription: First, register the event subscription in your OpenSIPS configuration file within the
startup_route:subscribe_event("MY_EVENT","sqs:http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/Queue2"); -
Event Subscription via CLI: After starting OpenSIPS, you can subscribe to the event from another terminal using the OpenSIPS CLI:
opensips-cli -x mi event_subscribe MY_EVENT \sqs:http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/Queue2 -
Raise the Event and Send Message: Finally, to send a message, raise the subscribed event with the desired message content:
opensips-cli -x mi raise_event MY_EVENT 'OpenSIPS Message'
Contributors
Section titled “Contributors”By Commit Statistics
Section titled “By Commit Statistics”Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)
| # | Name | DevScore | Commits | Lines++ | Lines— |
|---|---|---|---|---|---|
| 1. | Alexandra Titoc | 30 | 7 | 1703 | 440 |
| 2. | Stefan Darius | 7 | 4 | 196 | 16 |
| 3. | Razvan Crainea (@razvancrainea) | 6 | 4 | 10 | 5 |
(1) DevScore = author_commits + author_lines_added / (project_lines_added / project_commits) + author_lines_deleted / (project_lines_deleted / project_commits)
(2) including any documentation-related commits, excluding merge commits
(3) ignoring whitespace edits, renamed files and auto-generated files
By Commit Activity
Section titled “By Commit Activity”| # | Name | Commit Activity |
|---|---|---|
| 1. | Stefan Darius | Jun 2026 - Jul 2026 |
| 2. | Razvan Crainea (@razvancrainea) | Sep 2024 - Jun 2026 |
| 3. | Alexandra Titoc | Aug 2024 - Aug 2024 |
(1) including any documentation-related commits, excluding merge commits
Documentation
Section titled “Documentation”Contributors
Section titled “Contributors”Last edited by: Razvan Crainea (@razvancrainea), Alexandra Titoc.
License
Section titled “License”All documentation files (i.e. .md extension) are licensed under the Creative Common License 4.0