[Users] AVP subst callerid example

Daniel-Constantin Mierla daniel at voice-system.ro
Thu Jun 30 17:42:49 CEST 2005


On 06/30/05 17:26, Norman Brandinger wrote:

> At the risk of being flamed by the developers that argue messing with 
> SIP headers can break interoperability, cause parse problems, is a bad 
> programming practice, etc, etc. 

to cause problems it is true, but not bad programming practice :-) ... 
anyhow, this is on the roadmap of uac module, the developer is busy with 
studies and other projects in this period, but if someone will send a 
patch will be accepted.

> I'm posting a little example of using an AVP to set the callerid of a 
> user.
> Disclaimer: I'm not suggesting this is what anyone should or should 
> not do, I'm just showing an interesting example.

Seeing your mail from this morning to users@, maybe you should start a 
new dokuwiki page (or a new topic on forum) where to post these 
examples: "Norman Brandinger's examples" or so -- I am sure that they 
will be appreciated by many other users -- and just send small messages 
with links on mailing list to inform the users.

Cheers,
Daniel

>
> In the usr_preferences table, there is the following row:
>
> Username: user1
> Attribute: callerid
> Value: "My Name" <sip:19995551212 at example.com
>
> Note that the ending > after .com in the value column is missing on 
> purpose.  I haven't spent the time tweaking the regular expression 
> below to enable the trailing > to be included.
>
>  
> #------------------------------------------------------------------------------------------- 
>
>  # Set the callerid for the user from an AVP
>  
> #------------------------------------------------------------------------------------------- 
>
>    if (avp_db_load("$from/username", "s:callerid")) {
>        subst('/^From: (.*)>(.*)$/From: $avp(callerid)>\2/ig');
>    };
>
> Some things to consider would be to use one subst to change the "name" 
> and another subst to change the "number".  Obviously, two AVPs would 
> be needed to implement this.
>
> Regards,
> Norman Brandinger
> norm at goes dot com
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
>




More information about the sr-users mailing list