[OpenSIPS-Users] Setting CallerID Name

Brett Nemeroff brett at nemeroff.com
Fri Nov 5 05:19:57 CET 2010


Matt,
I'd recommend writing a custom module using libcurl.

One other thought, if you are flexible in your service offering you might be
able to do something useful with db_http.
-Brett



On Thu, Nov 4, 2010 at 9:37 PM, Matt Smith <msmith at bulkcnam.com> wrote:

> Hello List,
>
> I have a few carrier clients who are looking to use our CNAM (Caller
> ID Name) service, and seeking to do lookup directly on OpenSIPS,
> rather on the switch sitting behind the SIP router.
>
> We've provided our clients the following script snippets that uses the
> PERL module to perform the necessary HTTP lookup and set an AVP that
> will be used to change the Caller ID name with "uac_replace_from"
> function.
>
> Can anyone suggest a better of doing the lookup and changing the
> Caller ID Name? Is there a way to perform the HTTP lookup directly
> from the OpenSIPS script? Also, how can we set a timeout on Opensips
> to give up on the Perl script if no response is received after let's
> say 1000ms, and return to regular routing?
>
> Here's our OpenSIPS script snippet:
>
> modparam("perl", "modpath", "/usr/lib/opensips/perl/")
> modparam("perl", "filename", "/etc/opensips/bulkcnam.pl")
>
> route {
>               if (method == "INVITE") {
>                       route(6);
>                       return;
>               }
> }
>
> route[6] {
>               perl_exec("cnamgetname");
>               uac_replace_from("$avp(i:201)","");
>               avp_delete("*");
>               // Continue Routing...
> }
>
> bulkcnam.pl File:
>
> use OpenSIPS qw ( log );
> use OpenSIPS::Constants;
> use IO::Socket;
> use HTTP::Request;
> use LWP::UserAgent;
>
> sub cnamgetname {
>       my $m = shift;
>       $number = $m->getHeader(qw ( From));
>       $number = test('sip:(.*?)\@', $number);
>       my $server = "http://cnamserverIP/?id=BulkCNAM-ID-here&did=";
>               $request = HTTP::Request->new( GET => $server.$number );
>               $ua = LWP::UserAgent->new;
>               $response = $ua->request($request);
>               if ($response->is_success) {
>                       $name = $response->content;
>               }
>               OpenSIPS::AVP::add(201,$name);
>
>       return 1;
> }
>
> sub test($$)
>       {
>       my $lookfor = shift;
>       my $string  = shift;
>       if($string =~ m/$lookfor/)
>               { return $1 }
>       }
>
>
> Thanks,
>
> Matt S.
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20101104/6a9d6476/attachment.htm 


More information about the Users mailing list