[Serusers] setting prefix according to $SIP_HF_FROM?

sip sip at arcdiv.com
Tue Nov 8 15:00:52 CET 2005


I'm working on a module to do just that right now, actually.  The problem is
that there's currently no way to do this programmatically. There's a UAC
module which, for all intents and purposes, is a demo module that WILL change
the Display Name portion of the From: header and the full from portion... but
it only does it statically. 

For instance, you can change the display name or from headers for ALL users to
ONE particular thing. OR, if you have many if/thens, you can change different
users.  There's currently no way of doing it algorithmically for each user in
different ways or for allowing DB lookups or any such. It's kind of a module
designed for one specific purpose -- to mask the From header of users for
purposes of caller ID blocking. 

I'm in the process of hacking it to shreds and adding some DB lookups so I can
algorithmically change the way the data is done. My purpose is to take the
display name and replace it with a Last,First name or strip it out altogether
in order to prevent Caller ID spoofing (which is horrifically common in the
VoIP world and is destined to be a serious problem). 

It IS, however, on the back burner at the moment while I'm trying to get some
other things done. 

Again, OpenSER has the ability to pass AVPs to the UAC module's arguments,
which would allow you to probably construct exactly what you need from either
database data, or a simple avp_printf or some such and then pass that to the
UAC module to make your modifications. I'd be doing this myself, but I've been
having trouble porting one of my custom modules to OpenSER and we're on the
eve of a major launch. 

N.



On Tue, 08 Nov 2005 08:08:10 -0500, Steve Blair wrote
> I'd like to ask a slightly different but related question. What if 
> you'd like to
> check the value of the username in the From field and replace this value
> with something else. For example:
> 
>   I am using the CC-Diversion header to forward unanswered calls to a
> voicemail system reachable via a gateway and a PRI. The "redirected"
> call has an original called number in the ISDN setup message that matches
> the username in the original R-URI. So far so good.
> 
>   But I need to present to the voicemail system a 10 digit original called
> number and my users only register with their 5 digit extension. 
> Rather than change all of my users to a 10 digit username I'd prefer 
> to prefix the username in the From field with the appropriate area 
> code and exchange based on the leading number in the 5 digit 
> extension. So 81234 would become 2158981234 and so on.
> 
>     xlog("L_INFO", "\n[SER]: Failure block #3 OCTEL user: Time: 
> [%Tf] Method: <%rm>    From uri <%fu> To < %tu> IP source address 
> <%is> R-uri: <%ru> Contact Header: <%ct> \n\n");
> 
>     if(search("^From: 8*@*")
>    {
>        prefix("something");
>     }
>     else if (search("^From: sip:[3678][0-9]{4}@u.edu"))
>    {
>        prefix("something else");
>    };
> 
>    If I follow this example I don't see how to prefix the From 
> field? Is there a way to retain the initial value in the from field 
> then prepend a string to it?
> 
> Thanks,Steve
> 
> Gerd Feiner wrote:
> 
> > yeah,
> >
> > this is what i do now, with about 7 different prefixes this is not a  
> > problem.  but i am thinking when we have more than 200 or so  prefixes 
> > ... then a single search would be much better, wouldn't it?
> >
> >
> > Am 07.11.2005 um 20:27 schrieb sip:
> >
> >> As a workaround, could you not do a search on a regexp of the From  
> >> header and
> >> just do a couple of if-then cases...  i.e.
> >>
> >> If(search("^From: 999*@*")
> >> {
> >>   prefix("something");
> >> }
> >> else if(search("^From: 998*@*")
> >> {
> >>   prefix("something else");
> >> };
> >>
> >> ?
> >>
> >>
> >>
> >>
> >> On Mon, 7 Nov 2005 19:37:55 +0100, Gerd Feiner wrote
> >>
> >>> hi,
> >>>
> >>> is there some way, to prefix a given uri (=~[1-9]\d*, for example)
> >>> based on the From-header field?  suppose i want to extract a
> >>> specific  part (the area-code) from the From-header (like in
> >>> bla at 04711.sip...),  i want to add
> >>>
> >>> prefix(echo $SIP_HF_FROM | sed 's/.*\@\([^.]*\)\..*/\1/')
> >>>
> >>> or something like that in my SER config, but (even with the exec-
> >>> module, which isn't at all that flexible in my opinion) there seems
> >>> to be no way to accomplish this.  background is my previous mail
> >>> regarding aliases based on SIP_DOMAIN.  if i could just extract that
> >>>  area-code from the From-header, then i could easily prefix it to
> >>> the  To-header, so i would have no problems with aliases at all.
> >>>
> >>> any clues?
> >>>
> >>> brgds,
> >>> g. feiner
> >>>
> >>> _______________________________________________
> >>> 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




More information about the sr-users mailing list