[SR-Users] RPID Mod Question

Alex Balashov abalashov at evaristesys.com
Wed May 5 23:24:11 CEST 2010


On 05/05/2010 05:04 PM, dotnetdub wrote:

> For certain Asterisk customers I want them to be allowed to manage and
> send their own CLI - we currently pass this onto providers as RPID. For
> example we also run a multi tenant pbx that uses kamailio as its proxy
> so it makes sense that we can send the callerID from this box to kamailio.
>
> Basically I will setup a prefix, check for that and if it matches I want
> to rewrite the RPID using the From"" from the SIP message..
>
> From: "16172345671" <sip:username at domain>;tag=xxxxxxxxxxxx
>
> In this case I would send the RPID as
>
> <sip:16172345671 at domain;party=calling;id-type=subscriber;privacy=off;screen=yes>"
> to our providers rather than reading the default value from the database
> for rpid.
>
> Where in the Kamailio / SR docs should I be looking for examples that
> would be similar / manipulating this type of info.

The first scenario you have to deal with is one in which the customer 
may be sending you RPID already, as when they have sendrpid=yes enabled 
in sip.conf in Asterisk:

    if(is_present_hf("Remote-Party-ID"))
        remove_hf("Remote-Party-ID");

 From there, you can either use append_hf() to add your own RPID header 
or append_rpid_hf() functions in the 'auth' module: 
http://www.kamailio.org/docs/modules/3.0.x/modules_k/auth.html#append-rpid-hf-params. 
  Which one to use is a matter of taste.

Accessing from the elements of the From URI and display name is possible 
using a variety of pseudovariables that expose those message parts: 
http://www.kamailio.org/dokuwiki/doku.php/pseudovariables:3.0.x

For example, $fu is the full From URI, $fU is the user part, $fd is the 
domain part, and $fn is the display name.  You can also use URI 
transformations for this: 
http://www.kamailio.org/dokuwiki/doku.php/transformations:3.0.x#uri_transformations

In practical terms, this means you can do something like:

    append_hf("Remote-Party-ID: 
<sip:$fU@$fd>;party=calling;id-type=subscriber;privacy=off;screen=yes\r\n");

Note that the form you provided is wrong:

 
<sip:16172345671 at domain;party=calling;id-type=subscriber;privacy=off;screen=yes>

The parameters are header parameters, not URI parameters.  See 
http://tools.ietf.org/id/draft-ietf-sip-privacy-04.txt for more information.

Another, slightly more controversial option involves stateful 
replacement of the From header value, which proxies aren't really 
supposed to do, but that's what the statekeeping is for:

http://www.kamailio.org/docs/modules/3.0.x/modules_k/uac.html#id2886696

-- 
Alex Balashov - Principal
Evariste Systems LLC
1170 Peachtree Street
12th Floor, Suite 1200
Atlanta, GA 30309
Tel: +1-678-954-0670
Fax: +1-404-961-1892
Web: http://www.evaristesys.com/



More information about the sr-users mailing list