[asterisk-users] Ring locally when home or roadwarrior via IAX
when away
Anselm Martin Hoffmeister
anselm at hoffmeister-online.de
Mon Nov 6 06:29:56 MST 2006
Am Montag, den 06.11.2006, 11:04 +0000 schrieb Arik Raffael Funke:
> Hi,
>
> want to have calls directed to internal fixed phones, when my employees
> are home and automatically to their IAX connection when they are logged
> in remotely. How do I do this?
>
> The picture is as follows:
>
> --- HOME ---
> - user logged in via IAX with local IP adress
> - fixed line should ring
> - IAX should not ring
>
> --- ON THE ROAD ---
> - user logged in via IAX with an EXTERNAL IP
> - fixed line should not ring
> - but IAX should be called.
>
> I guess, in short my question reduces to: How do I find the IP adress of
> a specific iax client?
I do not currently run IAX, but SIP clients only. Nevertheless, once
connected, a database entry "appears" containing login info. It seems to
disappear once the client de-registers, so assuming that IAX does the
same, this could do the trick.
For SIP, the database entry would be "SIP/Registry/sip507" for my Laptop
which has username sip507 in sip.conf section sip507 (I do not know
which of those two selects the name in the database).
The value in the database looks like
80.136.xxx.xxx:5060:1800:sip507:sip:sip507 at 80.136.xxx.xxx;uniq=49XXXXXXXXXXXXXXXXXXXXXXXXXXXX
(with the IP address leading)
With a set of statements like
exten => _5XX,1,Set(IPADDR=${CUT(${DB(SIP/sip${EXTEN})},:,1)})
exten => _5XX,2,GotoIf($["10.0." = "${IPADDR:0:5}"]?100)
exten => _5XX,3,GotoIf($["" = "${IPADDR}"]?100)
exten => _5XX,4,NoOp(Stuff for calling the client via SIP)
exten => _5XX,100,NoOp(Stuff for calling via the phoneline, cause user
is local)
Note that line _5XX,3 is necessary to capture the case of "client not
logged in via SIP at all" - you might as well activate VoiceMail here or
whatever. In my opinion calling the client via SIP right then is not a
good idea :-), hence the GotoIf for calling via the phoneline.
I would try to achieve this with my SIPclient this way, you will have to
find out wether IAX works similarly.
This is untested though, but I hope to give you a useful hint here.
BR,
Anselm
More information about the asterisk-users
mailing list