I dont know about IAX, but for SIP users you can use the function SIP_HEADER(headername) to get the information u need from the sip packets. for example you can use SIP_HEADER(From) which will give you the From header containing the IP address of the caller. You will have to apply regex on it to extract the ip. <br>
<br>
<div class="gmail_quote">On Thu, Mar 13, 2008 at 8:47 AM, Gonzalo Servat <<a href="mailto:gservat@gmail.com">gservat@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi All,<br><br>I'm trying to achieve the following:<br><br>- If <sip/iax user> logs in from home, they can dial internal extensions only (this is to avoid employees going wild on local/mobile calls from home)<br>
- If <sip/iax user> logs in from the office, they can call anyone they want.<br><br>Since I have my users defined in an LDAP tree, I'd like to stick to one-account-per-user (each account is setup for both - IAX and SIP logins - to allow the employee to use IAX from home and SIP at work, or whatever combination they prefer).<br>
<br>So, I thought I would simply look at the IP address of the originating call. If the SIP/IAX user has an IP address outside the local subnet -> allow calls to extensions only. Else -> allow all. I thought the best way of doing this would be using AGI with a Perl script. The only problem I'm having is determining the IP address of the originating call. I can't find any channel variable that gives me this info.<br>
<br>The reason why I mentioned that I'd like to stick to one-account-per-user is that I know I could fix this simply by having 2 accounts per user (one that allows connections from the local subnet, and the other to login from outside and use different contexts for each), but it'd be much nicer to avoid having 2 accounts per user.<br>
<br>If anyone has any suggestions on how to achieve the above, I'd love to read them!<br><br>Thanks in advance.<br><font color="#888888">Gonzalo<br></font><br>_______________________________________________<br>-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com/" target="_blank">http://www.api-digital.com</a> --<br>
<br>asterisk-users mailing list<br>To UNSUBSCRIBE or update options visit:<br> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Best Regards<br>Rizwan Hisham<br>