]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Override the callerid in all cases when the callerid is set in the user, not
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 14 Jul 2008 23:59:13 +0000 (23:59 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 14 Jul 2008 23:59:13 +0000 (23:59 +0000)
just when a remote callerid is set.  Also, if not set in the user, allow the
remote CallerID to pass through.
(closes issue #12875)
 Reported by: dimas
 Patches:
       20080714__bug12875.diff.txt uploaded by Corydon76 (license 14)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@130889 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index c97b52189b5d724aa42ea47595a186c4fc094680..db0a72ed82f9883a6cbed05e6d31f12903599e32 100644 (file)
@@ -5283,20 +5283,17 @@ static int check_access(int callno, struct sockaddr_in *sin, struct iax_ies *ies
                /* And the permitted authentication methods */
                iaxs[callno]->authmethods = user->authmethods;
                iaxs[callno]->adsi = user->adsi;
-               /* If they have callerid, override the given caller id.  Always store the ANI */
-               if (!ast_strlen_zero(iaxs[callno]->cid_num) || !ast_strlen_zero(iaxs[callno]->cid_name)) {
-                       if (ast_test_flag(user, IAX_HASCALLERID)) {
-                               iaxs[callno]->calling_tns = 0;
-                               iaxs[callno]->calling_ton = 0;
-                               ast_string_field_set(iaxs[callno], cid_num, user->cid_num);
-                               ast_string_field_set(iaxs[callno], cid_name, user->cid_name);
-                               iaxs[callno]->calling_pres = AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN;
-                       }
-                       if (ast_strlen_zero(iaxs[callno]->ani))
-                               ast_string_field_set(iaxs[callno], ani, user->cid_num);
-               } else {
+               /* If the user has callerid, override the remote caller id. */
+               if (ast_test_flag(user, IAX_HASCALLERID)) {
+                       iaxs[callno]->calling_tns = 0;
+                       iaxs[callno]->calling_ton = 0;
+                       ast_string_field_set(iaxs[callno], cid_num, user->cid_num);
+                       ast_string_field_set(iaxs[callno], cid_name, user->cid_name);
+                       ast_string_field_set(iaxs[callno], ani, user->cid_num);
+                       iaxs[callno]->calling_pres = AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN;
+               } else if (ast_strlen_zero(iaxs[callno]->cid_num) && ast_strlen_zero(iaxs[callno]->cid_name)) {
                        iaxs[callno]->calling_pres = AST_PRES_NUMBER_NOT_AVAILABLE;
-               }
+               } /* else user is allowed to set their own CID settings */
                if (!ast_strlen_zero(user->accountcode))
                        ast_string_field_set(iaxs[callno], accountcode, user->accountcode);
                if (!ast_strlen_zero(user->mohinterpret))