Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 75840) +++ channels/chan_sip.c (working copy) @@ -9335,6 +9335,16 @@ res = AUTH_FAKE_AUTH; /* reject with fake authorization request */ else res = AUTH_SECRET_FAILED; /* we don't want any guests, authentication will fail */ + } else { + /* replace callerid if rpid found, and not restricted */ + if (!ast_strlen_zero(rpid_num) && ast_test_flag(&p->flags[0], SIP_TRUSTRPID)) { + char *tmp = ast_strdupa(rpid_num); + if (*calleridname) + ast_string_field_set(p, cid_name, calleridname); + if (ast_is_shrinkable_phonenumber(tmp)) + ast_shrink_phone_number(tmp); + ast_string_field_set(p, cid_num, tmp); + } } }