How Can I Dial Local Directory Service When A User Dials 411?

Keywords: avpops | ser.cfg

When a SIP user dials 411 we want replace the 411 portion of the R-URIi with their local area code and then append 5551212 to the R-URI.

So in our example if my SERi username is 4075660990 and I dial 411 then the R-URI will be transformed to 4075551212 - which is the local directory service.

Here is how we do it.

loadmodule "/usr/local/lib/seri/modules/avpops.so"
route {
# sanity checks
if (method!="REGISTER") record_route();
if (loose_route()) {
  t_relay();
break;
};
if (uri=~"^sip:411@") {
  avp_write("$from", "i:34");# Line 1
  avp_pushto("$ruri", "i:34");# Line 2
  strip_tail(7);# Line 3
  subst_uri('/^sip:([0-9]+)@(.*)$/sip:\15551212 @\2/i');# Line 4
  avp_delete("i:34");# Line 5
};
lookup("aliases");
if (uri!=myself) {
  t_relay();
  break;
};
if (!lookup("location")) {
  # normal processing
};
# additional processing
}

Line 1 stores the user in a temporary "variable" or AVP called i:34 which is been arbitrarily chosen.

Line 2 changes the request URI (R-URI) to be that of the header. This is how we get the area code portion of the local directory service.

Line 3 then removes the last 7 digits of the R-URI, which in our example leaves us with just sip:407@mycompany.com

Line 4 now appends the numeric digits 5551212 to the request URI. This uses regular expression string replacment to perform its magic.

NOTE: There is an illegal space before the second ampersand in this example which should be removed - but it is included here for formatting purposes.

Line 5 then frees the resources that were previously allocated.

Home |  Recent changes |  Search |  Glossary |  Sitemap |  Login