How to replace + sign with another string

Discuss any topic about Brekeke SIP Server.

Moderator: Brekeke Support Team

Post Reply
Pretorean
Posts: 8
Joined: Tue Oct 31, 2006 1:22 am

How to replace + sign with another string

Post by Pretorean »

1. Brekeke Product Name and version: 1.5.2.0/172

2. Java version: 1.4.2_05

3. OS type and the version:Linux 2.4.20-28.8smp

4. UA (phone), gateway or other hardware/software involved:

5. Select your network pattern from http://www.brekeke-sip.com/bbs/network/ ... terns.html : 9

6. Your problem: I want to forward a call to a certain IP, and the calling number has the '+' sign in front of it. How can I remove or replace the '+' before forwarding the call?


thanks
hope
Posts: 862
Joined: Tue Jan 15, 2008 4:08 pm

Post by hope »

matching:
$request=^INVITE
To=sip:+(calling number)@

Deploy
To=sip:%1@destinationIP
james
Posts: 501
Joined: Mon Dec 10, 2007 12:56 pm

Post by james »

All,

I think "To=sip:+(calling number)@ " shoud be
To=sip:\+(calling number)@

this is because "+" has a special meaning in regex so we need to escape it with "\".
Pretorean
Posts: 8
Joined: Tue Oct 31, 2006 1:22 am

Post by Pretorean »

I am talking about calling number, so To is not the place to do it.
Also what I am looking is a conditional: if '+' exists then translate it, otherwise don't touch the calling number.
hope
Posts: 862
Joined: Tue Jan 15, 2008 4:08 pm

Post by hope »

if calling is caller then
matching:
$request=^INVITE
From=sip:\+(.+)@(.+)

Deploy
From=sip:%1@%2
$replaceuri=true

James:
Thank you for the correction.
Post Reply