Asterisk AMI MessageSend - how to set CallerID?

I have an issue where messages sent using the below Examples results in the recipient unable to reply as the sender (From:) shows up unknown. Is there any way to spoof the From variable or will AMI Messages always show as unknown?
I have a php script that receives sms via an http gateway and feeds it into the AMI. It works well , and I can also send messages out via dial plan and CURL if I hand enter the recipient in a new message. I Just can’t reply due to the ‘Unknown’ sender issue.

Example1:
Action: MessageSend
To: sip:201
From: 407-380-0667
Body: This is a test message

Example2:
Action: MessageSend
To: sip:201
From: sip:203
Body: This is a test message

Note: Currently using Asterisk 16.3.0 and each example replies as:
“Response: Success
Message: Message successfully sent”

not seeing unknown with pjsip on 16.3

Action: MessageSend
To: pjsip:1002
From: sip:1001my.pbx.net
Body: This is a test message



MESSAGE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 2.2.2.2:5060;rport;branch=z9hG4bKPj212bcdcc-ded2-4e4c-90d1-6440a44df32c
From: <sip:[email protected]>;tag=5f00ef8c-4413-4e4f-ac0e-d36b0326ec0c
To: <sip:[email protected]>
Contact: <sip:[email protected]:5060>
Call-ID: 10dc63d9-8207-46c5-924e-8ebaabb410d5
CSeq: 41190 MESSAGE
Max-Forwards: 70
User-Agent: FPBX-14.0.11(16.3.0)
Content-Type: text/plain
Content-Length:    22

This is a test message

Thanks Chris!

I would not have guessed pjsip works with this, while chan sip does not. I just tested this and I’ve got replies working flawlessly now. Thank you so much :grinning:

I’ve clenched onto chan sip forever, but happy to jump over to pjsip to gain this functionality.

I like that pjsip does this without the extra effort, but in case any needs the chan sip solution… just enclose the from number as shown below.

Action: MessageSend
To: sip:201
From: <4073800667>
Body: This is a test message

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.