[asterisk-commits] branch oej/test-this-branch r16459 - in
/team/oej/test-this-branch: ./ channe...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Mar 29 22:17:20 MST 2006
Author: oej
Date: Wed Mar 29 23:17:19 2006
New Revision: 16459
URL: http://svn.digium.com/view/asterisk?rev=16459&view=rev
Log:
Resolve conflict, reset automerge
Modified:
team/oej/test-this-branch/ (props changed)
team/oej/test-this-branch/callerid.c
team/oej/test-this-branch/channels/chan_sip.c
team/oej/test-this-branch/include/asterisk/callerid.h
Propchange: team/oej/test-this-branch/
------------------------------------------------------------------------------
automerge = http://edvina.net/training/
Propchange: team/oej/test-this-branch/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Mar 29 23:17:19 2006
@@ -1,1 +1,1 @@
-/trunk:1-16418
+/trunk:1-16458
Modified: team/oej/test-this-branch/callerid.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/callerid.c?rev=16459&r1=16458&r2=16459&view=diff
==============================================================================
--- team/oej/test-this-branch/callerid.c (original)
+++ team/oej/test-this-branch/callerid.c Wed Mar 29 23:17:19 2006
@@ -905,19 +905,40 @@
n[y] = '\0';
}
+/*! \brief Checks if phone number consists of valid characters
+ \param exten String that needs to be checked
+ \param valid Valid characters in string
+ \return 1 if valid string, 0 if string contains invalid characters
+*/
+static int ast_is_valid_string(const char *exten, const char *valid)
+{
+ int x;
+
+ if (ast_strlen_zero(exten))
+ return 0;
+ for (x=0; exten[x]; x++)
+ if (!strchr(valid, exten[x]))
+ return 0;
+ return 1;
+}
+
/*! \brief checks if string consists only of digits and * \# and +
\return 1 if string is valid AST phone number
\return 0 if not
*/
-int ast_isphonenumber(char *n)
-{
- int x;
- if (ast_strlen_zero(n))
- return 0;
- for (x=0;n[x];x++)
- if (!strchr("0123456789*#+", n[x]))
- return 0;
- return 1;
+int ast_isphonenumber(const char *n)
+{
+ return ast_is_valid_string(n, "0123456789*#+");
+}
+
+/*! \brief checks if string consists only of digits and ( ) - * \# and +
+ Pre-qualifies the string for ast_shrink_phone_number()
+ \return 1 if string is valid AST shrinkable phone number
+ \return 0 if not
+*/
+int ast_is_shrinkable_phonenumber(const char *exten)
+{
+ return ast_is_valid_string(exten, "0123456789*#+()-.");
}
/*! \brief parse string for caller id information
Modified: team/oej/test-this-branch/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_sip.c?rev=16459&r1=16458&r2=16459&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_sip.c (original)
+++ team/oej/test-this-branch/channels/chan_sip.c Wed Mar 29 23:17:19 2006
@@ -7944,7 +7944,8 @@
*c = '\0';
tmp = ast_strdupa(of);
if (tmp) {
- ast_shrink_phone_number(tmp);
+ if (ast_is_shrinkable_phonenumber(tmp))
+ ast_shrink_phone_number(tmp);
ast_string_field_set(p, cid_num, tmp);
} else {
ast_string_field_set(p, cid_num, of);
@@ -8035,7 +8036,8 @@
ast_string_field_set(p, cid_name, calleridname);
tmp = ast_strdupa(rpid_num);
if (tmp) {
- ast_shrink_phone_number(tmp);
+ if (ast_is_shrinkable_phonenumber(tmp))
+ ast_shrink_phone_number(tmp);
ast_string_field_set(p, cid_num, tmp);
} else {
ast_string_field_set(p, cid_num, rpid_num);
@@ -8085,7 +8087,8 @@
if (!ast_strlen_zero(device->cid_num) && !ast_strlen_zero(p->cid_num)) {
char *tmp = ast_strdupa(device->cid_num);
if (tmp) {
- ast_shrink_phone_number(tmp);
+ if (ast_is_shrinkable_phonenumber(tmp))
+ ast_shrink_phone_number(tmp);
ast_string_field_set(p, cid_num, tmp);
} else {
ast_string_field_set(p, cid_num, device->cid_num);
Modified: team/oej/test-this-branch/include/asterisk/callerid.h
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/include/asterisk/callerid.h?rev=16459&r1=16458&r2=16459&view=diff
==============================================================================
--- team/oej/test-this-branch/include/asterisk/callerid.h (original)
+++ team/oej/test-this-branch/include/asterisk/callerid.h Wed Mar 29 23:17:19 2006
@@ -193,11 +193,18 @@
*/
extern void ast_shrink_phone_number(char *n);
-/*! \brief Check if a string consists only of digits.
+/*! \brief Check if a string consists only of digits and + \#
\param n number to be checked.
\return Returns 0 if n is a number, 1 if it's not.
*/
-extern int ast_isphonenumber(char *n);
+extern int ast_isphonenumber(const char *n);
+
+/*! \brief Check if a string consists only of digits and and + \# ( ) - .
+ (meaning it can be cleaned with ast_shrink_phone_number)
+ \param exten The extension (or URI) to be checked.
+ \return Returns 0 if n is a number, 1 if it's not.
+ */
+extern int ast_is_shrinkable_phonenumber(const char *exten);
extern int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen);
More information about the asterisk-commits
mailing list