[OpenSIPS-Users] Help with Inbound PSTN, and Inbound SIP URI Authentication Sub-Routine

Brett Woollum brett at woollum.com
Tue Sep 14 09:18:52 CEST 2010


Hello! 

I have an OpenSIPS 1.6.3 installation that is working well. I have subscribers registering to OpenSIPS, and they can dial between each other and outside of my domain (to my media servers and to the PSTN). All is well. 

I am now beginning to write the configuration that will process inbound calls - meaning calls from non-subscribers. This will include calls from the PSTN gateway, as well as direct SIP URI calls to the OpenSIPS subscribers. For example, a person can call 515-555-1212 from a regular phone, and the call will come to OpenSIPS as an un-authenticated call from my PSTN gateway. Also, I'd like to accept SIP URI's for incoming calls. For example, calling mycompany at mysipdomain.com from a soft phone might route the call to subscriber A's phone. 

The code I have that applies to this is: (This is currently configured to authenticate all outbound calls from subscribers only.) 
# authenticate if from local subscriber 
if (!(method=="REGISTER")) { 
if (!proxy_authorize("", "subscriber")) { 
proxy_challenge("", "0"); 
exit; 
} 
if (!db_check_from()) { 
send_reply("403","Forbidden auth ID"); 
exit; 
} 

consume_credentials(); 
# caller authenticated 
} 

I am looking for direction on how to expand this to determine if the call is A) from a subscriber calling outbound, B) inbound from the PSTN, or C) inbound from any other user calling my SIP URI's. Once I am able to determine this information, I'll be able to route the call appropriately within the rest of my scripts. 

My problem is that my SIP phones usually attempt to place calls without including authorization in the header (because they are registered already), then OpenSIPS replies requiring proxy authentication. The SIP phones will then try the call again including the credentials in the header, which works. How can I re-write this section of code to allow inbound SIP URI calls and calls from my PSTN gateway, while still asking my subscribers to authenticate? Or, is there a method that might work better? 

Notes: 
- Each of my PSTN gateway's has a static IP. 
- It's safe to assume a single-domain setup (mysipdomain.com). 

Thanks in advance! 


Brett Woollum 
Brett at Woollum.com 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20100914/528108ff/attachment-0001.htm 


More information about the Users mailing list