[Serusers] Fw: turning 30x blind forward to INVITE
Antanas Masevicius
admin at ntt.lt
Wed Aug 17 09:20:15 CEST 2005
Hello Marian,
very thanx, it seems that i was missing:
t_check_status("3[0-9][0-9]")
now ser generates invite.
But it seems i still have problem, i would like to charge initial called
number, for the redirected call and our billing takes 'from:' field for
charging appropriate user. Is there a way to generate invite from ser with
'from:' of original called number? Or it is against the rules? How do you do
billing for such redirected calls?
Antanas
----- Original Message -----
From: "Marian Dumitru" <marian.dumitru at voice-sistem.ro>
Cc: "Antanas Masevicius" <admin at ntt.lt>; <serusers at lists.iptel.org>
Sent: Tuesday, August 16, 2005 7:44 PM
Subject: Re: [Serusers] Fw: turning 30x blind forward to INVITE
> errata: t_reply() replaced with t_relay();
>
> Best regards
> Marian
>
> Marian Dumitru wrote:
> > Hi Antanas,
> >
> > have you added a failure_route like this ? :
> >
> > failure_route[x] {
> > if (t_check_status("3[0-9][0-9]")) {
> > log(1, "3xx reply received !\n");
> > get_redirects("*");
> > t_relay();
> > };
> > }
> >
> > Best regards,
> > Marian
> >
> > Antanas Masevicius wrote:
> >
> >> 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
> >
More information about the sr-users
mailing list