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

Wei Kun wei-kun at mediaring.com
Wed Aug 10 09:25:36 MST 2005


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




More information about the asterisk-users mailing list