<div>Nice.</div>
<div> </div>
<div>Thanks for the help<br><br></div>
<div class="gmail_quote">On Wed, Aug 26, 2009 at 10:55 AM, Bogdan-Andrei Iancu (via Nabble) <span dir="ltr"><<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3517646&i=0" target="_top" rel="nofollow">[hidden email]</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Hi Duane, <br><br>You can replace the complicated: <br><br> subst_uri('/^sip:([0-9]+)@(.*)$/sip:$avp(s:areacode)\1@\2/i'); <br>
<br>with more nicer: <br><br> $rU = $avp(s:areacode) + $rU; <br><br>Regards, <br>Bogdan <br><br><br>osiris123d wrote:
<div><br>> Got it working! Man OpenSIPS sure can do anything with SIP <br>> <br>> So here is what I did for future searchers <br>> <br>> So the users account is a 7 digit DID number XXXXXXX at <a href="http://blah.com/" target="_blank" rel="nofollow">blah.com</a> <br>
> <br>> I set up an AVP called areacode for the whole domain <a href="http://blah.com/" target="_blank" rel="nofollow">blah.com</a> (this assumes <br>> that the whole domain <a href="http://blah.com/" target="_blank" rel="nofollow">blah.com</a> is only in one areacode) <br>
> <br>> opensipsctl avp add -T usr_preferences 0 at <a href="http://blah.com/" target="_blank" rel="nofollow">blah.com</a> areacode 1 201 <br>> opensipsctl avp add -T usr_preferences 0 at <a href="http://foo.com/" target="_blank" rel="nofollow">foo.com</a> areacode 1 339 <br>
> <br>> <br>> In the opensips.cfg file I do the following (it depends on your config as to <br>> where you want to put this) <br>> if (uri=~"^sip:[2-9][0-9]{6}@") { <br>> avp_db_load("$ru/domain","$avp(s:areacode)"); <br>
> subst_uri('/^sip:([0-9]+)@(.*)$/sip:$avp(s:areacode)\1@\2/i'); <br>> }; <br>> <br>> So when someone calls a 7 digit number the avp_db_load() loads the variable <br>> for areacode and the subst_uri adds the areacode at the beginning of the <br>
> Request-URI. <div class='shrinkable-quote'><br>> <br>> <br>> <br>> <br>> <br>> <br>> Bogdan-Andrei Iancu wrote: <br>> <br>>> Hi Duane, <br>>> <br>>> You can correlate AVPs you a USER, a DOAMAIN, etc - it is up to you, </div>
>> from the script, when loading the AVP - is a pure logical mapping. <br>>> <br>>> Regards, <br>>> Bogdan <br>>> <br>>> osiris123d wrote: <br>>> <br>>>> I was reading Flavio's "Building Telephony Systems with OpenSER" chapter <br>
>>> about AVPOPs and he mentions that AVP's can be used for a whole domain. <br>>>> I <br>>>> was thinking that I might be able to configure a area code for Company <br>>>> A's <br>
>>> domain and then route calls that way. If not that then I can set the AVP <br>>>> on <br>>>> the fly within the transaction by looking at the callers Request URI's <br>>>> first <br>
>>> 3 digits and route it appropriately. <br>>>> <br>>>> <br>>>> Bogdan-Andrei Iancu wrote: <br>>>> <br>>>> <br>>>>> Hi, <br>>>>> <br>>>>> Requirements on the format of CONTACT and TO headers are nonsense as <br>
>>>> they are not used for routing at all. Only FROM (which provides info on <br>>>>> the caller) and RURI (request URI) (which provide info on callee). <br>>>>> <br>>>>> So, bottom line, only the normalization of the RURI should be required <br>
>>>> on the system. <br>>>>> <br>>>>> Regards, <br>>>>> Bogdan <br>>>>> <br>>>>> osiris123d wrote: <br>>>>> <br>>>>> <br>
>>>>> Thanks for the info. <br>>>>>> <br>>>>>> I will look into this and work up a config. <br>>>>>> <br>>>>>> I also got this direct email about my post from someone else who lives <br>
>>>>> in <br>>>>>> the US. I figured I would go ahead and post below what he sent just so <br>>>>>> its <br>>>>>> out there. <br>>>>>> <br>>>>>> <br>
>>>>> Hello Duane -- <br>>>>>> <br>>>>>> You have hit on one of the more difficult areas in SIP and telephony in <br>>>>>> general -- especially here in the North American Numbering Plan. Below <br>
>>>>> I <br>>>>>> will address the problem in general, and not particularly related to <br>>>>>> the <br>>>>>> OpenSIPs question, because IMO you need a solution that will work in <br>
>>>>> any <br>>>>>> architecture, not just OpenSIPs. <br>>>>>> <br>>>>>> In a nutshell, I recommend that for your USA users you: <br>>>>>> <br>>>>>> 1.) Require From: and Contact: headers to be in NANPA National (10 <br>
>>>>> digit) <br>>>>>> format. This is method is standard in the telephone industry, and will <br>>>>>> allow easy integration with North American ANI or Caller ID format, <br>
>>>>> especially when a call may eventually be handed off to the PSTN. <br>>>>>> <br>>>>>> 2.) Require incoming To: headers to be in e.164 International format, <br>>>>>> i.e. <br>
>>>>> NANPA-destination numbers all begin with the 1 digit, followed by the <br>>>>>> 10 <br>>>>>> digit National number. Any incoming call to 612xxxxxxx goes to <br>>>>>> Sydney, <br>
>>>>> Austrailia, and not Minneapolis, MN. This requirement should be <br>>>>>> enforced <br>>>>>> at <br>>>>>> the perimeter of your network, where Customer Equipment can enforce the <br>
>>>>> "local" digit normalization policy. <br>>>>>> <br>>>>>> 3.) If you can't enforce #2 above, you will need to "Normalize" <br>>>>>> incoming <br>
>>>>> calls to the e.164 International format prior to routing. The <br>>>>>> unfortunate <br>>>>>> reality here in the USA is that the requirements for how many digits to <br>
>>>>> dial <br>>>>>> for a given destination (the "dialing plan") depends on where the call <br>>>>>> comes <br>>>>>> from. Here in the Chicago area, residents of the 847 area code must <br>
>>>>> today <br>>>>>> dial all calls as 11 digits. Calls within the 312 or 773 area code may <br>>>>>> today be dialed as 7 digits, however beginning on 07 November, all <br>>>>>> calls <br>
>>>>> originating in 312 and 773 must be dialed as 1+10 digits, due to the <br>>>>>> new <br>>>>>> 872 <br>>>>>> overlay area code. For more information, see <br>
>>>>> <a href="http://www.nanpa.com/reports/NPA_Dialing_Plans_05_09.pdf" rel="nofollow" target="_blank">http://www.nanpa.com/reports/NPA_Dialing_Plans_05_09.pdf</a><br>>>>>> <br>>>>>> 4.) Finally, if you have any termination carriers who need special <br>
>>>>> "prefixes," append them after you have made your route selection. <br>>>>>> <br>>>>>> If you would like further information or discussion, please feel free <br>
>>>>> to <br>>>>>> contact me. <br>>>>>> <br>>>>>> John S. RobiXXXX <br>>>>>> <br>>>>>> <a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3516196&i=0" rel="nofollow" target="_blank">[hidden email]</a> <br>
>>>>> <br>>>>>> <br>>>>>> <br>>>>>> Bogdan-Andrei Iancu wrote: <br>>>>>> <br>>>>>> <br>>>>>> <br>>>>>>> Hi there, <br>
>>>>>> <br>>>>>>> When you have to deal with local dialling you need consider the amount <br>>>>>>> of information yon need to keep in order to translate to national <br>
>>>>>> format <br>>>>>>> and the complexity of the processing you have to do. <br>>>>>>> <br>>>>>>> A compromise solution will be to keep in user profile some information <br>
>>>>>> about the location (like for US, the 2 digits Id of the state) - this <br>>>>>>> will reduce the amount of data you need to keep per user. Also, this <br>>>>>>> info can be loaded at auth time, using "load_credentials" parameter <br>
>>>>>> (just an example). <br>>>>>>> <br>>>>>>> Now, using the location information, you can use dialplan to do the <br>>>>>>> actual transformation. Like, if location is NJ (use a separate plan): <br>
>>>>>> if 7 digits -> put 011-201 prefix <br>>>>>>> if 10 digits -> put 011 prefix <br>>>>>>> <br>>>>>>> And so on... <br>>>>>>> <br>
>>>>>> This works pretty fine and scale (not for local dialling but for <br>>>>>>> national dialling in international platforms). <br>>>>>>> <br>>>>>>> Regards, <br>
>>>>>> Bogdan <br>>>>>>> <br>>>>>>> osiris123d wrote: <br>>>>>>> <br>>>>>>> <br>>>>>>> <br>
>>>>>>> I was curious to see how people configure OpenSIPS when their <br>>>>>>>> customers <br>>>>>>>> could <br>>>>>>>> potentially be in different area codes. I am located in the US. Say <br>
>>>>>>> I <br>>>>>>>> have <br>>>>>>>> customers that are in the following area codes <br>>>>>>>> <br>>>>>>>> 201-XXX-XXXX <- New Jersey <br>
>>>>>>> 339-XXX-XXXX <- Boston <br>>>>>>>> <br>>>>>>>> Initially when I was setting up users I configured the username to be <br>>>>>>>> just <br>
>>>>>>> like the persons email address (ex. <a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3516196&i=1" rel="nofollow" target="_blank">[hidden email]</a>), and configured <br>
>>>>>>> an <br>>>>>>>> alias that included the DID for that person (ex. <a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3516196&i=2" rel="nofollow" target="_blank">[hidden email]</a>). <br>
>>>>>>> <br>>>>>>>> So when bobsmith in New Jersey calls someone and just types 7 digits <br>>>>>>>> then <br>>>>>>>> obviously its local. How do people out there using OpenSIPS usually <br>
>>>>>>> determine if the call is local or not? I was thinking that I need to <br>>>>>>>> swap <br>>>>>>>> my username and alias around so that the username is the 10 digit DID <br>
>>>>>>> and <br>>>>>>>> then I can look at the first 3 digits to see what the area code is. <br>>>>>>>> My <br>>>>>>>> other idea was to set up Groups for each area code and add the users <br>
>>>>>>> to <br>>>>>>>> their Area Code group and determine it that way. <br>>>>>>>> <br>>>>>>>> Am I looking at this the right way or am I making this more <br>
>>>>>>> complicated? <br>>>>>>>> I <br>>>>>>>> would like to get my setup right the first time so that this config <br>>>>>>>> scales <br>
>>>>>>> well. <br>>>>>>>> <br>>>>>>>> Thanks for any input. <br>>>>>>>> <br>>>>>>>> <br>>>>>>>> <br>
>>>>>>> <br>>>>>>> _______________________________________________ <br>>>>>>> Users mailing list <br>>>>>>> <a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3516196&i=3" rel="nofollow" target="_blank">[hidden email]</a> <br>
>>>>>> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="nofollow" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>>>>>>> <br>>>>>>> <br>
>>>>>> <br>>>>>>> <br>>>>>>> <br>>>>>> <br>>>>>> <br>>>>>> <br>>>>> _______________________________________________ <br>
>>>> Users mailing list <br>>>>> <a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3516196&i=4" rel="nofollow" target="_blank">[hidden email]</a> <br>>>>> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="nofollow" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
>>>> <br>>>>> <br>>>>> <br>>>>> <br>>>> <br>>>> <br>>> _______________________________________________ <br>>> Users mailing list <br>
>> <a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3516196&i=5" rel="nofollow" target="_blank">[hidden email]</a> <br>>> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="nofollow" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
>> <br>>> <br>>> <br>> <br>> </div><br><br>_______________________________________________ <br>Users mailing list <br><a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3516196&i=6" rel="nofollow" target="_blank">[hidden email]</a> <br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="nofollow" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br></blockquote></div><br><br clear="all">
<div></div><br>-- <br>--<br>*--*--*--*--*--*<br>Duane<br>*--*--*--*--*--*<br>--<br>
<br><hr align="left" width="300">
View this message in context: <a href="http://n2.nabble.com/Multiple-Area-Codes-in-Customer-Area-tp3419932p3517646.html">Re: [OpenSIPS-Users] Multiple Area Codes in Customer Area</a><br>
Sent from the <a href="http://n2.nabble.com/OpenSIPS-Users-f1449235.html">OpenSIPS - Users mailing list archive</a> at Nabble.com.<br>