Problem on handling prefixed contact number from Cisco GW

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

Problem on handling prefixed contact number from Cisco GW

joel.oliveira
This post was updated on .
Hi all,

Having fought this problem for almost 2 days now. I have the next topology on my system:

Client (Softphone Eyebeam) -> Opensips 1.6.4-notls with virtual-ip -> Cisco Media GW -> PSTN

When I place a call from a Client to a number on the PSTN, I prefix the callee number with a number and deliver it to the the Cisco GW via dynamic routing module.
(e.g. Client 5555 calls 6666, Opensips adds 44 and delivers the call to Cisco making the callee number 446666).

Until now there is no problem, the problem starts when Cisco responses to the Invite, with the 180 Ringing and the 200 OK with the Contact header with the prefixed number 446666. Well, I don't want my client to see the prefixed number so I need to change the Contact header of the returning SIP message before delivering it to the client.

I tryed changing the Contact header on the reply_route but unfortenately there is no way to access the $ct variable on the reply_route. I also tryed to have a b2b logic in it, but after testing it I continued to received the prefixed number in the Contact header.

Does anybody has crossed the same problem as me? If so, does anyone has any idea on how to solve my problem? Don't get me wrong but the calls are delivered all right, it's only a matter of information that I don't want to show to my end-user.

My Opensips script is available here:
http://pastebin.com/qFvfZru5

Thanks in Advance,
Joel Oliveira
Reply | Threaded
Open this post in threaded view
|

Re: Problem on handing prefixed contact number from Cisco GW

Bogdan-Andrei Iancu-2
Hi Joel,

On 04/01/2011 03:29 PM, joel.oliveira wrote:

> Hi all,
>
> Having fought this problem for almost 2 days now. I have the next topology
> on my system:
>
> Client (Softphone Eyebeam) ->  Opensips 1.6.4-notls with virtual-ip ->  Cisco
> Media GW ->  PSTN
>
> When I place a call from a Client to a number on the PSTN, I prefix the
> callee number with a number and deliver it to the the Cisco GW via dynamic
> routing module.
> (e.g. Client 5555 calls 6666, Opensips adds 44 and delivers the call to
> Cisco making the callee number 446666).
>
> Until now there is no problem, the problem starts when Cisco responses to
> the Invite, with the 180 Ringing and the 200 OK with the Contact header with
> the prefixed number 446666. Well, I don't want my client to see the prefixed
> number so I need to change the Contact header of the returning SIP message
> before delivering it to the client.
>
> I tryed changing the Contact header on the reply_route but unfortenately
> there is no way to access the $ct variable on the reply_route. I also tryed
> to have a b2b logic in it, but after testing it I continued to received the
> prefixed number in the Contact header.
>
> Does anybody has crossed the same problem as me? If so, does anyone has any
> idea on how to solve my problem? Don't get me wrong but the calls are
> delivered all right, it's only a matter of information that I don't want to
> show to my end-user.
>
> My Opensips script is available here:
> http://pastebin.com/qFvfZru5
>
> Thanks in Advance,
> Joel Oliveira

I see in your script you tried to remove and add a new contact hdr - did
it work? Did you end up in with the xlogs() showing that the script
execution goes into the "if" block?

Also, I see the condition:
if($((avp(s:ct_gw){uri.username}){s.substr,5,4}) == )

But the ct_gw AVP is never set :(....and there is no right side in the
condition :)

maybe you could try to "catch" the contacts with username part in
onreply route as:
         if ( $(ct.fields(uri){uri.username})=="" ) {.....}
See:
     http://www.opensips.org/Resources/DocsCoreVar16#toc21

Regards,
Bogdan

--
Bogdan-Andrei Iancu
OpenSIPS eBootcamp - 2nd of May 2011
OpenSIPS solutions and "know-how"


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

Re: Problem on handing prefixed contact number from Cisco GW

joel.oliveira
Hello Bogdan,

First of all, sorry for taking so long to answer you back but let me thank for your reply. That code that you replied on was commented out so I wasn't using it, but still your comments opened my eyes on how to access the $ct variable, maybe I was doing something wrong on that day but for some reason doing $avp(s:ct_gw) = $ct; wasn't working at all.

Anyway it's now working as you can verify on http://pastebin.com/hdBsD0hH . :)

Everything is working fine now and I'll continue to do my changes to the script so I can implement all the features that I need. Quick question though, on line 637 I have the m4 variable GW_PREFIX that has the prefix defined on the defines.m4 file; is it in anyway possible to access the prefix that is being used on that time by do_routing? As you may notice I am trying to access $avp(s:gw_attrs) pv but all I get is the value <null>.
According to the documentation on drouting's gw_attrs_avp ( http://www.opensips.org/html/docs/modules/1.6.x/drouting.html#id293965 ) I'll only get that value set when I use the use_next_gw() function but according to another Opensips user that I talked on #opensips, it's supposed to be set when doing do_routing() also. Am I missing something?

Thanks for your time and best regards,
Joel Oliveira
Reply | Threaded
Open this post in threaded view
|

Re: Problem on handing prefixed contact number from Cisco GW

Bogdan-Andrei Iancu-2
Hi Joel,

You cannot know what was the used prefix, but in your case (where you
want to strip the used prefix) it is simpler to store the username (from
RURI) before do_routing (into an AVP) and when rebuilding the contact,
just use the original username from AVP......so you do not care about
the prefix :).

Regards,
Bogdan

On 04/07/2011 12:55 PM, joel.oliveira wrote:

> Hello Bogdan,
>
> First of all, sorry for taking so long to answer you back but let me thank
> for your reply. That code that you replied on was commented out so I wasn't
> using it, but still your comments opened my eyes on how to access the $ct
> variable, maybe I was doing something wrong on that day but for some reason
> doing $avp(s:ct_gw) = $ct; wasn't working at all.
>
> Anyway it's now working as you can verify on http://pastebin.com/hdBsD0hH .
> :)
>
> Everything is working fine now and I'll continue to do my changes to the
> script so I can implement all the features that I need. Quick question
> though, on line 637 I have the m4 variable GW_PREFIX that has the prefix
> defined on the defines.m4 file; is it in anyway possible to access the
> prefix that is being used on that time by do_routing? As you may notice I am
> trying to access $avp(s:gw_attrs) pv but all I get is the value .
> According to the documentation on drouting's gw_attrs_avp (
> http://www.opensips.org/html/docs/modules/1.6.x/drouting.html#id293965 )
> I'll only get that value set when I use the use_next_gw() function but
> according to another Opensips user that I talked on #opensips, it's supposed
> to be set when doing do_routing() also. Am I missing something?
>
> Thanks for your time and best regards,
> Joel Oliveira
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Problem-on-handling-prefixed-contact-number-from-Cisco-GW-tp6230782p6249328.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.

--
Bogdan-Andrei Iancu
OpenSIPS eBootcamp - 2nd of May 2011
OpenSIPS solutions and "know-how"


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

Re: Problem on handing prefixed contact number from Cisco GW

joel.oliveira
Hello Bogdan,

Thanks for your reply. I tryed and it worked as I recall. I needed the prefix to do some comparison but I fixed it with some fixed value so for now everything is working fine.

Best Regards and Thanks,
Joel Oliveira