Wednesday, November 3, 2021

highly secure, highly private vpn for rent

 Hy,

Open VPN for rent.

I'm running a private vpn for me! The server is Open VPN on a router (not on pc/laptop) running on linux OpenWRT and keeps no logs of any kind. There is no password, all authentifications, authorizations... all security chains are based on tls/rsa 2048 bits keys and certificates. The software is Open VPN. There are windows/linux/android/iPhone  clients for connections (OpenVPN clients). There is only one file needed for setting these clients. This file contains all your needed rsa keys and certificates and tls handshake, server settings etc. Server location is in Romania and network provider is Digi - so your exit node will be a random IP address from Romania.

The certificates, the security keys are locally generated. No other/others, persons or companies are involved. There is just me providing these ssl/tls keys and certificates and no one has phisical access to my equipment room.

All your internet traffic, including DNS (domain name server) requests, will be encrypted   and routed through my vpn server.

So, this is a highly exclusive, unique and secure VPN service.

If you need a private/low profile/very secure vpn server with a steady  30-40 Mbps bandwidth, absolutely sufficient for every normal need, you can mail me at omotamm at ....   // The mail address is on gmail - so you know how to complete it, or you can go to https://everyday.go.ro/openvpn and contact me there.

Price is 6 euros/month.  It's a little high high but strong security, privacy, steady 30-40 Mbps bandwidth and exclusivity has it's price. The maximum period for rent is one month. After that, a new period and a new payment is necessary.

If you do not know how to setup the VPN client on your device, i will help you with all the necessary steps! There is no chance this process will require more than ten minutes! :)

This service is destinated for serious people not for script kiddies....

You can use bank payments or money transfer services (such as regular postal service, money gram, western union  etc...). The payments must be made in RON (romanian leu). You can use anonymous payments also, like gift cards, coupons, bitcoins etc..., provided i trust the service provider and type of this service (not all are serious and reliable) and the service is available on romanian teritory and, most of all, provided i can cash this type of payments.

For every question you may have, please mail me!   Lucian.

===================

Привет,

Откройте VPN (ВИРТУАЛЬНАЯ ЧАСТНАЯ СЕТЬ) в аренду.
Легко обойти цензуру в Интернете!

Я запускаю приватный vpn для себя! Сервер представляет собой Open VPN на маршрутизаторе (не на ПК / ноутбуке), работающем на Linux OpenWRT, и не ведет никаких журналов. Пароля нет, все аутентификации, авторизации... все цепочки безопасности основаны на 2048-битных ключах и сертификатах tls/rsa. Программное обеспечение Open VPN. Есть клиенты windows/linux/android/iPhone для подключения (клиенты OpenVPN). Для настройки этих клиентов нужен только один файл. Этот файл содержит все необходимые ключи и сертификаты rsa, рукопожатие tls, настройки сервера и т. д. Сервер расположен в Румынии, а сетевой провайдер — Digi, поэтому вашим выходным узлом будет случайный IP-адрес из Румынии.

Сертификаты, ключи безопасности генерируются локально. Никакие другие / другие лица или компании не участвуют. Только я предоставляю эти ключи и сертификаты ssl/tls, и ни у кого нет физического доступа к моей аппаратной.

Весь ваш интернет-трафик, включая запросы DNS (сервер доменных имен), будет зашифрован и направлен через мой сервер vpn.

Итак, это эксклюзивный, уникальный и безопасный VPN-сервис.

Если вам нужен частный/низкопрофильный/очень безопасный vpn-сервер с постоянной пропускной способностью 30-40 Мбит/с, абсолютно достаточной для любых обычных потребностей, вы можете написать мне на omotamm по адресу .... // Почтовый адрес находится на gmail - так что вы знаете, как его заполнить, или можете зайти на https://everyday.go.ro/openvpn и связаться со мной там.

Цена 6 евро/мес. Это немного высоко, но высокая безопасность, конфиденциальность, стабильная пропускная способность 30-40 Мбит / с и эксклюзивность имеют свою цену. Максимальный срок аренды – один месяц. После этого необходим новый период и новая оплата.

Если вы не знаете, как настроить VPN-клиент на своем устройстве, я помогу вам со всеми необходимыми шагами! Нет никаких шансов, что этот процесс потребует более десяти минут! :)

Эта услуга предназначена для серьезных людей, а не для сценарных детишек....

Вы можете использовать банковские платежи или услуги денежных переводов (например, обычная почтовая служба, Money Gram, Western Union и т. д.). Платежи должны производиться в RON (румынских леях). Вы также можете использовать анонимные платежи, такие как подарочные карты, купоны, биткойны и т. д., при условии, что я доверяю поставщику услуг и типу этой услуги (не все из них являются серьезными и надежными), и услуга доступна на румынской территории и, в большинстве случаев все, при условии, что я могу обналичить этот тип платежей.

По каждому вопросу, который у вас может возникнуть, пожалуйста, напишите мне! Люциан.

Saturday, October 30, 2021

cum sa spionezi ce fac angajatii pe calculator fara ca ei sa stie

Intrebarea este cum iti spionezi angajatii ce fac pe calculatorul/laptopul de serviciu in timpul programului si daca tehnic poti face acest lucru?

Da, tehnic poti face lucrul acesta foarte simplu si in urma implementarii solutiei de mai jos poti vedea in timp real chiar ecranul calculatorului unui anumit angajat si ce face el de fapt pe calculator.

Tot ce trebuie este sa schimbi ruterul de acces la net cu un router care suporta openwrt. Sunt destul de multe, unele chiar cu conectivitate gigabit (care ofera viteza maxim la ora actuala) pe toate mufele. Eu, de exemplu, am luat un router din acesta second hand cu 30 de lei de pe olx. 

Se instaleaza openWRT pe router, se instaleaza Open VPN pe router, clientul openvpn pe laptopul sau telefonul sefului, un server vnc care ruleaza invizibil pe fundal pe calculatoarele angajatilor, un client vnc viewer pe calculatorul/laptopul/telefonul sefului si tot pe calculatorul/telefonul sefului un client open vpn . Deci, seful poate spiona si de pe telefonul lui nu numai de pe laptopul/calculatorul personal.

Deci, trebuie un router modificat cu 2 programe software instalate, un program instalat pe calculatorul angajatului si doua programe pe calculatorul/laptopul/telefonul sefului.

Dupa ce routerul a fost modificat, toate instalarile astea dureaza 5 minute pe calculatorul angajatului si 10-20 minute pe calculatorul/telefonul sefului. Dureaza mai mult modificarea routerului - care este complicata, mie mi-a luat ce lputin 2-3 ore!

Reteta de mai sus a fost probata si folosita cu succes intr-o unitate unde seful avea banuiala ca angajatii nu bat pe aplicatia de vanzari toate produsele. Uitandu-se simultan pe camera video si pe ecranul care arata aplicatia de vanzari ( ecran care se vedea cu ajutorul solutiei tehnice descrise mai sus) seful a putut combina datele si sa-si dea seama cine il inseala.

Din punct de vedere legal implementarea unei astfel de solutii este dificila, dar din punct de vedere tehnic este foarte usor. Dar, nu a avut nevoie de implementare legala ci, a avut nevoie doar sa stie pentru el cine e angajatul problema. Dupa aia s-a descurcat el, orice patron stie ce are de facut cu un angajat care fura!

Cam asta este! În caz ca aveti nevoie de sprijin pentru implementarea unei astfel de solutii si nu gasiti pe cineva care s-o faca puteti trimite un mail la omotamm arond gmail punct com si rezolvam! Costul va fi de 200 ron onorariul meu, plus eventual achizitia unui router potrivit.   Implementarea se poate face si de la distanta prin teamviewer!

installing openwrt and openvpn on a router

 Hy!

I have an Asus RT-AC51U router and i have OpenWRT on it! Putting OpenWRT on this router is explained very good on the page dedicated to it on openWRT site. I used windows method.

Now, why not installing a private VPN? Maybe you are abroad and want access to your internal network or want to watch your netflix series or other tv stations/programs who cannot stream abroad because DRM and copyright things...

Installing openvpn is explained here very good. All you have to do is ssh into your router and literally write down every line in the tutorial followed by enter key. The single thing that didn't work very well for me was the firewall thing. In that case i followed the tutorial HERE (network/firewall section of the tutorial). After that, follow along the firs tutorial issuing terminal commands like they are written, till the end.

An observation: i generated 4 key for clients, as maybe i will gave one or two to somebody in the family. I used tcp protocol instead of udp.

Of course, after that you need to ftp into your router and edit manually some files to better link/fit to your needs and correct some errors who might have appear.

 

i modified 

/etc/openvpn/server.conf  ("server" is the name i gave to my server, really original :) )

/etc/openvpn/client.ovpn

examples of "server.conf" and "client.ovpn" are provided here. keys and certificates are deleted form examples.

for "server.conf".

user nobody
group nogroup
dev tun0
port 1194
proto tcp
server 192.168.8.0 255.255.255.0
topology subnet
client-to-client
keepalive 10 120
persist-tun
persist-key
push "dhcp-option DNS 8.8.8.8"
#push "dhcp-option 8.8.8.8 "
push "route 192.168.1.0 255.255.255.0"

# these 2 lines are for when you want to "see" the internal network behind the router and #use samba or ftp with your home station


push "redirect-gateway def1"
push "persist-tun"
push "persist-key"
#tls-auth /etc/easy-rsa/pki/ta.pem 0 this is old and incompatible with the new tls auth

mssfix 1305
 ifconfig-pool-persist   /tmp/ipp.txt
<dh>
-----BEGIN DH PARAMETERS-----

..................
-----END DH PARAMETERS-----
</dh>
<tls-crypt-v2>
-----BEGIN OpenVPN tls-crypt-v2 server key-----
..................
-----END OpenVPN tls-crypt-v2 server key-----
</tls-crypt-v2>
<key>
-----BEGIN PRIVATE KEY-----

-----END PRIVATE KEY-----
</key>
<cert>
-----BEGIN CERTIFICATE-----

...............

-----END CERTIFICATE-----

</cert>
<ca>
-----BEGIN CERTIFICATE-----.

........................

-----END CERTIFICATE-----
</ca>


the corespondent client.ovpn for the file above is:

(keys and certificates are deleted form example here)

user nobody
group nogroup
dev tun0
nobind
client
proto tcp
remote put your ddns/IP address or your domain here  1194
auth-nocache
persist-key
persist-tun
ns-cert-tls server
remote-cert-tls server
<tls-crypt-v2>
-----BEGIN OpenVPN tls-crypt-v2 client key-----
..........................
-----END OpenVPN tls-crypt-v2 client key-----
</tls-crypt-v2>
<key>
-----BEGIN PRIVATE KEY-----
.......................
-----END PRIVATE KEY-----
</key>
<cert>
-----BEGIN CERTIFICATE-----
.......................
-----END CERTIFICATE-----
</cert>
<ca>
-----BEGIN CERTIFICATE-----
................
-----END CERTIFICATE-----
</ca>


a screenshot of my firewall:

openwrt and openvpn firewall

a screenshot of interfaces (note, i didn't delete ip's and things, i don't care as i have everyday another ip address)

openwrt with openvpn interfaces


and thats it! Restart your router and enjoy your private VPN! :)

p.s.: do not forget to assign your VPN0 interface to vpn firewall zone (after you create VPN0 unmanaged interface additional settings will apear, among them is assign to firewall zone).



Friday, October 29, 2021

cum te uiti la programele digi tv cand esti in strainatate

 Cum poți să te uiți la programele Digi TV când ești în străinătate? 

 Din cauza drepturilor de autor, unele programe tv digi nu au drepturi de transmisie în străinătate. 

  Fapt deranjant pentru pasionații de seriale tv, meciuri, sport sau alte emisiuni îndrăgite.

  Și totuși, poți să te uiți dacă folosești un VPN. Un VPN este o legătură spre internet care ascunde locația ta reală. Să presupunem că ești în Bulgaria în concediu și intri pe Digi TV. Vei vedea că nu poți urmării serialele turcești, anumite fime, anumite seriale, anumite emisiuni de sport  etc....

  Practic, un VPN este un echipament de rețea intermediar care face legătura între telefonul/tableta/laptopul tău și serverul Digi din România. Ruta pachetelor de date transferate este a) telefon -> b) VPN -> c) Digi TV. Dacă VPN-ul este în România atunci cei de la Digi vor crede că ești în România și ai acces nelimitat la orice serial, emisiune etc, exact ca și cum ai fi în România. Să presupunem din nou că ești în Bulgaria: ruta pachetelor de date va fi a)Bulgaria -> România ( VPN) -> România (Digi Online).

 Exista o multime de firme care ofera VPN pentru inchiriat. Dupa ce platesti ti se furnizeaza un program de conectare si o parola sau un certificat de securitate - usor de instalat. 

Atentie, nu toate firmele care ofera VPN au programe de conectare disponibile pentru telefon. Daca vrei sa folosesti telefonul pentru accesarea Digi atunci trebuie sa intrebi mai intai daca firma ofera program de conectare pe telefon. 

Toate firmele care oferă VPN au programe de conectare pentru laptop/PC.

Partea pe care nu o stiu multi este ca multe din serviciile VPN mari nu au servere in Romania. Iar daca vrei sa pari ca esti in Romania atunci este obligatoriu ca firma sa detina servere in Romania. Concluzia: inainte sa platesti un VPN intreaba daca au servere in Ro.

Cei de la Nord VPN au sigur servere în Ro si preturi pana in 12-15 euro/luna, însa nu stiu care este perioada minima pentru plata!  Oricum, este cam cea mai mare firmă de inchiriere VPN, așa că probabil au opțiuni destul de flexibile - pentru toate nevoile personale!

Întrebați obligatoriu si despre lățimea de bandă de trafic oferită sau viteza conexiunii: trebuie să știți că pentru a viziona în condiții bune Digi Online sau Netflix din România îți trebuie o viteză minimă de 23-24 Mbps (cu "b" mic).

 În caz că nu găsești un VPN din Ro poți să mă contactezi  pe mail omotamm arond gmail punct com și-ți pot oferi setările și tot ce trebuie pe telefon/laptop. Prețul este de 10 euro/săptămână. Traficul garantat este de 50 Mbps, absolut suficient pentru filme de inalta definitie pe netflix, digi sau orice alta platforma de streaming. Serverul VPN nu face log-uri de nici un fel si este rulat in RAM. Nu se accepta torente!

 

Sunday, October 17, 2021

câți români se spală pe mâini?

 Cele de mai jos nu au nici o legătură cu pandemia etc...  Ce scrie mai jos este doar rezultatul unei observații care a durat cam 7-8 luni!

 Sunt doar un boșorog care de câte ori merge la Kaufland, și merg cam in 29 de zile din 30, merge obligatoriu și la toaletă. De ce? Așa sunt bosorogii, au nevoie mai des și e greu să se țină. Pe parcursul acestor 7-8 luni din urmă am zis să țin socoteala celor pe care-i văd că-și fac nevoile, mici sau mari, și se spală pe mâini după!

 Surpriză, cam 75% dintre toți ăia pe care i-am observat NU se spală pe mâini după ce-și fac nevoile!  Tineri, maturi, bătrâni, nu contează, 75% NU se spală. Din contră, cei tineri până în 25 de ani să zic sunt mai răi ca ăia bătrânii, reprezentând cam 60% din procentul celor ce nu se spală pe mâini după ce se pișă sau se cacă (ca să fie clar despre ce vorbim aici).

 

Wednesday, August 4, 2021

resetare parolă hikvision

     Salut, recent am avut de resetat o parolă pentru un dvr hikvision, din acela cu firmware mai vechi. Nu se poate absolut cu nici o metodă în afară de cea de mai jos, nici cu aplicația hikconnect, cu nimic, deoarece are firmware de tip vechi.  Uitați de scoaterea bateriei cmos sau coduri luate de pe diverse situri, nu are rost să pierdeți vremea cu porcării.

    Se instalează SADP pe laptop sau pc, se leagă dvr-ul si pc-ul in aceeași rețea, se caută dispozitivul în rețea, se apasă legătura unde scrie "forgot password". Se exportă fișierul xml sau codul QR, cum vreți.

   Se face o poză a etichetei de pe spatele aparatului.

   Se  trimit cele 2 fișiere (xml + poza) la adresa principală de contact hikvision, support arond hikvision punct com. Atenție, mailul din europa - support.eu@hikvision - nu răspunde, nu pare a fi funcțional, mie nu mi-a răspuns nici după 3 zile,  trimiteți din prima la adresa principală.

   Va trebui să știți să scrieți mesajul de bază în engleză. Eu n-am mai specificat din ce regiune sunt sau de unde am cumpărat aparatul. Doar cele 2 fișiere atașate plus mesajul respectuos in engleză în care ceream resetarea parolei.

   Cam după o zi vine răspunsul plus un fișier xml atașat pe care îl încărcați tot cu SADP pe DVR. Odată cu asta nu uitați să specificați noua parolă.  Parola veche este resetată instant pentru utilizatorul admin și este înlocuită cu cea nouă.

Baftă!

Wednesday, July 21, 2021

The Canadians


I mean, The Barbarians. The Pussy's. The lefties. The communists.

That's about the canadians. 

Communists filthy savages who are burning churches. 

Fuck you all in canada, and fuck your country too, and fuck your flag too! I piss on your flag and on your country!

A "country"(they call it a country, not me) with no history, no traditions, no nothing, no achievments, full of filthy brain dead monkeys zombies brain washed atheists.

A "country" of nothing - that's canada. An empty space filled sparcelly with filthy zombies.

If you were born and grown in a communist regime you would understand why is really bad to be a communist and to live in a filthy communist country. But you don't.

I hope you all filthy canadians would live in the near future in a filthy communist canada. 

That's the punishment i would choose for you for burning churches and for your filthy cancel culture.

Fuck You canada

Saturday, May 15, 2021

Climate change

     How funny is so called "climate change" problem! 

They are collecting, measuring, plotting and doctoring some 20-30 years of data, or even 50 years if they are courageous enough and then they are crying and screaming catastrophe.

Poor me, i was thinking that when you are talking about climate you are considering some thousands of years at least. 20 years or even a hundred years is about the Weather - not the climate.


And, of course, over the history of earth the climate was ever changing continuosly, this is not some stationary phenomenom who never changes! It's NORMAL to change. 


The same about co2 (carbon dioxide) level in atmosphere. Some millions years ago this was about ten or even hundred times than actual levels, and yet, life was flourishing back then more than now. 

All you can say about co2 levels right now is that they are too low! If they would be lower than this then you will have NO crops at all, no vegetation, no plants, no forests at all! 

 

Plus, as i know, NOBODY  has ever produced  a really scientific proof that co2 is the main component involved in climate change or how is afecting the climate. The main factor here is the Sun. Other factors are geological, marines, astronomicals etc etc...  There is nobody and will never be, there will be forever an impossible task to predict the life and the energy flow of an entire planet, at least for more ten tousands years from now.... and maybe then the scrientists will be more honest..... 


For now, what is for sure is this illusion of climate change is made off and is used for taxation,  for squeezing more money from tax payers, and you guess where that money are heading.... All is a big hypocrite lie.....



 

 

Thursday, March 25, 2021

mainstream media is worth something ?

 Is it worthy to read/watch mainstream media?

No. As i said, everyone watching any form of tv, everyone listening to main media fake / fabricated / doctored so called "news" is a flat brain dead walking knuckledragging monkey zombie. 

Best news and world perspective you will find is that aquired with your own eyes/ears/judgement and using common sense - if you have such a thing, or if you were lucky to have good teachers to teach you how to think with your own brain and  the real values in life (not teachers that indoctrinate you with hate, communism and stupid Lenin/Marx like left ideas).

Can u live w/out a tv or radio? Yes, and the quality of your life/mental health will improve dramatically! 

 

Tuesday, March 9, 2021

tv is for idiots and brain deads

     Can you survive without watching tv at all?

    Yes. And you will feel so good, so relaxed! No stupid fake news, no stupid movies and shows!

    I haven't watched tv for 5 years now! No news, no shows, no sports, no nothing! In fact, i don't even have a tv set! I feel very good, and i do not have any wish of watching anything on tv!

    Everything i want to watch i find on the internet! More important, i watch what i want to watch and when i want - not what others wants for me to watch. News, sports, movies, shows, you name it, everything is on the internet now. If you search, you will find! And all for free!

 

    The stupidity and retardness of today tv is incredible! I think only zombies, retarded or brain washed people could appreciate today state of tv industry.

 

    If you are a zombie right now, please don't be! Throw away that stupid box and regain your mental sanity and equilibrium, regain your brain!

    By the way, please close now your facebook or twitter etc account! Those are no good at all, nothing good comes from there! You do not need any stupid account on fb or twitter. 

Saturday, March 6, 2021

Hollywood today

     The only good movie industry in USA, as of today, is porn movie  industry.

Hollywood is a gizmo, a brain dead washed horde. Nothing good comes from there.

It is what it is, a total shit!

Thursday, February 11, 2021

asterisk pjsip extension conf for sending offline messages

 Hy!

Hard to find some good documentation about queuing offline voip/im text messages in asterisk voip software.

But, even if that was just a short hobby, i searched and i searched .... and i found one script using outgoing folder in /var/spool/asterisk and .call files.

I grabbed the script and i modified according to my software and environment.

This is a very basic script and such is not intended for complex scenarios, but is neat and do the job.

The script, together with some snippets from my pjsip.conf file and extensions.conf file are distributed and published here AS IS -  whitout any responsability and guarantee. 

If the message was sent successfuly, then you will receive a short message informing you about that. Of course, your corespondent will receive the message.


The script verifies if the number dialed exists using pjsip cli command - pjsip list auths.

I do not know if that command is listing ALL the users(extensions) as defined in pjsip.conf, or merely is listing all the users who are logged in at a certain time. And i do not care! :) 

If the number (extension) doesn't exist then you will receive a message saying that.

 If your corespondent is not online, then you will receive a short informing message.

The message will be sent to queue. The script will retry to transmit the message for about 1 day. This interval is editable. The script will do his job even for multiple failed messages, but i do not know if will keep the order of messages when the client goes online again.

 

If your queued message has been transmitted successfuly, then you will receive a short message informing you about that.

Bellow you will find all the lines. Atention, blogger has no "code" edit, so be aware of possible line breaks - those might render the script useless if you just copy-paste and do not perform some basic edit on it!

 #!/bin/bash
# v0.2
# copyleft Sanjay Willie sanjayws@gmail.com
# SCRIPT PURPOSE: GENERATE SMS OFFLINE QUEUE
# GEN INFO: Change variables sections
###########################################

######            NOTE  ###############################
# above script was modified by l u c i a n _ g e   0 u t l 0 0 k  and you know what is following.......
# for lubuntu 18.04, asterisk 18 compiled from source
# attention: this script do not cover every scenario
# for your needs it might be necessary to modify again this script
# this script is free and is distributed AS IS, with absolutely no guaranty and
# no responsabillity involved from creator
# this script is not intended for production scenarios but is merely an example
# i'm, but no mean, an expert in voip, this was just a 2 days hobby
# i must say, the documentation regarding this subject was awfully hard to find
# and fuck every knukledragger and monkey washed brain inbreed  out there on #net who doesn't know anything else but "search google"!!!!!!! this is not an #answer, nor a constructive discussion, you filthy big poo inbreed!
# fuck you, first i do not use google, second - you are an inbreed motherfucker
# communist. if you are so smart, why don't you answer and post something
# constructive, you braind dead knuckledragger inbreed monkey?

####################################################
maxretry=1000
retryint=60
# aprox. 1 day for retrying to transmit
ERRORCODE=0
#astbin='which asterisk' # no need of extra here, will use absolute path /usr/sbin/asterisk
# yes, this is a hardcoded command path. atention here, use

#your own environment path.
myrandom=$[ ( $RANDOM % 1000 )  + 1 ]

#random number for naming the queued .call files

echo "begin"

#exista=$(/usr/sbin/asterisk -rx pjsip show auths | grep -c '903')
#echo 'exista'
#echo $exista, too lazy to use bash debugger
#
function error_exit(){
      echo "error: $1"      
      exit
}

source=$1
dest=$2
message=$3
# arguments : source of message, destination of message and message body
# those are c U ming from extension.conf
#source is like pjsip:901, destination is like pjsip:903@somedomain.com

##################### ATTENTION #########################
##################   ATTENTION

#                A T T E N T I O N


# attention: message body is not filtered, need some filtering
# NOT TESTED
# NOT TESTED
# NOT TESTED, NOT IMPLEMENTED
# RIGHT NOW IS TESTED WITH MESSAGES WHITOUT ANY SPECIAL CHAR
# MESSAGE BODY NEED SOME BASIC FILTERING
#################################
#echo $source
#echo $dest
#echo $message
#lazy bastard, why don't u use debbuger?!
if [[ "$source" == "" ]]; then
    error_exit "message has no source"
fi
if [[ "$dest" == "" ]]; then
    error_exit "message has nodestination"
fi
if [[ "$message" == "" ]]; then
    error_exit "message has no body"
fi
#

# Check to see if pjsip extension is in auths list
#if is not, then the number is wrong - some typo
#destination_number='echo "$dest"' | cut -d @ -f1 | cut -d : -f2
 # example: from pjsip:901@somedomain.com we get 901 (extension number)
 destination_number=$(echo $dest | cut -d\@ -f1 | cut -d\: -f2)
 #echo "destinatie"
 #echo $destination_number

###################################### 1 wrong number

function destination_exist(){
    /usr/sbin/asterisk -rx 'pjsip show auths' | grep -c $destination_number

}

ifexist=$(destination_exist)
#echo "ifexist"
#echo $ifexist


 if [[ "$ifexist" == "0" ]]; then
    echo "Destination does not exist in dialplan"
    #send a message back to inform that destination does not exist in server dialplan
    filename="$destination_number-$myrandom.call"

#attention, random file name is not random enough, need more

    number=$(echo $source | cut -d\: -f2)

#atention here, the following lines in .call file must be set w/out any spaces

#at the beginning of the new lines
    echo "Channel: Local/$number@app-fakeanswer
CallerID: $source
Maxretries: $maxretry
RetryTime: $retryint
Context: mess
Extension: $destination_number
Priority: 1
Set: MESSAGE(body)='error the dialed number does not exist in server dialplan'
Set: MESSAGE(to)=$source
Set: MESSAGE(from)=MessageCenter
Set: INQUEUE=1 " | tee /var/spool/asterisk/outgoing/$filename
          error_exit "error: destination number does not exist in auths list for pjsip"
fi


############################################################### 1





#################################### 2 connectivity loss
#
#######################  A T E N T I O N
# Interesting situation:
# device is disconnected but in CLI > "pjsip show contacts" command output  is available
#i guess this is because time expire of registration or something similar
#like a session expire (qualify_frequency?)
# in this case the message is lost, unless is there
#some sort of check if the device is REALLY online BEFORE sending the message

########### ATENTION  

#sometimes the device goes offline for some time
#this is the second scenario
#maybe are more possibillities but for now
#this is it

#so, device is offline and we know that already
#SEND THE MESSAGE STRAIGHT TO QUEUE


source=$(echo $source | cut -d\: -f2)

echo "Channel: Local/$destination_number@app-fakeanswer
CallerID: $source
Maxretries: $maxretry
RetryTime: $retryint
Context: mesajetext
Extension: $destination_number
Priority: 1
Set: MESSAGE(body)=$message
Set: MESSAGE(to)=$dest
Set: MESSAGE(from)=$source
Set: INQUEUE=1 "


filename="$destination_number-$myrandom.call"
echo "Channel: Local/$destination_number@app-fakeanswer
CallerID: $source
Maxretries: $maxretry
RetryTime: $retryint
Context: mess
Extension: $destination_number
Priority: 1
Set: MESSAGE(body)=$message
Set: MESSAGE(to)=pjsip:$destination_number
Set: MESSAGE(from)=$source
Set: INQUEUE=1 " | tee /var/spool/asterisk/outgoing/$filename

exit 


this was the script (in folder /var/lib/asterisk/agi-bin).

Bellow you will find some fragments from pjsip.conf and extensions.conf matched with the above script. if you do not match what is needed, the whole thing will be useless.

[app-fakeanswer]
exten => _X.,1,NoCDR
exten => _X.,n,Set(DESTDEV=${EXTEN})
exten => _X.,n,Set(THISDEVSTATE=${DEVICE_STATE(PJSIP/${DESTDEV})})
exten => _X.,n,GotoIf($[“${THISDEVSTATE}” = “UNAVAILABLE”]?hang)
exten => _X.,n,GotoIf($[“${THISDEVSTATE}” = “UNKNOWN”]?hang)
exten => _X.,n,Answer
exten => _X.,n,Hangup()
exten => _X.,n(hang),Hangup()


[mess]
exten => _X.,1,Set(DEVSTATE=${DEVICE_STATE(PJSIP/${EXTEN})})
same => n,GotoIf($["${DEVSTATE}" = "UNAVAILABLE"]?errormsg)
same => n,GotoIf($["${DEVSTATE}" = "INVALID"]?errormsg)
same => n,GotoIf($["${DEVSTATE}" = "UNKNOWN"]?errormsg)
same => n,MessageSend(pjsip:${EXTEN},${MESSAGE(from)})
same => n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
same => n,GotoIf($[“${MESSAGE_SEND_STATUS}” = “SUCCESS”]?sendok)
same => n,Hangup()
same => n(sendok),NoOp(Sending ok message transmitted to user)
same => n,Set(MESAJORIGINAL=${MESSAGE(body)})
same => n,Set(MESSAGE(body)=”[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has been sent.”)
same => n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
same => n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
same => n,Set(EU=${CUT(ACTUALFROM,:,2)})
same => n,MessageSend(pjsip:${EU},MessageCenter)
same => n,Hangup()
same => n(errormsg),NoOp(Sending error to user)
same => n,Set(MESAJORIGINAL=${MESSAGE(body)})
same => n,Set(MESSAGE(body)=”[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Sending when available”)
same => n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
same => n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
same => n,Set(EU=${CUT(ACTUALFROM,:,2)})
same => n,MessageSend(pjsip:${EU},MessageCenter)
same => n,GotoIf($[“${INQUEUE}” != “1”]?startq)
same => n,Hangup()
 exten => _X.,n(startq),NoOp(Queueing messaging for offline)
 same => n,Set(MSGTIME=${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)})
 same => n,Set(SRC=pjsip:${EU})
 same => n,Set(DST=${MESSAGE(to)})
 same => n,Set(MSG=${MESAJORIGINAL})
 same => n,SYSTEM(/var/lib/asterisk/agi-bin/sendlater.sh  "${SRC}" "${DST}" "${MSG}")
 same => n,Hangup()

###############

bellow is a fragment from pjsip.conf
[901]
type=aor
max_contacts=1
remove_existing=yes
qualify_frequency=600
qualify_timeout=6.0

[901]
type=auth
auth_type=userpass
username=901
password=somepassword
 
[901]
type=endpoint
aors=901
auth=901
callerid="xxx" <901>
context=internal
disallow=all
allow=g722
allow=ulaw
allow=alaw
allow=vp8
;dtmf_mode=rfc4733

;above line with dtmf will break some mobile clients, i guess dtmf type need to ;match those types accepted by the client software

;media_encryption=sdes ;
direct_media=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
;transport=transport-tls
message_context=mess
allow_subscribe=yes
subscribe_context=subscribe


I hope it will be useful someday to someone! Do not forget, this was just for fun, a short 2 days hobby. Do not expect miracles, but do expect something functioning and useful for a start!