Skip to content

change short message by interceptorΒ #1262

@ashrafalzyoud

Description

@ashrafalzyoud

πŸ“¨ Help Request – Modify SMS Content in Interceptor and Forward to sms_logger
Subject: How to modify short_message in MT Interceptor and forward modified data to sms_logger?

Message:

Hello Jasmin community,

I'm currently developing a smart SMS filtering and transformation system using Jasmin SMS Gateway. I'm using MTInterceptor with a Python script to intercept and modify outgoing messages.

βœ… What I'm trying to achieve:
Modify the short_message before it's sent out.

Ensure the modified message and metadata (brand, pattern, etc.) are forwarded properly to sms_logger (which listens to AMQP submit.sm and submit.sm.resp).

Avoid affecting DLR or delivery tracking.

πŸ” My setup:
Jasmin 0.9+ running on Linux.

Python3 interceptor script like this:

def intercept(routable):
    old_msg = routable.message.decode(errors='ignore')
    new_msg = "Modified message 123456"
    routable.message = new_msg.encode('utf-8')
    return routable

❗ The problem:
Even though the script runs (verified via Jasmin logs), the actual message sent is still the original one, not the modified one. I also want to pass extra metadata (like x-brand, x-pattern, x-transformed) to the message headers so that sms_logger.py can log them.

πŸ’­ What I've tried:
Modifying routable.pdu.params['short_message'] β€” has no effect.

Modifying routable.message β€” also seems ineffective.

I confirmed MTInterceptor is registered correctly and is being executed.

The message in submit.sm still shows original content.

AMQP headers from Interceptor are not being passed to the logger.

❓ What I need help with:
What is the correct way to permanently modify the message content before sending it?

How can I add custom headers or metadata in the interceptor (e.g. x-brand, x-transformed_message) that will be visible to sms_logger or through the AMQP exchange?

Are there limitations in Jasmin's MTInterceptor that prevent such changes?

Any help, guidance, or working examples would be greatly appreciated!

Best regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions