u hv to enclose the destination number with () so its value will be assigned to $1<br> <condition field="destination_number" expression="^(0112341234)$"><br>
<br><br><div class="gmail_quote">On Mon, May 16, 2011 at 11:14 PM, Chris Graham <span dir="ltr"><<a href="mailto:chrisg.lists@gmail.com">chrisg.lists@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi All,<br>
I am having an issue with mod_lcr, when I query from the CLI it<br>
returns the expected values as per:<br>
<br>
freeswitch@internal> lcr 0112341234 peak<br>
| Digit Match | Carrier | Rate | Codec | CID Regexp | Limit |<br>
Dialstring<br>
|<br>
| 011 | Telkom | 0.32000 | | | |<br>
[lcr_carrier=Telkom,lcr_rate=0.32000]sofia/gateway/pp-ast-trunk-01/0112341234<br>
|<br>
freeswitch@internal> 2011-05-16 17:06:19.847934 [DEBUG] mod_lcr.c:1687<br>
data passed to lcr is [0112341234 peak]<br>
2011-05-16 17:06:19.847934 [WARNING] mod_lcr.c:1731 Using default CID<br>
<a href="tel:%5B18005551212" value="+18005551212">[18005551212</a>]<br>
2011-05-16 17:06:19.847934 [DEBUG] mod_lcr.c:836 Has NPA NXX: [1 == 1]<br>
2011-05-16 17:06:19.847934 [DEBUG] mod_lcr.c:771 0112341234 doesn't<br>
appear to be a NANP number<br>
2011-05-16 17:06:19.847934 [DEBUG] mod_lcr.c:852 intra routing<br>
[state:0 lata:0] so rate field is [rate]<br>
2011-05-16 17:06:19.847934 [DEBUG] mod_lcr.c:872 we have an event<br>
2011-05-16 17:06:19.847934 [DEBUG] mod_lcr.c:896 SQL: SELECT l.digits<br>
AS lcr_digits, c.carrier_name AS lcr_carrier_name, l.rate AS<br>
lcr_rate_field, cg.prefix AS lcr_gw_prefix, cg.suffix AS<br>
lcr_gw_suffix, l.lead_strip AS lcr_lead_strip, l.trail_strip AS<br>
lcr_trail_strip, l.prefix AS lcr_prefix, l.suffix AS lcr_suffix,<br>
cg.codec AS lcr_codec, l.cid AS lcr_cid FROM lcr l JOIN carriers c ON<br>
l.carrier_id=<a href="http://c.id" target="_blank">c.id</a> JOIN carrier_gateway cg ON <a href="http://c.id" target="_blank">c.id</a>=cg.carrier_id WHERE<br>
c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits IN<br>
(0112341234, 011234123, 01123412, 0112341, 011234, 01123, 0112, 011,<br>
01, 0) AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end ORDER BY<br>
digits DESC, rate, quality DESC, reliability DESC, rand();<br>
2011-05-16 17:06:19.847934 [DEBUG] mod_lcr.c:337 Returning Dialstring<br>
[lcr_carrier=Telkom,lcr_rate=0.32000]sofia/gateway/pp-ast-trunk-01/0112341234<br>
2011-05-16 17:06:19.847934 [DEBUG] mod_lcr.c:664 Adding Telkom to head of list<br>
2011-05-16 17:06:19.847934 [DEBUG] mod_lcr.c:337 Returning Dialstring<br>
[lcr_carrier=Neotel,lcr_rate=0.32000]sofia/gateway/pp-ast-trunk-01/0112341234<br>
2011-05-16 17:06:19.847934 [DEBUG] mod_lcr.c:682 Ignoring Duplicate<br>
route for termination point (sofia/gateway/pp-ast-trunk-01/:)<br>
2011-05-16 17:06:19.847934 [DEBUG] mod_lcr.c:337 Returning Dialstring<br>
[lcr_carrier=Telkom,lcr_rate=0.32000]sofia/gateway/pp-ast-trunk-01/0112341234<br>
<br>
<br>
When calling from the dialplan, it fails with:<br>
<br>
2011-05-16 17:08:33.100261 [DEBUG] mod_lcr.c:1563 intrastate channel<br>
var is [undef]<br>
2011-05-16 17:08:33.100261 [DEBUG] mod_lcr.c:1566 Select routes based<br>
on interstate rates<br>
2011-05-16 17:08:33.100261 [DEBUG] mod_lcr.c:1585 LCR Lookup on $1<br>
using profile peak<br>
2011-05-16 17:08:33.100261 [DEBUG] mod_lcr.c:836 Has NPA NXX: [1 == 1]<br>
2011-05-16 17:08:33.100261 [DEBUG] mod_lcr.c:771 $1 doesn't appear to<br>
be a NANP number<br>
2011-05-16 17:08:33.100261 [DEBUG] mod_lcr.c:852 intra routing<br>
[state:0 lata:0] so rate field is [rate]<br>
2011-05-16 17:08:33.100261 [DEBUG] mod_lcr.c:857 we have a session<br>
2011-05-16 17:08:33.100261 [DEBUG] mod_lcr.c:896 SQL: SELECT l.digits<br>
AS lcr_digits, c.carrier_name AS lcr_carrier_name, l.rate AS<br>
lcr_rate_field, cg.prefix AS lcr_gw_prefix, cg.suffix AS<br>
lcr_gw_suffix, l.lead_strip AS lcr_lead_strip, l.trail_strip AS<br>
lcr_trail_strip, l.prefix AS lcr_prefix, l.suffix AS lcr_suffix,<br>
cg.codec AS lcr_codec, l.cid AS lcr_cid FROM lcr l JOIN carriers c ON<br>
l.carrier_id=<a href="http://c.id" target="_blank">c.id</a> JOIN carrier_gateway cg ON <a href="http://c.id" target="_blank">c.id</a>=cg.carrier_id WHERE<br>
c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits IN<br>
(1) AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end ORDER BY<br>
digits DESC, rate, quality DESC, reliability DESC, rand();<br>
EXECUTE sofia/internal/<a href="mailto:1000@192.168.16.136">1000@192.168.16.136</a> bridge()<br>
2011-05-16 17:08:33.100261 [NOTICE] switch_core_state_machine.c:189<br>
sofia/internal/<a href="mailto:1000@192.168.16.136">1000@192.168.16.136</a> has executed the last dialplan<br>
instruction, hanging up.<br>
<br>
<br>
The xml entry called:<br>
<br>
<extension name="Test"><br>
<condition field="destination_number" expression="^0112341234$"><br>
<action application="lcr" data="$1 peak"/><br>
<action application="bridge" data="${lcr_auto_route}"/><br>
</condition><br>
</extension><br>
<br>
<br>
My custom query:<br>
<br>
<profile name="peak"><br>
<param name="custom_sql" value="<br>
SELECT l.digits AS lcr_digits, c.carrier_name AS lcr_carrier_name,<br>
l.rate AS lcr_rate_field, cg.prefix AS lcr_gw_prefix, cg.suffix AS<br>
lcr_gw_suffix, l.lead_strip AS lcr_lead_strip, l.trail_strip AS<br>
lcr_trail_strip, l.prefix AS lcr_prefix, l.suffix AS lcr_suffix,<br>
cg.codec AS lcr_codec, l.cid AS lcr_cid FROM lcr l JOIN carriers c ON<br>
l.carrier_id=<a href="http://c.id" target="_blank">c.id</a> JOIN carrier_gateway cg ON <a href="http://c.id" target="_blank">c.id</a>=cg.carrier_id WHERE<br>
c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits IN<br>
(${lcr_query_expanded_digits}) AND CURRENT_TIMESTAMP BETWEEN<br>
date_start AND date_end ORDER BY digits DESC, rate, quality DESC,<br>
reliability DESC, rand();<br>
"/><br>
</profile><br>
<br>
Thanks in advance,<br>
Chris<br>
<br>
_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote></div><br>