ppp down, send SMS to predefind numbers

Hello
I like to make notification to users when ppp goes down

I have CCR1009 for SSTP server and ~150 secret on him. Now, I like to inform users (secrets) when connection with my CCR1009 goes down. So i need to have phone number defined for every user (secret) and after connection is terminited or disconnected (of that secret) SMS to be send on predefine phone number for that user (secret)

SMS part is not problem I have GSM gateway and simple tool fetch http-post can send SMS.
Also massage text is same for all ex :There is no connection, chech you intenret"

But part of having different numbers for every user is problem.

Any idea hao to resolve this ?

/ppp secret set [find name=xyz] comment=“{"phone":"123456789"}”

Can You give full exampe with sms and 2 or more phone numbers for ppp…
Lets say that LTE interface is on CCR1009
/tool sms send port=lte1 massage=“Something” phone-number= ???

What do you mean 2 or more phone numbers, is that meant for a single user? I.e. if a connection of that single user falls down, you’ll send SMSes to three distinct numbers of that user?

Anyway, it was just a rough example - the comment is the only free field available for custom data for most items in Mikrotik configuration, but you can create your own internal structure inside it, which you have to be able to parse using the Mikrotik scripting language.

If you don’t need anything more complicated, a comma-separated list of numbers will save you from the hell of parsing the strings using :pick and :find, see the rough idea below:
:local comment “123,456,789” ; :local list [:toarray $comment] ; :foreach n in=$list do={put $n}

So the full example would be

:local list [:toarray [/ppp secret get [find user=xyz] comment]] ; foreach phone in=$list do={/tool sms send port=lte1 massage=“Something” phone-number=$phone}

Yes. For some users (secret) I need more then one phone number, for other just one

Anyway, it was just a rough example - the comment is the only free field available for custom data for most items in Mikrotik configuration, but you can create your own internal structure inside it, which you have to be able to parse using the Mikrotik scripting language.

If you don’t need anything more complicated, a comma-separated list of numbers will save you from the hell of parsing the strings using :pick and :find, see the rough idea below:
:local comment “123,456,789” ; :local list [:toarray $comment] ; :foreach n in=$list do={put $n}

So the full example would be

:local list [:toarray [/ppp secret get [find user=xyz] comment]] ; foreach phone in=$list do={/tool sms send port=lte1 massage=“Something” phone-number=$phone}

If so, my complete example covers that, does it work for you?

Your way of thinking help :smiley: Done same much easy with NOTE field on Dude. Just input phone number in NOTE for ping service and that is is. I create Notification to use SMS gateway device (it is also Mikrotik RB33G with 2 LTE)
Notification on Dude, execute on server
/tool fetch mode=http http-method=post url=“http://xxx.xxx.xxx.xxx:9999/?username=xxxxx& pw=xxxxxxxxx& clientaddress=[Service.NotesCommaList]&message=Internet na [Device.CustomField3] je sada [Service.Status]&device=Gateway1&port=LTE1” keep-result=no

If,there is no ping of device on other site of VPN for 15min, Dude send SMS tu user to check Internet (reboot router). For my using scenario it is great.

Onle problem is that on MT you can’t send SMS to multi phone-numbers in same line ex. tool sms send massage=“Somethig” phone-number=+xxxxxxxx,+xxxxxxx or phone-number=+xxxxxxxx;+xxxxxxx any combination can’t work exapt one number phone-number=+xxxxxxxx. .
I hope this will be possible in V7 or in some future v6 update, until thet I will use 1 phone number per user.