I posted this in asterisk’s forums but was told this was something I should post here
I’ve been testing some POC code and system architecture I’ve designed to make responding to SMS received from SIPSTATION gateway easier and more mobile than having to log into UCP to do so.
I’ve already written automation to scrape the asterisk sms tables in the database (in the future an event-driven model would be better) and email to me every few seconds.
The easiest way I’ve found to respond would be to reply to said email. I operate my own email relay and freepbx server. The emails sent from scraping are sent as an authenticated user on my relay with proper dkim/spf, etc. I have the relay set up to redirect all emails sent to that specific user (in this case all replies to said scrape emails) to the asterisk system, which runs a basic smtp routine i wrote to process the email and handoff to some sort of Asterisk AMI routine (written in php). The goal is to find a way to query Asterisk AMI (or some other method) to send an SMS through the SIPSTATION gateway i use.
the following snippet works, so I’m able to connect to AMI and issue commands
$asm = new AGI_AsteriskManager();
if($asm->connect('127.0.0.1', 'username', 'password')) {
$peers = $asm->command("sip show peers");
print_r($peers);
}
However, I can’t seem to call the MessageSend method without failure, provided this is what I will need to call.
$asm = new AGI_AsteriskManager();
if($asm->connect('127.0.0.1', 'username', 'password')) {
$result = $asm->MessageSend('sip:19999999999', '"Caller ID Name" <19999999999>', 'hello');
print_r($result);
}
Array
(
[Response] => Error
[Message] => Message failed to send.
)
asterisk cli debug logs show:
[2022-04-23 23:30:43] WARNING[31990]: chan_sip.c:6331 create_addr: Purely numeric hostname (19999999999), and not a peer–rejecting!
Is it possible for me to send an SMS message out to a 10 digit cell number like this?