Getting a little confused - want to execute script from IVR

Hi all,

I’ve tried asking this over on the Trixbox forum, but it’s been ignored so far, and I’m getting really frustrated with myself!

Version etc…

asterisk -vvvvvvvvvr
Asterisk 1.6.0.26-FONCORE-r78, Copyright (C) 1999 - 2010 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
  == Parsing '/etc/asterisk/asterisk.conf':   == Found
  == Parsing '/etc/asterisk/extconfig.conf':   == Found
Connected to Asterisk 1.6.0.26-FONCORE-r78 currently running on trixbox1 (pid = 2235)
Verbosity is at least 9

I struggled to get it set up, but with various forum posts and Google, I got it up and running with my sipgate account pretty quickly, and I have a kind of IVR set up - if I phone the sip number I get a pre-recorded voice telling me to dial the extension if I know it - a standard one that I selected from the list.

My problem is probably a little different than most, as I’m simply looking to have a way into my home network from any phone.

I’ve set up (which I thought would be the most difficult bit :wink: ) a variety of home automation projects in my house from bits and pieces I’ve found in skips/bins, and bits that I’ve made myself. Basically, I can turn lights on and off, open doors, open windows etc… through a series of relays that are triggered through shell scripts that make a call to an IP listener that redirects the command to the machine that controls the correct relay. I’d like to be able to trigger the scripts via the IVR, like so:

Select extension number:
—4011
-------1 - Ground Floor
--------------1 - Open Front Door
--------------2 - Turn on main lamp
--------------3 - Turn on second lamp
--------------4 - Turn on Amplifier
--------------5 - Toggle Motion Detection in Living room
--------------6 - Power Down Myth Client
--------------7 - Return to Room Menu

-------2 - Middle Floor
--------------1 - Toggle Lamp in Room 1
--------------2 - Toggle Lamp in Room 2
--------------3 - Toggle Lamp in Room 3
--------------4 - Toggle Lamp in Room 4
--------------5 - Toggle Fan in Room 1
--------------6 - Toggle Motion Detection on Driveway
--------------7 - Power Down Myth Client
--------------8 - Return to Room Menu

-------3 - Top Floor
--------------1 - Toggle South Facing Window
--------------2 - Toggle North Facing Window
--------------3 - Toggle West Facing Window
--------------4 - Toggle Fan
--------------5 - Power Down Myth
--------------6 - Return to Room MenuServer

Not sure if this helps, but here’s the output from ‘sip show channels’

Peer User/ANR Call ID Format Hold Last Message
217.10.79.23 3444949 0fde658f5540112 0x0 (nothing) No
1 active SIP dialog

I’ve set up an extension (4011), and have set simple options in the IVR, 1. - Phone book, 2 - IVR (test IVR), yet when I phone the number and dial either the 4011 extension, or press 1 or 2, nothing happens.

I’m sure this is really quite simple, but I just can’t seem to get the simplest of redirections working due to lack of knowledge, and was wondering if someone with patience might be able to guide me in the right direction a little.

Thanks in advance.

Show channels is no real use for something for which the channel is so transient.

You need to start by providing a verbose CLI trace.

Like this?:


Asterisk 1.6.0.26-FONCORE-r78, Copyright (C) 1999 - 2010 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
  == Parsing '/etc/asterisk/asterisk.conf':   == Found
  == Parsing '/etc/asterisk/extconfig.conf':   == Found
Connected to Asterisk 1.6.0.26-FONCORE-r78 currently running on trixbox1 (pid = 2238)
Verbosity was 3 and is now 9
    -- ast_get_srv: SRV lookup for '_sip._UDP.sipgate.co.uk' mapped to host sipgate.co.uk, port 5060
    -- ast_get_srv: SRV lookup for '_sip._UDP.sipgate.co.uk' mapped to host sipgate.co.uk, port 5060
    -- ast_get_srv: SRV lookup for '_sip._UDP.sipgate.co.uk' mapped to host sipgate.co.uk, port 5060
    -- ast_get_srv: SRV lookup for '_sip._UDP.sipgate.co.uk' mapped to host sipgate.co.uk, port 5060
    -- ast_get_srv: SRV lookup for '_sip._UDP.sipgate.co.uk' mapped to host sipgate.co.uk, port 5060
    -- ast_get_srv: SRV lookup for '_sip._UDP.sipgate.co.uk' mapped to host sipgate.co.uk, port 5060
    -- ast_get_srv: SRV lookup for '_sip._UDP.sipgate.co.uk' mapped to host sipgate.co.uk, port 5060
  == Manager 'admin' logged on from 127.0.0.1
  == Manager 'admin' logged off from 127.0.0.1
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
  == Using SIP VRTP TOS bits 136
  == Using SIP VRTP CoS mark 6
    -- Executing [3444949@ext-did:1] Set("SIP/sipgate-00000001", "__FROM_DID=3444949") in new stack
    -- Executing [3444949@ext-did:2] Gosub("SIP/sipgate-00000001", "app-blacklist-check,s,1") in new stack
    -- Executing [s@app-blacklist-check:1] GotoIf("SIP/sipgate-00000001", "0?blacklisted") in new stack
    -- Executing [s@app-blacklist-check:2] Return("SIP/sipgate-00000001", "") in new stack
    -- Executing [3444949@ext-did:3] ExecIf("SIP/sipgate-00000001", "0 ?Set(CALLERID(name)=01233504005)") in new stack
    -- Executing [3444949@ext-did:4] Ringing("SIP/sipgate-00000001", "") in new stack
    -- Executing [3444949@ext-did:5] Set("SIP/sipgate-00000001", "__CALLINGPRES_SV=allowed_not_screened") in new stack
    -- Executing [3444949@ext-did:6] Set("SIP/sipgate-00000001", "CALLERPRES()=allowed_not_screened") in new stack
    -- Executing [3444949@ext-did:7] Goto("SIP/sipgate-00000001", "ivr-2,s,1") in new stack
    -- Goto (ivr-2,s,1)
    -- Executing [s@ivr-2:1] Set("SIP/sipgate-00000001", "MSG=if-u-know-ext-dial") in new stack
    -- Executing [s@ivr-2:2] Set("SIP/sipgate-00000001", "LOOPCOUNT=0") in new stack
    -- Executing [s@ivr-2:3] Set("SIP/sipgate-00000001", "__DIR-CONTEXT=default") in new stack
    -- Executing [s@ivr-2:4] Set("SIP/sipgate-00000001", "_IVR_CONTEXT_ivr-2=") in new stack
    -- Executing [s@ivr-2:5] Set("SIP/sipgate-00000001", "_IVR_CONTEXT=ivr-2") in new stack
    -- Executing [s@ivr-2:6] GotoIf("SIP/sipgate-00000001", "0?begin") in new stack
    -- Executing [s@ivr-2:7] Answer("SIP/sipgate-00000001", "") in new stack
    -- Executing [s@ivr-2:8] Wait("SIP/sipgate-00000001", "1") in new stack
    -- Executing [s@ivr-2:9] Set("SIP/sipgate-00000001", "TIMEOUT(digit)=3") in new stack
    -- Digit timeout set to 3
    -- Executing [s@ivr-2:10] Set("SIP/sipgate-00000001", "TIMEOUT(response)=10") in new stack
    -- Response timeout set to 10
    -- Executing [s@ivr-2:11] Set("SIP/sipgate-00000001", "__IVR_RETVM=") in new stack
    -- Executing [s@ivr-2:12] ExecIf("SIP/sipgate-00000001", "1?Background(if-u-know-ext-dial)") in new stack
    -- <SIP/sipgate-00000001> Playing 'if-u-know-ext-dial.ulaw' (language 'en')
    -- Executing [s@ivr-2:13] WaitExten("SIP/sipgate-00000001", ",") in new stack
  == CDR updated on SIP/sipgate-00000001
    -- Executing [1@ivr-2:1] DBdel("SIP/sipgate-00000001", "") in new stack
    -- Executing [1@ivr-2:2] Set("SIP/sipgate-00000001", "__NODEST=") in new stack
    -- Executing [1@ivr-2:3] Goto("SIP/sipgate-00000001", "ivr-5,s,1") in new stack
    -- Goto (ivr-5,s,1)
    -- Executing [s@ivr-5:1] Set("SIP/sipgate-00000001", "MSG=for&ha/door&press-1&for&ha/lamp&press-2") in new stack
    -- Executing [s@ivr-5:2] Set("SIP/sipgate-00000001", "LOOPCOUNT=0") in new stack
    -- Executing [s@ivr-5:3] Set("SIP/sipgate-00000001", "__DIR-CONTEXT=default") in new stack
    -- Executing [s@ivr-5:4] Set("SIP/sipgate-00000001", "_IVR_CONTEXT_ivr-5=ivr-2") in new stack
    -- Executing [s@ivr-5:5] Set("SIP/sipgate-00000001", "_IVR_CONTEXT=ivr-5") in new stack
    -- Executing [s@ivr-5:6] GotoIf("SIP/sipgate-00000001", "1?begin") in new stack
    -- Goto (ivr-5,s,9)
    -- Executing [s@ivr-5:9] Set("SIP/sipgate-00000001", "TIMEOUT(digit)=3") in new stack
    -- Digit timeout set to 3
    -- Executing [s@ivr-5:10] Set("SIP/sipgate-00000001", "TIMEOUT(response)=10") in new stack
    -- Response timeout set to 10
    -- Executing [s@ivr-5:11] Set("SIP/sipgate-00000001", "__IVR_RETVM=") in new stack
    -- Executing [s@ivr-5:12] ExecIf("SIP/sipgate-00000001", "1?Background(for&ha/door&press-1&for&ha/lamp&press-2)") in new stack
    -- <SIP/sipgate-00000001> Playing 'for.ulaw' (language 'en')
    -- <SIP/sipgate-00000001> Playing 'ha/door.ulaw' (language 'en')
    -- <SIP/sipgate-00000001> Playing 'press-1.ulaw' (language 'en')
    -- <SIP/sipgate-00000001> Playing 'for.ulaw' (language 'en')
    -- <SIP/sipgate-00000001> Playing 'ha/lamp.ulaw' (language 'en')
    -- <SIP/sipgate-00000001> Playing 'press-2.ulaw' (language 'en')
    -- Executing [s@ivr-5:13] WaitExten("SIP/sipgate-00000001", ",") in new stack
  == CDR updated on SIP/sipgate-00000001
    -- Executing [1@ivr-5:1] DBdel("SIP/sipgate-00000001", "") in new stack
    -- Executing [1@ivr-5:2] Set("SIP/sipgate-00000001", "__NODEST=") in new stack
    -- Executing [1@ivr-5:3] Goto("SIP/sipgate-00000001", "ivr-3,s,1") in new stack
    -- Goto (ivr-3,s,1)
    -- Executing [s@ivr-3:1] Set("SIP/sipgate-00000001", "MSG=ha/door&on") in new stack
    -- Executing [s@ivr-3:2] Set("SIP/sipgate-00000001", "LOOPCOUNT=0") in new stack
    -- Executing [s@ivr-3:3] Set("SIP/sipgate-00000001", "__DIR-CONTEXT=default") in new stack
    -- Executing [s@ivr-3:4] Set("SIP/sipgate-00000001", "_IVR_CONTEXT_ivr-3=ivr-5") in new stack
    -- Executing [s@ivr-3:5] Set("SIP/sipgate-00000001", "_IVR_CONTEXT=ivr-3") in new stack
    -- Executing [s@ivr-3:6] GotoIf("SIP/sipgate-00000001", "1?begin") in new stack
    -- Goto (ivr-3,s,9)
    -- Executing [s@ivr-3:9] Set("SIP/sipgate-00000001", "TIMEOUT(digit)=3") in new stack
    -- Digit timeout set to 3
    -- Executing [s@ivr-3:10] Set("SIP/sipgate-00000001", "TIMEOUT(response)=10") in new stack
    -- Response timeout set to 10
    -- Executing [s@ivr-3:11] Set("SIP/sipgate-00000001", "__IVR_RETVM=") in new stack
    -- Executing [s@ivr-3:12] ExecIf("SIP/sipgate-00000001", "1?Background(ha/door&on)") in new stack
    -- <SIP/sipgate-00000001> Playing 'ha/door.ulaw' (language 'en')
    -- <SIP/sipgate-00000001> Playing 'on.ulaw' (language 'en')
    -- Executing [s@ivr-3:13] WaitExten("SIP/sipgate-00000001", ",") in new stack
  == Spawn extension (ivr-3, s, 13) exited non-zero on 'SIP/sipgate-00000001'
    -- Executing [h@ivr-3:1] Hangup("SIP/sipgate-00000001", "") in new stack
  == Spawn extension (ivr-3, h, 1) exited non-zero on 'SIP/sipgate-00000001'

I only included the channels thing as the manual has a step by step guide, which I followed, then at the end of the chapter is says “NB. You must have channels set up for this to work”. That’s the first and last mention of the word ‘channels’ in the whole book, so I don’t have a clue what a channel is.

For some reason, the ‘press 1 for this etc…’ now does go where I thought it should. Maybe Asterisk doesn’t update changes immediately. So I need to work out which file to edit to make the relevent scripts execute; this is the bit that baffles me, I know I need to use ‘System(/my/script.sh)’ somewhere, but there’s tonnes of files, plus in the extensions.conf file where I have guessed at it, it simply doesn’t work.

I guess I have to have something like this:

exten => 1,1,System(/usr/sbin/myscript.sh)

somewhere, but there’s no clue as to where I would put it. The files don’t seem to follow any logic in order that I can reverse engineer what’s going on.

Based on googling this and viewing various forums, I’m guessing that what I want to do isn’t possible in Asterisk?

Your problem is with the GUI, not with Asterisk.

In the example,

[ivr-3]
exten => s,1,System…

would do it, although, doing it by hand, I’m not sure I would go down the extra level.

Hi, thanks for that.

Are you saying I should add

[ivr-3]
exten => n,1,System(echo "hello") 

to the extensions.conf file?

I tried this, but I still see nothing.

    -- ast_get_srv: SRV lookup for '_sip._UDP.sipgate.co.uk' mapped to host sipgate.co.uk, port 5060
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
  == Using SIP VRTP TOS bits 136
  == Using SIP VRTP CoS mark 6
    -- Executing [3444949@ext-did:1] Set("SIP/sipgate-00000002", "__FROM_DID=3444949") in new stack
    -- Executing [3444949@ext-did:2] Gosub("SIP/sipgate-00000002", "app-blacklist-check,s,1") in new stack
    -- Executing [s@app-blacklist-check:1] GotoIf("SIP/sipgate-00000002", "0?blacklisted") in new stack
    -- Executing [s@app-blacklist-check:2] Return("SIP/sipgate-00000002", "") in new stack
    -- Executing [3444949@ext-did:3] ExecIf("SIP/sipgate-00000002", "0 ?Set(CALLERID(name)=07502225705)") in new stack
    -- Executing [3444949@ext-did:4] Ringing("SIP/sipgate-00000002", "") in new stack
    -- Executing [3444949@ext-did:5] Set("SIP/sipgate-00000002", "__CALLINGPRES_SV=allowed_not_screened") in new stack
    -- Executing [3444949@ext-did:6] Set("SIP/sipgate-00000002", "CALLERPRES()=allowed_not_screened") in new stack
    -- Executing [3444949@ext-did:7] Goto("SIP/sipgate-00000002", "ivr-2,s,1") in new stack
    -- Goto (ivr-2,s,1)
    -- Executing [s@ivr-2:1] Set("SIP/sipgate-00000002", "MSG=if-u-know-ext-dial") in new stack
    -- Executing [s@ivr-2:2] Set("SIP/sipgate-00000002", "LOOPCOUNT=0") in new stack
    -- Executing [s@ivr-2:3] Set("SIP/sipgate-00000002", "__DIR-CONTEXT=default") in new stack
    -- Executing [s@ivr-2:4] Set("SIP/sipgate-00000002", "_IVR_CONTEXT_ivr-2=") in new stack
    -- Executing [s@ivr-2:5] Set("SIP/sipgate-00000002", "_IVR_CONTEXT=ivr-2") in new stack
    -- Executing [s@ivr-2:6] GotoIf("SIP/sipgate-00000002", "0?begin") in new stack
    -- Executing [s@ivr-2:7] Answer("SIP/sipgate-00000002", "") in new stack
    -- Executing [s@ivr-2:8] Wait("SIP/sipgate-00000002", "1") in new stack
    -- Executing [s@ivr-2:9] Set("SIP/sipgate-00000002", "TIMEOUT(digit)=3") in new stack
    -- Digit timeout set to 3
    -- Executing [s@ivr-2:10] Set("SIP/sipgate-00000002", "TIMEOUT(response)=10") in new stack
    -- Response timeout set to 10
    -- Executing [s@ivr-2:11] Set("SIP/sipgate-00000002", "__IVR_RETVM=") in new stack
    -- Executing [s@ivr-2:12] ExecIf("SIP/sipgate-00000002", "1?Background(if-u-know-ext-dial)") in new stack
    -- <SIP/sipgate-00000002> Playing 'if-u-know-ext-dial.ulaw' (language 'en')
    -- Executing [s@ivr-2:13] WaitExten("SIP/sipgate-00000002", ",") in new stack
  == CDR updated on SIP/sipgate-00000002
    -- Executing [1@ivr-2:1] DBdel("SIP/sipgate-00000002", "") in new stack
    -- Executing [1@ivr-2:2] Set("SIP/sipgate-00000002", "__NODEST=") in new stack
    -- Executing [1@ivr-2:3] Goto("SIP/sipgate-00000002", "ivr-5,s,1") in new stack
    -- Goto (ivr-5,s,1)
    -- Executing [s@ivr-5:1] Set("SIP/sipgate-00000002", "MSG=for&ha/door&press-1&for&ha/lamp&press-2") in new stack
    -- Executing [s@ivr-5:2] Set("SIP/sipgate-00000002", "LOOPCOUNT=0") in new stack
    -- Executing [s@ivr-5:3] Set("SIP/sipgate-00000002", "__DIR-CONTEXT=default") in new stack
    -- Executing [s@ivr-5:4] Set("SIP/sipgate-00000002", "_IVR_CONTEXT_ivr-5=ivr-2") in new stack
    -- Executing [s@ivr-5:5] Set("SIP/sipgate-00000002", "_IVR_CONTEXT=ivr-5") in new stack
    -- Executing [s@ivr-5:6] GotoIf("SIP/sipgate-00000002", "1?begin") in new stack
    -- Goto (ivr-5,s,9)
    -- Executing [s@ivr-5:9] Set("SIP/sipgate-00000002", "TIMEOUT(digit)=3") in new stack
    -- Digit timeout set to 3
    -- Executing [s@ivr-5:10] Set("SIP/sipgate-00000002", "TIMEOUT(response)=10") in new stack
    -- Response timeout set to 10
    -- Executing [s@ivr-5:11] Set("SIP/sipgate-00000002", "__IVR_RETVM=") in new stack
    -- Executing [s@ivr-5:12] ExecIf("SIP/sipgate-00000002", "1?Background(for&ha/door&press-1&for&ha/lamp&press-2)") in new stack
    -- <SIP/sipgate-00000002> Playing 'for.ulaw' (language 'en')
    -- <SIP/sipgate-00000002> Playing 'ha/door.ulaw' (language 'en')
    -- <SIP/sipgate-00000002> Playing 'press-1.ulaw' (language 'en')
    -- <SIP/sipgate-00000002> Playing 'for.ulaw' (language 'en')
    -- <SIP/sipgate-00000002> Playing 'ha/lamp.ulaw' (language 'en')
    -- <SIP/sipgate-00000002> Playing 'press-2.ulaw' (language 'en')
    -- Executing [s@ivr-5:13] WaitExten("SIP/sipgate-00000002", ",") in new stack
  == CDR updated on SIP/sipgate-00000002
    -- Executing [1@ivr-5:1] DBdel("SIP/sipgate-00000002", "") in new stack
    -- Executing [1@ivr-5:2] Set("SIP/sipgate-00000002", "__NODEST=") in new stack
    -- Executing [1@ivr-5:3] Goto("SIP/sipgate-00000002", "ivr-3,s,1") in new stack
    -- Goto (ivr-3,s,1)
    -- Executing [s@ivr-3:1] Set("SIP/sipgate-00000002", "MSG=ha/door&on") in new stack
    -- Executing [s@ivr-3:2] Set("SIP/sipgate-00000002", "LOOPCOUNT=0") in new stack
    -- Executing [s@ivr-3:3] Set("SIP/sipgate-00000002", "__DIR-CONTEXT=default") in new stack
    -- Executing [s@ivr-3:4] Set("SIP/sipgate-00000002", "_IVR_CONTEXT_ivr-3=ivr-5") in new stack
    -- Executing [s@ivr-3:5] Set("SIP/sipgate-00000002", "_IVR_CONTEXT=ivr-3") in new stack
    -- Executing [s@ivr-3:6] GotoIf("SIP/sipgate-00000002", "1?begin") in new stack
    -- Goto (ivr-3,s,9)
    -- Executing [s@ivr-3:9] Set("SIP/sipgate-00000002", "TIMEOUT(digit)=3") in new stack
    -- Digit timeout set to 3
    -- Executing [s@ivr-3:10] Set("SIP/sipgate-00000002", "TIMEOUT(response)=10") in new stack
    -- Response timeout set to 10
    -- Executing [s@ivr-3:11] Set("SIP/sipgate-00000002", "__IVR_RETVM=") in new stack
    -- Executing [s@ivr-3:12] ExecIf("SIP/sipgate-00000002", "1?Background(ha/door&on)") in new stack
    -- <SIP/sipgate-00000002> Playing 'ha/door.ulaw' (language 'en')
    -- <SIP/sipgate-00000002> Playing 'on.ulaw' (language 'en')
    -- Executing [s@ivr-3:13] WaitExten("SIP/sipgate-00000002", ",") in new stack
    -- Timeout on SIP/sipgate-00000002, going to 't'
    -- Executing [t@ivr-3:1] Goto("SIP/sipgate-00000002", "loop,1") in new stack
    -- Goto (ivr-3,loop,1)
    -- Executing [loop@ivr-3:1] Set("SIP/sipgate-00000002", "LOOPCOUNT=1") in new stack
    -- Executing [loop@ivr-3:2] GotoIf("SIP/sipgate-00000002", "0?hang,1") in new stack
    -- Executing [loop@ivr-3:3] Goto("SIP/sipgate-00000002", "ivr-3,s,begin") in new stack
    -- Goto (ivr-3,s,9)
    -- Executing [s@ivr-3:9] Set("SIP/sipgate-00000002", "TIMEOUT(digit)=3") in new stack
    -- Digit timeout set to 3
    -- Executing [s@ivr-3:10] Set("SIP/sipgate-00000002", "TIMEOUT(response)=10") in new stack
    -- Response timeout set to 10
    -- Executing [s@ivr-3:11] Set("SIP/sipgate-00000002", "__IVR_RETVM=") in new stack
    -- Executing [s@ivr-3:12] ExecIf("SIP/sipgate-00000002", "1?Background(ha/door&on)") in new stack
    -- <SIP/sipgate-00000002> Playing 'ha/door.ulaw' (language 'en')
    -- <SIP/sipgate-00000002> Playing 'on.ulaw' (language 'en')
    -- Executing [s@ivr-3:13] WaitExten("SIP/sipgate-00000002", ",") in new stack
  == CDR updated on SIP/sipgate-00000002
    -- Executing [1@ivr-3:1] DBdel("SIP/sipgate-00000002", "") in new stack
    -- Executing [1@ivr-3:2] Set("SIP/sipgate-00000002", "__NODEST=") in new stack
    -- Executing [1@ivr-3:3] Goto("SIP/sipgate-00000002", "app-blackhole,hangup,1") in new stack
    -- Goto (app-blackhole,hangup,1)
    -- Executing [hangup@app-blackhole:1] NoOp("SIP/sipgate-00000002", "Blackhole Dest: Hangup") in new stack
    -- Executing [hangup@app-blackhole:2] Hangup("SIP/sipgate-00000002", "") in new stack
  == Spawn extension (app-blackhole, hangup, 2) exited non-zero on 'SIP/sipgate-00000002'
    -- ast_get_srv: SRV lookup for '_sip._UDP.sipgate.co.uk' mapped to host sipgate.co.uk, port 5060

I’m really stuck, and I’m sure this should be really simple, but I just can’t see the wood for trees.

You either didn’t remove the orignal contents of the ivr-3 context, or you didn’t force asterisk to reload the configuration.

Hi, am I looking in the right place?

In the extensions.conf file there was no [ivr-3], so I added it at the bottom of the file.

That’s because you are trying to use a GUI. The GUI has probably put all the IVR stuff in a different file, and included it from extensions.conf. A GUI also uses a lot more code that straight coding, because it has to anticipate things that you would know wouldn’t happen.

If you did it from first principles, you probably wouldn’t call your contexts ivr-1, ivr-5 and ivr-3, etc. put something more like HomeAutomation, GroundFloor, and OpenFront door, although you might to the action for that in GroundFloor.

EDIT: Aha! For some reason, it’s now creating the text file.

Does asterisk take a little while to catch up and I’m being impatient perhaps?

Something is happening. It is playing a prompt (“door on”) for a third level menu, then waiting for your third level menu choice. You hung up before it finished waiting.

It’s saying don’t change this, because GUIs don’t like you directly manipulating the dialplan they create, as they can only cope with dialplans which exactly match their pattern for the function. They may also store the same information elsewhere, and get confused if it gets out of step.

I think you may find that there is more than one ivr-3 context, and the GUI has got confused about that.

Given that you are designing a small home automation system, not trying to maintain a large system with unskilled labour, I’d strongly advise throwing away the GUI and hand coding the dialplan.

People who want to use a GUI, are best advised to learn how to hand code first, as it makes it much easier to understand what the GUI is doing.

The basic pattern is something like:

[code][HomeAutomation]
exten => s,1,Background(top-menu)
exten => s,n,WaitExten()
exten => s,n,Goto(1)

exten => 1,1,Goto(GroundFloor,s,1)

[GroundFloor]
exten => s,1,Background…
exten => s,n,Wait…
exten => s,n,Goto…

exten => 1,1,System(…)
exten => 1,n, Hangup

[default]
exten => 1234,1,Goto(HomeAutomation,s,1)[/code]

Absolutely agree. I’m a programmer by trade (for more years than I care to remember), and to see trainees etc… that have only used ‘visual’ programming tools illustrates what you are talking about perfectly.