[OpenSIPS-Users] 302 handling
Alex G
greekman0000 at gmail.com
Wed Aug 20 21:00:26 CEST 2008
correct..
first branch originates on pstn -> openser -> asterisk -> openser->
phone(sends diversion) -> |LOGIC REQUIRED| openser(change diversion ip) ->
pstn
where LOGIC REQUIRED exists the following happens
asterisk is waiting for the phone to reply on it's invite
i grab the reply to the invite (302) in the onreply_route. I set the
contact(which is the diversion contact) and set it to an avp
the packet then comes to the failure route where something strange
persists.. the contact,from, and to addresses are all the same and are the
uri of the phone providing the redirect
here i try to route the request out to the pstn
my gateway requires me to place the diversion contact in the rpid and then
set a diversion header with the did they provide which is usually required
to be in the rpid to make calls, but in the case of a diversion must be
placed in the diversion header
once i do set these headers i set another avp as a flag for the rerouting to
the diversion
i then invoke t_relay
the packet then moves into the branch_route
here I look for the avp flag from failure_route, if it exists I rewrite the
port to the pstn gateway and off goes the packet
so now i have this messy bridge through asterisk (i have to bridge through
it to maintain the media path for call features) that allows me to connect
the call, the only thing I can't seem to get to work is the audio
should I be looking to still push this through rtp proxy at this point? I'm
pretty sure that it is in the packets as the original request that went to
the phone is behind nat and on the invite I'm sure rtp proxy is invoked.
should i just unforce it before i t_relay? or do i need to maintain it for
the path through asterisk?
this is where it all gets very cloudy lol
any pointers are always appreciated :)
On Wed, Aug 20, 2008 at 8:14 AM, Bogdan-Andrei Iancu <bogdan at voice-system.ro
> wrote:
> So, the first branch goes behind a NAT and gets redirected; the second
> branch goes to PSTN and has the SDP from the first branch, right ?
>
> get_redirects() works only in failure route.
>
> Regards,
> Bogdan
>
> Alex G wrote:
>
>> I did some more testing with this yesterday. The phone that is redirecting
>> indeed is behind nat, but my pstn gateway is all open net. What I did find
>> was that opensips was rediricting sdp to the phone still and not the
>> gateway. Why there is still rtp traffic in asterisk is still a mystery, but
>> I think with the right code I can also redirect the sdp out to the pstn as
>> well.
>>
>> Will update you all on how this goes as I don't anticipate to start this
>> scripting challenge till late in the week.
>>
>> A question that comes up is does the get_redirect function actually work
>> in the failure route or am I misplacing it and it should be somewhere else?
>>
>> Thanks,
>>
>> Alex
>>
>> On Tue, Aug 19, 2008 at 6:30 AM, Bogdan-Andrei Iancu <
>> bogdan at voice-system.ro <mailto:bogdan at voice-system.ro>> wrote:
>>
>> Hi Alex,
>>
>> Glad you solved the problem - at least at signalling level :)
>>
>> Do you have NAT involved ? Have you checked the SDP (Ip and port)
>> in both request and reply to see if where the problem comes?
>>
>> Regards,
>> Bogdan
>>
>> Alex G wrote:
>>
>> well i did make some headway on this, unfortunately i had to
>> get tricky with it.
>>
>> Even with the get redirects, it was still not placing the
>> correct redirect in there. As a matter of fact, it seems like
>> the function was not working at all in the failure_route. My
>> solution involved setting an avp in the reply route becuase
>> both the source and destination of the paceket were the same
>> when it was in the failure route. So in on reply i set an avp
>> that then if was true in the branch route just rewrote the
>> host port. So great I was able to make the call path divert
>> but when the 2 pstn endpoints actually link, there is no
>> sound. There seems to be rtp when i look in asterisk's cli,
>> but neither side is giving me audio :(
>>
>> In the branch route, i tried with and without forecrtp proxy,
>> but no dice....
>>
>> anyone have an idea as to what might be going on?
>>
>> as always any input is greatly appreciated :)
>>
>>
>> On Sun, Aug 17, 2008 at 2:16 PM, Bogdan-Andrei Iancu
>> <bogdan at voice-system.ro <mailto:bogdan at voice-system.ro>
>> <mailto:bogdan at voice-system.ro
>> <mailto:bogdan at voice-system.ro>>> wrote:
>>
>> Hi Alex,
>>
>> Actually, after the get_redirects(), you should not do a
>> rewiteXXXX() - just to t_relay(); the get_redirects() already
>> populates the new branch with all the information.
>>
>> Regards,
>> Bogdan
>>
>>
>> Ovidiu Sas wrote:
>>
>> If you want to rewrite the port, you need to use the
>> following
>> syntax:
>> rewritehostport("XXX.XXX.XXX.XXX:ZZZZZ");
>> where ZZZZZ is the new port.
>>
>>
>> Regards,
>> Ovidiu Sas
>>
>> On Wed, Aug 13, 2008 at 4:54 PM, Alex G
>> <greekman0000 at gmail.com <mailto:greekman0000 at gmail.com>
>> <mailto:greekman0000 at gmail.com
>>
>> <mailto:greekman0000 at gmail.com>>> wrote:
>> unfortunately the solution is a bit vague
>> for what I'm
>> trying to do...
>>
>>
>> in the 302 packet the contact for redirect is sip
>> xyz at abc.abc.abc.abc
>>
>> failure_route[1] {
>> if (t_check_status("302")) {
>> xlog("in redirect failure $fu");
>> get_redirects("*:1","redirect");
>> rewritehostport("XXX.XXX.XXX.XXX");
>> t_relay();
>> }
>>
>> this should take the contact address and rewrite
>> the host
>> port for it
>> relaying it to the new location right? should be an
>> immediate invite to
>> abc at XXX.XXX.XXX.XXX
>>
>> unfortunately it doesn't rewrite the host port. It
>> merely
>> relays directly to
>> the contact in the 302 packet xyz at abc.abc.abc.abc
>>
>> any ideas would be welcome :)
>>
>> thanks
>>
>> alex
>>
>> On Wed, Aug 13, 2008 at 2:38 PM, Ovidiu Sas
>> <osas at voipembedded.com
>> <mailto:osas at voipembedded.com> <mailto:osas at voipembedded.com
>> <mailto:osas at voipembedded.com>>> wrote:
>> It is all here:
>>
>> http://www.opensips.org/html/uac_redirect.html#id2519995
>>
>> Regards,
>> Ovidiu Sas
>>
>> On Wed, Aug 13, 2008 at 2:03 PM, Alex G
>> <greekman0000 at gmail.com
>> <mailto:greekman0000 at gmail.com>
>> <mailto:greekman0000 at gmail.com
>>
>> <mailto:greekman0000 at gmail.com>>> wrote:
>> I know there was some
>> stuff about how to handle
>> 302s and send forward a
>> new
>> invite to the diversion contact on the old
>> mailing
>> list archives, but
>> they
>> are all gone now :(
>>
>> wondering if anyone can help me with this.....
>>
>> opensips -> ua -> moved -> opensips invite
>> contact
>> from diversion
>>
>>
>>
>> basically opensips makes an invite to locally
>> registered uac, the uac
>> redirects to an external pstn number
>> XXX-XXX-XXXX,
>> opensips then needs
>> to
>> handle the 302 and generate an invite to
>> XXX-XXX-XXXX
>>
>>
>> any help would be most appreciated
>>
>> thanks Alex
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> <mailto:Users at lists.opensips.org>
>> <mailto:Users at lists.opensips.org
>> <mailto:Users at lists.opensips.org>>
>>
>>
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> <mailto:Users at lists.opensips.org>
>> <mailto:Users at lists.opensips.org
>> <mailto:Users at lists.opensips.org>>
>>
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20080820/93a88f00/attachment-0001.htm
More information about the Users
mailing list