[Help] Trouble editing files/ gaining access

Hi all,

Ok so im running asterisk on a synology NAS. I know… Its not ideal but its my only option ATM.

SO the only access I have to asterisk here is through the web gui which I know is crap.

So im trying to add the following lines to the extensions.conf file, and im having to do so using the file editor in the web gui.

[quote][dialplan_name]
exten => _.,1,NoOp(SMS receiving dialplan invoked)
exten => _.,n,NoOp(To ${MESSAGE(to)})
exten => _.,n,NoOp(From ${MESSAGE(from)})
exten => _.,n,NoOp(Body ${MESSAGE(body)})
exten => _.,n,AGI(chatplan.php,${MESSAGE(from)})
;exten => _.,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
;exten => _.,n,ExecIf($["${ACTUALTO}" != “sip:${EXTEN}”]?Set(ACTUALTO=sip:${EXTEN}))
exten => _.,n,MessageSend(${ACTUALTOS},${MESSAGE(from)})
exten => _.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _.,n,GotoIf($["${MESSAGE_SEND_STATUS}" != “SUCCESS”]?sendfailedmsg)
exten => _.,n,Hangup()[/quote]

I add those lines and hit save, but this is what it actually saves…

[quote]exten=.,n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
exten=
.,n,MessageSend(${ACTUALFROM},ServiceCenter)
exten=.,1,NoOp(SMS receiving dialplan invoked)
exten=
.,n,NoOp(To ${MESSAGE(to)})
exten=.,n,NoOp(From ${MESSAGE(from)})
exten=
.,n,NoOp(Body ${MESSAGE(body)})
exten=.,n,AGI(chatplan.php,${MESSAGE(from)})
exten=
.,n,MessageSend(${ACTUALTOS},${MESSAGE(from)})
exten=.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten=
.,n,GotoIf($["${MESSAGE_SEND_STATUS}" != “SUCCESS”]?sendfailedmsg)
exten=_.,n,Hangup()
[/quote]

as you can see its removing the execif lines. and there are a few other things it tends to remove or it changes the order of what I actually put in resulting in errors.

SO my question is, whats causing this? and how can I fix it?
OR Is there another way to acess this asterisk install apart from the gui? I would love to be able to telnet into this, but doing so just lands me in the CLI for synology and not asterisk.

Anyone have any ideas here?

Ask Synology. The GUI they provide is a dead product. There is a stickly posting about this.

Yes I know this. Im not asking for help with the GUI. Im just wondering if there is a way to change the SSH port using the GUI or other forms of accesing the server other than the GUI possibly the AMI to change the SSH port so i can gain acess.

I cant get in on port 22 as that gets me to the NAS.

If you can access to the linux box console then you can edit the asterisk files and also the asterisk cli. To enter in the asterisk cli use: asterisk -r

The asterisk cli provides the output and some realtime commands if you want to edit files to configure your asterisk then use the linux console and your preferred text editor.

I have tried that this is the output I get

The device is running BusyBox v1.16.1 built-in shell (ash)

I was however able to get to the etc/asterisk folder and saw the extensions.conf file. I was able to edit this file with VI but its not working like it should. This is what I have added to the extensions file. This should get IM working, and if a client is offline, it should send the message when the client comes back online. But whenever I use this code, I simply get a message from asterisk saying “Your message to 6002 has failed, will send when available” Even if the client is online. None of the messages go through.

[quote]
exten => _.,1,NoOp(SMS receiving dialplan invoked)
exten => _.,n,NoOp(To ${MESSAGE(to)})
exten => _.,n,NoOp(From ${MESSAGE(from)})
exten => _.,n,NoOp(Body ${MESSAGE(body)})
exten => _.,n,AGI(chatplan.php,${MESSAGE(from)})
exten => _.,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => _.,n,ExecIf($[“${ACTUALTO}” != “sip:${EXTEN}”]?Set(ACTUALTO=sip:${EXTEN}))
exten => _.,n,MessageSend(${ACTUALTOS},${MESSAGE(from)})
exten => _.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _.,n,GotoIf($[“${MESSAGE_SEND_STATUS}” != “SUCCESS”]?sendfailedmsg)
exten => _.,n,Hangup()
;
; Handle failed messaging
exten => _.,n(sendfailedmsg),NoOp(Sending error to user)
exten => _.,n,Set(SRC=${MESSAGE(from)})
exten => _.,n,Set(DST=${MESSAGE(to)})
exten => _.,n,Set(MSG=${MESSAGE(body)})
exten => _.,n,Set(MESSAGE(body)=“[${STRFTIME(${EPOCH},%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Sending when available”)
exten => _.,n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
exten => _.,n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
exten => _.,n,MessageSend(${ACTUALFROM},ServiceCenter)
exten => _.,n,GotoIf($[“${INQUEUE}” != “1”]?startq)
exten => _.,n,Hangup()
;
exten => _.,n(startq),NoOp(Queueing messaging for offline)
exten => _.,n,Set(MSGTIME=${STRFTIME(${EPOCH},%d%m%Y-%H:%M:%S)})
exten => _.,n,SYSTEM(/var/lib/asterisk/agi-bin/astqueue.sh –SRC ‘${SRC}’ –DST ‘${DST}’ –MSG ‘${MSG}’)
exten => _.,n,Hangup()[app-fakeanswer]
exten => _.,1,NoCDR
exten => _.,n,Set(DESTDEV=${EXTEN})
exten => _.,n,Set(THISDEVSTATE=${DEVICE_STATE(SIP/${DESTDEV})})
exten => _.,n,GotoIf($[“${THISDEVSTATE}” = “UNAVAILABLE”]?hang)
exten => _.,n,GotoIf($[“${THISDEVSTATE}” = “UNKNOWN”]?hang)
exten => _.,n,Answer
exten => _.,n,Hangup()
exten => _.,n(hang),Hangup()[/quote]

If I add only this code [quote]
exten => _.,1,NoOp(SMS receiving dialplan invoked)
exten => _.,n,NoOp(To ${MESSAGE(to)})
exten => _.,n,NoOp(From ${MESSAGE(from)})
exten => _.,n,NoOp(Body ${MESSAGE(body)})
exten => _.,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => _.,n,MessageSend(${ACTUALTO},${MESSAGE(from)})
exten => _.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _.,n,GotoIf($[“${MESSAGE_SEND_STATUS}” != “SUCCESS”]?
sendfailedmsg)
exten => _.,n,Hangup()
exten => h,1,Hangup()
;
; Handle failed messaging
exten => _.,n(sendfailedmsg),Set(MESSAGE(body)=“[${STRFTIME(${EPOCH},
%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Retry later.”)
exten => _.,n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
exten => _.,n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
exten => _.,n,MessageSend(${ACTUALFROM},ServiceCenter)
exten => _.,n,Hangup()
exten => h,1,Hangup() [/quote]

The messaging works, but obviously messages are lost if a client is unavailable.

So either there is a problem with the code? But I found this on several different forums and it seems to be working for anyone running version 11 or higher.
Or there is a problem with this version of asterisk, IE it cant handle these commands.

im running
OS Version:
Linux DiskstationVPS 3.10.35 #1 SMP x86_64 GNU/Linux synology_bromolow_3615xs

Asterisk Build:
Asterisk/13.1.0
Asterisk GUI-version : 2.1.0-rc1

Any Ideas?

After editing the extensions.conf you need to reload it by the command: dialplan reload but you need to gain access to the asterisk cli or at least that the command: asterisk -rx ‘dialplan reload’

Try to run the command from the folder of asterisk because maybe yor shell doesnt has the path updated.

Hi,

I know I need to reload after any changes are made.

My point was that one set of code works and one doesent. and I think I may have found the problem.

I started to look through the files one by one on the server and realized that chatplan.php file that is referenced here [quote]exten => _.,n,AGI(chatplan.php,${MESSAGE(from)})[/quote] Doesent exist on the server. So that would explain why this code set is not working. The problem is this only seems to be available with freepbx installed. So I guess im just gonna have to forget about messaging on this server :cry: