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

Dovid Bender dovid at telecurve.com
Mon Oct 16 12:04:51 CDT 2017


It's been years since I have used real time but can it be because of the
GoSub?



On Mon, Oct 16, 2017 at 12:39 PM, John Kiniston <johnkiniston at gmail.com>
wrote:

> 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 <(520)%20670-0792>'
> [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 <(520)%20670-0792>'
> [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 <(520)%20670-0792>@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 <(520)%20670-0792>'
> [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 <(520)%20670-0792>'
> [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 <(520)%20670-0792>@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 <(520)%20670-0792>    5
> Gosub    sub-setupinboundcall,s,1(kiniston,Pop_Country_Crossover,300,VOIP)
> 7301702413361087848    sip-in    5206700792 <(520)%20670-0792>    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
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at: https://community.asterisk.
> org/
>
> New to Asterisk? Start here:
>       https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20171016/9596a91c/attachment.html>


More information about the asterisk-users mailing list