[Freeswitch-users] mod_lcr
Madovsky
infos at madovsky.org
Thu Jun 10 09:24:06 PDT 2010
Rupa,
I'd like to test PREFIX module form postgresql.
so in your postgresql sql I can see :
CREATE TABLE lcr
(
...
digits NUMERIC(20, 0),
....
prefix VARCHAR(16) NOT NULL DEFAULT '',
...
);
but in your PREFIX postgresql module example it's written :
create table rates (id serial not null, prefix prefix_range, [...]);
create index rates_prefix_idx on rates using gist (prefix gist_prefix_range_ops);
insert [...]
select * from rates where prefix @> '16666666666';
and in the custom example :...WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1'
AND digits_prefix @> '%q'
....
My question is how to uise the lcr table with PREFIX module of postgresql ?
Thaks
Franck
----- Original Message -----
From: Rupa Schomaker
To: freeswitch-users
Sent: Thursday, June 10, 2010 8:38 AM
Subject: Re: [Freeswitch-users] mod_lcr
Read the part about how to define the table + the gist index. The whole custom_sql thing assumes a familiarity with sql. you can choose to not have a digits_prefix column and just change the datatype of prefix to prefix. You can do what I did which is to have prefix be text and digits_prefix be of type prefix and a trigger to keep the two in sync. the key is that you are searching against the prefix column for which there is a GIST index.
On Thu, Jun 10, 2010 at 2:53 AM, Madovsky <infos at madovsky.org> wrote:
ok thanks I will read again
F
----- Original Message -----
From: Nandy Dagondon
To: freeswitch-users at lists.freeswitch.org
Sent: Thursday, June 10, 2010 3:09 AM
Subject: Re: [Freeswitch-users] mod_lcr
it's the digits_prefix in the WHERE clause that's causing the error.
ur question re prefix+digits, it's explained in the Custom SQL portion in the wiki.
-nandy
On Thu, Jun 10, 2010 at 2:56 PM, Madovsky <infos at madovsky.org> wrote:
ok so it needs also the alias l.digits in the condition I think.
I'm a little confused about digits and prefix.
if I check a number with the country code is it need to join
prefix+digits ? how with this kinkd of sql request ?
Thanks
F
----- Original Message -----
From: Nandy Dagondon
To: freeswitch-users at lists.freeswitch.org
Sent: Thursday, June 10, 2010 2:44 AM
Subject: Re: [Freeswitch-users] mod_lcr
i think it's a typo. i changed digits_prefix to digits. to be sure, pls check the CREATE TABLE entries.
-nandy
On Thu, Jun 10, 2010 at 2:16 PM, Madovsky <infos at madovsky.org> wrote:
I'm experimenting with mod_lcr with postgresql (8.4.4)
there s an example of custom sql on wiki below :
<profile name="use_prefix">
<param name="custom_sql" value="
SELECT l.digits, c.carrier_name, l.${lcr_rate_field}, cg.prefix AS gw_prefix, cg.suffix AS gw_suffix,
l.lead_strip, l.trail_strip, l.prefix, l.suffix, cg.codec, l.cid
FROM lcr l
JOIN carriers c ON l.carrier_id=c.id
JOIN carrier_gateway cg ON c.id=cg.carrier_id
WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1'
AND digits_prefix @> '%q'
AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end
ORDER BY digits DESC, ${lcr_rate_field} asc, random();
"/>
</profile>
however the query failed cause of digits_prefix field doesn't exist in the table.is it a typo ? or does it need a field concatenation of prefix and digits ?Thanks Franck
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
----------------------------------------------------------------------
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
--------------------------------------------------------------------------
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
--
-Rupa
------------------------------------------------------------------------------
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100610/7b9c7c86/attachment.html
More information about the FreeSWITCH-users
mailing list