Dynamic Routes FAQ: Difference between revisions

From voipsupport
Jump to navigation Jump to search
No edit summary
Line 17: Line 17:
<pre>select destination from callerid_table where calleridnum like '%[NUMBER]' and length('[NUMBER]') > 4</pre>
<pre>select destination from callerid_table where calleridnum like '%[NUMBER]' and length('[NUMBER]') > 4</pre>


2. Q. How can I match data in my database when sometimes the callerid arrives with an international prefix of +country codes, other times 00 country code and other times just as a national number?
2. Q. How can I match data in my database when sometimes the callerid arrives with an international prefix of + country codes, other times 00 country code and other times just as a national number?


A. You may use the MySQL TRIM function to adjust the presented caller id to match the type of data in your database. For example:
A. You may use the MySQL TRIM function to adjust the presented caller id to match the type of data in your database. For example:

Revision as of 21:03, 11 June 2016

General FAQ

1. Q. What are the prerequisites for Dynamic Routes?

2. Q. Does Dynamic Routes effect performance?

3. Q. Does Dynamic Routes effect system availability?

4. Q. What are the security implications of using Dynamic Routes?

Configuration FAQ

1. Q. How can I avoid matching short caller ids?

A. You can use a condition in the WHERE clause to ensure that only caller ids of sufficient length are matched. This is useful if your database contains company phone numbers with similar prefixes, but when receiving calls the caller id is set to the shorter main phone number of the company.

select destination from callerid_table where calleridnum like '%[NUMBER]' and length('[NUMBER]') > 4

2. Q. How can I match data in my database when sometimes the callerid arrives with an international prefix of + country codes, other times 00 country code and other times just as a national number?

A. You may use the MySQL TRIM function to adjust the presented caller id to match the type of data in your database. For example:

select destination from callerid_table where calleridnum like concat('%',TRIM(LEADING '+' FROM TRIM(LEADING '0' FROM '[NUMBER]')))

Trouble shooting FAQ

1. Q. Why do I get strange errors when using asterisk MYSQL module?

[2015-04-24 21:52:59] WARNING[14294][C-000020b6] pbx.c: Error in extension logic (missing '}')
[2015-04-24 21:52:59] WARNING[14294][C-000020b6] pbx.c: Can't find trailing parenthesis for function 'CALLERID(nu'?
[2015-04-24 21:52:59] ERROR[14294][C-000020b6] func_callerid.c: Unknown callerid data type 'nu'.
[2015-04-24 21:52:59] VERBOSE[14294][C-000020b6] pbx.c:     -- Executing [s@dynroute-21:4] MYSQL("SIP/215-00000087", "Query resultid 1 select callerid_firstname from calleridlookup where owner='john' and '") in new stack
[2015-04-24 21:52:59] WARNING[14294][C-000020b6] app_mysql.c: aMYSQL_query: mysql_query failed. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' at line 1
[2015-04-24 21:52:59] VERBOSE[14294][C-000020b6] pbx.c:     -- Executing [s@dynroute-21:5] MYSQL("SIP/215-00000087", "Fetch fetchid  dynroute") in new stack
[2015-04-24 21:52:59] WARNING[14294][C-000020b6] app_mysql.c: aMYSQL_fetch: missing some arguments
[2015-04-24 21:52:59] VERBOSE[14294][C-000020b6] pbx.c:     -- Executing [s@dynroute-21:6] MYSQL("SIP/215-00000087", "Clear ") in new stack
[2015-04-24 21:52:59] WARNING[14294][C-000020b6] app_mysql.c: Identifier 0, identifier_type 2 not found in identifier list
[2015-04-24 21:52:59] WARNING[14294][C-000020b6] app_mysql.c: Invalid result identifier 0 passed in aMYSQL_clear
[2015-04-24 21:52:59] VERBOSE[14294][C-000020b6] pbx.c:     -- Executing [s@dynroute-21:7] MYSQL("SIP/215-00000087", "Disconnect 1") in new stack
[2015-04-24 21:52:59] VERBOSE[14294][C-000020b6] pbx.c:     -- Executing [s@dynroute-21:8] Set("SIP/215-00000087", "__DYNROUTE_TEST=") in new stack
[2015-04-24 21:52:59] WARNING[14294][C-000020b6] ast_expr2.fl: ast_yyerror():  syntax error: syntax error, unexpected '=', expecting $end; Input:>

A. Do not use a semicolon at the end of the query. This syntax is not supported by asterisk MYSQL module.