How to send destination nr (DID) in INVITE / Dialplan?


I set up an asterisk 13 instance to route internal calls via PJSIP.
Clients are various telephone systems which authenticate with alphanumerical usernames (like sip981232).
This works well for connections with a single number. As soon as I need DID to be taken into account for routing the call, I am lacking the required information (only username is shown in Request-URI and To).

How can I set (replace) the destination number in TO-Header?
The username is not needed at the other side and most systems use the To-Header to match DIDs.

I did not find a way to modify this header when using PJSIP.
My last try was “Set(PJSIP_HEADER(update,To)=0123456789@” which did not change the header.

The destination number for routing should be in the request URI, not the To header!

For chan_sip I believe you use ! at the end of the dialstring, before the user part of the To header. I don’t know if PJSIP supports this.

1 Like

Found the solution: Dial(PJSIP/12345678@${DESTTRUNK})
This works like expected.

Thanks for your response. You are right and my current solution should be better supported.