ERROR: Invalid command syntax. Please advise

Guys,

I don’t know what to do anymore. I tried both versions of asterisk 1.4 and 1.2 and I have the same issue. When I make a call the call fails with error Invalid command syntax. Here are the logs:

dialparties.agi: priority is 1
dialparties.agi: Caller ID name is ‘User 2’ number is '1002’
dialparties.agi: Methodology of ring is ‘none’
– dialparties.agi: Added extension 1001 to extension map
dialparties.agi: Extension 1001 has call forward set to Invalid command syntax. Proper usage follows:
dialparties.agi: Usage: DATABASE GET
dialparties.agi: Retrieves an entry in the Asterisk database for a
dialparties.agi: given family and key.
dialparties.agi: Returns 0 if is not set. Returns 1 if
dialparties.agi: is set and returns the variable in parentheses.
dialparties.agi: Example return code: 200 result=1 (testvariable)
dialparties.agi:
== Manager ‘admin’ logged off from 127.0.0.1
– AGI Script dialparties.agi completed, returning 0
– Executing Macro(“SIP/1002-095bea38”, “hangupcall”) in new stack
– Executing ResetCDR(“SIP/1002-095bea38”, “w”) in new stack
– Executing NoCDR(“SIP/1002-095bea38”, “”) in new stack
– Executing GotoIf(“SIP/1002-095bea38”, “1?skiprg”) in new stack
– Goto (macro-hangupcall,s,6)
– Executing GotoIf(“SIP/1002-095bea38”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,9)
– Executing Wait(“SIP/1002-095bea38”, “5”) in new stack
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘SIP/1002-095bea38’ in macro ‘hangupcall’
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘SIP/1002-095bea38’

Your help is highly appreciated

Thanks
Delian

The return value is 0 so the database lookup wasn’t succesfull.

You need to provide more info before somebody can give a usefull answer:
-What kind of Asterisk are you running.
-What is in your extensions.conf
-What do the sip entries look like
-Is there any info in log /var/log/asterisk

Right now I am running Asterisk SVN-branch-1.2-r82334 on a Fedora Core 6 but I also tried the latest Asterisk version 1.4.12 without success.

I use FreeePBX 2.2.3 to configure Asterisk.

The sip_additional looks like:
[1001]
type=friend
secret=1001
record_out=Adhoc
record_in=Adhoc
qualify=yes
port=5060
nat=no
mailbox=1001@device
host=dynamic
dtmfmode=rfc2833
disallow=all
dial=SIP/1001
context=from-internal
canreinvite=no
callerid=device <1001>
allow=g729

[1002]
type=friend
secret=1002
record_out=Adhoc
record_in=Adhoc
qualify=yes
port=5060
nat=no
mailbox=1002@device
host=dynamic
dtmfmode=rfc2833
disallow=all
dial=SIP/1002
context=from-internal
canreinvite=no
callerid=device <1002>
allow=g729

The extensions_additionnal.conf looks like:
[globals]
#include globals_custom.conf
CALLFILENAME = ""
DIAL_OPTIONS = tr
TRUNK_OPTIONS =
DIAL_OUT = 9
FAX =
FAX_RX = system
FAX_RX_EMAIL = fax@mydomain.com
FAX_RX_FROM = freepbx@gmail.com
INCOMING = group-all
NULL = ""
OPERATOR =
OPERATOR_XTN =
PARKNOTIFY = SIP/200
RECORDEXTEN = ""
RINGTIMER = 15
DIRECTORY = last
AFTER_INCOMING =
“extensions_additional.conf” 813L, 24131C
include => app-dictate-record-custom
exten => *34,1,Answer
exten => *34,n,Macro(user-callerid,)
exten => *34,n,Noop(CallerID is ${CALLERID(num)})
exten => *34,n,Set(DICTENABLED=${DB(AMPUSER/${CALLERID(num)}/dictate/enabled)})
exten => *34,n,GotoIf($[$[“x${DICTENABLED}”=“x”]|$[“x${DICTENABLED}”=“xdisabled”]]?nodict:dictok)
exten => *34,n(nodict),Playback(feature-not-avail-line)
exten => *34,n,Hangup
exten => *34,n(dictok),Dictate(/var/lib/asterisk/sounds/dictate/${CALLERID(num)}
)
exten => *34,n,Macro(hangupcall,)

; end of [app-dictate-record]

[app-dictate-send]
include => app-dictate-send-custom
exten => *35,1,Answer
exten => *35,n,Macro(user-callerid,)
exten => *35,n,Noop(CallerID is ${CALLERID(num)})
exten => *35,n,Set(DICTENABLED=${DB(AMPUSER/${CALLERID(num)}/dictate/enabled)})
@
[app-calltrace]
include => app-calltrace-custom
exten => *69,1,Goto(app-calltrace-perform,s,1)

; end of [app-calltrace]

[app-calltrace-perform]
include => app-calltrace-perform-custom
exten => s,1,Macro(user-callerid,)
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(info-about-last-call&telephone-number)
exten => s,n,Set(lastcaller=${DB(CALLTRACE/${CALLERID(number)})}) exten => s,n,GotoIf($[ $[ “${lastcaller}” = “” ] | $[ “${lastcaller}” = “unknown
” ] ]?noinfo)
exten => s,n,SayDigits(${lastcaller})
exten => s,n,Set(TIMEOUT(digit)=3)
exten => s,n,Set(TIMEOUT(response)=7)
exten => s,n,Background(to-call-this-number&press-1)
exten => s,n,Goto(fin)
exten => s,n(noinfo),Playback(from-unknown-caller)
exten => s,n,Macro(hangupcall,)

; end of [app-directory]

[app-echo-test]
include => app-echo-test-custom
exten => *43,1,Answer
exten => *43,n,Wait(1)
exten => *43,n,Playback(demo-echotest)
exten => *43,n,Echo()
exten => *43,n,Playback(demo-echodone)
exten => *43,n,Hangup

; end of [app-echo-test]

[app-speakextennum]include => app-speakextennum-custom
exten => *65,1,Answer
exten => *65,n,Wait(1)
exten => *65,n,Macro(user-callerid,)
exten => *65,n,Playback(your)
exten => *65,n,Playback(extension)
exten => *60,n(hr24format),SayUnixTime(${FutureTime},kM ‘and’ S ‘seconds’)
exten => *60,n(waitloop),Set(TimeLeft=$[${FutureTime} - ${EPOCH}])
exten => *60,n,GotoIf($[${TimeLeft} < 1]?playbeep)
exten => *60,n,Wait(1)
exten => *60,n,Goto(waitloop)
exten => *60,n(playbeep),Playback(beep)
exten => *60,n,Wait(5)
exten => *60,n,Set(NumLoops=$[${NumLoops} + 1])
exten => *60,n,GotoIf($[${NumLoops} < 5]?start)
exten => *60,n,Playback(goodbye)
exten => *60,n,Hangup

; end of [app-speakingclock]

[app-recordings]
include => app-recordings-custom
exten => *77,1,Macro(user-callerid,)
exten => *77,n,Wait(2)
exten => *77,n,Macro(systemrecording,dorecord)
exten => *99,1,Macro(user-callerid,)
exten => *99,n,Wait(2)
exten => *99,n,Macro(systemrecording,docheck)
exten => s,n,Set(SPEEDDIALNUMBER=)
exten => s,n(lookupuser),dbGet(SPEEDDIALNUMBER=AMPUSER/${ARG2}/speeddials/${ARG1})
exten => s,n,GotoIf($["${SPEEDDIALNUMBER}"=""]?lookupsys)
exten => s,n,Noop(Found speeddial ${ARG1} for user ${ARG2}: ${SPEEDDIALNUMBER})
exten => s,n,Goto(end)
exten => s,lookupuser+101(lookupsys),dbGet(SPEEDDIALNUMBER=sysspeeddials/${ARG1}
)
exten => s,n,GotoIf($["${SPEEDDIALNUMBER}"=""]?failed)
exten => s,n,Noop(Found system speeddial ${ARG1}: ${SPEEDDIALNUMBER})
exten => s,n,Goto(end)
exten => s,lookupsys+101(failed),Noop(No system or user speeddial found)
exten => s,n(end),Noop(End of Speeddial-lookup)

; end of [macro-speeddial-lookup]

[app-speeddial]
include => app-speeddial-custom
exten => _*0.,1,Macro(user-callerid,)
exten => _*0.,n,Set(SPEEDDIALLOCATION=${EXTEN:2})
exten => _*0.,n,Macro(speeddial-clean,SPEEDDIALLOCATION)
@
exten => s,n(setnum),Read(newnum,speed-enternumber,)
exten => s,n(success),dbPut(AMPUSER/${CALLERID(num)}/speeddials/${newlocation}=$
{newnum})exten => s,n,Playback(speed-dial)
exten => s,n,SayNumber(${newlocation},f)
exten => s,n,Playback(is-set-to)
exten => s,n,SayDigits(${newnum})
exten => s,n,Hangup
exten => s,n(conflicts),Playback(speed-dial)
exten => s,n,SayNumber(${newlocation},f)
exten => s,n,Playback(is-in-use)
exten => s,n,Background(press-1&to-listen-to-it&press-2&to-enter-a-diff&location&press-3&to-change&telephone-number)
exten => 1,1,Playback(speed-dial)
exten => 1,n,SayNumber(${newlocation},f)
exten => 1,n,Playback(is-set-to)
exten => 1,n,SayDigits(${SPEEDDIALNUMBER})
exten => 1,n,Goto(s,conflicts)
exten => 2,1,Goto(s,setloc)
exten => 3,1,Goto(s,setnum)
exten => t,1,Congestion(20)
; end of [app-speeddial-set]
exten => *78,n,Set(DB(DND/${CALLERID(number)})=YES)
exten => *78,n,Playback(do-not-disturb&activated)
exten => *78,n,Macro(hangupcall,)

; end of [app-dnd-on]

[app-callwaiting-cwoff]
include => app-callwaiting-cwoff-custom
exten => *71,1,Answer
exten => *71,n,Wait(1)
exten => *71,n,Macro(user-callerid,)
exten => *71,n,dbDel(CW/${CALLERID(number)})
exten => *71,n,Playback(call-waiting&de-activated)
exten => *71,n,Macro(hangupcall,)

; end of [app-callwaiting-cwoff]

[app-callwaiting-cwon]
include => app-callwaiting-cwon-custom
exten => *70,1,Answer
exten => *70,n,Wait(1)
exten => _*91.,n,dbDel(CFB/${fromext})
exten => _*91.,n,Playback(call-fwd-on-busy&for&extension)
exten => _*91.,n,SayDigits(${fromext})
exten => _*91.,n,Playback(cancelled)
exten => _*91.,n,Macro(hangupcall,)

; end of [app-cf-busy-off]

[app-cf-busy-off-any]
include => app-cf-busy-off-any-custom
exten => *92,1,Answer
exten => *92,n,Wait(1)
exten => *92,n,Playback(please-enter-your&extension)
exten => *92,n,Read(fromext,then-press-pound,)
exten => *92,n,Wait(1)
exten => *92,n,dbDel(CFB/${fromext})
exten => *92,n,Playback(call-fwd-on-busy&for&extension)
exten => *92,n,SayDigits(${fromext})
exten => *92,n,Playback(cancelled)
exten => *92,n,Macro(hangupcall,)

; end of [app-cf-busy-off-any]
exten => *90,n,Playback(is-set-to)
exten => *90,n,SayDigits(${toext})
exten => *90,n,Macro(hangupcall,)
exten => _*90.,1,Answer
exten => _*90.,n,Wait(1)
exten => _*90.,n,Macro(user-callerid,)
exten => _*90.,n,Set(DB(CFB/${CALLERID(number)})=${EXTEN:3})
exten => _*90.,n,Playback(call-fwd-on-busy&for&extension)
exten => _*90.,n,SayDigits(${CALLERID(number)})
exten => _*90.,n,Playback(is-set-to)
exten => _*90.,n,SayDigits(${EXTEN:3})
exten => _*90.,n,Macro(hangupcall,)

; end of [app-cf-busy-on]

[app-cf-off]
include => app-cf-off-custom
exten => *73,1,Answer
exten => *73,n,Wait(1)
exten => *73,n,Macro(user-callerid,)
exten => *73,n,dbDel(CF/${CALLERID(number)})
exten => *73,n,Playback(call-fwd-unconditional&de-activated)
exten => *74,n,Wait(1)
exten => *74,n,dbDel(CF/${fromext})
exten => *74,n,Playback(call-fwd-unconditional&for&extension)
exten => *74,n,SayDigits(${fromext})
exten => *74,n,Playback(cancelled)
exten => *74,n,Macro(hangupcall,)

; end of [app-cf-off-any]

[app-cf-on]
include => app-cf-on-custom
exten => *72,1,Answer
exten => *72,n,Wait(1)
exten => *72,n,Playback(call-fwd-unconditional)
exten => *72,n,Playback(please-enter-your&extension)
exten => *72,n,Read(fromext,then-press-pound,)
exten => *72,n,Set(fromext=${IF($[“foo${fromext}”=“foo”]?${CALLERID(number)}:${f
romext})})
exten => *72,n,Wait(1)
exten => *72,n(startread),Playback(ent-target-attendant)
exten => *72,n,Read(toext,then-press-pound,)
exten => *72,n,GotoIf($[“foo${toext}”=“foo”]?startread)

[app-cf-unavailable-off]
include => app-cf-unavailable-off-custom
exten => *53,1,Answer
exten => *53,n,Wait(1)
exten => *53,n,Macro(user-callerid,)
exten => *53,n,dbDel(CFU/${CALLERID(number)})
exten => *53,n,Playback(call-fwd-no-ans&de-activated)
exten => *53,n,Macro(hangupcall,)
exten => _*53.,1,Answer
exten => _*53.,n,Wait(1)
exten => _*53.,n,Set(fromext=${EXTEN:3})
exten => _*53.,n,dbDel(CFU/${fromext})
exten => _*53.,n,Playback(call-fwd-no-ans&for&extension)
exten => _*53.,n,SayDigits(${fromext})
exten => _*53.,n,Playback(cancelled)
exten => _*53.,n,Macro(hangupcall,)

; end of [app-cf-unavailable-off]

[app-cf-unavailable-on]
include => app-cf-unavailable-on-custom
exten => _*52.,n,Wait(1)
exten => _*52.,n,Macro(user-callerid,)
exten => _*52.,n,Set(DB(CFU/${CALLERID(number)})=${EXTEN:3})
exten => _*52.,n,Playback(call-fwd-no-ans&for&extension)
exten => _*52.,n,SayDigits(${CALLERID(number)})
exten => _*52.,n,Playback(is-set-to)
exten => _*52.,n,SayDigits(${EXTEN:3})
exten => _*52.,n,Macro(hangupcall,)

; end of [app-cf-unavailable-on]

[cidlookup]
include => cidlookup-custom
exten => cidlookup_return,1,LookupCIDName
exten => cidlookup_return,n,Return()

; end of [cidlookup]

[app-blacklist-check]
include => app-blacklist-check-custom
exten => s,1,LookupBlacklist()

[app-blacklist-add]
include => app-blacklist-add-custom
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(enter-num-blacklist)
exten => s,n,Set(TIMEOUT(digit)=5)
exten => s,n,Set(TIMEOUT(response)=60)
exten => s,n,Read(blacknr,then-press-pound,)
exten => s,n,SayDigits(${blacknr})
exten => s,n,Playback(if-correct-press&digits/1)
exten => s,n,Noop(Waiting for input)
exten => s,n(end),WaitExten(60)
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => 1,1,Set(DB(blacklist/${blacknr})=1)
exten => 1,n,Playback(num-was-successfully&added)
exten => 1,n,Wait(1)
exten => 1,n,Hangup

; end of [app-blacklist-add]

[app-blacklist-last]
exten => 1,n,Playback(added)
exten => 1,n,Wait(1)
exten => 1,n,Hangup

; end of [app-blacklist-last]

[app-blacklist-remove]
include => app-blacklist-remove-custom
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(entr-num-rmv-blklist)
exten => s,n,Set(TIMEOUT(digit)=5)
exten => s,n,Set(TIMEOUT(response)=60)
exten => s,n,Read(blacknr,then-press-pound,)
exten => s,n,SayDigits(${blacknr})
exten => s,n,Playback(if-correct-press&digits/1)
exten => s,n,Noop(Waiting for input)
exten => s,n(end),WaitExten(60,)
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => 1,1,dbDel(blacklist/${blacknr})
exten => 1,n,Playback(num-was-successfully&removed)
exten => 1,n,Wait(1)

[app-vmmain]
include => app-vmmain-custom
exten => *97,1,Answer
exten => *97,n,Wait(1)
exten => *97,n,Macro(user-callerid,)
exten => *97,n,Macro(get-vmcontext,${CALLERID(num)})
exten => *97,n(check),MailBoxExists(${CALLERID(num)}@${VMCONTEXT})|j
exten => *97,n,VoiceMailMain()
exten => *97,n,Macro(hangupcall,)
exten => *97,check+101,VoiceMailMain(${CALLERID(num)}@${VMCONTEXT})
exten => *97,n,Macro(hangupcall,)

; end of [app-vmmain]

[app-pbdirectory]
include => app-pbdirectory-custom
exten => 411,1,Answer
exten => 411,n,Wait(1)
exten => 411,n,Goto(pbdirectory,1)
exten => pbdirectory,1,AGI(pbdirectory)
exten => pbdirectory,n,GotoIf($["${dialnumber}"=""]?hangup,1)
[app-pickup]
include => app-pickup-custom
exten => _.,1,Noop(Attempt to Pickup ${EXTEN:2} by ${CALLERID(num)})
exten => _
.,n,Pickup(${EXTEN:2})

; end of [app-pickup]

[app-zapbarge]
include => app-zapbarge-custom
exten => 888,1,Macro(user-callerid,)
exten => 888,n,Set(GROUP()=${CALLERID(number)})
exten => 888,n,Answer
exten => 888,n,Wait(1)
exten => 888,n,ZapBarge()
exten => 888,n,Hangup

; end of [app-zapbarge]

[app-chanspy]
include => app-chanspy-custom
exten => 555,1,Macro(user-callerid,)
exten => fax,1,Goto(ext-fax,in_fax,1)
exten => 1001,1,Set(__FROM_DID=1001)
exten => 1001,n,Goto(from-did-direct,1001,1)
exten => 1002,1,Set(__FROM_DID=1002)
exten => 1002,n,Goto(from-did-direct,1002,1)

; end of [ext-did]

[ext-did-catchall]
include => ext-did-catchall-custom
exten => s,1,Noop(No DID or CID Match)
exten => s,n,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(ss-noservice)
exten => s,n,SayAlpha(${FROM_DID})
exten => _[#X].,1,Set(__FROM_DID=${EXTEN})
exten => _[
#X].,n,Noop(Received an unknown call with DID set to ${EXTEN})
exten => _[*#X].,n,Goto(ext-did,s,1)

; end of [ext-did-catchall]

[outrt-001-9_outside]
include => outrt-001-9_outside-custom
exten => _9.,1,Macro(dialout-trunk,1,${EXTEN:1},)
exten => _9.,n,Macro(outisbusy,)

; end of [outrt-001-9_outside]

[app-blackhole]
include => app-blackhole-custom
exten => hangup,1,Noop(Blackhole Dest: Hangup)
exten => hangup,n,Hangup
exten => zapateller,1,Noop(Blackhole Dest: Play SIT Tone)
exten => zapateller,n,Answer
exten => zapateller,n,Zapateller()
exten => musiconhold,1,Noop(Blackhole Dest: Put caller on hold forever)
exten => musiconhold,n,Answer
exten => musiconhold,n,MusicOnHold()
exten => congestion,1,Noop(Blackhole Dest: Congestion)
exten => congestion,n,Answer
exten => congestion,n,Playtones(congestion)
exten => congestion,n,Congestion(20)
include => app-recordings
include => app-speeddial
include => app-dnd-off
include => app-dnd-on
include => app-callwaiting-cwoff
include => app-callwaiting-cwon
include => ext-group
include => grps
include => ext-queues
include => ext-meetme
include => app-cf-busy-off
include => app-cf-busy-off-any
include => app-cf-busy-on
include => app-cf-off
include => app-cf-off-any
include => app-cf-on
include => app-cf-unavailable-off
include => app-cf-unavailable-on
include => app-blacklist
include => ext-findmefollow
include => fmgrps
include => app-dialvm
include => app-vmmain

Please let me know if you need anything else

The log information from the full log file I posted yesterday

Thanks a lot for the help
Delian

I have an update:

If I start asterisk with the -c option /usr/sbin/asterisk -c it works and I don’t encounter the error any more but if I simply run asterisk wuthout this optin /usr/sbin/asterisk it fails

I am wondering why it makes difference?

Any ideas?

Thanks