Hello Benny,
Maybe you could use the following solution (assuming that the regional
prefixes are the first 3 digits of the national number): Define for each
phone a full national CallerID number and use the same context:
[from-sip]
exten => _Z.,1,Goto(outgoing,${CALLERIDNUM:0:3}$EXTEN,1)
exten => _0.,1,Goto(outgoing,${EXTEN},1)
Best regards,
## nini @ www.modulo.ro ##
Benny Amorsen wrote:> I have a challenge that is ending up quite interesting. I need to
> identify which SIP phone "touched a call last", that is, which
phone did
> the last transfer or dialed the original call if no transfers were
> done.
>
> It is easy in the case of a regular, non-transfered call. Just put
> something in callerid= in sip.conf, and that will show up in
> ${CALLERID}. The same with an attended transfer, since that is just
> another outgoing call which gets bridged later.
>
> Unattended transfers are not so difficult (at least not if the
> asterisk version is reasonably new), because ${BLINDTRANSFER} is set,
> and I can get the phone name from that.
>
> It is much more difficult if call forwarding is set on the phone. Then
> it just replies to requests with 302 Moved Temporarily. In that case
> ${BLINDTRANSFER} is not set. ${RDNIS} is set, but it is not always
> easy or even possible to turn the dialed number into a phone ID.
>
> Is there a variable I can check to see which phone did the redirect?
>
>
> If you are asking yourself why I care, here is the (long) background
> story:
>
> In Sweden, there are local calls, national calls, and international
> calls. National calls are prefixed with 0, international ones with 00.
> Those are easy to handle.
>
> Local calls start by [1-9], and I need to massage them into national
> calls. There are several locations connected by IP, and they each
> need to be able to dial local numbers, but the calls all exit at the
> same location and the users would get all confused if their local
> calls from Malm? end up connecting to a phone in Stockholm.
>
> It's not so difficult in that specific case. Add context=frommalmoe to
> sip.conf, and do something like this:
>
> [frommalmoe]
> exten => _Z.,1,Goto(outgoing,032${EXTEN},1)
> exten => _0.,1,Goto(outgoing,${EXTEN},1)
>
> (I have no idea what the real prefix for Malm? is, this is just an
> example).
>
> When you have phones all over the country it gets complicated though.
> You need a context for each area code, and that gets unwieldy. It is
> much easier to have a database of phones and their locations -- but
> that does not work if someone sets their phone to forward calls to a
> local number. I have no way to find out which area that number belongs
> to. If I knew which phone did the transfer, I would know which area to
> use.
>
>
> /Benny
>
> (I'm sure someone will now give me the solution in just one line)
>
>
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>