How to delivery message if the SIP device is offline?

I made a Asterisk v15.2.0 with USB Dongle Huawei 1550.
I reach the point that Im able to send/receive sms message from /and to my SIP device, as to receive /send call.
Im using for now ZOPIER on Android device.

Now I faceing with next problem…
If Im offline on my SIP device (Zoiper on android, let assume that my phone left without battery) and if someone send me a SMS message I will see next i CLI:

[Jan 22 09:26:37] NOTICE[1205]: chan_sip.c:30192 sip_poke_noanswer: Peer 'test_user' is now UNREACHABLE!  Last qualify: 67
 [dongle0] Got SMS from +my_phone_number: 'OFFILE!@'
    -- Executing [sms@from-gsm:1] Set("Local/sms@from-gsm-00000001;1", "MESSAGE(body)=OFFILE!@") in new stack
    -- Executing [sms@from-gsm:2] System("Local/sms@from-gsm-00000001;1", "echo '2018-01-22 09:26:56 - dongle0 - +my_phone_number: OFFILE!@' >> /var/log/asterisk/sms.txt") in new stack
    -- Executing [sms@from-gsm:3] MessageSend("Local/sms@from-gsm-00000001;1", "sip:test_user,"+my_phone_number"<+my_phone_number>") in new stack
    -- Executing [sms@from-gsm:4] NoOp("Local/sms@from-gsm-00000001;1", "Send status: FAILURE") in new stack
    -- Executing [sms@from-gsm:5] Hangup("Local/sms@from-gsm-00000001;1", "") in new stack
  == Spawn extension (from-gsm, sms, 5) exited non-zero on 'Local/sms@from-gsm-00000001;1'
    -- Registered SIP 'test_user' at
[Jan 22 09:28:41] NOTICE[1585]: chan_sip.c:24668 handle_response_peerpoke: Peer 'test_user' is now Reachable. (7ms / 2000ms)
    -- Unregistered SIP 'test_user'
    -- Registered SIP 'test_user' at

When I become online on SIP device, I do not get any notification about sms.
It is same with a missed call.

Is there any solution to do this in dial plan with some bash scripts?

No one have an idea?

There is no canned solution for this. I have a feeling that out of dialogue message failures aren’t reported to the dialplan, but if they are, it would be up to you to store the message outside of Asterisk.

Ok…then I will make a bash script to send on sip when user become online missed call and sms!

Hi there , could you plz tell me about your solution, I faced the same problem too.

I still didnt made it, because of lack of time…
But I will.
When It will be finish I can share with u!

I’m using JabberSend command for that, all users receive their missed calls or whatever you want once they get online.

I’m using Openfire to achieve it.

Best Regards

Can u give us more infromation, concrete example how did u solve?
Some tutorial?

Would u be so kind to give us quick review and function how u using this options?


In my case I’ve installed Openfire for adding XMPP account to my users so I’ve added a column on sippeers realtime table which contain user firstname.lastname.

On Asterisk dialplan I’ve a step doing as peer below

same => n,Set(user=${ODBC_GETXMPPID(${EXTEN})})
same => n,JabberSend(asterisk,${user}@telecom.lenumero.local,${user} You’ve missed a call from ${CALLERID(all)} at ${STRFTIME(${EPOCH},%d/%m/%Y à %Hh%M)})

within func_odbc.conf

readsql=SELECT bria_login_username FROM sippeers WHERE name=’${SQL_ESC(${ARG1})}’

I hope it help.

Best Regards