[OpenSIPS-Users] Virtual Service Activation Codes

Bogdan-Andrei Iancu bogdan at voice-system.ro
Wed Dec 9 14:25:10 CET 2009


Hi Indiver,

in a similar manner, when a user receives a call (somewhere before doing 
lookup(location) for the user ), you need to check a group to see if the 
user has (or not) the DND activated. If it is on, you can to redirect to 
VM or return busy indication.

Regards,
BOgdan

Indiver wrote:
> Hi Bodgan,
>  Thanks for your reply. I had no idea about ACLs , i saw a document that
> ACLS are nothing but group checking but i'm not clear abt that.so i modified
> and tried the code and it's working for DND.
> The procedure i followed is
> when i called to internal number the call goes to route[10] as follows:
> In opensips.cfg:
> if (is_uri_host_local()) {
>             # -- Inbound to Inbound
>             route(10);
>
> route[10] {
> if (!does_uri_exist()) {
>     if (uri=~"^sip:[2-9][0-9]{9}@") {
>         if (is_user_in("credentials","local")) {
>             route(6);
>             route(4);
>             exit;
>         } else {
>             sl_send_reply("403", "No permissions for local calls");
>             exit;
>         };
>     };
>
>     if (uri=~"^sip:1[2-9][0-9]{9}@") {
>         if (is_user_in("credentials","ld")) {
>             route(6);
>             route(4);
>             exit;
>         } else {
>             sl_send_reply("403", "No permissions for long distance");
>             exit;
>         };
>     };
>
>     if (uri=~"^sip:011[0-9]*@") {
>         if (is_user_in("credentials","int")) {
>             route(6);
>             route(4);
>             exit;
>         } else {
>             sl_send_reply("403", "No permissions for international calls");
>         };
>     };
>   };   
>   if (uri=~"^\*[1-9]+") {
> 		# we do provide access to media services only to our
> 		# subscribers, who were previously authenticated
>                 xlog("****Starting of $ru***\n"); 
> 		if (!is_from_local()) {
> 			send_reply("403","Forbidden access to media service");
> 			exit;
> 		}
> 		#identify the services and translate to Asterisk extensions
> 		if ($rU=="*78") {
> 			#ENABLE DND
> 			seturi("sip:AN_fwdok at Asterisk IP:5060");
>                       
> 		}
>
> else
> if ($rU=="*79") {
> 			# DISABLE DND
> 			seturi("sip:AN_fwdko at Asterisk IP:5060");
> 		} 
>
> t_relay();
> exit;
> }      
>     if (!lookup("location")) {
>         if (does_uri_exist()) {
>             ## User not registered at this time.
>             revert_uri();
>             prefix("u");
>             rewritehostport("localhost"); #Use the IP address of your
> voicemail server
>             route(6);
>             route(1);
>         } else {
>             sl_send_reply("404", "Not Found-10-1");
>          exit;
>         }      
>         sl_send_reply("404", "Not Found-10-2");
>         exit;
>     };
>     route(6); 
>     route(1);
> }
> Asterisk Server:
>
> In the Asterisk(extensions.conf) i wrote a dialplan for DND:
> extensions.conf:
> exten => AN_fwdok,1,Answer
> exten => AN_fwdok,2,Set(DB(SIP/DND/${CALLERID(num)})=1)
> exten => AN_fwdok,3,Playback(beep)
> exten => AN_fwdok,4,Wait(2)
> exten => AN_fwdok,5,Hangup
>
> exten => AN_fwdko,1,Answer
> exten => AN_fwdko,2,NoOp(${DB_DELETE(SIP/DND/${CALLERID(num)})})
> exten => AN_fwdko,3,Playback(beep)
> exten => AN_fwdko,4,Wait(2)
> exten => AN_fwdko,5,Hangup.
>
> The above code i posted is working for me
> Is the above procedure i followed for activation of DND in opensips is
> correct? Thanks in Advance!
>
>
> Bogdan-Andrei Iancu wrote:
>   
>> Hi Indiver,
>>
>> your code is not implementing DND, but simply redirects *78 to a voice 
>> announcement.  What you have to do is to actually implement the DND 
>> service first (maybe using an ACL -> if a user receives a call and the 
>> user had the DND ACL on, reject the call) and then to control it 
>> (enable/disable) via the *78 code.
>>
>> Regards,
>> Bogdan
>>
>> Indiver wrote:
>>     
>>> Hi Bodgan,
>>>
>>> For Virtual service activation codes, as per my observation when ever
>>> user
>>> dials *78 u just redirecting to asterisk as follows:
>>> if ($rU=~"^\*[1-9]+") {
>>> 		# we do provide access to media services only to our
>>> 		# subscribers, who were previously authenticated 
>>> 		if (!is_from_local()) {
>>> 			send_reply("403","Forbidden access to media service");
>>> 			exit;
>>> 		}
>>> 		#identify the services and translate to Asterisk extensions
>>> 		if ($rU=="*78") {
>>> 			# access to own voicemail IVR
>>> 			seturi("sip:AN_fwdok at ASTERISK_IP:ASTERISK_PORT");
>>>                          t_relay();
>>> 		        exit;
>>>             and when the user dialing *79 it was just rewriting the uri
>>> as
>>> follows
>>>                         
>>>            seturi("sip:AN_fwdko at ASTERISK_IP:ASTERISK_PORT");
>>>            t_relay();
>>>            exit;
>>>
>>> Is my assumption is right?Thanks in advance
>>>
>>>
>>>
>>>
>>> Bogdan-Andrei Iancu wrote:
>>>       
>>>   
>>>       
>>>> Hi Indiver,
>>>>
>>>> the Activation Codes service is pure scripting - it is not a module in 
>>>> opensips. Most of the VoIP features you can do with OpenSIPS are not 
>>>> necessarily provided by module (directly by C code), but rather via 
>>>> scripting logic (combination of different ops in the opensips script).
>>>>
>>>> Regards,
>>>> Bogdan
>>>>
>>>> Indiver wrote:
>>>>     
>>>>         
>>>>> Hi Every One,
>>>>>
>>>>> I registered in opensips voip services site. I found a tab regarding
>>>>> dialing
>>>>> plan. such as *78 for enable dnd,*72 for setting to permanent
>>>>> redirect,*50
>>>>> for voicemail inbox. I found no documentation in opensips regarding
>>>>> these
>>>>> services. Is there a way for acheiving this thru opensips. Thanks in
>>>>> advance.
>>>>>   
>>>>>       
>>>>>           
>>>> -- 
>>>> Bogdan-Andrei Iancu
>>>> www.voice-system.ro
>>>>
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.opensips.org
>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>
>>>>
>>>>     
>>>>         
>>>   
>>>       
>> -- 
>> Bogdan-Andrei Iancu
>> www.voice-system.ro
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>     
>
>   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro




More information about the Users mailing list