From b478513f785517f98fd55fc0f4f2d8b242b2680a Mon Sep 17 00:00:00 2001 From: dvossel Date: Wed, 21 Oct 2009 15:14:06 +0000 Subject: 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 --- channels/chan_sip.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'channels/chan_sip.c') diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 64ae98d1e..196eb80c0 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1087,6 +1087,7 @@ static int global_rtpholdtimeout; /*!< Time out call if no RTP during hold */ static int global_rtpkeepalive; /*!< Send RTP keepalives */ static int global_reg_timeout; static int global_regattempts_max; /*!< Registration attempts before giving up */ +static int global_shrinkcallerid; /*!< enable or disable shrinking of caller id */ static int global_callcounter; /*!< Enable call counters for all devices. This is currently enabled by setting the peer call-limit to INT_MAX. When we remove the call-limit from the code, we can make it with just a boolean flag in the device structure */ @@ -13484,7 +13485,7 @@ static void replace_cid(struct sip_pvt *p, const char *rpid_num, const char *cal char *tmp = ast_strdupa(rpid_num); /* XXX the copy can be done later */ if (!ast_strlen_zero(calleridname)) ast_string_field_set(p, cid_name, calleridname); - if (ast_is_shrinkable_phonenumber(tmp)) + if (global_shrinkcallerid && ast_is_shrinkable_phonenumber(tmp)) ast_shrink_phone_number(tmp); ast_string_field_set(p, cid_num, tmp); } @@ -13602,7 +13603,7 @@ static enum check_auth_result check_peer_ok(struct sip_pvt *p, char *of, } if (!ast_strlen_zero(peer->cid_num)) { char *tmp = ast_strdupa(peer->cid_num); - if (ast_is_shrinkable_phonenumber(tmp)) + if (global_shrinkcallerid && ast_is_shrinkable_phonenumber(tmp)) ast_shrink_phone_number(tmp); ast_string_field_set(p, cid_num, tmp); } @@ -13718,7 +13719,7 @@ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_requ */ tmp = strsep(&tmp, ";"); - if (ast_is_shrinkable_phonenumber(tmp)) + if (global_shrinkcallerid && ast_is_shrinkable_phonenumber(tmp)) ast_shrink_phone_number(tmp); ast_string_field_set(p, cid_num, tmp); } @@ -23919,6 +23920,7 @@ static int reload_config(enum channelreloadreason reason) global_t1min = DEFAULT_T1MIN; global_qualifyfreq = DEFAULT_QUALIFYFREQ; global_t38_maxdatagram = -1; + global_shrinkcallerid = 1; sip_cfg.matchexterniplocally = DEFAULT_MATCHEXTERNIPLOCALLY; @@ -24369,6 +24371,14 @@ static int reload_config(enum channelreloadreason reason) ast_log(LOG_WARNING, "Invalid pokepeers '%s' at line %d of %s\n", v->value, v->lineno, config); global_qualify_peers = DEFAULT_QUALIFY_PEERS; } + } else if (!strcasecmp(v->name, "shrinkcallerid")) { + if (ast_true(v->value)) { + global_shrinkcallerid = 1; + } else if (ast_false(v->value)) { + global_shrinkcallerid = 0; + } else { + ast_log(LOG_WARNING, "shrinkcallerid value %s is not valid at line %d.\n", v->value, v->lineno); + } } } -- cgit v1.2.3