Hello Simpson,
The xhttp_pi module is built on top of the existing kamailio generic
db api which doesn't provide a "contains" or "like" SQL query.
The supported clause operators are listed in the autogenerated
pi_framework.xml, but I will need to add them also to the module
readme:
/* clause_cols operator */
- '<' '<'
- '>' '>'
- '=' '='
- '<=' '<='
- '>=' '>='
- '!=' '!='
Regards,
Ovidiu Sas
--
VoIP Embedded, Inc.
http://www.voipembedded.com
On Thu, Jun 27, 2013 at 7:01 AM, Simpson Chua <simpsonchua(a)yahoo.com> wrote:
Hi,
I'm using the xhttp_pi module to query the kamailio user registration table
"location". Per the defined clause_cols operators in the module, it
doesn't
seem possible to achieve a query equivalent to a SQL "contains" or
"like".
An exact match is required to query the record; e.g.,
http://xxxxxxx/location/QueryContacts?cmd=on&0=sip:8675309@a.b.c.d:5060…=udp.
Is my understanding correct that there is no way to match on an regular
expression? My end goal is to be able to query for a user's AOR and
expiration status based on a search string (e.g. 8675309) via a webservice.
Can anyone share a better method to do this? Perhaps asynchronously? All
feedback is appreciated.
Sample contact field:
sip:8675309@a.b.c.d:5060;transport=udp
Sample Framework:
<cmd><cmd_name>QueryContacts</cmd_name>
<db_table_id>location</db_table_id>
<cmd_type>DB1_QUERY</cmd_type>
<clause_cols>
<col><field>contact</field><operator>=</operator></col>
</clause_cols>
<query_cols>
<col><field>username</field></col>
<col><field>contact</field></col>
<col><field>expires</field></col>
</query_cols>
</cmd>
Thanks,
Simpson