[Asterisk-Users] asterisk query mysql problem or bug?

Matthew Boehm mboehm at cytelcom.com
Thu Aug 11 08:13:02 MST 2005


Don't use commas as delimiters in database. You must use pipe |. Replace 
your commas and see if that does the trick.

-Matthew

Wei Kun wrote:
> Hi;
> I have entries as below in DB,
> 
> mysql> select * from sip_buddies;
> +----+------+----------+------------+---------+------------+--------+-------
> -----+------------+----------+------+
> | id | name | context  | defaultip  | host    | mailbox    | type   |
> regseconds | ipaddr     | username | port |
> +----+------+----------+------------+---------+------------+--------+-------
> -----+------------+----------+------+
> |  1 | 2000 | from-sip | 10.1.2.192 | dynamic | 2000 at local | friend |
> 1123733887 | 10.1.2.192 | 2000     | 5060 |
> |  2 | 2001 | from-sip | 10.1.2.220 | dynamic | 2001 at local | friend |
> 1123733888 | 10.1.1.220 | 2001     | 5080 |
> +----+------+----------+------------+---------+------------+--------+-------
> -----+------------+----------+------+
> 2 rows in set (0.01 sec)
> 
> mysql> select * from extensions_table;
> +----+----------+-------+----------+---------------+----------------+
> | id | context  | exten | priority | app           | appdata        |
> +----+----------+-------+----------+---------------+----------------+
> |  1 | from-sip | 2000  |        1 | Dial          | SIP/2000,20    |
> |  2 | from-sip | 2000  |        2 | Voicemail     | u2000          |
> |  3 | from-sip | 2000  |      102 | Voicemail     | b2000          |
> |  4 | from-sip | 2000  |      103 | Hangup        |                |
> |  5 | from-sip | 2001  |        1 | Dial          | SIP/2001       |
> |  6 | from-sip | 2001  |        2 | Voicemail     | u2001          |
> |  7 | from-sip | 2001  |      102 | Voicemail     | b2001          |
> |  8 | from-sip | 2001  |      103 | Hangup        |                |
> |  9 | from-sip | 2999  |        1 | VoicemailMain | ${CALLERIDNUM} |
> +----+----------+-------+----------+---------------+----------------+
> 9 rows in set (0.00 sec)
> 
> Somehow the program get the info '2001,20' stripped from extensions_table
> appdata column 'SIP/2001, 20', and try to look it up in sip_buddies name
> column as debug output below.
> 
> Aug 11 12:23:05 DEBUG[23952] res_config_mysql.c: MySQL RealTime: Retrieve
> SQL: SELECT * FROM sip_buddies WHERE name = '2001,20'
> 
> Of course, it can't find it, and go to second step for voicemail. If I
> change the appdata to 'SIP/2001', it can find it and ring remote party, the
> problem is it rings for ever without the 20 hint.
> 
> Any hints for this problem?
> 
> Thanks
> Kun
> 
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
> 





More information about the asterisk-users mailing list