Rewrite R-URI for incoming PSTN calls

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Rewrite R-URI for incoming PSTN calls

Robert Borz
Hi,

While now running our sip proxy quite a while our requirements changed and we now need a multidomain setup with pstn connectivity, which almost works already. But I need help for solving a special issue... ok, here's the problem...

Imagine we got the accounts [hidden email] and [hidden email] (both got pstn-numbers as their uri parts).

In our current configuration it is possible to dial pstn numbers by omitting the domain part (use_domain=0, usrloc) and every body can reach the other (e.g. [hidden email] just dials 20000 and ends up by talking to [hidden email]). It is also possible to receive pstn calls from our gateway which addresses the users by an ruri like "10000@<ip-address>". Everythings great.

But now we set use_domain=1 (usrloc), because we want to allow same uri-parts for different domains (e.g. [hidden email] and [hidden email]).

If now [hidden email] dials a pstn number, let's say 12345, and omits the domain part, the sip server redirects the call to our pstn-gateway and the call get's established.

But if we got the accounts [hidden email] and [hidden email] where only the first is the user allowed to receive pstn calls for the pstn number 10000 and the second is not, the call from our pstn gateway comes in with ruri=10000@<ip-address> and because use_domain=1 is set for the usrloc module, the sip server cannot direct the call to the user [hidden email] because [hidden email] is not the same domain as 10000@<ip-address>.

What we would need is an additional mapping/translation. On an incoming call from our pstn gateway for 10000@<ip-address> must be translated for either [hidden email] or [hidden email]. So we need to rewrite the ruri. The best would be a database table holding at least the following information:

uri, dst_domain
10000, example1.com
20000, example2.com

So if we receive a call from our pstn gateway, we can lookup the destination domain from this table an rewrite the ruri accordingly.

Is there already a module/method for achieving this goal?

This is a lot of text and I hope you can follow me... any help would be really appreciated.


Regards,
Robert
____________________________________________________________
Text: GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Rewrite R-URI for incoming PSTN calls

Bogdan-Andrei Iancu
Hi Robert,

I suggest a kind of separation between SIP ids (which are multidomain
-userpart may appear in more domains-  and the identifier is
user@domain) and the DID (or numbers that are unique and do not belong
to any domain).

This will solve the problem of SIP IDS with domain and DIDs without domains.

To map DIDs over the SIP accounts, use aliases (aliasesdb).

Regards,
Bogdan

Robert Borz wrote:

> Hi,
>
> While now running our sip proxy quite a while our requirements changed and we now need a multidomain setup with pstn connectivity, which almost works already. But I need help for solving a special issue... ok, here's the problem...
>
> Imagine we got the accounts [hidden email] and [hidden email] (both got pstn-numbers as their uri parts).
>
> In our current configuration it is possible to dial pstn numbers by omitting the domain part (use_domain=0, usrloc) and every body can reach the other (e.g. [hidden email] just dials 20000 and ends up by talking to [hidden email]). It is also possible to receive pstn calls from our gateway which addresses the users by an ruri like "10000@<ip-address>". Everythings great.
>
> But now we set use_domain=1 (usrloc), because we want to allow same uri-parts for different domains (e.g. [hidden email] and [hidden email]).
>
> If now [hidden email] dials a pstn number, let's say 12345, and omits the domain part, the sip server redirects the call to our pstn-gateway and the call get's established.
>
> But if we got the accounts [hidden email] and [hidden email] where only the first is the user allowed to receive pstn calls for the pstn number 10000 and the second is not, the call from our pstn gateway comes in with ruri=10000@<ip-address> and because use_domain=1 is set for the usrloc module, the sip server cannot direct the call to the user [hidden email] because [hidden email] is not the same domain as 10000@<ip-address>.
>
> What we would need is an additional mapping/translation. On an incoming call from our pstn gateway for 10000@<ip-address> must be translated for either [hidden email] or [hidden email]. So we need to rewrite the ruri. The best would be a database table holding at least the following information:
>
> uri, dst_domain
> 10000, example1.com
> 20000, example2.com
>
> So if we receive a call from our pstn gateway, we can lookup the destination domain from this table an rewrite the ruri accordingly.
>
> Is there already a module/method for achieving this goal?
>
> This is a lot of text and I hope you can follow me... any help would be really appreciated.
>
>
> Regards,
> Robert
> ____________________________________________________________
> Text: GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://movieflat.web.de
>
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Rewrite R-URI for incoming PSTN calls

Andreas Westermaier
Hi Robert,

that's almost the same issue we ran into some day... the best what you can do (maybe for future setups) is what Bogdan already told you.

One solution would be using the pdt module. It allows you to rewrite the domain part and do matching against a given prefix (here the DID).

In your example you could place the DIDs in the pdt table and associate them with the destination domain for which they should be available. E.g.

 sdomain |    prefix    |   domain    
---------+--------------+--------------
 *       |        10000 | example1.com

Using the prefix2domain("2") function in your opensips.cfg leaves the prefix untouched and rewrites only the ruri's domain part:

10000@<ip-address> ---> [hidden email]

Now the lookup function should be able to determine the right callee for the DID 10000.


Regards,
Andreas


-------- Original-Nachricht --------
> Datum: Mon, 01 Jun 2009 14:14:48 +0300
> Von: Bogdan-Andrei Iancu <[hidden email]>
> An: Robert Borz <[hidden email]>
> CC: [hidden email]
> Betreff: Re: [OpenSIPS-Users] Rewrite R-URI for incoming PSTN calls

> Hi Robert,
>
> I suggest a kind of separation between SIP ids (which are multidomain
> -userpart may appear in more domains-  and the identifier is
> user@domain) and the DID (or numbers that are unique and do not belong
> to any domain).
>
> This will solve the problem of SIP IDS with domain and DIDs without
> domains.
>
> To map DIDs over the SIP accounts, use aliases (aliasesdb).
>
> Regards,
> Bogdan
>
> Robert Borz wrote:
> > Hi,
> >
> > While now running our sip proxy quite a while our requirements changed
> and we now need a multidomain setup with pstn connectivity, which almost
> works already. But I need help for solving a special issue... ok, here's the
> problem...
> >
> > Imagine we got the accounts [hidden email] and [hidden email]
> (both got pstn-numbers as their uri parts).
> >
> > In our current configuration it is possible to dial pstn numbers by
> omitting the domain part (use_domain=0, usrloc) and every body can reach the
> other (e.g. [hidden email] just dials 20000 and ends up by talking to
> [hidden email]). It is also possible to receive pstn calls from our gateway
> which addresses the users by an ruri like "10000@<ip-address>".
> Everythings great.
> >
> > But now we set use_domain=1 (usrloc), because we want to allow same
> uri-parts for different domains (e.g. [hidden email] and
> [hidden email]).
> >
> > If now [hidden email] dials a pstn number, let's say 12345, and
> omits the domain part, the sip server redirects the call to our pstn-gateway
> and the call get's established.
> >
> > But if we got the accounts [hidden email] and [hidden email]
> where only the first is the user allowed to receive pstn calls for the pstn
> number 10000 and the second is not, the call from our pstn gateway comes in
> with ruri=10000@<ip-address> and because use_domain=1 is set for the usrloc
> module, the sip server cannot direct the call to the user
> [hidden email] because [hidden email] is not the same domain as 10000@<ip-address>.
> >
> > What we would need is an additional mapping/translation. On an incoming
> call from our pstn gateway for 10000@<ip-address> must be translated for
> either [hidden email] or [hidden email]. So we need to rewrite the
> ruri. The best would be a database table holding at least the following
> information:
> >
> > uri, dst_domain
> > 10000, example1.com
> > 20000, example2.com
> >
> > So if we receive a call from our pstn gateway, we can lookup the
> destination domain from this table an rewrite the ruri accordingly.
> >
> > Is there already a module/method for achieving this goal?
> >
> > This is a lot of text and I hope you can follow me... any help would be
> really appreciated.
> >
> >
> > Regards,
> > Robert
> > ____________________________________________________________
> > Text: GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
> > Jetzt freischalten unter http://movieflat.web.de
> >
> >
> > _______________________________________________
> > Users mailing list
> > [hidden email]
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >
> >  
>
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

--
Nur bis 31.05.: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate und
Telefonanschluss nur 17,95 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Rewrite R-URI for incoming PSTN calls

osiris123d
I was wondering how to solve this issue and sure thing using PDT and inserting the info into the PDT table worked, but I noticed that after I insert data into PDT via mysql I have to restart OpenSIPS in order for me to be able to call the DID number.  Does this make sense?  I figured I wouldn't need to restart OpenSIPS.

Andreas Westermaier wrote
Hi Robert,

that's almost the same issue we ran into some day... the best what you can do (maybe for future setups) is what Bogdan already told you.

One solution would be using the pdt module. It allows you to rewrite the domain part and do matching against a given prefix (here the DID).

In your example you could place the DIDs in the pdt table and associate them with the destination domain for which they should be available. E.g.

 sdomain |    prefix    |   domain    
---------+--------------+--------------
 *       |        10000 | example1.com

Using the prefix2domain("2") function in your opensips.cfg leaves the prefix untouched and rewrites only the ruri's domain part:

10000@<ip-address> ---> 10000@example1.com

Now the lookup function should be able to determine the right callee for the DID 10000.


Regards,
Andreas


-------- Original-Nachricht --------
> Datum: Mon, 01 Jun 2009 14:14:48 +0300
> Von: Bogdan-Andrei Iancu <bogdan@voice-system.ro>
> An: Robert Borz <robert.borz@web.de>
> CC: users@lists.opensips.org
> Betreff: Re: [OpenSIPS-Users] Rewrite R-URI for incoming PSTN calls

> Hi Robert,
>
> I suggest a kind of separation between SIP ids (which are multidomain
> -userpart may appear in more domains-  and the identifier is
> user@domain) and the DID (or numbers that are unique and do not belong
> to any domain).
>
> This will solve the problem of SIP IDS with domain and DIDs without
> domains.
>
> To map DIDs over the SIP accounts, use aliases (aliasesdb).
>
> Regards,
> Bogdan
>
> Robert Borz wrote:
> > Hi,
> >
> > While now running our sip proxy quite a while our requirements changed
> and we now need a multidomain setup with pstn connectivity, which almost
> works already. But I need help for solving a special issue... ok, here's the
> problem...
> >
> > Imagine we got the accounts 10000@example1.com and 20000@example2.com
> (both got pstn-numbers as their uri parts).
> >
> > In our current configuration it is possible to dial pstn numbers by
> omitting the domain part (use_domain=0, usrloc) and every body can reach the
> other (e.g. 1000@example1.com just dials 20000 and ends up by talking to
> 20000@example2.com). It is also possible to receive pstn calls from our gateway
> which addresses the users by an ruri like "10000@<ip-address>".
> Everythings great.
> >
> > But now we set use_domain=1 (usrloc), because we want to allow same
> uri-parts for different domains (e.g. userxy@example1.com and
> userxy@example2.com).
> >
> > If now 10000@example1.com dials a pstn number, let's say 12345, and
> omits the domain part, the sip server redirects the call to our pstn-gateway
> and the call get's established.
> >
> > But if we got the accounts 10000@example1.com and 10000@example2.com
> where only the first is the user allowed to receive pstn calls for the pstn
> number 10000 and the second is not, the call from our pstn gateway comes in
> with ruri=10000@<ip-address> and because use_domain=1 is set for the usrloc
> module, the sip server cannot direct the call to the user
> 10000@example1.com because 10000@example1.com is not the same domain as 10000@<ip-address>.
> >
> > What we would need is an additional mapping/translation. On an incoming
> call from our pstn gateway for 10000@<ip-address> must be translated for
> either 10000@example1.com or 10000@example2.com. So we need to rewrite the
> ruri. The best would be a database table holding at least the following
> information:
> >
> > uri, dst_domain
> > 10000, example1.com
> > 20000, example2.com
> >
> > So if we receive a call from our pstn gateway, we can lookup the
> destination domain from this table an rewrite the ruri accordingly.
> >
> > Is there already a module/method for achieving this goal?
> >
> > This is a lot of text and I hope you can follow me... any help would be
> really appreciated.
> >
> >
> > Regards,
> > Robert
> > ____________________________________________________________
> > Text: GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
> > Jetzt freischalten unter http://movieflat.web.de
> >
> >
> > _______________________________________________
> > Users mailing list
> > Users@lists.opensips.org
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >
> >  
>
>
> _______________________________________________
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

--
Nur bis 31.05.: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate und
Telefonanschluss nur 17,95 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02

_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Rewrite R-URI for incoming PSTN calls

osiris123d
Nevermind my last post.  I hadn't worked with the PDT MI functions and didn't know about OpenSIPS reading the database at startup and then needing to use the MI functions to add or edit stuff in realtime.

Read the following on the PDT page and that should be the answer to my question "The database is loaded by OpenSIPS at start up time. The module uses only the cache to look up domains. If you want to add or delete a new prefix-domain pair at runtime you have to use MI FIFO commands. All changes made via these commands are applied to database and the cache is updated correspondingly."




osiris123d wrote
I was wondering how to solve this issue and sure thing using PDT and inserting the info into the PDT table worked, but I noticed that after I insert data into PDT via mysql I have to restart OpenSIPS in order for me to be able to call the DID number.  Does this make sense?  I figured I wouldn't need to restart OpenSIPS.

Andreas Westermaier wrote
Hi Robert,

that's almost the same issue we ran into some day... the best what you can do (maybe for future setups) is what Bogdan already told you.

One solution would be using the pdt module. It allows you to rewrite the domain part and do matching against a given prefix (here the DID).

In your example you could place the DIDs in the pdt table and associate them with the destination domain for which they should be available. E.g.

 sdomain |    prefix    |   domain    
---------+--------------+--------------
 *       |        10000 | example1.com

Using the prefix2domain("2") function in your opensips.cfg leaves the prefix untouched and rewrites only the ruri's domain part:

10000@<ip-address> ---> 10000@example1.com

Now the lookup function should be able to determine the right callee for the DID 10000.


Regards,
Andreas


-------- Original-Nachricht --------
> Datum: Mon, 01 Jun 2009 14:14:48 +0300
> Von: Bogdan-Andrei Iancu <bogdan@voice-system.ro>
> An: Robert Borz <robert.borz@web.de>
> CC: users@lists.opensips.org
> Betreff: Re: [OpenSIPS-Users] Rewrite R-URI for incoming PSTN calls

> Hi Robert,
>
> I suggest a kind of separation between SIP ids (which are multidomain
> -userpart may appear in more domains-  and the identifier is
> user@domain) and the DID (or numbers that are unique and do not belong
> to any domain).
>
> This will solve the problem of SIP IDS with domain and DIDs without
> domains.
>
> To map DIDs over the SIP accounts, use aliases (aliasesdb).
>
> Regards,
> Bogdan
>
> Robert Borz wrote:
> > Hi,
> >
> > While now running our sip proxy quite a while our requirements changed
> and we now need a multidomain setup with pstn connectivity, which almost
> works already. But I need help for solving a special issue... ok, here's the
> problem...
> >
> > Imagine we got the accounts 10000@example1.com and 20000@example2.com
> (both got pstn-numbers as their uri parts).
> >
> > In our current configuration it is possible to dial pstn numbers by
> omitting the domain part (use_domain=0, usrloc) and every body can reach the
> other (e.g. 1000@example1.com just dials 20000 and ends up by talking to
> 20000@example2.com). It is also possible to receive pstn calls from our gateway
> which addresses the users by an ruri like "10000@<ip-address>".
> Everythings great.
> >
> > But now we set use_domain=1 (usrloc), because we want to allow same
> uri-parts for different domains (e.g. userxy@example1.com and
> userxy@example2.com).
> >
> > If now 10000@example1.com dials a pstn number, let's say 12345, and
> omits the domain part, the sip server redirects the call to our pstn-gateway
> and the call get's established.
> >
> > But if we got the accounts 10000@example1.com and 10000@example2.com
> where only the first is the user allowed to receive pstn calls for the pstn
> number 10000 and the second is not, the call from our pstn gateway comes in
> with ruri=10000@<ip-address> and because use_domain=1 is set for the usrloc
> module, the sip server cannot direct the call to the user
> 10000@example1.com because 10000@example1.com is not the same domain as 10000@<ip-address>.
> >
> > What we would need is an additional mapping/translation. On an incoming
> call from our pstn gateway for 10000@<ip-address> must be translated for
> either 10000@example1.com or 10000@example2.com. So we need to rewrite the
> ruri. The best would be a database table holding at least the following
> information:
> >
> > uri, dst_domain
> > 10000, example1.com
> > 20000, example2.com
> >
> > So if we receive a call from our pstn gateway, we can lookup the
> destination domain from this table an rewrite the ruri accordingly.
> >
> > Is there already a module/method for achieving this goal?
> >
> > This is a lot of text and I hope you can follow me... any help would be
> really appreciated.
> >
> >
> > Regards,
> > Robert
> > ____________________________________________________________
> > Text: GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
> > Jetzt freischalten unter http://movieflat.web.de
> >
> >
> > _______________________________________________
> > Users mailing list
> > Users@lists.opensips.org
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >
> >  
>
>
> _______________________________________________
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

--
Nur bis 31.05.: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate und
Telefonanschluss nur 17,95 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02

_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users