12 aug 2009 kl. 12.45 skrev Alex Balashov:
Iñaki Baz Castillo wrote:
El Miércoles, 12 de Agosto de 2009, Olle E.
Johansson escribió:
Anyway, there's some work in the IETF to
handle the register for
multiple DID's, since the way it's used now clearly violates
what's in
the RFCs and there is an obvious need to register for "SIP trunks".
I
implemented this in an "ellegant" way:
- The SIP trunk (Asterisk?) registers with Contact "s@IP" (or any
contact).
- It has associated 3 PSTN numbers in the proxy/registrar.
- When the proxy receives a call for one of these 3 numbers it
changes the RURI according to the location of the client
(lookup("location")) and adds a header whose value is the dialed
PSTN number in E164 format:
P-Dialed-Number: +34987654321
So:
- "To" remains unchanged.
- RURI arriving to the client matches its registration's Contact.
- The client must inspect a custom header to know the real
destination number of the call.
That is quite elegant, and easy to get around in the Asterisk dial
plan so that routing can still happen on "extension," where
"extension" is the dialed number:
[generic-incoming]
exten => _.,1,Set(dialed=${SIP_HEADER(P-Dialed-Number)})
exten => _.,n,Goto(incoming-route,${dialed},1)
But in other endpoints it would be quite hard or impossible.