[Serusers] Fw: turning 30x blind forward to INVITE

Antanas Masevicius admin at ntt.lt
Tue Aug 16 14:32:17 CEST 2005


Hello Marian,

tried to use this module, but ser always forwarded 302 back to calling side.
Ser himself,  never generated INVITE instead of calling client. Does
uac_redirect module should really generate INVITE by replying to 302 itself?
Now, it just forwards 302 message to calling client.

Antanas

----- Original Message ----- 
From: "Marian Dumitru" <marian.dumitru at voice-sistem.ro>
To: "Antanas Masevicius" <admin at ntt.lt>
Sent: Friday, August 12, 2005 2:29 PM
Subject: Re: [Serusers] Fw: turning 30x blind forward to INVITE


> Hi Antanas,
>
> you may try the uac_redirect module from the OpenSER - it will serve
> your purpose - see
> http://www.openser.org/docs/modules/0.10.x/uac_redirect.html
>
> Best regards,
> Marian
>
> Antanas Masevicius wrote:
> > Hello,
> >
> >
> > this topic was last discussed here:
> > http://lists.iptel.org/pipermail/serusers/2005-May/019551.html
> >
> > last few days i was trying to apply juha's move() function with almost
> > no success to 0.9.3 stable branch.
> >
> > i added such code to my ser.cfg:
> >
> > onreply_route[1] {
> >         xlog("L_NOTICE", "Reply status %rs: Reason %rr\n");
> >         if (t_check_status("30[12]")) {
> >                 xlog("L_NOTICE", "We got a 30[12]!!!!!\n");
> >                 t_move();  # custom function by juha
> >                 #t_reply();
> >         };
> > }
> > and modified move() code like this:
> >
> > inline static int move(struct sip_msg* _m, char *_foo, char *_bar)
> > {
> >         //struct sip_msg* reply;
> >         regmatch_t pmatch[2];
> >         struct hdr_field hf;
> >         contact_t* first;
> >         regex_t contact_re;
> >
> >         // What is it? didn't find anywere.
> >         //reply = _m->final_reply;
> >         // MOD HERE
> >         if (!_m) {
> >                 LOG(L_ERR, "move(): No reply found\n");
> >                 return -1;
> >         }
> >
> >
> >         LOG(L_ERR, "move(): unparsed part of reply: %s\n",
_m->unparsed);
> >         // FIXME: where to put this? initialisation?
> >         // MOD HERE
> >         regcomp(&contact_re, "^Contact:(.*)$",
REG_EXTENDED|REG_NEWLINE);
> >         if ( ( regexec(&contact_re, _m->unparsed, 2, &(pmatch[0]), 0) !=
> > 0) || (pmatch[1].rm_so == -1)) {
> >                 LOG(L_ERR, "move(): No Contact header found\n");
> >                 return -1;
> >         }
> >
> >         hf.type = HDR_CONTACT;
> >         hf.name.len = 0;
> >         hf.body.len = pmatch[1].rm_eo - pmatch[1].rm_so - 1;
> >         hf.body.s = &(_m->unparsed[pmatch[1].rm_so]);
> >         hf.len = hf.body.len + 2;
> >         hf.parsed = NULL;
> >         hf.next = NULL;
> >
> >         // this prints out redirected contact
> >         LOG(L_ERR, "hf.body: '%.*s'\n", hf.body.len, hf.body.s);
> >
> >         if (parse_contact(&hf) < 0) {
> >                 LOG(L_ERR, "move(): Error while parsing Contact\n");
> >                 goto failure;
> >         }
> >
> >         if (((contact_body_t*)hf.parsed)->star == 1) {
> >                 LOG(L_ERR, "move(): Contact is *\n");
> >                 goto failure;
> >         }
> >         first = ((contact_body_t*)hf.parsed)->contacts;
> >         if (first) {
> >                 // MOD HERE
> >                 if (append_branch(_m, first->uri.s, first->uri.len, 0,
> > 0, Q_UNSPECIFIED) == 1) {
> >                         goto success;
> >                 } else {
> >                         LOG(L_ERR, "move(): Appending branch failed\n");
> >                 }
> >         } else {
> >                 LOG(L_ERR, "move(): No contacts in Contact header\n");
> >         }
> >
> > failure:
> >         if (hf.parsed) {
> >                 free_contact((contact_body_t**)(&(hf.parsed)));
> >         }
> >         return -1;
> >
> > success:
> >         free_contact((contact_body_t**)(&(hf.parsed)));
> >         return 1;
> > }
> >
> > it seems that t_move succeeds(), contact gets parsed and append_branch()

> > gets execuded. But then, nothing happens. 302 is replied back to call
> > originator. It is function build_res_buf_from_sip_res is called() which
> > builds 302 message back to call originator..
> > It seems that after getting contact from 302 message, INVITE sould be
> > generatated somehow. I suspect that i am passing wrong message to
> > append_branch, but i didn't found how to access INVITE from tm module
> > while in onreply_route[].
> >
> > Can anybody with deeper ser knowledge help?
> >
> >
> > Antanas
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Serusers mailing list
> > serusers at lists.iptel.org
> > http://lists.iptel.org/mailman/listinfo/serusers
>
> -- 
> OpenSER - the next generation SER
> http://www.openser.org




More information about the sr-users mailing list