diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index c00c439600..074e233aee 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1202,10 +1202,15 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) if (!zstr(invite_domain)) { sipip = invite_domain; } - - format = strchr(sipip, ':') ? "\"%s\" " : "\"%s\" "; - - tech_pvt->from_str = switch_core_session_sprintf(tech_pvt->session, format, cid_name, use_cid_num, !zstr(cid_num) ? "@" : "", sipip); + + if (zstr(tech_pvt->caller_profile->aniii)){ + format = strchr(sipip, ':') ? "\"%s\" " : "\"%s\" "; + tech_pvt->from_str = switch_core_session_sprintf(tech_pvt->session, format, cid_name, use_cid_num, !zstr(cid_num) ? "@" : "", sipip); + } else { + format = strchr(sipip, ':') ? "\"%s\" " : "\"%s\" "; + tech_pvt->from_str = switch_core_session_sprintf(tech_pvt->session, format, cid_name, use_cid_num, !zstr(cid_num) ? "@" : "", + sipip, tech_pvt->caller_profile->aniii); + } } if (from_var) {