On Thursday 23 October 2014 19:16:58 Kenny Watson wrote:
What I need to figure out is how to on kamailo maybe using a dial prefix specify that the call is going to a remote extension on a "user" and rewrite the to header to be extension@useripaddress rather than user@useripaddress.
I think your "problem" can be summarized as:
initial trunk invite: INVITE sip:number@kamailio in kamailio $rU is number, but after a successful location lookup (lookup("location")/alias_db_lookup) $rU is the username from subscribers or dbaliases. Without further processing the invite to asterisk would look like: INVITE sip:username@asterisk
The solution I use is simple: -before lookup I store the initial $rU in an avp(callednumber). -lookup -check in usr_preferences wether the endpoint wants DID or should be addressed with its username (true/false) -if true: $rU=$avp(callednumber) -t_relay()