[Serusers] I need to alter and duplicate REGISTER saves

Jerome Martin jmartin at western.fr
Wed May 4 16:16:12 CEST 2005


Hello everyone,

After looking everywhere in the docs and ML archives, I couldn't find a 
way to solve my problem, so I would appreciate any help.

We have several iPBX servers sending REGISTERs to a SER registrar. Some 
of those servers send us the numbers to register as aor in the form 
0XXXXXXXXX (local numbering plan), some other in the form 33XXXXXXXXX 
(local country code prefix). For various reasons, we need to handle 
those different REGISTERs simultaneously, and be able to lookup both 
formats in the location database.

What I'm looking for is a way to "duplicate" the REGISTER entries, i.e. 
when ser receives a REGISTER for 33XXXXXXXXX, I'd like it to save() the 
33XXXXXXXXX, but also create an entry for the corresponding 0XXXXXXXXX.

Example : SER receives a REGISTER request for 33122334455. I'd like to 
have two aors in the location database, so that lookup("33122334455") 
and lookup("0123344556") would both return the same thing.

What I have in mind is something like this :

if (method=="REGISTER") {
    # Always save the original aor
    save("location");

   # If the number starts with 33, also save a duplicate aor in the 
0XXXXXXXXX format
    if (search("^From.*sip:33.*")) {

       # Insert some code to alter the received SIP message and change the
       # number in order to save the 0XXXXXXXXX aor
       # ...
       # ...
       # ...

        save("location");
        break;
    }
    break;
};

Can anyone help ?

Best Regards,
Jerome Martin




More information about the sr-users mailing list