[asterisk-users] Realtime extensions, Multiple SQL lookups?

John Kiniston johnkiniston at gmail.com
Mon Oct 16 11:39:08 CDT 2017


I'm toying with the idea of replacing a statically generated file I include
in my extensions.conf with a realtime lookup against my database.

I've got it working but something seems off in my logs, It looks like I'm
getting two lookups for every priority?

[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_odbc.c: Reusing ODBC handle
0x7f8da8002938 from class 'odbc_kiniston-test'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Skip: 0; SQL:
SELECT * FROM extensions-test WHERE exten = ? AND priority = ? AND context
= ?
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Parameter 1
('exten') = '5206700792'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Parameter 2
('priority') = '5'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Parameter 3
('context') = 'sip-in'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_odbc.c: Releasing ODBC
handle 0x7f8da8002938 into pool
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_odbc.c: Reusing ODBC handle
0x7f8da8002938 from class 'odbc_kiniston-test'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Skip: 0; SQL:
SELECT * FROM extensions-test WHERE exten = ? AND priority = ? AND context
= ?
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Parameter 1
('exten') = '5206700792'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Parameter 2
('priority') = '5'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Parameter 3
('context') = 'sip-in'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_odbc.c: Releasing ODBC
handle 0x7f8da8002938 into pool
[Oct 12 16:45:24] VERBOSE[26541][C-0000000e] pbx_realtime.c: Executing
[5206700792 at sip-in:5] Gosub("PJSIP/trunks1-0000000e",
"sub-setupinboundcall,s,1(kiniston,Pop_Country_Crossover,300,VOIP)")

---SNIP---

[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_odbc.c: Reusing ODBC handle
0x7f8da8002938 from class 'odbc_kiniston-test'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Skip: 0; SQL:
SELECT * FROM extensions-test WHERE exten = ? AND priority = ? AND context
= ?
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Parameter 1
('exten') = '5206700792'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Parameter 2
('priority') = '6'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Parameter 3
('context') = 'sip-in'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_odbc.c: Releasing ODBC
handle 0x7f8da8002938 into pool
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_odbc.c: Reusing ODBC handle
0x7f8da8002938 from class 'odbc_kiniston-test'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Skip: 0; SQL:
SELECT * FROM extensions-test WHERE exten = ? AND priority = ? AND context
= ?
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Parameter 1
('exten') = '5206700792'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Parameter 2
('priority') = '6'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_config_odbc.c: Parameter 3
('context') = 'sip-in'
[Oct 12 16:45:24] DEBUG[26541][C-0000000e] res_odbc.c: Releasing ODBC
handle 0x7f8da8002938 into pool
[Oct 12 16:45:24] VERBOSE[26541][C-0000000e] pbx_realtime.c: Executing
[5206700792 at sip-in:6] Goto("PJSIP/trunk1-0000000e", "kiniston-ivr,s,1")
[Oct 12 16:45:24] VERBOSE[26541][C-0000000e] pbx_builtins.c: Goto
(kiniston-ivr,s,1)



The contents of my table are just
id                context        exten        priority    app    appdata
7301702413361087843 sip-in    5206700792    5    Gosub
sub-setupinboundcall,s,1(kiniston,Pop_Country_Crossover,300,VOIP)
7301702413361087848    sip-in    5206700792    6    Goto    kiniston-ivr,s,1

My extensions.conf
[sip-in]
exten => _X.,1,Log(NOTICE,Incoming ${CHANNEL:0:3} call DID: ${EXTEN} from
CallerID: ${CALLERID(num)} ${CALLERID(name)}, ANI:${CALLERID(ani)}
ANI2:${CALLINGANI2})
exten =>
_X.,2,Set(ARRAY(CDR(firstext),CDR(firstcontext))=${EXTEN},${CONTEXT})
exten => _X.,3,Set(ARRAY(__FirstEXT,__FirstContext)=${EXTEN},${CONTEXT})
exten => _X.,4,Set(CHANNEL(hangup_handler_push)=cdr-fixup,s,1)
exten => _X.,7,Hangup()
switch => Realtime/sip-in at extensions/p


Has anyone else noticed this behavior? Is it expected? I dont' see any
mentions of it in any the docs.

-- 
A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts,
build a wall, set a bone, comfort the dying, take orders, give orders,
cooperate, act alone, solve equations, analyze a new problem, pitch manure,
program a computer, cook a tasty meal, fight efficiently, die gallantly.
Specialization is for insects.
---Heinlein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20171016/ea70e118/attachment.html>


More information about the asterisk-users mailing list