Hi,
I’m in the process of migrating our Asterisk configuration from chan_sip
to PJSIP, and have run into a problem with the way we do dial strings.
For some background, we’re using a very simple “bare bones” Asterisk configuration with chan_sip
configured with insecure=invite
, and a dialplan which just throws new channels into stasis
. We have SIP proxies and registrars which manage registration and authentication where needed, and we orchestrate and manage our calls via ARI. Asterisk is not using any real-time configuration or pre-configured users.
We have multiple SIP proxies in front of the Asterisk services, and we dial in and out via these proxies. Our software which is orchestrating calls via ARI is also aware of all the proxies involved, and the various routes to/from our Asterisks and the outside world.
Now the problem. Using chan_sip
, we could build dial strings which looked something like this:
SIP/target-host/target-user/outbound-proxy
This does the following for us:
- Creates an INVITE with a URI which looks like
sip:target-user@target-host
- Sends the INVITE via
outbound-proxy
This all works marvelously. We also have variations which append custom Route:
headers for more complicated routing scenarios, using magical __SIPADDHEADER5n
variables along with the ARI channel creation request (not even sure how this is going to interact with PJSIP, yet, one thing at a time).
I currently have an anonymous
endpoint defined as follows in pjsip.conf
:
[anonymous]
type=endpoint
transport=transport-udp
context=my-stasis-context
allow=all
This works for accepting inbound calls, and making outbound calls using an endpoint/dialstring of pjsip/anonymous/sip:target-user@target-host
.
So my question is, how may I (or can I even) achieve the equivalent of our current chan_sip
style dial strings, which allow software to determine the outbound_proxy
dynamically at runtime, without the need for database reliance and the like?