Function not registered

Hi.
I am trying to do some hotdesking.
The main idea is that people dial code then password and will be logged in to queue.
But before that i want to write to mysql whenever they where logged in or out.
At now, i m stuck at log in. The problem is, that i don’t understand why asterisk keeps saying that function is not registered.
Here is my dialplan

[agents]
exten => *897,1,Goto(agent-status,begin,1)
exten => _9XXXXXXXX,Goto(queue-agents-outbound)

[agent-status]
exten => begin,1,NoOp
same => 2,Read(Extension,enter-username,4)
same => 3,Set(Pass=${AGENTS_INFO(${Extension})})
same => 4,Verbose(Login is ${Extension})
same => 5,Verbose(Password is ${Pass})
same => 6,Read(Getpasswd,password-enter,4)
same => 7,Gotoif($["${Pass}" = “${Getpasswd}”]?8:bad,start,1)
same => 8,Playback(login-ok)
same => 9,Set(usrname=${CALLERID(num)})
same => 10,Verbose(Calledis is ${usrname})
same => 11,Set(AGENTS_LOGIN(${Extension})=${CALLERID(num)})
same => 12,Set(AGENTS_MONITOR()=${Extension})
same => 13,Hangup()

[bad]
exten => start,1,Playback(wrong-password)
same => 2,Hangup()

Here is func_odbc.conf

[INFO]
prefix=AGENTS
dsn=asterisk
readsql=SELECT password from agents where username = ‘${ARG1}’

[LOGIN]
prefix=AGENTS
dsn=asterisk
writesql=UPDATE agents set location = ‘${VAL1}’, status = 1 where username = ‘${ARG1}’

[MONITOR]
prefix=AGENTS
dns=asterisk
writesql=INSERT INTO cc_stats(user,event) values(’${VAL1}’,1)

Call log

[size=85]
[Nov 17 22:17:46] VERBOSE[2618] netsock2.c: == Using SIP RTP TOS bits 184
[Nov 17 22:17:46] VERBOSE[2618] netsock2.c: == Using SIP RTP CoS mark 5
[Nov 17 22:17:46] VERBOSE[5147] pbx.c: – Executing [*897@agents:1] Goto(“SIP/1101-00000045”, “agent-status,begin,1”) in new stack
[Nov 17 22:17:46] VERBOSE[5147] pbx.c: – Goto (agent-status,begin,1)
[Nov 17 22:17:46] VERBOSE[5147] pbx.c: – Executing [begin@agent-status:1] NoOp(“SIP/1101-00000045”, “”) in new stack
[Nov 17 22:17:46] VERBOSE[5147] pbx.c: – Executing [begin@agent-status:2] Read(“SIP/1101-00000045”, “Extension,enter-username,4”) in new stack
[Nov 17 22:17:47] VERBOSE[5147] app_read.c: – Accepting a maximum of 4 digits.
[Nov 17 22:17:47] VERBOSE[5147] file.c: – <SIP/1101-00000045> Playing ‘enter-username.slin’ (language ‘en’)
[Nov 17 22:17:49] VERBOSE[5147] app_read.c: – User entered ‘1101’
[Nov 17 22:17:49] VERBOSE[5147] pbx.c: – Executing [begin@agent-status:3] Set(“SIP/1101-00000045”, “Pass=2222”) in new stack
[Nov 17 22:17:49] VERBOSE[5147] pbx.c: – Executing [begin@agent-status:4] Verbose(“SIP/1101-00000045”, “Login is 1101”) in new stack
[Nov 17 22:17:49] VERBOSE[5147] app_verbose.c: Login is 1101
[Nov 17 22:17:49] VERBOSE[5147] pbx.c: – Executing [begin@agent-status:5] Verbose(“SIP/1101-00000045”, “Password is 2222”) in new stack
[Nov 17 22:17:49] VERBOSE[5147] app_verbose.c: Password is 2222
[Nov 17 22:17:49] VERBOSE[5147] pbx.c: – Executing [begin@agent-status:6] Read(“SIP/1101-00000045”, “Getpasswd,password-enter,4”) in new stack
[Nov 17 22:17:49] VERBOSE[5147] app_read.c: – Accepting a maximum of 4 digits.
[Nov 17 22:17:49] VERBOSE[5147] file.c: – <SIP/1101-00000045> Playing ‘password-enter.slin’ (language ‘en’)
[Nov 17 22:17:51] VERBOSE[5147] app_read.c: – User entered ‘2222’
[Nov 17 22:17:51] VERBOSE[5147] pbx.c: – Executing [begin@agent-status:7] GotoIf(“SIP/1101-00000045”, “1?8:bad,start,1”) in new stack
[Nov 17 22:17:51] VERBOSE[5147] pbx.c: – Goto (agent-status,begin,8)
[Nov 17 22:17:51] VERBOSE[5147] pbx.c: – Executing [begin@agent-status:8] Playback(“SIP/1101-00000045”, “login-ok”) in new stack
[Nov 17 22:17:51] VERBOSE[5147] file.c: – <SIP/1101-00000045> Playing ‘login-ok.slin’ (language ‘en’)
[Nov 17 22:17:53] VERBOSE[5147] pbx.c: – Executing [begin@agent-status:9] Set(“SIP/1101-00000045”, “usrname=1101”) in new stack
[Nov 17 22:17:53] VERBOSE[5147] pbx.c: – Executing [begin@agent-status:10] Verbose(“SIP/1101-00000045”, “Calledis is 1101”) in new stack
[Nov 17 22:17:53] VERBOSE[5147] app_verbose.c: Calledis is 1101
[Nov 17 22:17:53] VERBOSE[5147] pbx.c: – Executing [begin@agent-status:11] Set(“SIP/1101-00000045”, “AGENTS_LOGIN(1101)=1101”) in new stack
[Nov 17 22:17:53] VERBOSE[5147] pbx.c: – Executing [begin@agent-status:12] Set(“SIP/1101-00000045”, “AGENTS_MONITOR()=1101”) in new stack
[Nov 17 22:17:53] ERROR[5147] pbx.c: Function AGENTS_MONITOR not registered
[Nov 17 22:17:53] VERBOSE[5147] pbx.c: – Executing [begin@agent-status:13] Hangup(“SIP/1101-00000045”, “”) in new stack
[Nov 17 22:17:53] VERBOSE[5147] pbx.c: == Spawn extension (agent-status, begin, 13) exited non-zero on ‘SIP/1101-00000045’
[/size]

Could somone tell me where is mistake?

I have lookup on the Asterisk 11 Command Reference and there is not any function or dialplan application called AGENTS_MONITOR() at least on Asterisk 11

Did you reload Asterisk after adding AGENTS_MONITOR in func_odbc?

–Satish Barot
satish4asterisk@gmail.com

@ambiorixg12 :

This is custom function created through func_odbc. :smile:

–Satish Barot
satish4asterisk@gmail.com

I did reloads and core reloads and other reloads…
So, what could it be?
Other functions from func_odbc.conf are working.

Shouldn’t give an error then.
Does it appear in a list of asterisk -rx “core show functions”?

–Satish Barot
satish4asterisk@gmail.com

[quote=“satish4asterisk”]Shouldn’t give an error then.
Does it appear in a list of asterisk -rx “core show functions”?

–Satish Barot
satish4asterisk@gmail.com[/quote]

Hi,
No it doesn’t. None of my functions, no INFO no LOGIN no MONITOR, but INFO and LOGIN work
MONITOR doesn’t

[quote=“satish4asterisk”]@ambiorixg12 :

This is custom function created through func_odbc. :smile:

–Satish Barot
satish4asterisk@gmail.com[/quote]

Thanks -Satish Barot for clarify my doubt, i have never use the func_odbc function, but i will take a look

Hard to believe this!
Post the output of following from Asterisk CLI.
(1)core show version
(2)core reload
(3)core show function AGENTS_LOGIN
(4)core show function AGENTS_MONITOR
and
cat /etc/asterisk/func_odbc.conf

–Satish Barot
satish4asterisk@gmail.com

I have found the solution through system(script)
No i have another question.
I am adding agents through AddQueueMember from dialplan.
Is it possible to add member with not just sip/location but with name and account code,
that will be written in cdrs when agent answers the call?

You should then post your solution so that someone else can benefit from this thread.

Look at the membername argument which you can use for your requirement.
wiki.asterisk.org/wiki/display/ … ueueMember

–Satish Barot
satish4asterisk@gmail.com