[asterisk-users] unconditionally redirecting incoming calls by 302 Moved Temporarily messages doing right accounting

Ricardo Carvalho rjcarvalho at reit.up.pt
Fri Mar 30 10:11:06 MST 2007


Dear all,

In my Asterisk 1.2.17 architecture different levels of permissions are 
established using different contexts that hierarchically include more 
permissive contexts until default context is reached.
In default context there are only local extensions, only in more 
restricted contexts there are the PSTN access.
So, if some user dials some number, Asterisk looks which context that 
user belongs to in sip.conf and sends that call to that context in 
extensions.conf. Call flow goes successively including other contexts 
along the hierarchy until some established filter matches, and than that 
call is routed to the destination. If no match is found after call flow 
has descend until the default context, Asterisk hungs up the call.

Problem arises when
The problem is that the phones I've deployed in my site have the 
optional feature of unconditionally redirecting incoming calls to other 
phone number by sending a "302 Moved Temporarily" SIP message back to 
Asterisk, carrying the new contact that should be dialled by the server. 
When this happens, Asterisk seems to send this 302 message to the 
default context.
If the new contact is some internal extension, it matches some rule in 
the default context, and Asterisk dials that extension with no problem.
If the new contact is some PSTN number, Asterisk can't find a successful 
matching rule in default context because only upper hierarchy contexts 
match PSTN numbers, and call is hung up.

To solve this, I can include PSTN numbers matching rules in default 
context (or include upper hierarchy permission contexts in default), but 
than, every one without PSTN dial permissions would be able to dial PSTN 
numbers!!
Is there any way that I can make that 302 message be dropped in the 
context to which the user that redirected the call belongs to, and not 
the default context, because, this is the one that should be charged for 
the forwarded accounting? And like this, the redirected call would only 
take place if the user that redirected the call has PSTN permissions to 
do that!

Thanks in advance,
Ricardo.





More information about the asterisk-users mailing list