[Serusers] call forwarding and *21

Kyriakos Mavromichalis kyriakos at otenettel.com
Fri Nov 18 16:33:54 CET 2005


I have done it with avpops.
User inputs *21*1*number  for forwarding to.
First 6 digits get stripped and the rest gets stored in user_preferences.
*21*2 is for dectivation and what it does is that deletes the row from 
user_preferences of the user sending the deactivation request.

		if(uri =~ "^sip:\*21\*1\*")
		{	
			log(1,"route[3]:Call forwarding activation detected\n");
			#check if cf option already exists and delete it
			if (avp_db_load("$from/username", "s:callfwd"))
			{
				log(1,"route[3]:Call forwarding option already exists, deleting it....
\n");
				if(!avp_db_delete("$from/username", "s:callfwd/usr_preferences"))
				{
					sl_send_reply("500", "Server DB error");
				}
			}
			strip(6);
			avp_write("$ruri","s:callfwd");
			avp_db_store("$from/username", "s:callfwd/usr_preferences");
			
			#replace this with number that points to IVR saying "Service activated"
			subst_user('/.*$/22693314/');
			route(8);
			
			break;
		} else if (uri =~ "^sip:\*21\*2")
		{	
			strip(5);
			log(1,"route[3]:Call forwarding cancellation detected\n");
			if(!avp_db_delete("$from/username", "s:callfwd/usr_preferences"))
			{
				sl_send_reply("500", "Server DB error");
			}
			
			##replace this with number that points to IVR saying "Service deactivated"
			subst_user('/.*$/22693314/');
			route(8);
			
			break;
		};

thanks for the help!
Kyriakos

On Thursday 17 November 2005 12:16, Atle Samuelsen wrote:
> Hey guys,
>
> use sems, sems has support for doing this.. I've done it in sems before..
> just write a small python script that does it, and make the python script
> update usr_preferences.and have some avps :-)
>
> -A
>
> On Wed, Nov 16, 2005 at 10:56:07AM -0500, sip wrote:
> > And in fact, not even in the AVP stuff, I've noticed one glaring syntax
> > error...
> >
> > if(uri =~ "^sip:\*21\*1")  should be if(uri =~ "^sip:\*21\*1*")
> >
> > On Wed, 16 Nov 2005 10:53:25 -0500, sip wrote
> >
> > > THAT'S not too bad.
> > >
> > > Basically, what they dial will be the RURI.
> > >
> > > So if they dial *21*1*5551212  your SIP RURI becomes
> >
> > sip:*21*1*5551212 at your.server
> >
> > > All you'd need is a check for the URI and then strip out the
> > > unnecessary bits and use something like an AVPop to store the db
> > > info... something like:
> > > (note, I'm just tossing stuff out for an idea... this syntax may be
> > > completely wrong)
> > >
> > > if(uri =~ "^sip:\*21\*1")
> > > {
> > >    strip(6);
> > >    avp_write("$ruri","i:19");
> > >    ....
> > >    avp_db_store("$from/username", "i:19/usr_preferences");
> > > };
> > >
> > > Or some such (as I say, I'm playing loose and fast with syntax here)
> > > ...
> > >
> > > N.
> > >
> > > On Wed, 16 Nov 2005 17:30:16 +0200, Kyriakos Mavromichalis wrote
> > >
> > > > Hi,
> > > >    actually I was thinking that users would press *21*1*number to
> > > > forward to , number would be stored to database. For disabling it
> > > > could be something like *21*2 , which in that case , the record in
> > > > db with the call forwarding option for the user who sent the message
> > > > would be deleted. The problem is how do i write and delete in the
> > > > usr_preferences table from the ser.cfg file? Of course the users
> > > > will also have the option of enabling call forwarding from a web
> > > > interface but adding this its much more practical.
> > > >
> > > > K.
> > > >
> > > > On Wednesday 16 November 2005 16:47, you wrote:
> > > > > If you do a search on the list, I THINK I posted a way to do call
> > > > > forwarding (the way I was doing it anyway)... there are likely
> > > > > other ways. How are you going to take input for the forwarding,
> > > > > though?
> > > > >
> > > > > Will they dial *21 and it will forward to something they've
> > > > > predefined on a website somewhere? Will they dial *21 and then the
> > > > > number to which they want to forward? How do you turn it off? Etc,
> > > > > etc.
> > > > >
> > > > > N.
> > > > >
> > > > >
> > > > > On Wed, 16 Nov 2005 16:44:15 +0200, Kyriakos Mavromichalis wrote
> > > > >
> > > > > > Can someone point me to any resources on how to implement
> > > > > > services like callforwarding by pressing  *21 through the users'
> > > > > > UA? Basically I need my users to be able to activate different
> > > > > > services via the phone's keys.
> > > > > >
> > > > > > thank you
> > > > > > --
> > > > > > Kyriakos Mavromichalis
> > > > > > Otenet Telecom
> > > > > >
> > > > > > _______________________________________________
> > > > > > Serusers mailing list
> > > > > > serusers at lists.iptel.org
> > > > > > http://lists.iptel.org/mailman/listinfo/serusers
> > > >
> > > > --
> > > > Kyriakos Mavromichalis
> > > > Otenet Telecom
> > >
> > > _______________________________________________
> > > Serusers mailing list
> > > serusers at lists.iptel.org
> > > http://lists.iptel.org/mailman/listinfo/serusers
> >
> > _______________________________________________
> > Serusers mailing list
> > serusers at lists.iptel.org
> > http://lists.iptel.org/mailman/listinfo/serusers
>
> _______________________________________________
> Serusers mailing list
> serusers at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers

-- 
Kyriakos Mavromichalis	
Otenet Telecom




More information about the sr-users mailing list