diff options
author | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-10-21 15:14:06 +0000 |
---|---|---|
committer | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-10-21 15:14:06 +0000 |
commit | b478513f785517f98fd55fc0f4f2d8b242b2680a (patch) | |
tree | 52bfcd1a74a193658682628d4900c9462e9edec9 /channels/chan_iax2.c | |
parent | c1d51696c64f968b101f50c84fbefcd3afbed937 (diff) |
Merged revisions 225033 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r225033 | dvossel | 2009-10-21 09:39:10 -0500 (Wed, 21 Oct 2009) | 27 lines
Merged revisions 225032 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r225032 | dvossel | 2009-10-21 09:37:04 -0500 (Wed, 21 Oct 2009) | 20 lines
IAX/SIP shrinkcallerid option
The shrinking of caller id removes '(', ' ', ')', non-trailing '.',
and '-' from the string. This means values such as 555.5555 and
test-test result in 555555 and testtest. There are instances,
such as Skype integration, where a specific value is passed via
caller id that must be preserved unmodified. This patch makes
the shrinking of caller id optional in chan_sip and chan_iax in
order to support such cases. By default this option is on to
preserve previous expected behavior.
(closes issue #15940)
Reported by: dimas
Patches:
v2-15940.patch uploaded by dimas (license 88)
15940_shrinkcallerid_trunk.c uploaded by dvossel (license 671)
Tested by: dvossel
Review: https://reviewboard.asterisk.org/r/408/
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@225035 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r-- | channels/chan_iax2.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index e83a1913b..ab28c638d 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -379,6 +379,7 @@ enum iax2_flags { IAX_ALLOWFWDOWNLOAD = (1 << 26), /*!< Allow the FWDOWNL command? */ IAX_IMMEDIATE = (1 << 27), /*!< Allow immediate off-hook to extension s */ IAX_FORCE_ENCRYPT = (1 << 28), /*!< Forces call encryption, if encryption not possible hangup */ + IAX_SHRINKCALLERID = (1 << 29), /*!< Turn on and off caller id shrinking */ }; static int global_rtautoclear = 120; @@ -7143,7 +7144,9 @@ static int check_access(int callno, struct sockaddr_in *sin, struct iax_ies *ies if (ies->called_number) ast_string_field_set(iaxs[callno], exten, ies->called_number); if (ies->calling_number) { - ast_shrink_phone_number(ies->calling_number); + if (ast_test_flag(&globalflags, IAX_SHRINKCALLERID)) { + ast_shrink_phone_number(ies->calling_number); + } ast_string_field_set(iaxs[callno], cid_num, ies->calling_number); } if (ies->calling_name) @@ -12472,7 +12475,8 @@ static int set_config(const char *config_file, int reload) /* Reset Global Flags */ memset(&globalflags, 0, sizeof(globalflags)); ast_set_flag(&globalflags, IAX_RTUPDATE); - + ast_set_flag(&globalflags, IAX_SHRINKCALLERID); + #ifdef SO_NO_CHECK nochecksums = 0; #endif @@ -12724,10 +12728,18 @@ static int set_config(const char *config_file, int reload) if (sscanf(v->value, "%10hu", &global_maxcallno_nonval) != 1) { ast_log(LOG_WARNING, "maxcallnumbers_nonvalidated must be set to a valid number. %s is not valid at line %d.\n", v->value, v->lineno); } - } else if(!strcasecmp(v->name, "calltokenoptional")) { + } else if (!strcasecmp(v->name, "calltokenoptional")) { if (add_calltoken_ignore(v->value)) { ast_log(LOG_WARNING, "Invalid calltokenoptional address range - '%s' line %d\n", v->value, v->lineno); } + } else if (!strcasecmp(v->name, "shrinkcallerid")) { + if (ast_true(v->value)) { + ast_set_flag((&globalflags), IAX_SHRINKCALLERID); + } else if (ast_false(v->value)) { + ast_clear_flag((&globalflags), IAX_SHRINKCALLERID); + } else { + ast_log(LOG_WARNING, "shrinkcallerid value %s is not valid at line %d.\n", v->value, v->lineno); + } }/*else if (strcasecmp(v->name,"type")) */ /* ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */ v = v->next; |