Followme Issue

Hi

I have an issue with followme.

Our extensions.conf is as follows :

exten => _2XXX,1,Dial(SIP/${EXTEN},20,tT)                   ;Transfer Ability Enabled, see features.conf : Blind xfer #1 : Attended xfer *21
exten => _2XXX,2,GotoIf($[${DB(followme/${CALLERID(num)})} as "0"]?4:5)
exten => _2XXX,3,GotoIf($[${DB(followme/${CALLERID(num)})} as "0"]?5:4)
exten => _2XXX,4,Followme(${EXTEN})
exten => _2XXX,5,VoiceMail(${EXTEN}@staff-mailboxes,u)
exten => _2XXX,n,Hangup


exten => _3XXX,n,VoiceMail(${EXTEN}@staff-mailboxes,u)

;turn on/off follow me
;*44 = on
;*45 = off
exten => _*44,1,Set(DB(followme/${CALLERID(num)})=1)
exten => _*45,1,Set(DB(followme/${CALLERID(num)})=0)

However when I turn on follow me by issuing a *44 on our handset it does not work as asterisk cannot recognise the value of 1 as opposed to the value of 0 specified in line 2 of the above.

The error is as follows :

[Mar 23 16:19:10] WARNING[11757]: ast_expr2.fl:445 ast_yyerror: ast_yyerror(): syntax error: syntax error, unexpected ‘’, expecting $end; Input: as “0”

Can anyone help ?

instead of

exten => _2XXX,2,GotoIf($[${DB(followme/${CALLERID(num)})} as “0”]?4:5)

try

exten => _2XXX,2,GotoIf($["${DB(followme/${CALLERID(num)})}" = “0”]?4:5)

Thanks for the reply mudslide567 however that did not fix the issue.

It would seem that asterisk is not honoring the GotoIf command correctly, by this I mean if the followme value is set to 1 (i.e follow me) the 2nd line in my code always seems to trigger no matter what the value is set to…

Can you help, it’s driving me crazy !!

Best

W

Just for reference my code now looks like this :

exten => _2XXX,1,Dial(SIP/${EXTEN},10,tT)
exten => _2XXX,2,Gotoif($[${DB(followme/${CALLERID(num)})}" = 0"]?5)
exten => _2XXX,3,Gotoif($[${DB(followme/${CALLERID(num)})}" = 1"]?4:5)
exten => _2XXX,4,Followme(${EXTEN})
exten => _2XXX,5,VoiceMail(${EXTEN}@staff-mailboxes,u)
exten => _2XXX,n,Hangup

;turn on/off follow me
;*44 = on
;*45 = off
exten => _*44,1,Set(DB(followme/${CALLERID(num)})=1)
exten => _*45,1,Set(DB(followme/${CALLERID(num)})=0)

exten => _2XXX,2,Gotoif($[${DB(followme/${CALLERID(num)})}" = 0"]?5)

should be

exten => _2XXX,2,Gotoif($["${DB(followme/${CALLERID(num)})}" = “0”]?5)

note the (2) extra quotes. unlike most scripting languages, dial plan syntax will parse blank spaces as blank spaces so the part where you put

= 0]

is comparing the DB value to " 0" , not “0”… so the best way to be certain is to enclose both sides of the comparison expressions with quotes:

Gotoif($[ “expression1” = “expression2”]?a,b)

Hope that helps.

Hi mudslide567

Thanks again for the reply, i appreciate your input…

Your suggestion regarding the extra " still will not work for me :

Here is my code :

[code]exten => _2XXX,1,Dial(SIP/${EXTEN},10,tT)
exten => _2XXX,2,Gotoif($["${DB(followme/${CALLERID(num)})}" = “0”]?5)
exten => _2XXX,3,Gotoif($["${DB(followme/${CALLERID(num)})}" = “1”]?4:5)
exten => _2XXX,4,Followme(${EXTEN})
exten => _2XXX,5,VoiceMail(${EXTEN}@staff-mailboxes,u)
exten => _2XXX,n,Hangup

exten => _3XXX,n,VoiceMail(${EXTEN}@staff-mailboxes,u)

;turn on/off follow me
;*44 = on
;*45 = off
exten => _*44,1,Set(DB(followme/${CALLERID(num)})=1)
exten => _*45,1,Set(DB(followme/${CALLERID(num)})=0)
[/code]

Here is the error I get :

== Using SIP RTP CoS mark 5
– Executing [*44@default:1] Set(“SIP/2269-00000063”, “DB(followme/2269)=1”) in new stack
– Auto fallthrough, channel ‘SIP/2269-00000063’ status is ‘UNKNOWN’
== Using SIP RTP CoS mark 5
– Executing [2269@default:1] Dial(“SIP/2268-00000064”, “SIP/2269,10,tT”) in new stack
== Using SIP RTP CoS mark 5
– Called 2269
– SIP/2269-00000065 is ringing
– Nobody picked up in 10000 ms
– Executing [2269@default:2] GotoIf(“SIP/2268-00000064”, “0?5”) in new stack
– Executing [2269@default:3] GotoIf(“SIP/2268-00000064”, “0?4:5”) in new stack
– Goto (default,2269,5)
– Executing [2269@default:5] VoiceMail(“SIP/2268-00000064”, “2269@staff-mailboxes,u”) in new stack
– <SIP/2268-00000064> Playing ‘/var/spool/asterisk/voicemail/staff-mailboxes/2269/unavail.slin’ (language ‘en’)

Is the issue not with how I am setting the values 1 and 0 using the extensions, should they not also have the " marks in there ?

Many thanks for your help.

Best

W

looks more like a logic problem to me

when you set the value : DB(followme/2269)=1") …which is what you want

however, when you call the extension from extension 2268, your test is going to be:

GotoIf($[“DB(followme/2268)” = “1”] … and that makes no sense to be determining the followme based on the number that is calling.

Thanks mudslide567

You beat me to it !! I just spotted that one, basically the logic is saying look in the DB and if you see a 1 or a 0 for the calling number then followme etc…

The issue is that in the DB it is the CALLED number that has the 1 or the 0 set…

Hmmm so how to do that within the dialplan, possibly using the EXTEN variable ?

Would you know how to do this ?

correct…test for Gotoif($["${DB(followme/${EXTEN})}" = “1”]?4:5)

Bingo !

Thanks mudslide567 very much appreciated.