*** 344,349 **** --- 344,350 ---- int network_port; int cd = 0; const char *call_id = NULL; + char *force_user; /* all callers must confirm that sip, sip->sip_request and sip->sip_contact are not NULL */ switch_assert(sip != NULL && sip->sip_contact != NULL && sip->sip_request != NULL); *************** *** 419,424 **** --- 420,433 ---- char *exp_var; register_gateway = switch_event_get_header(*v_event, "sip-register-gateway"); + + /* Allow us to force the SIP user to be something specific - needed if + * we - for example - want to be able to ensure that the username a UA can + * be contacted at is the same one that they used for authentication. + */ + if ((force_user = switch_event_get_header(*v_event, "sip-force-user"))) { + to_user = force_user; + } if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact"))) { if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-connectile-dysfunction")) {