Finally I used that and all it seems to work well: (in AVP 69 I stored the
new URI to reach)
avp_pushto("$ruri", "$avp(i:69)");
avp_delete("$avp(i:69)/g");
sl_send_reply("302", "Moved Temporarily");
exit;
When I use Ethereal, the 302 message contains:
in From header, the original caller
in To header, the original callee
And in the Contact header the new URI I stored in AVP 69
Thanks for your help
Christophe
-----Message d'origine-----
De : Greg Fausak [mailto:[EMAIL PROTECTED]
Envoyé : mardi 22 août 2006 18:00
À : Christophe Irles
Cc : [EMAIL PROTECTED]; OpenSER
Objet : Re: RE: [Users] Create 302 message and modify contact header
On 8/22/06, Christophe Irles <[EMAIL PROTECTED]> wrote:
>
> Thanks for the hint and sorry I miss this example.
>
> But unfortunately I have a infinite loop if I use directly the example...
>
> I tried to redirect the call to 101 when 102 is used (100 is making
> the
> call)
>
> When I used a config file like that:
> # rewrite current URI, which is always part of destination ser
> rewriteuri("sip:[EMAIL PROTECTED]");
>
> # append one more URI to the destination ser
> append_branch("sip:[EMAIL PROTECTED]");
>
> # redirect now
> sl_send_reply("300", "Redirect");
> exit;
> => Infinite loop !
>
How 'bout this?
# rewrite current URI, which is always part of destination ser
rewriteuri("sip:[EMAIL PROTECTED]");
# redirect now
sl_send_reply("300", "Redirect");
exit;
-g
> Now if I use only:
> # append one more URI to the destination ser
> append_branch("sip:[EMAIL PROTECTED]");
>
> # redirect now
> sl_send_reply("300", "Redirect");
> exit;
> => The call is redirected correctly but if 101 cancel the call if
> have a "Call failed: 404 user not found" on the device 100. Is it normal ?
>
> Another point: in the example on the end of each URI, there is ":9". Why ?
> Example: append_branch("sip:[EMAIL PROTECTED]:9");
>
> And finally: the function append_branch() doesn't seem to accept avp
> value ...
>
> Thanks,
> Christophe
>
> -----Message d'origine-----
> De : Daniel-Constantin Mierla [mailto:[EMAIL PROTECTED] Envoyé :
> mardi 22 août 2006 16:04 À : Christophe Irles Cc : 'Greg Fausak';
> 'OpenSER'
> Objet : Re: [Users] Create 302 message and modify contact header
>
> If you got OpenSER sources, look into examples directory, you have a
> redirect.cfg file. Online, you can browse it via:
>
>
http://openser.cvs.sourceforge.net/openser/sip-server/examples/redirect.cfg?
> revision=1.2&view=markup
>
> Cheers,
> Daniel
>
>
> On 08/22/06 16:58, Christophe Irles wrote:
> >
> > Before to reply a 302, I need to change the contact header in order
> > to specify the URI of the new callee.
> >
> > For example A call B, but from the config file I know B wants to
> > redirect calls to C. So I must specify the URI of user C in the
> > contact header of the 302 message
> >
> > In your example, you change only the domain:
> > A call [EMAIL PROTECTED] and you change the message to A call [EMAIL
> > PROTECTED]
> > <mailto:[EMAIL PROTECTED]>
> >
> > Christophe
> >
> > --------------------------------------------------------------------
> > --
> > -- *De :* Greg Fausak [mailto:[EMAIL PROTECTED] *Envoyé :* mardi
> > 22 août 2006 15:44 *À :* Christophe Irles *Cc :* OpenSER *Objet :* Re:
> > [Users] Create 302 message and modify contact header
> >
> > I don't know if this is right, but:
> >
> > if(is_method("INVITE"))
> > {
> > rewritehostport("test.com");
> > sl_send_reply("302", "Moved Temporarily"); }
> >
> > seems to work for me.
> >
> > I'd try loading some branches if you want more than one item in the
> > contact header. Just guessing though, I'm usually the recipient of a
> > 302!
> >
> > -g
> >
> > On Aug 22, 2006, at 8:24 AM, Christophe Irles wrote:
> >
> >> Hi,
> >>
> >> I checked archive without any result... >From an openSER rule, I
> >> want to create a 302 message if a specific RURI is used.
> >>
> >> First I need to change the contact header to specify the URI of the
> >> new callee.
> >>
> >> I tried something like that:
> >> avp_printf("$avp(s:100)", "sip:[EMAIL PROTECTED]
> >> <mailto:[EMAIL PROTECTED]>;target=$ruri;cause=486;");
> >> avp_pushto("$ct", "$avp(s:100)"); # => error generated on this line
> >>
> >> ERROR:avpops:fixup_pushto_avp: unsupported destination "$ct";
> >> expected $ru,$du,$br
> >>
> >> So how can I modify the contact header ?
> >>
> >> Just after the update on the contact header I envisaged to use this
> >> function sl_send_reply(302, "Moved Temporarily")
> >>
> >> Is it correct ? Is there a better way to 'create' 302 message in
> >> this case ?
> >> I check UAC_REDIRECT module but I don't think I can use it in this
> >> case or perhaps I missed something
> >>
> >> Before to use a 302 message I succesfully tested to create a new
> >> INVITE with the $ruri modified correctly. But I would like to
> >> create a 302 message to prevent any problem of authentication.
> >>
> >> Thanks,
> >> Christophe
> >>
> >> _______________________________________________
> >> Users mailing list
> >> [email protected] <mailto:[email protected]>
> >> http://openser.org/cgi-bin/mailman/listinfo/users
> >
> > --------------------------------------------------------------------
> > --
> > --
> >
> > _______________________________________________
> > Users mailing list
> > [email protected]
> > http://openser.org/cgi-bin/mailman/listinfo/users
> >
>
>
--
Greg Fausak
[EMAIL PROTECTED]
_______________________________________________
Users mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/users