extensions_custom.conf
[sms-sender]
exten => s,1,Noop(send sms to ${CALLERID(num)})
exten => s,n,AGI(sms.php, ${CALLERID(number)})
exten => s,n,Goto(app-announcement-9,s,1)
sms.php
#!/usr/bin/php -q
<?php
require('phpagi.php');
$agi = new AGI();
$cid = $agi->request['agi_callerid'];
$user = "smsuser";
$pas = "smsuser";
$text = "message ";
$sms = str_replace(" ", "+", $text);
$prov = "1";
$meth = "2";
$url = "https://my-domain/goip/en/dosend.php?USERNAME=$user&PASSWORD=$pas&smsprovider=$prov&smsnum=%2B$cid&method=$meth&Memo=$sms";
if(preg_match('/^79[0-9]{9}/',$cid)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$out = curl_exec($ch);
curl_close($ch);
echo $out;
}
else {
echo "not mobile";
}
?>
in the console I see an error message
-- Executing [2@ivr-6:1] Set("SIP/XXXXXXXXXXX-00000232", "__ivrreturn=0") in new stack
-- Executing [2@ivr-6:2] Goto("SIP/XXXXXXXXXXX-00000232", "customdests,dest-4,1") in new stack
-- Goto (customdests,dest-4,1)
-- Executing [dest-4@customdests:1] NoOp("SIP/XXXXXXXXXXX-00000232", "Entering Custom Destination sms-sender") in new stack
-- Executing [dest-4@customdests:2] Gosub("SIP/XXXXXXXXXXX-00000232", "sms-sender,s,1()") in new stack
-- Executing [s@sms-sender:1] NoOp("SIP/XXXXXXXXXXX-00000232", "send sms to XXXXXXXXXXX") in new stack
-- Executing [s@sms-sender:2] AGI("SIP/XXXXXXXXXXX-00000232", "sms.php, XXXXXXXXXXX") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/sms.php
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_request: sms.php
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_channel: SIP/XXXXXXXXXXX-00000232
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_language: ru
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_type: SIP
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_uniqueid: 1613638224.1108
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_version: 16.15.1
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_callerid: XXXXXXXXXXX
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_calleridname: XXXXXXXXXXX
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_callingpres: 0
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_callingani2: 0
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_callington: 0
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_callingtns: 0
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_dnid: XXXXXXXXXXX
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_rdnis: unknown
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_context: sms-sender
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_extension: s
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_priority: 2
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_enhanced: 0.0
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_accountcode:
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_threadid: 140256500864768
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> agi_arg_1: XXXXXXXXXXX
<SIP/XXXXXXXXXXX-00000232>AGI Tx >>
<SIP/XXXXXXXXXXX-00000232>AGI Rx << Could not open input file: XXXXXXXXXXX
<SIP/XXXXXXXXXXX-00000232>AGI Tx >> 510 Invalid or unknown command
-- <SIP/XXXXXXXXXXX-00000232>AGI Script sms.php completed, returning 0
-- Executing [s@sms-sender:3] Goto("SIP/XXXXXXXXXXX-00000232", "app-announcement-9,s,1") in new stack
-- Goto (app-announcement-9,s,1)
where did i go wrong?