2 msgVoicemail Question
1 msgVOIP Users Conference for Friday Dec 7 @ 12 Noo...
9 msgCDR Function in Hangup Channel
6 msgProbems receiving 200ok message

Setting Multiple Values via func_odbc ...?
\ Douglas Garstang (6 Dec 2007)
. \ Alex Balashov (6 Dec 2007)
. \ Douglas Garstang (6 Dec 2007)
. \ Tilghman Lesher (6 Dec 2007)

6 msgDial() Macro option error in 1.4.15
7 msgSetting custom field in CDR
13 msgCisco power injector with GXP2000 phones
3 msgLogging in and off sessions in the dialplan
1 msgRe: Increasing the voice volume for digium card
5 msgCall Center Scenario -- take 2
1 msgIVR problem (Trixbox)
5 msgPlay Beep instead of MOH
2 msgRe: Increasing the voice volume from the digium...
5 msgDeadAgi
1 msgPolycom call drops
4 msgGSM and CDMA Gateways
1 msgC&W ISDN110
1 msgRe: Can Asterix seperate the signalling and the...
3 msgRunning AGI script if condition met?
Subject:Re: Setting Multiple Values via func_odbc ...?
Group:Asterisk-users
From:Tilghman Lesher
Date:6 Dec 2007


 
On Thursday 06 December 2007 12:20:54 Douglas Garstang wrote:
> I need to insert/update multiple MySQL columns in a single row with the
> func_odbc function at the SAME TIME.
>
> Someone showed me how to use ARRAY to retrieve multiple values at the same
> time, but I need to SET multiple values.
>
> Can this be done?
>
> If not, I will just stick with MySQL, but that's a pain in the ass because
> the asterisk-addons package has no default rpm spec file for building an
> RPM.
>
> I had something like this in func_odbc.conf:
>
> [VOX_LOG_CALL_LEG]
> dsn=MySQL
> write=INSERT into CallLog (Source,IDDCode,AreaCode,ProviderId,SIPReply)
> values (${VAL1},${VAL2},${VAL3},${VAL4},${VAL5})
>
> but it doesn't like it. In order for this to work, I'd have to have several
> LOG_CALL_LEG functions, each taking one parameter, and then requiring
> several database updates!

Yes, you can. The issue is that Set is claiming the '|' character for itself,
which is masking the multiple values passed to func_odbc. You need to
escape your commas with a backslash to ensure the multiple arguments
are seen by func_odbc:

Set(ODBC_VOX_CALL_LEG()=foo\,bar\,baz\,bay\,bax)

I suppose, just brainstorming, that you could also use an alternate delimiter
and break them up yourself with CUT:

[VOX_LOG_CALL_LEG]
dsn=MySQL
write=INSERT into CallLog (Source,IDDCode,AreaCode,ProviderId,SIPReply)
values (${CUT(VAL1,^,1)},${CUT(VAL1,^,2)},${CUT(VAL1,^,3},${CUT(VAL1,^,4)},
${CUT(VAL1,^,5)})

Set(ODBC_VOX_CALL_LEG()=foo^bar^baz^bay^bax)

That's assuming that you can ensure that other character won't be used in any
of your data fields.

BTW, this issue is solved in trunk (which will become 1.6) by limiting Set to
get only a single name/value pair.

--
Tilghman

_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users


© 2004-2008 readlist.com