[Serusers] avpops - how to fake a registration

Java Rockx javarockx at gmail.com
Sat Apr 2 13:40:55 CEST 2005


Greg,

I wish it were that easy. If you receive a REGISTER message, it does
contain the <Contact> header.

But by doing the following a 200 OK is retured __without__ a <Contact>
header and therefore the SIP client must ignore the response. So I
really need to find a way to "copy" the Contact header from the
REGISTER message to the 200OK response.

if (method=="REGISTER") {
     sl_send_reply("200", "OK");
     break;
};

FYI, if you're wondering why such a silly thing is needed it is
because we use a UTstarcom iAN-02EX ATA which is two phone ports on
the back. We only configure Line 1 and in the past this caused
customers problems because they assume the Line 1 is the "left" port
and Line 2 is the "right" port.

So the just plug in to the left port (Line 2) and realize the get no
dial tone. Then they call for support and blah blah blah.

So we now configure Line 2 as extension 697. If they attempt to dial
__any__ number from Line 2 we route them to the Asterisk server and
play a "please reconfigure your ATA" message to prevent a support
call.

The only problem is that in order for the ATA to give dial tone it
must successfully REGISTER.

And from a SIP proxy point of view, there is no reason to ever fully
process these REGISTER messages.

Regards,
Paul

On Apr 2, 2005 3:50 AM, Greger V. Teigre <greger at teigre.com> wrote:
> No guarantees that this works, just a quick attempt:
> You already have a Contact header in the reply (I believe), you just need to
> manipulate it. (If not, you can use avp_pushto("Contact/reply","avpair") to
> create one)
> 
> Use subst to get:
> Contact: <sip:username at ipaddress:port>;q=0.00;expires=3600.
> 
> Here is a regex I put together as an example:
> /^Contact:(.*)sip:([a-zA-Z0-9_-]+)@([0-9.]+):([0-9]*)(.*)$/Contact:\1sip:\2@\3:\4>;q=0.00;expires=3600/
> 
> Good luck! ;-)
> g-)
> 
> Java Rockx wrote:
> > Hi All.
> >
> > I'm using ser-0.9.1 with auth_db enabled for user registration stuff.
> >
> > I need to fake a REGISTRATION under certain circumstances. What I want
> > to do is sl_send_reply("200", "OK") when I get a REGISTER message from
> > user 697.
> >
> > I don't want to actually call the save("location") method because I do
> > not want to store 697 in the database or in ser's cache.
> >
> > So how can I sl_send_reply() and include the <Contact> header which
> > the save() function would normally insert in to the response?
> >
> > I'm thinking I could use AVPOPs somehow, but I'm not sure.
> >
> > Can this be done?
> >
> > Regards,
> > Paul
> >
> > _______________________________________________
> > Serusers mailing list
> > serusers at lists.iptel.org
> > http://lists.iptel.org/mailman/listinfo/serusers
> 
>




More information about the sr-users mailing list